fix(extensions): always prefer vendored @fusion/pi-claude-cli over external installs
When users have an external pi-claude-cli (e.g. a global `npm install -g pi-claude-cli`, or `npm:pi-claude-cli` in ~/.pi/agent/settings.json packages), pi's extension discovery loaded the upstream copy and shadowed our fork. The upstream has a once-and-lock MCP-config bug that throws "Extension runtime not initialized" during early streamSimple calls and never recovers. Adds reconcileClaudeCliPaths in @fusion/core, used by both the daemon's extension assembly and the engine's per-session registerExtensionProviders, to drop any path with a `pi-claude-cli` segment that isn't our vendored fork and prepend the vendored path. Engine resolves the fork via require.resolve and gracefully no-ops when it isn't reachable (e.g. embedded standalone usage). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
GlobalSettingsStore,
|
||||
resolveGlobalDir,
|
||||
getEnabledPiExtensionPaths,
|
||||
reconcileClaudeCliPaths,
|
||||
} from "@fusion/core";
|
||||
import type { AutomationRunResult, ScheduledTask } from "@fusion/core";
|
||||
import { createServer, GitHubClient, createSkillsAdapter, getProjectSettingsPath, loadTlsCredentialsFromEnv } from "@fusion/dashboard";
|
||||
@@ -411,12 +412,17 @@ export async function runDaemon(opts: DaemonOptions = {}) {
|
||||
}
|
||||
})();
|
||||
|
||||
// Always prefer Fusion's vendored `@fusion/pi-claude-cli` over any
|
||||
// external `pi-claude-cli` install. Drops shadowing externals (e.g. a
|
||||
// global `npm install -g pi-claude-cli`) so the upstream's once-and-lock
|
||||
// MCP-config bug can't poison sessions.
|
||||
const reconciledExtensionPaths = reconcileClaudeCliPaths(
|
||||
[...getEnabledPiExtensionPaths(cwd), ...packageExtensionPaths, ...claudeCliPaths],
|
||||
claudeCliPaths[0] ?? null,
|
||||
);
|
||||
|
||||
const extensionsResult = await discoverAndLoadExtensions(
|
||||
[
|
||||
...getEnabledPiExtensionPaths(cwd),
|
||||
...packageExtensionPaths,
|
||||
...claudeCliPaths,
|
||||
],
|
||||
reconciledExtensionPaths,
|
||||
cwd,
|
||||
join(cwd, ".fusion", "disabled-auto-extension-discovery"),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user