Skip to content

Commit a92c4df

Browse files
committed
perf(sdk): load Claude CLI identity from a narrow plugin artifact
src/plugin-sdk/anthropic-cli.ts snapshots CLAUDE_CLI_BACKEND_ID at module scope through the sync facade loader, which jiti-evaluates the full anthropic api.js barrel on source checkouts: 130.86s of self time per cold worker on CI (Testbox import profile), silently stalling every job whose graph reaches cli-runner/prepare.ts. A narrow cli-api.js artifact carries the two static facts; Testbox proof: the reliability+helpers agents-core pair drops from 157.6s to 14.3s.
1 parent e01027d commit a92c4df

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

config/knip.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,10 @@ const config = {
549549
},
550550
[`${BUNDLED_PLUGIN_ROOT_DIR}/amazon-bedrock-mantle`]: bundledPluginWorkspace(),
551551
[`${BUNDLED_PLUGIN_ROOT_DIR}/amazon-bedrock`]: bundledPluginWorkspace(),
552-
[`${BUNDLED_PLUGIN_ROOT_DIR}/anthropic`]: bundledPluginWorkspace(),
552+
[`${BUNDLED_PLUGIN_ROOT_DIR}/anthropic`]: bundledPluginWorkspace([
553+
// The plugin-SDK anthropic-cli facade resolves this shipped artifact by basename.
554+
"cli-api.ts!",
555+
]),
553556
[`${BUNDLED_PLUGIN_ROOT_DIR}/anthropic-vertex`]: bundledPluginWorkspace(),
554557
[`${BUNDLED_PLUGIN_ROOT_DIR}/acpx`]: bundledPluginWorkspace([
555558
// Copied as executable runtime internals by the package artifact manifest.

extensions/anthropic/cli-api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Lightweight Claude CLI identity artifact for core facades. The full api.js
2+
// barrel drags the whole plugin graph through jiti on source checkouts
3+
// (~130s per cold worker on CI); keep this surface to static facts only.
4+
export { CLAUDE_CLI_BACKEND_ID } from "./cli-constants.js";
5+
export { isClaudeCliProvider } from "./cli-shared.js";

src/plugin-sdk/anthropic-cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ type FacadeModule = {
77
};
88

99
function loadFacadeModule(): FacadeModule {
10+
// cli-api.js, not api.js: this facade evaluates at module scope, and the
11+
// full barrel costs ~130s per cold jiti worker on source checkouts.
1012
return loadBundledPluginPublicSurfaceModuleSync<FacadeModule>({
1113
dirName: "anthropic",
12-
artifactBasename: "api.js",
14+
artifactBasename: "cli-api.js",
1315
});
1416
}
1517
/** Anthropic plugin backend id for Claude CLI provider detection. */

0 commit comments

Comments
 (0)