@opencow-ai/opencow-agent-sdk 0.4.25 → 0.4.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capabilities/mcp/codexConfigFields.d.ts +20 -0
- package/dist/capabilities/mcp/envExpansion.d.ts +4 -1
- package/dist/capabilities/mcp/types.d.ts +3 -0
- package/dist/capabilities/plugins/lspPluginIntegration.d.ts +1 -0
- package/dist/capabilities/plugins/mcpPluginIntegration.d.ts +1 -0
- package/dist/capabilities/plugins/pluginOptionsStorage.d.ts +6 -0
- package/dist/capabilities/plugins/schemas.d.ts +6 -0
- package/dist/capabilities/plugins/sdkPluginRuntime.d.ts +2 -0
- package/dist/cli.mjs +285 -242
- package/dist/client.js +263 -261
- package/dist/constants/envVars.d.ts +1 -0
- package/dist/constants/oauth.d.ts +0 -8
- package/dist/controller/dispatch/toolHooks.d.ts +4 -3
- package/dist/entrypoints/sdk/controlSchemas.d.ts +20 -0
- package/dist/entrypoints/sdk/coreSchemas.d.ts +6 -0
- package/dist/entrypoints/sdk/runtimeTypes.d.ts +24 -0
- package/dist/sdk.js +263 -261
- package/dist/session/attachments.d.ts +9 -0
- package/dist/session/branding.d.ts +4 -0
- package/dist/session/brandingConfig.d.ts +16 -0
- package/dist/session/state/index.d.ts +1 -1
- package/dist/session/state/registries.d.ts +8 -1
- package/dist/session/state/types.d.ts +2 -0
- package/dist/types/plugin.d.ts +5 -0
- package/package.json +1 -1
- package/dist/capabilities/tools/AgentTool/built-in/claudeCodeGuideAgent.d.ts +0 -3
package/dist/client.js
CHANGED
|
@@ -19269,6 +19269,7 @@ var init_envVars = __esm(() => {
|
|
|
19269
19269
|
DISABLE_EARLY_INPUT: envVar("OPENCOW_DISABLE_EARLY_INPUT"),
|
|
19270
19270
|
ENABLE_EXTENDED_KEYS: envVar("OPENCOW_ENABLE_EXTENDED_KEYS"),
|
|
19271
19271
|
ENABLE_STREAM_WATCHDOG: envVar("OPENCOW_ENABLE_STREAM_WATCHDOG"),
|
|
19272
|
+
SKILL_LISTING: envVar("OPENCOW_SKILL_LISTING"),
|
|
19272
19273
|
STREAM_IDLE_TIMEOUT_MS: envVar("OPENCOW_STREAM_IDLE_TIMEOUT_MS"),
|
|
19273
19274
|
UNBOUNDED_CONNECTION_RETRY: envVar("OPENCOW_UNBOUNDED_CONNECTION_RETRY"),
|
|
19274
19275
|
STREAM_REPLAY_RETRIES: envVar("OPENCOW_STREAM_REPLAY_RETRIES"),
|
|
@@ -19277,21 +19278,49 @@ var init_envVars = __esm(() => {
|
|
|
19277
19278
|
});
|
|
19278
19279
|
|
|
19279
19280
|
// src/session/brandingConfig.ts
|
|
19281
|
+
function toProductSlug(value) {
|
|
19282
|
+
const slug = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
19283
|
+
return slug || PRODUCT_SLUG_FALLBACK;
|
|
19284
|
+
}
|
|
19280
19285
|
function normalizeBrandName(value, fallback) {
|
|
19281
19286
|
const normalized = value?.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
19282
19287
|
return normalized ? normalized.slice(0, 80) : fallback;
|
|
19283
19288
|
}
|
|
19289
|
+
function optionalUrl(key, value) {
|
|
19290
|
+
const trimmed = value?.trim();
|
|
19291
|
+
return trimmed ? { [key]: trimmed } : {};
|
|
19292
|
+
}
|
|
19293
|
+
function validatedProductUrl(value) {
|
|
19294
|
+
const trimmed = value?.trim();
|
|
19295
|
+
if (!trimmed)
|
|
19296
|
+
return {};
|
|
19297
|
+
let protocol;
|
|
19298
|
+
try {
|
|
19299
|
+
protocol = new URL(trimmed).protocol;
|
|
19300
|
+
} catch {
|
|
19301
|
+
throw new TypeError(`branding.productUrl is not a valid URL: ${trimmed}`);
|
|
19302
|
+
}
|
|
19303
|
+
if (protocol !== "https:" && protocol !== "http:" || /[^\x21-\x7e]/.test(trimmed)) {
|
|
19304
|
+
throw new TypeError(`branding.productUrl must be an ASCII http(s) URL: ${trimmed}`);
|
|
19305
|
+
}
|
|
19306
|
+
return { productUrl: trimmed };
|
|
19307
|
+
}
|
|
19284
19308
|
function resolveBranding(options) {
|
|
19285
19309
|
const productName = normalizeBrandName(options?.productName, DEFAULT_BRANDING.productName);
|
|
19310
|
+
const explicitSlug = options?.productSlug?.trim();
|
|
19286
19311
|
return Object.freeze({
|
|
19287
19312
|
productName,
|
|
19288
|
-
|
|
19313
|
+
productSlug: toProductSlug(explicitSlug || productName),
|
|
19314
|
+
assistantName: normalizeBrandName(options?.assistantName, productName),
|
|
19315
|
+
...optionalUrl("mcpOAuthClientMetadataUrl", options?.mcpOAuthClientMetadataUrl),
|
|
19316
|
+
...validatedProductUrl(options?.productUrl)
|
|
19289
19317
|
});
|
|
19290
19318
|
}
|
|
19291
|
-
var DEFAULT_BRANDING;
|
|
19319
|
+
var DEFAULT_BRANDING, PRODUCT_SLUG_FALLBACK = "app";
|
|
19292
19320
|
var init_brandingConfig = __esm(() => {
|
|
19293
19321
|
DEFAULT_BRANDING = Object.freeze({
|
|
19294
19322
|
productName: "Agentic",
|
|
19323
|
+
productSlug: "agentic",
|
|
19295
19324
|
assistantName: "Agentic"
|
|
19296
19325
|
});
|
|
19297
19326
|
});
|
|
@@ -19308,12 +19337,17 @@ function getAssistantIdentityPrompt() {
|
|
|
19308
19337
|
return `You are ${getBranding().assistantName}, an agentic coding assistant.`;
|
|
19309
19338
|
}
|
|
19310
19339
|
function getMcpClientInfo() {
|
|
19311
|
-
const { productName } = getBranding();
|
|
19340
|
+
const { productName, productSlug, productUrl } = getBranding();
|
|
19312
19341
|
return {
|
|
19342
|
+
name: productSlug,
|
|
19313
19343
|
title: `${productName} Coding Client`,
|
|
19314
|
-
description: `${productName} agentic coding client
|
|
19344
|
+
description: `${productName} agentic coding client`,
|
|
19345
|
+
...productUrl ? { websiteUrl: productUrl } : {}
|
|
19315
19346
|
};
|
|
19316
19347
|
}
|
|
19348
|
+
function getProductUserAgentToken() {
|
|
19349
|
+
return getBranding().productSlug;
|
|
19350
|
+
}
|
|
19317
19351
|
var brandingStorage;
|
|
19318
19352
|
var init_branding = __esm(() => {
|
|
19319
19353
|
init_brandingConfig();
|
|
@@ -19543,6 +19577,12 @@ var init_paths = __esm(() => {
|
|
|
19543
19577
|
});
|
|
19544
19578
|
|
|
19545
19579
|
// src/session/layout/LayoutProfile.ts
|
|
19580
|
+
var exports_LayoutProfile = {};
|
|
19581
|
+
__export(exports_LayoutProfile, {
|
|
19582
|
+
DEFAULT_LAYOUT_PROFILE: () => DEFAULT_LAYOUT_PROFILE,
|
|
19583
|
+
resolveBinding: () => resolveBinding,
|
|
19584
|
+
resolveLayoutProfile: () => resolveLayoutProfile
|
|
19585
|
+
});
|
|
19546
19586
|
function resolveBinding(binding) {
|
|
19547
19587
|
if (typeof binding === "string") {
|
|
19548
19588
|
return BUILT_IN_BINDINGS[binding];
|
|
@@ -27244,6 +27284,11 @@ var init_platform = __esm(() => {
|
|
|
27244
27284
|
});
|
|
27245
27285
|
|
|
27246
27286
|
// src/session/settings/managedPath.ts
|
|
27287
|
+
var exports_managedPath = {};
|
|
27288
|
+
__export(exports_managedPath, {
|
|
27289
|
+
getManagedFilePath: () => getManagedFilePath,
|
|
27290
|
+
getManagedSettingsDropInDir: () => getManagedSettingsDropInDir
|
|
27291
|
+
});
|
|
27247
27292
|
import { join as join5 } from "path";
|
|
27248
27293
|
var getManagedFilePath, getManagedSettingsDropInDir;
|
|
27249
27294
|
var init_managedPath = __esm(() => {
|
|
@@ -35391,7 +35436,7 @@ function getOauthConfig() {
|
|
|
35391
35436
|
}
|
|
35392
35437
|
return config;
|
|
35393
35438
|
}
|
|
35394
|
-
var CLAUDE_AI_INFERENCE_SCOPE = "user:inference", CLAUDE_AI_PROFILE_SCOPE = "user:profile", CONSOLE_SCOPE = "org:create_api_key", OAUTH_BETA_HEADER = "oauth-2025-04-20", CONSOLE_OAUTH_SCOPES, CLAUDE_AI_OAUTH_SCOPES, ALL_OAUTH_SCOPES, PROD_OAUTH_CONFIG,
|
|
35439
|
+
var CLAUDE_AI_INFERENCE_SCOPE = "user:inference", CLAUDE_AI_PROFILE_SCOPE = "user:profile", CONSOLE_SCOPE = "org:create_api_key", OAUTH_BETA_HEADER = "oauth-2025-04-20", CONSOLE_OAUTH_SCOPES, CLAUDE_AI_OAUTH_SCOPES, ALL_OAUTH_SCOPES, PROD_OAUTH_CONFIG, STAGING_OAUTH_CONFIG, ALLOWED_OAUTH_BASE_URLS;
|
|
35395
35440
|
var init_oauth = __esm(() => {
|
|
35396
35441
|
init_envUtils();
|
|
35397
35442
|
init_envVars();
|
|
@@ -38526,6 +38571,7 @@ var init_git = __esm(() => {
|
|
|
38526
38571
|
init_log2();
|
|
38527
38572
|
init_memoize2();
|
|
38528
38573
|
init_which();
|
|
38574
|
+
init_branding();
|
|
38529
38575
|
GIT_ROOT_NOT_FOUND = Symbol("git-root-not-found");
|
|
38530
38576
|
findGitRootImpl = memoizeWithLRU((startPath) => {
|
|
38531
38577
|
const startTime = Date.now();
|
|
@@ -39816,7 +39862,8 @@ var init_types4 = __esm(() => {
|
|
|
39816
39862
|
type: literal("stdio").optional(),
|
|
39817
39863
|
command: string2().min(1, "Command cannot be empty"),
|
|
39818
39864
|
args: array(string2()).default([]),
|
|
39819
|
-
env: record(string2(), string2()).optional()
|
|
39865
|
+
env: record(string2(), string2()).optional(),
|
|
39866
|
+
cwd: string2().optional()
|
|
39820
39867
|
}));
|
|
39821
39868
|
McpXaaConfigSchema = lazySchema(() => boolean2());
|
|
39822
39869
|
McpOAuthConfigSchema = lazySchema(() => object2({
|
|
@@ -40753,7 +40800,7 @@ var init_types5 = __esm(() => {
|
|
|
40753
40800
|
allow: array(PermissionRuleSchema()).optional().describe("List of permission rules for allowed operations"),
|
|
40754
40801
|
deny: array(PermissionRuleSchema()).optional().describe("List of permission rules for denied operations"),
|
|
40755
40802
|
ask: array(PermissionRuleSchema()).optional().describe("List of permission rules that should always prompt for confirmation"),
|
|
40756
|
-
defaultMode: _enum(EXTERNAL_PERMISSION_MODES).optional().describe("Default permission mode when
|
|
40803
|
+
defaultMode: _enum(EXTERNAL_PERMISSION_MODES).optional().describe("Default permission mode when the agent needs access"),
|
|
40757
40804
|
disableBypassPermissionsMode: _enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),
|
|
40758
40805
|
...{},
|
|
40759
40806
|
additionalDirectories: array(string2()).optional().describe("Additional directories to include in the permission scope")
|
|
@@ -40798,7 +40845,7 @@ var init_types5 = __esm(() => {
|
|
|
40798
40845
|
"mcp"
|
|
40799
40846
|
];
|
|
40800
40847
|
SettingsSchema = lazySchema(() => object2({
|
|
40801
|
-
$schema: literal(CLAUDE_CODE_SETTINGS_SCHEMA_URL).optional().describe("JSON Schema reference for
|
|
40848
|
+
$schema: literal(CLAUDE_CODE_SETTINGS_SCHEMA_URL).optional().describe("JSON Schema reference for settings"),
|
|
40802
40849
|
apiKeyHelper: string2().optional().describe("Path to a script that outputs authentication values"),
|
|
40803
40850
|
awsCredentialExport: string2().optional().describe("Path to a script that exports AWS credentials"),
|
|
40804
40851
|
awsAuthRefresh: string2().optional().describe("Path to a script that refreshes AWS authentication"),
|
|
@@ -40806,7 +40853,7 @@ var init_types5 = __esm(() => {
|
|
|
40806
40853
|
...isEnvTruthy(resolveEnvVar("ENABLE_XAA")) ? {
|
|
40807
40854
|
xaaIdp: object2({
|
|
40808
40855
|
issuer: string2().url().describe("IdP issuer URL for OIDC discovery"),
|
|
40809
|
-
clientId: string2().describe("
|
|
40856
|
+
clientId: string2().describe("The client_id registered at the IdP"),
|
|
40810
40857
|
callbackPort: number2().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. " + "Only needed if the IdP does not honor RFC 8252 port-any matching.")
|
|
40811
40858
|
}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")
|
|
40812
40859
|
} : {},
|
|
@@ -40816,10 +40863,10 @@ var init_types5 = __esm(() => {
|
|
|
40816
40863
|
}).optional().describe("Custom file suggestion configuration for @ mentions"),
|
|
40817
40864
|
respectGitignore: boolean2().optional().describe("Whether file picker should respect .gitignore files (default: true). " + "Note: .ignore files are always respected."),
|
|
40818
40865
|
cleanupPeriodDays: number2().nonnegative().int().optional().describe("Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup."),
|
|
40819
|
-
env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for
|
|
40866
|
+
env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for agent sessions"),
|
|
40820
40867
|
includeGitInstructions: boolean2().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),
|
|
40821
40868
|
permissions: PermissionsSchema().optional().describe("Tool usage permissions configuration"),
|
|
40822
|
-
model: string2().optional().describe("Override the default model used by
|
|
40869
|
+
model: string2().optional().describe("Override the default model used by the agent"),
|
|
40823
40870
|
availableModels: array(string2()).optional().describe("Allowlist of models that users can select. " + 'Accepts family aliases ("opus" allows any opus version), ' + 'version prefixes ("opus-4-5" allows only that version), ' + "and full model IDs. " + "If undefined, all models are available. If empty array, only the default model is available. " + "Typically set in managed settings by enterprise administrators."),
|
|
40824
40871
|
modelOverrides: record(string2(), string2()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific ' + "model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by " + "enterprise administrators."),
|
|
40825
40872
|
enableAllProjectMcpServers: boolean2().optional().describe("Whether to automatically approve all MCP servers in the project"),
|
|
@@ -63644,11 +63691,6 @@ function parseAnthropicStreamChunk(chunk) {
|
|
|
63644
63691
|
return [chunk];
|
|
63645
63692
|
}
|
|
63646
63693
|
|
|
63647
|
-
// src/providers/shared/userAgent.ts
|
|
63648
|
-
function getClaudeCodeUserAgent() {
|
|
63649
|
-
return `claude-code/${"99.0.0"}`;
|
|
63650
|
-
}
|
|
63651
|
-
|
|
63652
63694
|
// src/session/workloadContext.ts
|
|
63653
63695
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
63654
63696
|
function getWorkload() {
|
|
@@ -63680,17 +63722,19 @@ function getMCPUserAgent() {
|
|
|
63680
63722
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
63681
63723
|
}
|
|
63682
63724
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
63683
|
-
return
|
|
63725
|
+
return `${getProductUserAgentToken()}/${"99.0.0"}${suffix}`;
|
|
63684
63726
|
}
|
|
63685
63727
|
function getWebFetchUserAgent() {
|
|
63686
|
-
const
|
|
63687
|
-
|
|
63728
|
+
const { productSlug, productUrl } = getBranding();
|
|
63729
|
+
const contact = productUrl ? `; +${productUrl}` : "";
|
|
63730
|
+
return `${productSlug}-User (${productSlug}/${"99.0.0"}${contact})`;
|
|
63688
63731
|
}
|
|
63689
63732
|
var init_http2 = __esm(() => {
|
|
63690
63733
|
init_oauth();
|
|
63691
63734
|
init_auth();
|
|
63692
63735
|
init_state2();
|
|
63693
63736
|
init_workloadContext();
|
|
63737
|
+
init_branding();
|
|
63694
63738
|
});
|
|
63695
63739
|
|
|
63696
63740
|
// src/providers/shared/model/providers.ts
|
|
@@ -90142,8 +90186,8 @@ function createBootQueryContext() {
|
|
|
90142
90186
|
}
|
|
90143
90187
|
const sessionId = randomUUID();
|
|
90144
90188
|
init_paths();
|
|
90145
|
-
init_LayoutProfile();
|
|
90146
|
-
init_managedPath();
|
|
90189
|
+
const { DEFAULT_LAYOUT_PROFILE } = (init_LayoutProfile(), __toCommonJS(exports_LayoutProfile));
|
|
90190
|
+
const { getManagedFilePath } = (init_managedPath(), __toCommonJS(exports_managedPath));
|
|
90147
90191
|
const { homedir } = __require("node:os");
|
|
90148
90192
|
const bootConfigHomeDir = process.env.CLAUDE_CONFIG_DIR ? process.env.CLAUDE_CONFIG_DIR.normalize("NFC") : (homedir() + "/.opencow").normalize("NFC");
|
|
90149
90193
|
const bootMemoryBaseDir = resolveEnvVar("REMOTE_MEMORY_DIR") ?? bootConfigHomeDir;
|
|
@@ -90248,6 +90292,7 @@ function createBootQueryContext() {
|
|
|
90248
90292
|
loaded: createSignal()
|
|
90249
90293
|
},
|
|
90250
90294
|
pluginDataPaths: new Map,
|
|
90295
|
+
pluginContentVariables: {},
|
|
90251
90296
|
lspManager: null
|
|
90252
90297
|
},
|
|
90253
90298
|
diagnostics: createFreshDiagnostics(),
|
|
@@ -90339,6 +90384,7 @@ function deriveSubagentRegistries(parent) {
|
|
|
90339
90384
|
skillListingSuppressNext: false,
|
|
90340
90385
|
dynamicSkills: parent.dynamicSkills,
|
|
90341
90386
|
pluginDataPaths: parent.pluginDataPaths,
|
|
90387
|
+
pluginContentVariables: parent.pluginContentVariables,
|
|
90342
90388
|
lspManager: parent.lspManager
|
|
90343
90389
|
};
|
|
90344
90390
|
}
|
|
@@ -90491,7 +90537,7 @@ function buildQueryContextFromSdk(options) {
|
|
|
90491
90537
|
const memoryBaseDir = resolveEnvVar("REMOTE_MEMORY_DIR") ?? configHomeDir;
|
|
90492
90538
|
const autoMemEnvOverride = resolveEnvVar("MEMORY_PATH_OVERRIDE");
|
|
90493
90539
|
const autoMemSettingsOverride = resolvedFileSystemLayer === "disabled" ? undefined : readAutoMemSettingsOverride();
|
|
90494
|
-
init_managedPath();
|
|
90540
|
+
const { getManagedFilePath } = (init_managedPath(), __toCommonJS(exports_managedPath));
|
|
90495
90541
|
const paths = computeSessionPaths({
|
|
90496
90542
|
cwd,
|
|
90497
90543
|
projectRoot: cwd,
|
|
@@ -90594,6 +90640,7 @@ function buildQueryContextFromSdk(options) {
|
|
|
90594
90640
|
loaded: createSignal()
|
|
90595
90641
|
},
|
|
90596
90642
|
pluginDataPaths: new Map,
|
|
90643
|
+
pluginContentVariables: {},
|
|
90597
90644
|
lspManager: null
|
|
90598
90645
|
},
|
|
90599
90646
|
diagnostics: createFreshDiagnostics(),
|
|
@@ -91108,11 +91155,22 @@ function resetSdkInitState() {
|
|
|
91108
91155
|
r.initJsonSchema = null;
|
|
91109
91156
|
r.registeredHooks = null;
|
|
91110
91157
|
}
|
|
91111
|
-
function setExplicitPluginRuntimeContext(dataPaths, lspManager) {
|
|
91158
|
+
function setExplicitPluginRuntimeContext(dataPaths, lspManager, contentVariables) {
|
|
91112
91159
|
const registries = getQueryContext().registries;
|
|
91113
91160
|
registries.pluginDataPaths = new Map(dataPaths);
|
|
91161
|
+
registries.pluginContentVariables = { ...contentVariables };
|
|
91114
91162
|
registries.lspManager = lspManager;
|
|
91115
91163
|
}
|
|
91164
|
+
function setExplicitPluginRuntimeBundle(bundle) {
|
|
91165
|
+
setExplicitPluginRuntimeContext(bundle.dataPaths, bundle.lspManager, bundle.contentVariables ?? {});
|
|
91166
|
+
}
|
|
91167
|
+
function tryGetPluginContentVariables() {
|
|
91168
|
+
try {
|
|
91169
|
+
return getQueryContext().registries.pluginContentVariables;
|
|
91170
|
+
} catch {
|
|
91171
|
+
return {};
|
|
91172
|
+
}
|
|
91173
|
+
}
|
|
91116
91174
|
function tryGetExplicitPluginDataPath(pluginId) {
|
|
91117
91175
|
try {
|
|
91118
91176
|
return getQueryContext().registries.pluginDataPaths.get(pluginId);
|
|
@@ -91578,6 +91636,7 @@ __export(exports_state, {
|
|
|
91578
91636
|
setCwdState: () => setCwdState2,
|
|
91579
91637
|
setDirectConnectServerUrl: () => setDirectConnectServerUrl,
|
|
91580
91638
|
setEnvVar: () => setEnvVar,
|
|
91639
|
+
setExplicitPluginRuntimeBundle: () => setExplicitPluginRuntimeBundle,
|
|
91581
91640
|
setExplicitPluginRuntimeContext: () => setExplicitPluginRuntimeContext,
|
|
91582
91641
|
setFastModeHeaderLatched: () => setFastModeHeaderLatched2,
|
|
91583
91642
|
setFlagSettingsInline: () => setFlagSettingsInline,
|
|
@@ -91614,6 +91673,7 @@ __export(exports_state, {
|
|
|
91614
91673
|
snapshotOutputTokensForTurn: () => snapshotOutputTokensForTurn,
|
|
91615
91674
|
switchSession: () => switchSession,
|
|
91616
91675
|
tryGetExplicitPluginDataPath: () => tryGetExplicitPluginDataPath,
|
|
91676
|
+
tryGetPluginContentVariables: () => tryGetPluginContentVariables,
|
|
91617
91677
|
tryGetQueryContext: () => tryGetQueryContext,
|
|
91618
91678
|
tryGetSessionLspManager: () => tryGetSessionLspManager,
|
|
91619
91679
|
unregisterCreatedTeam: () => unregisterCreatedTeam
|
|
@@ -107254,6 +107314,7 @@ var init_TaskOutput = __esm(() => {
|
|
|
107254
107314
|
init_stringUtils();
|
|
107255
107315
|
init_diskOutput();
|
|
107256
107316
|
init_fsOperations();
|
|
107317
|
+
init_branding();
|
|
107257
107318
|
DEFAULT_MAX_MEMORY = 8 * 1024 * 1024;
|
|
107258
107319
|
TaskOutput = class TaskOutput {
|
|
107259
107320
|
taskId;
|
|
@@ -107441,7 +107502,7 @@ Output truncated (${sizeKB}KB total). Full output saved to: ${this.path}`;
|
|
|
107441
107502
|
} catch (err) {
|
|
107442
107503
|
const code = err instanceof Error && "code" in err ? String(err.code) : "unknown";
|
|
107443
107504
|
logForDebugging(`TaskOutput.#readStdoutFromFile: failed to read ${this.path} (${code}): ${err}`);
|
|
107444
|
-
return `<bash output unavailable: output file ${this.path} could not be read (${code}). This usually means another
|
|
107505
|
+
return `<bash output unavailable: output file ${this.path} could not be read (${code}). This usually means another ${getBranding().productName} process in the same project deleted it during startup cleanup.>`;
|
|
107445
107506
|
}
|
|
107446
107507
|
}
|
|
107447
107508
|
getStderr() {
|
|
@@ -113082,6 +113143,11 @@ function substitutePluginVariables(value, plugin) {
|
|
|
113082
113143
|
}
|
|
113083
113144
|
return out;
|
|
113084
113145
|
}
|
|
113146
|
+
function substitutePluginContentVariables(value, variables = tryGetPluginContentVariables()) {
|
|
113147
|
+
if (Object.keys(variables).length === 0)
|
|
113148
|
+
return value;
|
|
113149
|
+
return value.replace(/\$\{([A-Z][A-Z0-9_]*)\}/g, (match, name) => Object.hasOwn(variables, name) ? variables[name] : match);
|
|
113150
|
+
}
|
|
113085
113151
|
function substituteUserConfigVariables(value, userConfig) {
|
|
113086
113152
|
return value.replace(/\$\{user_config\.([^}]+)\}/g, (_match, key) => {
|
|
113087
113153
|
const configValue = userConfig[key];
|
|
@@ -122419,7 +122485,7 @@ function getErrorMessageIfRefusal(stopReason, model) {
|
|
|
122419
122485
|
}
|
|
122420
122486
|
logEvent("tengu_refusal_api_response", {});
|
|
122421
122487
|
const usagePolicyUrl = isFamily(getProvider(), "firstParty") ? "https://www.anthropic.com/legal/aup" : "your provider's acceptable use policy";
|
|
122422
|
-
const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}:
|
|
122488
|
+
const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}: ${getBranding().productName} is unable to respond to this request, which appears to violate our Usage Policy (${usagePolicyUrl}). Try rephrasing the request or attempting a different approach.` : `${API_ERROR_MESSAGE_PREFIX}: ${getBranding().productName} is unable to respond to this request, which appears to violate our Usage Policy (${usagePolicyUrl}). Please double press esc to edit your last message or start a new session for ${getBranding().productName} to assist with a different task.`;
|
|
122423
122489
|
const modelSuggestion = model !== "claude-sonnet-4-20250514" ? " If you are seeing this refusal repeatedly, try running /model claude-sonnet-4-20250514 to switch models." : "";
|
|
122424
122490
|
return createAssistantAPIErrorMessage({
|
|
122425
122491
|
content: baseMessage + modelSuggestion,
|
|
@@ -122466,6 +122532,7 @@ var init_errors7 = __esm(() => {
|
|
|
122466
122532
|
init_claudeAiLimits();
|
|
122467
122533
|
init_mocking();
|
|
122468
122534
|
init_errorUtils();
|
|
122535
|
+
init_branding();
|
|
122469
122536
|
});
|
|
122470
122537
|
|
|
122471
122538
|
// src/providers/shared/retry.ts
|
|
@@ -166871,40 +166938,6 @@ var init_p_map = __esm(() => {
|
|
|
166871
166938
|
pMapSkip = Symbol("skip");
|
|
166872
166939
|
});
|
|
166873
166940
|
|
|
166874
|
-
// src/session/bridge/sessionIdCompat.ts
|
|
166875
|
-
function toCompatSessionId(id) {
|
|
166876
|
-
if (!id.startsWith("cse_"))
|
|
166877
|
-
return id;
|
|
166878
|
-
if (_isCseShimEnabled && !_isCseShimEnabled())
|
|
166879
|
-
return id;
|
|
166880
|
-
return "session_" + id.slice("cse_".length);
|
|
166881
|
-
}
|
|
166882
|
-
var _isCseShimEnabled;
|
|
166883
|
-
|
|
166884
|
-
// src/constants/product.ts
|
|
166885
|
-
function isRemoteSessionStaging(sessionId, ingressUrl) {
|
|
166886
|
-
return sessionId?.includes("_staging_") === true || ingressUrl?.includes("staging") === true;
|
|
166887
|
-
}
|
|
166888
|
-
function isRemoteSessionLocal(sessionId, ingressUrl) {
|
|
166889
|
-
return sessionId?.includes("_local_") === true || ingressUrl?.includes("localhost") === true;
|
|
166890
|
-
}
|
|
166891
|
-
function getClaudeAiBaseUrl(sessionId, ingressUrl) {
|
|
166892
|
-
if (isRemoteSessionLocal(sessionId, ingressUrl)) {
|
|
166893
|
-
return CLAUDE_AI_LOCAL_BASE_URL;
|
|
166894
|
-
}
|
|
166895
|
-
if (isRemoteSessionStaging(sessionId, ingressUrl)) {
|
|
166896
|
-
return CLAUDE_AI_STAGING_BASE_URL;
|
|
166897
|
-
}
|
|
166898
|
-
return CLAUDE_AI_BASE_URL;
|
|
166899
|
-
}
|
|
166900
|
-
function getRemoteSessionUrl(sessionId, ingressUrl) {
|
|
166901
|
-
;
|
|
166902
|
-
const compatId = toCompatSessionId(sessionId);
|
|
166903
|
-
const baseUrl = getClaudeAiBaseUrl(compatId, ingressUrl);
|
|
166904
|
-
return `${baseUrl}/code/${compatId}`;
|
|
166905
|
-
}
|
|
166906
|
-
var PRODUCT_URL = "https://claude.com/claude-code", TELEMETRY_SERVICE_NAME = "claude-code", CLAUDE_AI_BASE_URL = "https://claude.ai", CLAUDE_AI_STAGING_BASE_URL = "https://claude-ai.staging.ant.dev", CLAUDE_AI_LOCAL_BASE_URL = "http://localhost:4000";
|
|
166907
|
-
|
|
166908
166941
|
// node_modules/.bun/semver@7.7.4/node_modules/semver/internal/constants.js
|
|
166909
166942
|
var require_constants7 = __commonJS(function(exports, module) {
|
|
166910
166943
|
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
@@ -171573,11 +171606,11 @@ For example, to get tab context:
|
|
|
171573
171606
|
var init_knownServers = () => {};
|
|
171574
171607
|
|
|
171575
171608
|
// src/capabilities/mcp/envExpansion.ts
|
|
171576
|
-
function expandEnvVarsInString(value) {
|
|
171609
|
+
function expandEnvVarsInString(value, env = process.env) {
|
|
171577
171610
|
const missingVars = [];
|
|
171578
171611
|
const expanded = value.replace(/\$\{([^}]+)\}/g, (match, varContent) => {
|
|
171579
171612
|
const [varName, defaultValue] = varContent.split(":-", 2);
|
|
171580
|
-
const envValue =
|
|
171613
|
+
const envValue = env[varName];
|
|
171581
171614
|
if (envValue !== undefined) {
|
|
171582
171615
|
return envValue;
|
|
171583
171616
|
}
|
|
@@ -171593,8 +171626,63 @@ function expandEnvVarsInString(value) {
|
|
|
171593
171626
|
};
|
|
171594
171627
|
}
|
|
171595
171628
|
|
|
171629
|
+
// src/capabilities/mcp/codexConfigFields.ts
|
|
171630
|
+
function isPlainObject6(value) {
|
|
171631
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
171632
|
+
}
|
|
171633
|
+
function setMissing(record, key, value) {
|
|
171634
|
+
if (record[key] !== undefined)
|
|
171635
|
+
return;
|
|
171636
|
+
record[key] = value;
|
|
171637
|
+
}
|
|
171638
|
+
function recordFor(config, key) {
|
|
171639
|
+
const existing = config[key];
|
|
171640
|
+
if (isPlainObject6(existing))
|
|
171641
|
+
return existing;
|
|
171642
|
+
const created = {};
|
|
171643
|
+
config[key] = created;
|
|
171644
|
+
return created;
|
|
171645
|
+
}
|
|
171646
|
+
function stringRecordEntries(value) {
|
|
171647
|
+
if (!isPlainObject6(value))
|
|
171648
|
+
return [];
|
|
171649
|
+
return Object.entries(value).filter((entry) => typeof entry[1] === "string");
|
|
171650
|
+
}
|
|
171651
|
+
function normalizeCodexMcpFields(input) {
|
|
171652
|
+
if (!isPlainObject6(input))
|
|
171653
|
+
return {};
|
|
171654
|
+
const config = structuredClone(input);
|
|
171655
|
+
const envVars = config["env_vars"];
|
|
171656
|
+
if (Array.isArray(envVars)) {
|
|
171657
|
+
for (const name of envVars.filter((item) => typeof item === "string")) {
|
|
171658
|
+
setMissing(recordFor(config, "env"), name, `\${${name}}`);
|
|
171659
|
+
}
|
|
171660
|
+
delete config["env_vars"];
|
|
171661
|
+
}
|
|
171662
|
+
const envHttpHeaders = config["env_http_headers"];
|
|
171663
|
+
if (isPlainObject6(envHttpHeaders)) {
|
|
171664
|
+
for (const [header, varName] of stringRecordEntries(envHttpHeaders)) {
|
|
171665
|
+
setMissing(recordFor(config, "headers"), header, `\${${varName}}`);
|
|
171666
|
+
}
|
|
171667
|
+
delete config["env_http_headers"];
|
|
171668
|
+
}
|
|
171669
|
+
const bearer = config["bearer_token_env_var"];
|
|
171670
|
+
if (typeof bearer === "string" && bearer.trim()) {
|
|
171671
|
+
setMissing(recordFor(config, "headers"), "Authorization", `Bearer \${${bearer.trim()}}`);
|
|
171672
|
+
delete config["bearer_token_env_var"];
|
|
171673
|
+
}
|
|
171674
|
+
const httpHeaders = config["http_headers"];
|
|
171675
|
+
if (isPlainObject6(httpHeaders)) {
|
|
171676
|
+
for (const [header, value] of stringRecordEntries(httpHeaders)) {
|
|
171677
|
+
setMissing(recordFor(config, "headers"), header, value);
|
|
171678
|
+
}
|
|
171679
|
+
delete config["http_headers"];
|
|
171680
|
+
}
|
|
171681
|
+
return config;
|
|
171682
|
+
}
|
|
171683
|
+
|
|
171596
171684
|
// src/capabilities/plugins/mcpPluginIntegration.ts
|
|
171597
|
-
import { join as join40 } from "path";
|
|
171685
|
+
import { join as join40, resolve as resolvePath } from "path";
|
|
171598
171686
|
async function loadMcpServersFromMcpb(plugin, mcpbPath, errors) {
|
|
171599
171687
|
try {
|
|
171600
171688
|
logForDebugging(`Loading MCP servers from MCPB: ${mcpbPath}`);
|
|
@@ -171725,7 +171813,7 @@ async function loadMcpServersFromFile(pluginPath, relativePath, errors, plugin,
|
|
|
171725
171813
|
const mcpServers = parsed.mcpServers || parsed;
|
|
171726
171814
|
const validatedServers = {};
|
|
171727
171815
|
for (const [name, config] of Object.entries(mcpServers)) {
|
|
171728
|
-
const result = McpServerConfigSchema().safeParse(config);
|
|
171816
|
+
const result = McpServerConfigSchema().safeParse(normalizeCodexMcpFields(config));
|
|
171729
171817
|
if (result.success) {
|
|
171730
171818
|
validatedServers[name] = result.data;
|
|
171731
171819
|
} else {
|
|
@@ -171783,12 +171871,13 @@ function buildMcpUserConfig(plugin, serverName) {
|
|
|
171783
171871
|
}
|
|
171784
171872
|
function resolvePluginMcpEnvironment(config, plugin, userConfig, errors, pluginName, serverName) {
|
|
171785
171873
|
const allMissingVars = [];
|
|
171874
|
+
const envLookup = plugin.env ? { ...process.env, ...plugin.env } : process.env;
|
|
171786
171875
|
const resolveValue = (value) => {
|
|
171787
171876
|
let resolved = substitutePluginVariables(value, plugin);
|
|
171788
171877
|
if (userConfig) {
|
|
171789
171878
|
resolved = substituteUserConfigVariables(resolved, userConfig);
|
|
171790
171879
|
}
|
|
171791
|
-
const { expanded, missingVars } = expandEnvVarsInString(resolved);
|
|
171880
|
+
const { expanded, missingVars } = expandEnvVarsInString(resolved, envLookup);
|
|
171792
171881
|
allMissingVars.push(...missingVars);
|
|
171793
171882
|
return expanded;
|
|
171794
171883
|
};
|
|
@@ -171803,6 +171892,9 @@ function resolvePluginMcpEnvironment(config, plugin, userConfig, errors, pluginN
|
|
|
171803
171892
|
if (stdioConfig.args) {
|
|
171804
171893
|
stdioConfig.args = stdioConfig.args.map((arg) => resolveValue(arg));
|
|
171805
171894
|
}
|
|
171895
|
+
if (stdioConfig.cwd) {
|
|
171896
|
+
stdioConfig.cwd = resolvePath(plugin.path, resolveValue(stdioConfig.cwd));
|
|
171897
|
+
}
|
|
171806
171898
|
const resolvedEnv = {
|
|
171807
171899
|
CLAUDE_PLUGIN_ROOT: plugin.path,
|
|
171808
171900
|
CLAUDE_PLUGIN_DATA: plugin.dataPath ?? getPluginDataDir(plugin.source),
|
|
@@ -172367,160 +172459,6 @@ var init_agentMemorySnapshot = __esm(() => {
|
|
|
172367
172459
|
}));
|
|
172368
172460
|
});
|
|
172369
172461
|
|
|
172370
|
-
// src/capabilities/tools/AgentTool/built-in/claudeCodeGuideAgent.ts
|
|
172371
|
-
function getClaudeCodeGuideBasePrompt() {
|
|
172372
|
-
const localSearchHint = hasEmbeddedSearchTools() ? `${FILE_READ_TOOL_NAME}, \`find\`, and \`grep\`` : `${FILE_READ_TOOL_NAME}, ${GLOB_TOOL_NAME}, and ${GREP_TOOL_NAME}`;
|
|
172373
|
-
return `You are the Claude guide agent. Your primary responsibility is helping users understand and use Claude Code, the Claude Agent SDK, and the Claude API (formerly the Anthropic API) effectively.
|
|
172374
|
-
|
|
172375
|
-
**Your expertise spans three domains:**
|
|
172376
|
-
|
|
172377
|
-
1. **Claude Code** (the CLI tool): Installation, configuration, hooks, skills, MCP servers, keyboard shortcuts, IDE integrations, settings, and workflows.
|
|
172378
|
-
|
|
172379
|
-
2. **Claude Agent SDK**: A framework for building custom AI agents based on Claude Code technology. Available for Node.js/TypeScript and Python.
|
|
172380
|
-
|
|
172381
|
-
3. **Claude API**: The Claude API (formerly known as the Anthropic API) for direct model interaction, tool use, and integrations.
|
|
172382
|
-
|
|
172383
|
-
**Documentation sources:**
|
|
172384
|
-
|
|
172385
|
-
- **Claude Code docs** (${CLAUDE_CODE_DOCS_MAP_URL}): Fetch this for questions about the Claude Code CLI tool, including:
|
|
172386
|
-
- Installation, setup, and getting started
|
|
172387
|
-
- Hooks (pre/post command execution)
|
|
172388
|
-
- Custom skills
|
|
172389
|
-
- MCP server configuration
|
|
172390
|
-
- IDE integrations (VS Code, JetBrains)
|
|
172391
|
-
- Settings files and configuration
|
|
172392
|
-
- Keyboard shortcuts and hotkeys
|
|
172393
|
-
- Subagents and plugins
|
|
172394
|
-
- Sandboxing and security
|
|
172395
|
-
|
|
172396
|
-
- **Claude Agent SDK docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about building agents with the SDK, including:
|
|
172397
|
-
- SDK overview and getting started (Python and TypeScript)
|
|
172398
|
-
- Agent configuration + custom tools
|
|
172399
|
-
- Session management and permissions
|
|
172400
|
-
- MCP integration in agents
|
|
172401
|
-
- Hosting and deployment
|
|
172402
|
-
- Cost tracking and context management
|
|
172403
|
-
Note: Agent SDK docs are part of the Claude API documentation at the same URL.
|
|
172404
|
-
|
|
172405
|
-
- **Claude API docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about the Claude API (formerly the Anthropic API), including:
|
|
172406
|
-
- Messages API and streaming
|
|
172407
|
-
- Tool use (function calling) and Anthropic-defined tools (computer use, code execution, web search, text editor, bash, programmatic tool calling, tool search tool, context editing, Files API, structured outputs)
|
|
172408
|
-
- Vision, PDF support, and citations
|
|
172409
|
-
- Extended thinking and structured outputs
|
|
172410
|
-
- MCP connector for remote MCP servers
|
|
172411
|
-
- Cloud provider integrations (Bedrock, Vertex AI, Foundry)
|
|
172412
|
-
|
|
172413
|
-
**Approach:**
|
|
172414
|
-
1. Determine which domain the user's question falls into
|
|
172415
|
-
2. Use ${WEB_FETCH_TOOL_NAME} to fetch the appropriate docs map
|
|
172416
|
-
3. Identify the most relevant documentation URLs from the map
|
|
172417
|
-
4. Fetch the specific documentation pages
|
|
172418
|
-
5. Provide clear, actionable guidance based on official documentation
|
|
172419
|
-
6. Use ${WEB_SEARCH_TOOL_NAME} if docs don't cover the topic
|
|
172420
|
-
7. Reference local project files (CLAUDE.md, .claude/ directory) when relevant using ${localSearchHint}
|
|
172421
|
-
|
|
172422
|
-
**Guidelines:**
|
|
172423
|
-
- Always prioritize official documentation over assumptions
|
|
172424
|
-
- Keep responses concise and actionable
|
|
172425
|
-
- Include specific examples or code snippets when helpful
|
|
172426
|
-
- Reference exact documentation URLs in your responses
|
|
172427
|
-
- Help users discover features by proactively suggesting related commands, shortcuts, or capabilities
|
|
172428
|
-
|
|
172429
|
-
Complete the user's request by providing accurate, documentation-based guidance.`;
|
|
172430
|
-
}
|
|
172431
|
-
function getFeedbackGuideline() {
|
|
172432
|
-
if (isUsing3PServices()) {
|
|
172433
|
-
return `- When you cannot find an answer or the feature doesn't exist, direct the user to ${"report the issue at https://github.com/anthropics/claude-code/issues"}`;
|
|
172434
|
-
}
|
|
172435
|
-
return "- When you cannot find an answer or the feature doesn't exist, direct the user to use /feedback to report a feature request or bug";
|
|
172436
|
-
}
|
|
172437
|
-
var CLAUDE_CODE_DOCS_MAP_URL = "https://code.claude.com/docs/en/claude_code_docs_map.md", CDP_DOCS_MAP_URL = "https://platform.claude.com/llms.txt", CLAUDE_CODE_GUIDE_AGENT_TYPE = "claude-code-guide", CLAUDE_CODE_GUIDE_AGENT;
|
|
172438
|
-
var init_claudeCodeGuideAgent = __esm(() => {
|
|
172439
|
-
init_auth();
|
|
172440
|
-
init_embeddedTools();
|
|
172441
|
-
init_settings2();
|
|
172442
|
-
init_slowOperations();
|
|
172443
|
-
CLAUDE_CODE_GUIDE_AGENT = {
|
|
172444
|
-
agentType: CLAUDE_CODE_GUIDE_AGENT_TYPE,
|
|
172445
|
-
whenToUse: `Use this agent when the user asks questions ("Can Claude...", "Does Claude...", "How do I...") about: (1) Claude Code (the CLI tool) - features, hooks, slash commands, MCP servers, settings, IDE integrations, keyboard shortcuts; (2) Claude Agent SDK - building custom agents; (3) Claude API (formerly Anthropic API) - API usage, tool use, Anthropic SDK usage. **IMPORTANT:** Before spawning a new agent, check if there is already a running or recently completed claude-code-guide agent that you can continue via ${SEND_MESSAGE_TOOL_NAME}.`,
|
|
172446
|
-
tools: hasEmbeddedSearchTools() ? [
|
|
172447
|
-
BASH_TOOL_NAME,
|
|
172448
|
-
FILE_READ_TOOL_NAME,
|
|
172449
|
-
WEB_FETCH_TOOL_NAME,
|
|
172450
|
-
WEB_SEARCH_TOOL_NAME
|
|
172451
|
-
] : [
|
|
172452
|
-
GLOB_TOOL_NAME,
|
|
172453
|
-
GREP_TOOL_NAME,
|
|
172454
|
-
FILE_READ_TOOL_NAME,
|
|
172455
|
-
WEB_FETCH_TOOL_NAME,
|
|
172456
|
-
WEB_SEARCH_TOOL_NAME
|
|
172457
|
-
],
|
|
172458
|
-
source: "built-in",
|
|
172459
|
-
baseDir: "built-in",
|
|
172460
|
-
model: "haiku",
|
|
172461
|
-
permissionMode: "dontAsk",
|
|
172462
|
-
getSystemPrompt({ toolUseContext }) {
|
|
172463
|
-
const commands = toolUseContext.options.commands;
|
|
172464
|
-
const contextSections = [];
|
|
172465
|
-
const customCommands = commands.filter((cmd) => cmd.type === "prompt");
|
|
172466
|
-
if (customCommands.length > 0) {
|
|
172467
|
-
const commandList = customCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
|
|
172468
|
-
`);
|
|
172469
|
-
contextSections.push(`**Available custom skills in this project:**
|
|
172470
|
-
${commandList}`);
|
|
172471
|
-
}
|
|
172472
|
-
const customAgents = toolUseContext.options.agentDefinitions.activeAgents.filter((a) => a.source !== "built-in");
|
|
172473
|
-
if (customAgents.length > 0) {
|
|
172474
|
-
const agentList = customAgents.map((a) => `- ${a.agentType}: ${a.whenToUse}`).join(`
|
|
172475
|
-
`);
|
|
172476
|
-
contextSections.push(`**Available custom agents configured:**
|
|
172477
|
-
${agentList}`);
|
|
172478
|
-
}
|
|
172479
|
-
const mcpClients = toolUseContext.options.mcpClients;
|
|
172480
|
-
if (mcpClients && mcpClients.length > 0) {
|
|
172481
|
-
const mcpList = mcpClients.map((client) => `- ${client.name}`).join(`
|
|
172482
|
-
`);
|
|
172483
|
-
contextSections.push(`**Configured MCP servers:**
|
|
172484
|
-
${mcpList}`);
|
|
172485
|
-
}
|
|
172486
|
-
const pluginCommands = commands.filter((cmd) => cmd.type === "prompt" && cmd.source === "plugin");
|
|
172487
|
-
if (pluginCommands.length > 0) {
|
|
172488
|
-
const pluginList = pluginCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
|
|
172489
|
-
`);
|
|
172490
|
-
contextSections.push(`**Available plugin skills:**
|
|
172491
|
-
${pluginList}`);
|
|
172492
|
-
}
|
|
172493
|
-
const settings = getSettings_DEPRECATED();
|
|
172494
|
-
if (Object.keys(settings).length > 0) {
|
|
172495
|
-
const settingsJson = jsonStringify(settings, null, 2);
|
|
172496
|
-
contextSections.push(`**User's settings.json:**
|
|
172497
|
-
\`\`\`json
|
|
172498
|
-
${settingsJson}
|
|
172499
|
-
\`\`\``);
|
|
172500
|
-
}
|
|
172501
|
-
const feedbackGuideline = getFeedbackGuideline();
|
|
172502
|
-
const basePromptWithFeedback = `${getClaudeCodeGuideBasePrompt()}
|
|
172503
|
-
${feedbackGuideline}`;
|
|
172504
|
-
if (contextSections.length > 0) {
|
|
172505
|
-
return `${basePromptWithFeedback}
|
|
172506
|
-
|
|
172507
|
-
---
|
|
172508
|
-
|
|
172509
|
-
# User's Current Configuration
|
|
172510
|
-
|
|
172511
|
-
The user has the following custom setup in their environment:
|
|
172512
|
-
|
|
172513
|
-
${contextSections.join(`
|
|
172514
|
-
|
|
172515
|
-
`)}
|
|
172516
|
-
|
|
172517
|
-
When answering questions, consider these configured features and proactively suggest them when relevant.`;
|
|
172518
|
-
}
|
|
172519
|
-
return basePromptWithFeedback;
|
|
172520
|
-
}
|
|
172521
|
-
};
|
|
172522
|
-
});
|
|
172523
|
-
|
|
172524
172462
|
// src/capabilities/tools/AgentTool/built-in/exploreAgent.ts
|
|
172525
172463
|
function getExploreSystemPrompt() {
|
|
172526
172464
|
const embedded = hasEmbeddedSearchTools();
|
|
@@ -172995,10 +172933,6 @@ function getBuiltInAgents() {
|
|
|
172995
172933
|
if (areExplorePlanAgentsEnabled()) {
|
|
172996
172934
|
agents.push(EXPLORE_AGENT, PLAN_AGENT);
|
|
172997
172935
|
}
|
|
172998
|
-
const isNonSdkEntrypoint = resolveEnvVar("ENTRYPOINT") !== "sdk-ts" && resolveEnvVar("ENTRYPOINT") !== "sdk-py" && resolveEnvVar("ENTRYPOINT") !== "sdk-cli";
|
|
172999
|
-
if (isNonSdkEntrypoint) {
|
|
173000
|
-
agents.push(CLAUDE_CODE_GUIDE_AGENT);
|
|
173001
|
-
}
|
|
173002
172936
|
if (false) {}
|
|
173003
172937
|
return agents;
|
|
173004
172938
|
}
|
|
@@ -173008,7 +172942,6 @@ function resolveSdkAgents(hostAgents) {
|
|
|
173008
172942
|
var init_builtInAgents = __esm(() => {
|
|
173009
172943
|
init_state();
|
|
173010
172944
|
init_envUtils();
|
|
173011
|
-
init_claudeCodeGuideAgent();
|
|
173012
172945
|
init_exploreAgent();
|
|
173013
172946
|
init_generalPurposeAgent();
|
|
173014
172947
|
init_planAgent();
|
|
@@ -176816,6 +176749,40 @@ var init_agentSummary = __esm(() => {
|
|
|
176816
176749
|
init_sessionStorage();
|
|
176817
176750
|
});
|
|
176818
176751
|
|
|
176752
|
+
// src/session/bridge/sessionIdCompat.ts
|
|
176753
|
+
function toCompatSessionId(id) {
|
|
176754
|
+
if (!id.startsWith("cse_"))
|
|
176755
|
+
return id;
|
|
176756
|
+
if (_isCseShimEnabled && !_isCseShimEnabled())
|
|
176757
|
+
return id;
|
|
176758
|
+
return "session_" + id.slice("cse_".length);
|
|
176759
|
+
}
|
|
176760
|
+
var _isCseShimEnabled;
|
|
176761
|
+
|
|
176762
|
+
// src/constants/product.ts
|
|
176763
|
+
function isRemoteSessionStaging(sessionId, ingressUrl) {
|
|
176764
|
+
return sessionId?.includes("_staging_") === true || ingressUrl?.includes("staging") === true;
|
|
176765
|
+
}
|
|
176766
|
+
function isRemoteSessionLocal(sessionId, ingressUrl) {
|
|
176767
|
+
return sessionId?.includes("_local_") === true || ingressUrl?.includes("localhost") === true;
|
|
176768
|
+
}
|
|
176769
|
+
function getClaudeAiBaseUrl(sessionId, ingressUrl) {
|
|
176770
|
+
if (isRemoteSessionLocal(sessionId, ingressUrl)) {
|
|
176771
|
+
return CLAUDE_AI_LOCAL_BASE_URL;
|
|
176772
|
+
}
|
|
176773
|
+
if (isRemoteSessionStaging(sessionId, ingressUrl)) {
|
|
176774
|
+
return CLAUDE_AI_STAGING_BASE_URL;
|
|
176775
|
+
}
|
|
176776
|
+
return CLAUDE_AI_BASE_URL;
|
|
176777
|
+
}
|
|
176778
|
+
function getRemoteSessionUrl(sessionId, ingressUrl) {
|
|
176779
|
+
;
|
|
176780
|
+
const compatId = toCompatSessionId(sessionId);
|
|
176781
|
+
const baseUrl = getClaudeAiBaseUrl(compatId, ingressUrl);
|
|
176782
|
+
return `${baseUrl}/code/${compatId}`;
|
|
176783
|
+
}
|
|
176784
|
+
var TELEMETRY_SERVICE_NAME = "claude-code", CLAUDE_AI_BASE_URL = "https://claude.ai", CLAUDE_AI_STAGING_BASE_URL = "https://claude-ai.staging.ant.dev", CLAUDE_AI_LOCAL_BASE_URL = "http://localhost:4000";
|
|
176785
|
+
|
|
176819
176786
|
// src/session/tasks.ts
|
|
176820
176787
|
import { join as join44 } from "path";
|
|
176821
176788
|
function notifyTasksUpdated() {
|
|
@@ -177483,7 +177450,6 @@ NOTE: You just closed out 3+ tasks and none of them was a verification step. Bef
|
|
|
177483
177450
|
}
|
|
177484
177451
|
});
|
|
177485
177452
|
});
|
|
177486
|
-
|
|
177487
177453
|
// src/providers/anthropic/policyLimits/types.ts
|
|
177488
177454
|
var PolicyLimitsResponseSchema;
|
|
177489
177455
|
var init_types8 = __esm(() => {
|
|
@@ -179230,7 +179196,8 @@ var init_coreSchemas = __esm(() => {
|
|
|
179230
179196
|
type: literal("stdio").optional(),
|
|
179231
179197
|
command: string2(),
|
|
179232
179198
|
args: array(string2()).optional(),
|
|
179233
|
-
env: record(string2(), string2()).optional()
|
|
179199
|
+
env: record(string2(), string2()).optional(),
|
|
179200
|
+
cwd: string2().optional()
|
|
179234
179201
|
}));
|
|
179235
179202
|
McpSSEServerConfigSchema2 = lazySchema(() => object2({
|
|
179236
179203
|
type: literal("sse"),
|
|
@@ -185271,7 +185238,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
185271
185238
|
if (validator && !validator(args)) {
|
|
185272
185239
|
return {
|
|
185273
185240
|
behavior: "ask",
|
|
185274
|
-
message: `${command} with flags requires manual approval to ensure path safety. For security,
|
|
185241
|
+
message: `${command} with flags requires manual approval to ensure path safety. For security, ${getBranding().productName} cannot automatically validate ${command} commands that use flags, as some flags like --target-directory=PATH can bypass path validation.`,
|
|
185275
185242
|
decisionReason: {
|
|
185276
185243
|
type: "other",
|
|
185277
185244
|
reason: `${command} command with flags requires manual approval`
|
|
@@ -185281,7 +185248,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
185281
185248
|
if (compoundCommandHasCd && operationType !== "read") {
|
|
185282
185249
|
return {
|
|
185283
185250
|
behavior: "ask",
|
|
185284
|
-
message: `Commands that change directories and perform write operations require explicit approval to ensure paths are evaluated correctly. For security,
|
|
185251
|
+
message: `Commands that change directories and perform write operations require explicit approval to ensure paths are evaluated correctly. For security, ${getBranding().productName} cannot automatically determine the final working directory when 'cd' is used in compound commands.`,
|
|
185285
185252
|
decisionReason: {
|
|
185286
185253
|
type: "other",
|
|
185287
185254
|
reason: "Compound command contains cd with write operation - manual approval required to prevent path resolution bypass"
|
|
@@ -185293,7 +185260,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
185293
185260
|
if (!allowed) {
|
|
185294
185261
|
const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
|
|
185295
185262
|
const dirListStr = formatDirectoryList(workingDirs);
|
|
185296
|
-
const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : `${command} in '${resolvedPath}' was blocked. For security,
|
|
185263
|
+
const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : `${command} in '${resolvedPath}' was blocked. For security, ${getBranding().productName} may only ${ACTION_VERBS[command]} the allowed working directories for this session: ${dirListStr}.`;
|
|
185297
185264
|
if (decisionReason?.type === "rule") {
|
|
185298
185265
|
return {
|
|
185299
185266
|
behavior: "deny",
|
|
@@ -185418,7 +185385,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
|
|
|
185418
185385
|
if (compoundCommandHasCd && redirections.length > 0) {
|
|
185419
185386
|
return {
|
|
185420
185387
|
behavior: "ask",
|
|
185421
|
-
message: `Commands that change directories and write via output redirection require explicit approval to ensure paths are evaluated correctly. For security,
|
|
185388
|
+
message: `Commands that change directories and write via output redirection require explicit approval to ensure paths are evaluated correctly. For security, ${getBranding().productName} cannot automatically determine the final working directory when 'cd' is used in compound commands.`,
|
|
185422
185389
|
decisionReason: {
|
|
185423
185390
|
type: "other",
|
|
185424
185391
|
reason: "Compound command contains cd with output redirection - manual approval required to prevent path resolution bypass"
|
|
@@ -185433,7 +185400,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
|
|
|
185433
185400
|
if (!allowed) {
|
|
185434
185401
|
const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
|
|
185435
185402
|
const dirListStr = formatDirectoryList(workingDirs);
|
|
185436
|
-
const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : decisionReason?.type === "rule" ? `Output redirection to '${resolvedPath}' was blocked by a deny rule.` : `Output redirection to '${resolvedPath}' was blocked. For security,
|
|
185403
|
+
const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : decisionReason?.type === "rule" ? `Output redirection to '${resolvedPath}' was blocked by a deny rule.` : `Output redirection to '${resolvedPath}' was blocked. For security, ${getBranding().productName} may only write to files in the allowed working directories for this session: ${dirListStr}.`;
|
|
185437
185404
|
if (decisionReason?.type === "rule") {
|
|
185438
185405
|
return {
|
|
185439
185406
|
behavior: "deny",
|
|
@@ -185640,6 +185607,7 @@ var init_pathValidation2 = __esm(() => {
|
|
|
185640
185607
|
init_pathValidation();
|
|
185641
185608
|
init_bashPermissions();
|
|
185642
185609
|
init_sedValidation();
|
|
185610
|
+
init_branding();
|
|
185643
185611
|
PATH_EXTRACTORS = {
|
|
185644
185612
|
cd: (args) => args.length === 0 ? [homedir16()] : [args.join(" ")],
|
|
185645
185613
|
ls: (args) => {
|
|
@@ -193304,12 +193272,13 @@ async function loadLspServersFromManifest(declaration, pluginPath, pluginName, e
|
|
|
193304
193272
|
}
|
|
193305
193273
|
function resolvePluginLspEnvironment(config, plugin, userConfig, _errors) {
|
|
193306
193274
|
const allMissingVars = [];
|
|
193275
|
+
const envLookup = plugin.env ? { ...process.env, ...plugin.env } : process.env;
|
|
193307
193276
|
const resolveValue = (value) => {
|
|
193308
193277
|
let resolved = substitutePluginVariables(value, plugin);
|
|
193309
193278
|
if (userConfig) {
|
|
193310
193279
|
resolved = substituteUserConfigVariables(resolved, userConfig);
|
|
193311
193280
|
}
|
|
193312
|
-
const { expanded, missingVars } = expandEnvVarsInString(resolved);
|
|
193281
|
+
const { expanded, missingVars } = expandEnvVarsInString(resolved, envLookup);
|
|
193313
193282
|
allMissingVars.push(...missingVars);
|
|
193314
193283
|
return expanded;
|
|
193315
193284
|
};
|
|
@@ -198138,7 +198107,7 @@ function validateInputForSettingsFileEdit(filePath, originalContent, getUpdatedC
|
|
|
198138
198107
|
if (!afterValidation.isValid) {
|
|
198139
198108
|
return {
|
|
198140
198109
|
result: false,
|
|
198141
|
-
message: `
|
|
198110
|
+
message: `settings.json validation failed after edit:
|
|
198142
198111
|
${afterValidation.error}
|
|
198143
198112
|
|
|
198144
198113
|
Full schema:
|
|
@@ -200422,7 +200391,7 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
200422
200391
|
logForDebugging(`Looking for shell config file: ${configFile}`);
|
|
200423
200392
|
const configFileExists = await pathExists(configFile);
|
|
200424
200393
|
if (!configFileExists) {
|
|
200425
|
-
logForDebugging(`Shell config file not found: ${configFile}, creating snapshot with
|
|
200394
|
+
logForDebugging(`Shell config file not found: ${configFile}, creating snapshot with ${getBranding().productName} defaults only`);
|
|
200426
200395
|
}
|
|
200427
200396
|
const timestamp = Date.now();
|
|
200428
200397
|
const randomId = Math.random().toString(36).substring(2, 8);
|
|
@@ -200535,6 +200504,7 @@ var init_ShellSnapshot = __esm(() => {
|
|
|
200535
200504
|
init_subprocessEnv();
|
|
200536
200505
|
init_shellQuote();
|
|
200537
200506
|
init_state2();
|
|
200507
|
+
init_branding();
|
|
200538
200508
|
VCS_DIRECTORIES_TO_EXCLUDE2 = [
|
|
200539
200509
|
".git",
|
|
200540
200510
|
".svn",
|
|
@@ -211345,6 +211315,7 @@ ${content}`;
|
|
|
211345
211315
|
source: sourceName,
|
|
211346
211316
|
dataPath: pluginDataPath
|
|
211347
211317
|
});
|
|
211318
|
+
finalContent = substitutePluginContentVariables(finalContent);
|
|
211348
211319
|
if (pluginManifest.userConfig) {
|
|
211349
211320
|
finalContent = substituteUserConfigInContent(finalContent, loadPluginOptions(sourceName), pluginManifest.userConfig);
|
|
211350
211321
|
}
|
|
@@ -216933,7 +216904,7 @@ async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl,
|
|
|
216933
216904
|
}
|
|
216934
216905
|
if (code) {
|
|
216935
216906
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
216936
|
-
res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to
|
|
216907
|
+
res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to ${import_xss2.default(getBranding().productName)}.</p>`);
|
|
216937
216908
|
cleanup();
|
|
216938
216909
|
resolveOnce(code);
|
|
216939
216910
|
}
|
|
@@ -217099,7 +217070,7 @@ class ClaudeAuthProvider {
|
|
|
217099
217070
|
}
|
|
217100
217071
|
get clientMetadata() {
|
|
217101
217072
|
const metadata = {
|
|
217102
|
-
client_name:
|
|
217073
|
+
client_name: `${getBranding().productName} (${this.serverName})`,
|
|
217103
217074
|
redirect_uris: [this.redirectUri],
|
|
217104
217075
|
grant_types: ["authorization_code", "refresh_token"],
|
|
217105
217076
|
response_types: ["code"],
|
|
@@ -217118,7 +217089,7 @@ class ClaudeAuthProvider {
|
|
|
217118
217089
|
logMCPDebug(this.serverName, `Using CIMD URL from env: ${override}`);
|
|
217119
217090
|
return override;
|
|
217120
217091
|
}
|
|
217121
|
-
return
|
|
217092
|
+
return getBranding().mcpOAuthClientMetadataUrl;
|
|
217122
217093
|
}
|
|
217123
217094
|
setMetadata(metadata) {
|
|
217124
217095
|
this._metadata = metadata;
|
|
@@ -217686,7 +217657,7 @@ var init_auth6 = __esm(() => {
|
|
|
217686
217657
|
init_auth5();
|
|
217687
217658
|
init_errors8();
|
|
217688
217659
|
init_auth4();
|
|
217689
|
-
|
|
217660
|
+
init_branding();
|
|
217690
217661
|
init_browser();
|
|
217691
217662
|
init_envUtils();
|
|
217692
217663
|
init_errors5();
|
|
@@ -222586,7 +222557,7 @@ function isIncludedMcpTool(tool) {
|
|
|
222586
222557
|
return !tool.name.startsWith("mcp__ide__") || ALLOWED_IDE_TOOLS.includes(tool.name);
|
|
222587
222558
|
}
|
|
222588
222559
|
function getServerCacheKey(name, serverRef) {
|
|
222589
|
-
return `${name}-${jsonStringify(serverRef)}`;
|
|
222560
|
+
return `${name}-${jsonStringify(serverRef)}-${jsonStringify(getBranding())}`;
|
|
222590
222561
|
}
|
|
222591
222562
|
async function clearServerCache(name, serverRef) {
|
|
222592
222563
|
const key = getServerCacheKey(name, serverRef);
|
|
@@ -223201,6 +223172,7 @@ var init_client5 = __esm(() => {
|
|
|
223201
223172
|
ALLOWED_IDE_TOOLS = ["mcp__ide__executeCode", "mcp__ide__getDiagnostics"];
|
|
223202
223173
|
connectToServer = memoize_default(async (name, serverRef, serverStats) => {
|
|
223203
223174
|
const connectStartTime = Date.now();
|
|
223175
|
+
const cacheKey = getServerCacheKey(name, serverRef);
|
|
223204
223176
|
let inProcessServer;
|
|
223205
223177
|
try {
|
|
223206
223178
|
let transport;
|
|
@@ -223399,6 +223371,7 @@ var init_client5 = __esm(() => {
|
|
|
223399
223371
|
...subprocessEnv(),
|
|
223400
223372
|
...serverRef.env
|
|
223401
223373
|
},
|
|
223374
|
+
...serverRef.cwd ? { cwd: serverRef.cwd } : {},
|
|
223402
223375
|
stderr: "pipe"
|
|
223403
223376
|
});
|
|
223404
223377
|
} else {
|
|
@@ -223420,10 +223393,8 @@ var init_client5 = __esm(() => {
|
|
|
223420
223393
|
}
|
|
223421
223394
|
}
|
|
223422
223395
|
const client = new Client({
|
|
223423
|
-
name: TELEMETRY_SERVICE_NAME,
|
|
223424
223396
|
...getMcpClientInfo(),
|
|
223425
|
-
version: "99.0.0"
|
|
223426
|
-
websiteUrl: PRODUCT_URL
|
|
223397
|
+
version: "99.0.0"
|
|
223427
223398
|
}, {
|
|
223428
223399
|
capabilities: {
|
|
223429
223400
|
roots: {},
|
|
@@ -223633,12 +223604,11 @@ var init_client5 = __esm(() => {
|
|
|
223633
223604
|
const uptime = Date.now() - connectionStartTime;
|
|
223634
223605
|
const transportType = serverRef.type ?? "unknown";
|
|
223635
223606
|
logMCPDebug(name, `${transportType.toUpperCase()} connection closed after ${Math.floor(uptime / 1000)}s (${hasErrorOccurred ? "with errors" : "cleanly"})`);
|
|
223636
|
-
const key = getServerCacheKey(name, serverRef);
|
|
223637
223607
|
fetchToolsForClient.cache.delete(name);
|
|
223638
223608
|
fetchResourcesForClient.cache.delete(name);
|
|
223639
223609
|
fetchCommandsForClient.cache.delete(name);
|
|
223640
223610
|
if (false) {}
|
|
223641
|
-
connectToServer.cache.delete(
|
|
223611
|
+
connectToServer.cache.delete(cacheKey);
|
|
223642
223612
|
logMCPDebug(name, `Cleared connection cache for reconnection`);
|
|
223643
223613
|
if (originalOnclose) {
|
|
223644
223614
|
originalOnclose();
|
|
@@ -224246,12 +224216,11 @@ async function* runPostToolUseFailureHooks(toolUseContext, tool, toolUseID, mess
|
|
|
224246
224216
|
}
|
|
224247
224217
|
async function resolveHookPermissionDecision(hookPermissionResult, tool, input, toolUseContext, canUseTool, assistantMessage, toolUseID) {
|
|
224248
224218
|
const requiresInteraction = tool.requiresUserInteraction?.();
|
|
224249
|
-
const requireCanUseTool = toolUseContext.requireCanUseTool;
|
|
224250
224219
|
if (hookPermissionResult?.behavior === "allow") {
|
|
224251
224220
|
const hookInput = hookPermissionResult.updatedInput ?? input;
|
|
224252
224221
|
const interactionSatisfied = requiresInteraction && hookPermissionResult.updatedInput !== undefined;
|
|
224253
|
-
if (
|
|
224254
|
-
logForDebugging(`Hook approved tool use for ${tool.name},
|
|
224222
|
+
if (!interactionSatisfied) {
|
|
224223
|
+
logForDebugging(`Hook approved tool use for ${tool.name}, deferring final decision to canUseTool`);
|
|
224255
224224
|
return {
|
|
224256
224225
|
decision: await consumePermissionPreDecision(toolUseContext, toolUseID, hookInput, () => canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID)),
|
|
224257
224226
|
input: hookInput
|
|
@@ -224259,7 +224228,7 @@ async function resolveHookPermissionDecision(hookPermissionResult, tool, input,
|
|
|
224259
224228
|
}
|
|
224260
224229
|
const ruleCheck = await checkRuleBasedPermissions(tool, hookInput, toolUseContext);
|
|
224261
224230
|
if (ruleCheck === null) {
|
|
224262
|
-
logForDebugging(
|
|
224231
|
+
logForDebugging(`Hook satisfied user interaction for ${tool.name} via updatedInput`);
|
|
224263
224232
|
return { decision: hookPermissionResult, input: hookInput };
|
|
224264
224233
|
}
|
|
224265
224234
|
if (ruleCheck.behavior === "deny") {
|
|
@@ -227327,7 +227296,7 @@ function getAnthropicEnvMetadata() {
|
|
|
227327
227296
|
function getBuildAgeMinutes() {
|
|
227328
227297
|
if (false)
|
|
227329
227298
|
;
|
|
227330
|
-
const buildTime = new Date("2026-10-
|
|
227299
|
+
const buildTime = new Date("2026-10-20T14:00:47.620Z").getTime();
|
|
227331
227300
|
if (isNaN(buildTime))
|
|
227332
227301
|
return;
|
|
227333
227302
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -231551,7 +231520,7 @@ async function getAttachments(input, toolUseContext, ideSelection, queuedCommand
|
|
|
231551
231520
|
maybe("changed_files", () => getChangedFiles(context)),
|
|
231552
231521
|
maybe("nested_memory", () => getNestedMemoryAttachments(context)),
|
|
231553
231522
|
maybe("dynamic_skill", () => getDynamicSkillAttachments(context)),
|
|
231554
|
-
maybe("skill_listing", () => getSkillListingAttachments(context)),
|
|
231523
|
+
...isSkillListingEnabled() ? [maybe("skill_listing", () => getSkillListingAttachments(context))] : [],
|
|
231555
231524
|
maybe("plan_mode", () => getPlanModeAttachments(messages, toolUseContext)),
|
|
231556
231525
|
maybe("plan_mode_exit", () => getPlanModeExitAttachment(toolUseContext)),
|
|
231557
231526
|
...[],
|
|
@@ -232380,6 +232349,9 @@ async function getDynamicSkillAttachments(toolUseContext) {
|
|
|
232380
232349
|
}
|
|
232381
232350
|
return attachments;
|
|
232382
232351
|
}
|
|
232352
|
+
function isSkillListingEnabled() {
|
|
232353
|
+
return !isEnvDefinedFalsy(resolveEnvVar("SKILL_LISTING"));
|
|
232354
|
+
}
|
|
232383
232355
|
async function getSkillListingAttachments(toolUseContext) {
|
|
232384
232356
|
if (false) {}
|
|
232385
232357
|
if (!toolUseContext.options.tools.some((t) => toolMatchesName2(t, SKILL_TOOL_NAME))) {
|
|
@@ -241142,7 +241114,7 @@ function AUTO_REJECT_MESSAGE(toolName) {
|
|
|
241142
241114
|
return `Permission to use ${toolName} has been denied. ${DENIAL_WORKAROUND_GUIDANCE}`;
|
|
241143
241115
|
}
|
|
241144
241116
|
function DONT_ASK_REJECT_MESSAGE(toolName) {
|
|
241145
|
-
return `Permission to use ${toolName} has been denied because
|
|
241117
|
+
return `Permission to use ${toolName} has been denied because ${getBranding().productName} is running in don't ask mode. ${DENIAL_WORKAROUND_GUIDANCE}`;
|
|
241146
241118
|
}
|
|
241147
241119
|
function isSyntheticMessage(message) {
|
|
241148
241120
|
return message.type !== "progress" && message.type !== "attachment" && message.type !== "system" && Array.isArray(message.message.content) && message.message.content[0]?.type === "text" && SYNTHETIC_MESSAGES.has(message.message.content[0].text);
|
|
@@ -243899,6 +243871,7 @@ var init_messages4 = __esm(() => {
|
|
|
243899
243871
|
init_tasks();
|
|
243900
243872
|
init_toolSearch();
|
|
243901
243873
|
init_state2();
|
|
243874
|
+
init_branding();
|
|
243902
243875
|
DENIAL_WORKAROUND_GUIDANCE = `IMPORTANT: You *may* attempt to accomplish this action using other tools that might naturally be used to accomplish this goal, ` + `e.g. using head instead of cat. But you *should not* attempt to work around this denial in malicious ways, ` + `e.g. do not use your ability to run tests to execute non-test actions. ` + `You should only try to work around this restriction in reasonable ways that do not attempt to bypass the intent behind this denial. ` + `If you believe this capability is essential to complete the user's request, STOP and explain to the user ` + `what you were trying to do and why you need this permission. Let the user decide how to proceed.`;
|
|
243903
243876
|
SYNTHETIC_MESSAGES = new Set([
|
|
243904
243877
|
INTERRUPT_MESSAGE,
|
|
@@ -273255,10 +273228,11 @@ init_http2();
|
|
|
273255
273228
|
init_log2();
|
|
273256
273229
|
init_state2();
|
|
273257
273230
|
init_mcpOutputStorage();
|
|
273231
|
+
init_branding();
|
|
273258
273232
|
init_settings2();
|
|
273259
273233
|
class DomainBlockedError extends Error {
|
|
273260
273234
|
constructor(domain) {
|
|
273261
|
-
super(
|
|
273235
|
+
super(`${getBranding().productName} is unable to fetch from ${domain}`);
|
|
273262
273236
|
this.name = "DomainBlockedError";
|
|
273263
273237
|
}
|
|
273264
273238
|
}
|
|
@@ -278312,10 +278286,15 @@ function assertNoDependencyCycles(plugins) {
|
|
|
278312
278286
|
for (const plugin of plugins)
|
|
278313
278287
|
visit(plugin, []);
|
|
278314
278288
|
}
|
|
278289
|
+
var HOST_PROVIDED_ENVIRONMENT_NAMES = new Set([
|
|
278290
|
+
"CLAUDE_PLUGIN_ROOT",
|
|
278291
|
+
"CLAUDE_PLUGIN_DATA"
|
|
278292
|
+
]);
|
|
278315
278293
|
function collectEnvironmentNames(value, output) {
|
|
278316
278294
|
if (typeof value === "string") {
|
|
278317
278295
|
for (const match of value.matchAll(/\$\{([A-Z][A-Z0-9_]*)\}/g)) {
|
|
278318
|
-
|
|
278296
|
+
if (!HOST_PROVIDED_ENVIRONMENT_NAMES.has(match[1]))
|
|
278297
|
+
output.add(match[1]);
|
|
278319
278298
|
}
|
|
278320
278299
|
return;
|
|
278321
278300
|
}
|
|
@@ -278328,8 +278307,10 @@ function collectEnvironmentNames(value, output) {
|
|
|
278328
278307
|
return;
|
|
278329
278308
|
for (const [key, item] of Object.entries(value)) {
|
|
278330
278309
|
if (key === "env" && item && typeof item === "object" && !Array.isArray(item)) {
|
|
278331
|
-
for (const name of Object.keys(item))
|
|
278332
|
-
|
|
278310
|
+
for (const name of Object.keys(item)) {
|
|
278311
|
+
if (!HOST_PROVIDED_ENVIRONMENT_NAMES.has(name))
|
|
278312
|
+
output.add(name);
|
|
278313
|
+
}
|
|
278333
278314
|
}
|
|
278334
278315
|
collectEnvironmentNames(item, output);
|
|
278335
278316
|
}
|
|
@@ -278458,6 +278439,8 @@ async function stageResolvedPlugins(revision, inputs) {
|
|
|
278458
278439
|
plugin.source = input.id;
|
|
278459
278440
|
plugin.repository = input.id;
|
|
278460
278441
|
plugin.dataPath = dataPath;
|
|
278442
|
+
if (input.env && Object.keys(input.env).length > 0)
|
|
278443
|
+
plugin.env = { ...input.env };
|
|
278461
278444
|
plugin.manifest = { ...plugin.manifest, userConfig: undefined };
|
|
278462
278445
|
loadedPlugins.push(plugin);
|
|
278463
278446
|
diagnostics.push(...errors.map((error) => diagnosticFromPluginError(input.id, error)));
|
|
@@ -278592,15 +278575,17 @@ async function stageManagedPluginSnapshot(snapshot, appliedState) {
|
|
|
278592
278575
|
try {
|
|
278593
278576
|
for (const plugin of snapshot.plugins)
|
|
278594
278577
|
validateManagedPlugin(plugin);
|
|
278578
|
+
const contentVariables = validateContentVariables(snapshot.contentVariables);
|
|
278595
278579
|
const bundle = await stageResolvedPlugins(snapshot.revision, snapshot.plugins.map((plugin) => ({
|
|
278596
278580
|
id: plugin.id,
|
|
278597
278581
|
path: plugin.source.path,
|
|
278598
278582
|
dataPath: plugin.dataPath,
|
|
278599
|
-
permissionGrant: plugin.permissionGrant
|
|
278583
|
+
permissionGrant: plugin.permissionGrant,
|
|
278584
|
+
env: plugin.env
|
|
278600
278585
|
})));
|
|
278601
278586
|
return {
|
|
278602
278587
|
status: "staged",
|
|
278603
|
-
bundle,
|
|
278588
|
+
bundle: { ...bundle, contentVariables },
|
|
278604
278589
|
result: {
|
|
278605
278590
|
status: "applied",
|
|
278606
278591
|
requestedRevision: snapshot.revision,
|
|
@@ -278630,6 +278615,20 @@ async function inspectPluginSnapshot(snapshot) {
|
|
|
278630
278615
|
return rejectResult(snapshot.revision, appliedState, error);
|
|
278631
278616
|
}
|
|
278632
278617
|
}
|
|
278618
|
+
var CONTENT_VARIABLE_NAME = /^[A-Z][A-Z0-9_]*$/;
|
|
278619
|
+
function validateContentVariables(variables) {
|
|
278620
|
+
if (!variables)
|
|
278621
|
+
return {};
|
|
278622
|
+
for (const [name, value] of Object.entries(variables)) {
|
|
278623
|
+
if (!CONTENT_VARIABLE_NAME.test(name)) {
|
|
278624
|
+
throw new Error(`Invalid plugin content variable name: ${name}`);
|
|
278625
|
+
}
|
|
278626
|
+
if (typeof value !== "string") {
|
|
278627
|
+
throw new Error(`Plugin content variable ${name} must be a string`);
|
|
278628
|
+
}
|
|
278629
|
+
}
|
|
278630
|
+
return Object.freeze({ ...variables });
|
|
278631
|
+
}
|
|
278633
278632
|
function validateManagedPlugin(plugin) {
|
|
278634
278633
|
if (plugin.source.type !== "local")
|
|
278635
278634
|
throw new Error(`Unsupported plugin source for ${plugin.id}`);
|
|
@@ -278842,7 +278841,8 @@ function optionsWithProviderRoutingEnv(options) {
|
|
|
278842
278841
|
const reasoningEffort = options.reasoningEffort;
|
|
278843
278842
|
const openaiResponses = options.providerSpecific?.openaiResponses;
|
|
278844
278843
|
const extraBody = extraBodyFromOptions(options);
|
|
278845
|
-
|
|
278844
|
+
const skillListing = options.skillListing;
|
|
278845
|
+
if (transport === undefined && reasoningEffort === undefined && openaiResponses === undefined && extraBody === undefined && skillListing === undefined) {
|
|
278846
278846
|
return options;
|
|
278847
278847
|
}
|
|
278848
278848
|
const mergedEnv = { ...options.env ?? {} };
|
|
@@ -278862,6 +278862,9 @@ function optionsWithProviderRoutingEnv(options) {
|
|
|
278862
278862
|
mergedEnv[ENV_VARS.EXTRA_BODY.primary] = rawExtraBody;
|
|
278863
278863
|
mergedEnv[QUERY_ENV_KEY_EXTRA_BODY] = rawExtraBody;
|
|
278864
278864
|
}
|
|
278865
|
+
if (typeof skillListing === "boolean") {
|
|
278866
|
+
mergedEnv[ENV_VARS.SKILL_LISTING.primary] = skillListing ? "1" : "0";
|
|
278867
|
+
}
|
|
278865
278868
|
return { ...options, env: mergedEnv };
|
|
278866
278869
|
}
|
|
278867
278870
|
function createQueryLike(generator, runtimeState, finalize) {
|
|
@@ -279038,7 +279041,6 @@ function runSdkQueryRuntime(params) {
|
|
|
279038
279041
|
const [clientTransport, serverTransport] = createLinkedTransportPair();
|
|
279039
279042
|
await inProcessServer.connect(serverTransport);
|
|
279040
279043
|
const client = new Client({
|
|
279041
|
-
name: "claude-code",
|
|
279042
279044
|
...getMcpClientInfo(),
|
|
279043
279045
|
version: "99.0.0"
|
|
279044
279046
|
}, {
|
|
@@ -279079,7 +279081,7 @@ function runSdkQueryRuntime(params) {
|
|
|
279079
279081
|
activePluginBundle = await stageStaticLocalPlugins(options.plugins, cwd);
|
|
279080
279082
|
}
|
|
279081
279083
|
if (activePluginBundle) {
|
|
279082
|
-
|
|
279084
|
+
setExplicitPluginRuntimeBundle(activePluginBundle);
|
|
279083
279085
|
registerHookCallbacks2(activePluginBundle.hooks);
|
|
279084
279086
|
}
|
|
279085
279087
|
const shellCapabilities = await initializeShellCapabilities();
|
|
@@ -279479,7 +279481,7 @@ class SessionRuntime {
|
|
|
279479
279481
|
this.projectContextIds.add(ctx.identity.sessionId);
|
|
279480
279482
|
await runWithQueryContext(ctx, async () => {
|
|
279481
279483
|
if (this.pluginBundle) {
|
|
279482
|
-
|
|
279484
|
+
setExplicitPluginRuntimeBundle(this.pluginBundle);
|
|
279483
279485
|
registerHookCallbacks2(this.pluginBundle.hooks);
|
|
279484
279486
|
}
|
|
279485
279487
|
if (this.baseOptions.hooks) {
|
|
@@ -280498,4 +280500,4 @@ export {
|
|
|
280498
280500
|
watchScheduledTasks
|
|
280499
280501
|
};
|
|
280500
280502
|
|
|
280501
|
-
//# debugId=
|
|
280503
|
+
//# debugId=7F28B624A121A3CF64756E2164756E21
|