refactor(claude-cli): always load extension, gate via /api/models filter
Previously the vendored @fusion/pi-claude-cli extension was conditionally
loaded based on GlobalSettings.useClaudeCli. That forced a Fusion restart
every time the user toggled the provider card — confusing UX.
Key insight: pi-claude-cli registers a NEW provider id ("pi-claude-cli")
rather than overriding "anthropic", so loading it unconditionally is
safe — direct Anthropic auth and CLI-routed models coexist peacefully.
The extension also gracefully no-ops when the `claude` binary is missing
(see packages/pi-claude-cli/index.ts:106 — the throw is caught locally).
Changes:
- serve/daemon/dashboard: always append the resolved pi-claude-cli path
to discoverAndLoadExtensions, no settings lookup.
- resolveClaudeCliExtensionPaths() takes no args now; always returns the
resolved path.
- /api/models filter flipped: hide provider === "pi-claude-cli" when
the toggle is OFF (previously: restricted to those models when ON).
- POST /api/auth/claude-cli drops restartRequired semantics — toggling
now has immediate effect on the picker.
- Provider card UX updated to match: "Claude-CLI-routed models are
now visible/hidden from the model picker" instead of "Restart Fusion
to activate".
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -393,22 +393,16 @@ export async function runDaemon(opts: DaemonOptions = {}) {
|
||||
.filter((r) => r.enabled)
|
||||
.map((r) => r.path);
|
||||
|
||||
const claudeCliPaths = await (async () => {
|
||||
try {
|
||||
const globalSettings = await store.getGlobalSettingsStore().getSettings();
|
||||
const result = resolveClaudeCliExtensionPaths(globalSettings);
|
||||
setCachedClaudeCliResolution(result.resolution);
|
||||
if (result.warning) {
|
||||
console.warn(`[extensions] pi-claude-cli: ${result.warning}`);
|
||||
}
|
||||
return result.paths;
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
`[extensions] Unable to evaluate useClaudeCli setting: ${err instanceof Error ? err.message : String(err)}`,
|
||||
);
|
||||
setCachedClaudeCliResolution(null);
|
||||
return [];
|
||||
// Always load the vendored pi-claude-cli extension — see comment in
|
||||
// serve.ts for rationale. The `useClaudeCli` setting only affects the
|
||||
// /api/models filter, not extension registration.
|
||||
const claudeCliPaths = (() => {
|
||||
const result = resolveClaudeCliExtensionPaths();
|
||||
setCachedClaudeCliResolution(result.resolution);
|
||||
if (result.warning) {
|
||||
console.warn(`[extensions] pi-claude-cli: ${result.warning}`);
|
||||
}
|
||||
return result.paths;
|
||||
})();
|
||||
|
||||
const extensionsResult = await discoverAndLoadExtensions(
|
||||
|
||||
Reference in New Issue
Block a user