FN-7391: route Anthropic subscription chats through Claude CLI
Keep Anthropic OAuth subscription credentials away from the direct /v1 provider while preserving raw API-key routing. - Treat direct anthropic auth as raw API-key-only in auth storage and model discovery. - Re-route persisted anthropic model selections to the Claude CLI provider when no raw Anthropic API key is configured. - Add regression coverage for OAuth-only routing, raw API-key preservation, and provider list separation. - Document the distinct raw API key, OAuth subscription, and Claude CLI routes. Files changed: .../fn-7391-anthropic-subscription-cli-routing.md | 7 ++ docs/settings-reference.md | 2 +- .../dashboard/src/__tests__/routes-auth.test.ts | 74 ++++++++++++++ .../dashboard/src/routes/register-model-routes.ts | 27 +++++- packages/engine/src/__tests__/auth-storage.test.ts | 108 +++++++-------------- .../src/__tests__/pi-create-fn-agent.test.ts | 100 +++++++++++++++++++ packages/engine/src/auth-storage.ts | 45 ++++----- packages/engine/src/pi.ts | 61 ++++++++++++ 8 files changed, 319 insertions(+), 105 deletions(-) Fusion-Task-Id: FN-7391 Fusion-Task-Lineage: d1fecc2d-7f31-408c-bf65-0e65b7fd88b1 Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
This commit is contained in:
@@ -53,7 +53,7 @@ Defaults from `DEFAULT_GLOBAL_SETTINGS`; key scope from `GLOBAL_SETTINGS_KEYS`.
|
||||
| `language` | `"en" \| "zh-CN" \| "zh-TW" \| "fr" \| "es" \| "ko"` | `undefined` | UI language for the dashboard and TUI. When unset, the dashboard detects from localStorage → browser language and the CLI from `--lang` flag → environment locale, falling back to `en`. Validated at the store write boundary (`validateLocale`); invalid values are dropped. Reset to auto-detect via the dashboard's "Auto" language option or `fn settings set language auto` (clears the persisted key). |
|
||||
| `dashboardFontScalePct` | `number` | `100` | Dashboard font scale percentage used by Appearance settings. Valid range: `85` to `125`; applied pre-hydration via document root font-size so board typography (column headers/counts, task cards, and quick-entry text) scales with the setting from first paint. |
|
||||
| `dismissModalsOnOutsideClick` | `boolean` | `false` | Global dashboard preference for closing fixed modal overlays by clicking/tapping the backdrop. Off by default to prevent accidental modal dismissal; explicit close, cancel, and Escape paths remain available. |
|
||||
| `defaultProvider` | `string` | `undefined` | Default AI provider. |
|
||||
| `defaultProvider` | `string` | `undefined` | Default AI provider. Anthropic has three distinct surfaces: direct `anthropic` uses raw API-key material only (`ANTHROPIC_API_KEY`, a `models.json` `apiKey`, or an `api_key` auth credential); subscription OAuth remains the `anthropic-subscription` auth/usage credential; Claude CLI execution uses the `pi-claude-cli` model provider. OAuth-only Anthropic selections are never sent to `api.anthropic.com/v1`; Fusion routes them to the CLI provider when available or fails with a configuration error. |
|
||||
| `defaultModelId` | `string` | `undefined` | Default AI model ID. |
|
||||
| `modelPricingOverrides` | `Record<string, ModelPricing>` | `undefined` | Optional global Command Center pricing overrides keyed by lowercased `provider:model` or bare `:model`. Values store USD per 1M input, output, cache-read, and cache-write tokens plus optional `source`; they override the built-in pricing table for cost estimates only and are editable from Settings → Global Models → View pricing table. |
|
||||
| `modelPricingFetchedAt` | `string` | `undefined` | ISO timestamp for the last successful one-click pricing refresh from the Settings → Global Models pricing summary. |
|
||||
|
||||
Reference in New Issue
Block a user