feat(settings): make Claude Code OAuth token configurable in UI

The OAuth token that authenticates the spawned `claude` CLI was only
readable from the container env, so an expired token meant editing
.env on the Unraid host and rebuilding. Now it can be rotated from
the Settings page like every other key.

- Adds CLAUDE_CODE_OAUTH_TOKEN to the settings registry and a "Claude"
  card at the top of the settings UI.
- loadPipelineEnv() injects the DB value into every spawned subprocess
  env (overrides the container env), covering both campaign launches
  and chat sessions.
- checkIntegrationStatus() validates the token by hitting the Anthropic
  messages API with a 1-token call, surfacing 401s as "Token expired
  or invalid" instead of a generic "Not connected".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-05-03 20:53:46 -05:00
parent 352fb59e7c
commit 63698333ff
3 changed files with 55 additions and 0 deletions
+1
View File
@@ -663,6 +663,7 @@ async function loadPipelineEnv(): Promise<Record<string, string>> {
const settings = await getAllSettings();
const env: Record<string, string> = {};
if (settings.CLAUDE_CODE_OAUTH_TOKEN) env.CLAUDE_CODE_OAUTH_TOKEN = settings.CLAUDE_CODE_OAUTH_TOKEN;
if (settings.TAVILY_API_KEY) env.TAVILY_API_KEY = settings.TAVILY_API_KEY;
if (settings.POSTIZ_URL) env.POSTIZ_URL = settings.POSTIZ_URL;
if (settings.POSTIZ_API_KEY) env.POSTIZ_API_KEY = settings.POSTIZ_API_KEY;