@opencow-ai/opencow-agent-sdk 0.4.26 → 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/client.js CHANGED
@@ -19278,21 +19278,49 @@ var init_envVars = __esm(() => {
19278
19278
  });
19279
19279
 
19280
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
+ }
19281
19285
  function normalizeBrandName(value, fallback) {
19282
19286
  const normalized = value?.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
19283
19287
  return normalized ? normalized.slice(0, 80) : fallback;
19284
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
+ }
19285
19308
  function resolveBranding(options) {
19286
19309
  const productName = normalizeBrandName(options?.productName, DEFAULT_BRANDING.productName);
19310
+ const explicitSlug = options?.productSlug?.trim();
19287
19311
  return Object.freeze({
19288
19312
  productName,
19289
- assistantName: normalizeBrandName(options?.assistantName, productName)
19313
+ productSlug: toProductSlug(explicitSlug || productName),
19314
+ assistantName: normalizeBrandName(options?.assistantName, productName),
19315
+ ...optionalUrl("mcpOAuthClientMetadataUrl", options?.mcpOAuthClientMetadataUrl),
19316
+ ...validatedProductUrl(options?.productUrl)
19290
19317
  });
19291
19318
  }
19292
- var DEFAULT_BRANDING;
19319
+ var DEFAULT_BRANDING, PRODUCT_SLUG_FALLBACK = "app";
19293
19320
  var init_brandingConfig = __esm(() => {
19294
19321
  DEFAULT_BRANDING = Object.freeze({
19295
19322
  productName: "Agentic",
19323
+ productSlug: "agentic",
19296
19324
  assistantName: "Agentic"
19297
19325
  });
19298
19326
  });
@@ -19309,12 +19337,17 @@ function getAssistantIdentityPrompt() {
19309
19337
  return `You are ${getBranding().assistantName}, an agentic coding assistant.`;
19310
19338
  }
19311
19339
  function getMcpClientInfo() {
19312
- const { productName } = getBranding();
19340
+ const { productName, productSlug, productUrl } = getBranding();
19313
19341
  return {
19342
+ name: productSlug,
19314
19343
  title: `${productName} Coding Client`,
19315
- description: `${productName} agentic coding client`
19344
+ description: `${productName} agentic coding client`,
19345
+ ...productUrl ? { websiteUrl: productUrl } : {}
19316
19346
  };
19317
19347
  }
19348
+ function getProductUserAgentToken() {
19349
+ return getBranding().productSlug;
19350
+ }
19318
19351
  var brandingStorage;
19319
19352
  var init_branding = __esm(() => {
19320
19353
  init_brandingConfig();
@@ -35403,7 +35436,7 @@ function getOauthConfig() {
35403
35436
  }
35404
35437
  return config;
35405
35438
  }
35406
- 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, MCP_CLIENT_METADATA_URL = "https://claude.ai/oauth/claude-code-client-metadata", STAGING_OAUTH_CONFIG, ALLOWED_OAUTH_BASE_URLS;
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;
35407
35440
  var init_oauth = __esm(() => {
35408
35441
  init_envUtils();
35409
35442
  init_envVars();
@@ -38538,6 +38571,7 @@ var init_git = __esm(() => {
38538
38571
  init_log2();
38539
38572
  init_memoize2();
38540
38573
  init_which();
38574
+ init_branding();
38541
38575
  GIT_ROOT_NOT_FOUND = Symbol("git-root-not-found");
38542
38576
  findGitRootImpl = memoizeWithLRU((startPath) => {
38543
38577
  const startTime = Date.now();
@@ -39828,7 +39862,8 @@ var init_types4 = __esm(() => {
39828
39862
  type: literal("stdio").optional(),
39829
39863
  command: string2().min(1, "Command cannot be empty"),
39830
39864
  args: array(string2()).default([]),
39831
- env: record(string2(), string2()).optional()
39865
+ env: record(string2(), string2()).optional(),
39866
+ cwd: string2().optional()
39832
39867
  }));
39833
39868
  McpXaaConfigSchema = lazySchema(() => boolean2());
39834
39869
  McpOAuthConfigSchema = lazySchema(() => object2({
@@ -40765,7 +40800,7 @@ var init_types5 = __esm(() => {
40765
40800
  allow: array(PermissionRuleSchema()).optional().describe("List of permission rules for allowed operations"),
40766
40801
  deny: array(PermissionRuleSchema()).optional().describe("List of permission rules for denied operations"),
40767
40802
  ask: array(PermissionRuleSchema()).optional().describe("List of permission rules that should always prompt for confirmation"),
40768
- defaultMode: _enum(EXTERNAL_PERMISSION_MODES).optional().describe("Default permission mode when Claude Code needs access"),
40803
+ defaultMode: _enum(EXTERNAL_PERMISSION_MODES).optional().describe("Default permission mode when the agent needs access"),
40769
40804
  disableBypassPermissionsMode: _enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),
40770
40805
  ...{},
40771
40806
  additionalDirectories: array(string2()).optional().describe("Additional directories to include in the permission scope")
@@ -40810,7 +40845,7 @@ var init_types5 = __esm(() => {
40810
40845
  "mcp"
40811
40846
  ];
40812
40847
  SettingsSchema = lazySchema(() => object2({
40813
- $schema: literal(CLAUDE_CODE_SETTINGS_SCHEMA_URL).optional().describe("JSON Schema reference for Claude Code settings"),
40848
+ $schema: literal(CLAUDE_CODE_SETTINGS_SCHEMA_URL).optional().describe("JSON Schema reference for settings"),
40814
40849
  apiKeyHelper: string2().optional().describe("Path to a script that outputs authentication values"),
40815
40850
  awsCredentialExport: string2().optional().describe("Path to a script that exports AWS credentials"),
40816
40851
  awsAuthRefresh: string2().optional().describe("Path to a script that refreshes AWS authentication"),
@@ -40818,7 +40853,7 @@ var init_types5 = __esm(() => {
40818
40853
  ...isEnvTruthy(resolveEnvVar("ENABLE_XAA")) ? {
40819
40854
  xaaIdp: object2({
40820
40855
  issuer: string2().url().describe("IdP issuer URL for OIDC discovery"),
40821
- clientId: string2().describe("Claude Code's client_id registered at the IdP"),
40856
+ clientId: string2().describe("The client_id registered at the IdP"),
40822
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.")
40823
40858
  }).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")
40824
40859
  } : {},
@@ -40828,10 +40863,10 @@ var init_types5 = __esm(() => {
40828
40863
  }).optional().describe("Custom file suggestion configuration for @ mentions"),
40829
40864
  respectGitignore: boolean2().optional().describe("Whether file picker should respect .gitignore files (default: true). " + "Note: .ignore files are always respected."),
40830
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."),
40831
- env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for Claude Code sessions"),
40866
+ env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for agent sessions"),
40832
40867
  includeGitInstructions: boolean2().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),
40833
40868
  permissions: PermissionsSchema().optional().describe("Tool usage permissions configuration"),
40834
- model: string2().optional().describe("Override the default model used by Claude Code"),
40869
+ model: string2().optional().describe("Override the default model used by the agent"),
40835
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."),
40836
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."),
40837
40872
  enableAllProjectMcpServers: boolean2().optional().describe("Whether to automatically approve all MCP servers in the project"),
@@ -63656,11 +63691,6 @@ function parseAnthropicStreamChunk(chunk) {
63656
63691
  return [chunk];
63657
63692
  }
63658
63693
 
63659
- // src/providers/shared/userAgent.ts
63660
- function getClaudeCodeUserAgent() {
63661
- return `claude-code/${"99.0.0"}`;
63662
- }
63663
-
63664
63694
  // src/session/workloadContext.ts
63665
63695
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
63666
63696
  function getWorkload() {
@@ -63692,17 +63722,19 @@ function getMCPUserAgent() {
63692
63722
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
63693
63723
  }
63694
63724
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
63695
- return `claude-code/${"99.0.0"}${suffix}`;
63725
+ return `${getProductUserAgentToken()}/${"99.0.0"}${suffix}`;
63696
63726
  }
63697
63727
  function getWebFetchUserAgent() {
63698
- const supportUrl = isFamily(getProvider(), "firstParty") ? "https://support.anthropic.com/" : "https://github.com/Gitlawb/opencow";
63699
- return `Claude-User (${getClaudeCodeUserAgent()}; +${supportUrl})`;
63728
+ const { productSlug, productUrl } = getBranding();
63729
+ const contact = productUrl ? `; +${productUrl}` : "";
63730
+ return `${productSlug}-User (${productSlug}/${"99.0.0"}${contact})`;
63700
63731
  }
63701
63732
  var init_http2 = __esm(() => {
63702
63733
  init_oauth();
63703
63734
  init_auth();
63704
63735
  init_state2();
63705
63736
  init_workloadContext();
63737
+ init_branding();
63706
63738
  });
63707
63739
 
63708
63740
  // src/providers/shared/model/providers.ts
@@ -90260,6 +90292,7 @@ function createBootQueryContext() {
90260
90292
  loaded: createSignal()
90261
90293
  },
90262
90294
  pluginDataPaths: new Map,
90295
+ pluginContentVariables: {},
90263
90296
  lspManager: null
90264
90297
  },
90265
90298
  diagnostics: createFreshDiagnostics(),
@@ -90351,6 +90384,7 @@ function deriveSubagentRegistries(parent) {
90351
90384
  skillListingSuppressNext: false,
90352
90385
  dynamicSkills: parent.dynamicSkills,
90353
90386
  pluginDataPaths: parent.pluginDataPaths,
90387
+ pluginContentVariables: parent.pluginContentVariables,
90354
90388
  lspManager: parent.lspManager
90355
90389
  };
90356
90390
  }
@@ -90606,6 +90640,7 @@ function buildQueryContextFromSdk(options) {
90606
90640
  loaded: createSignal()
90607
90641
  },
90608
90642
  pluginDataPaths: new Map,
90643
+ pluginContentVariables: {},
90609
90644
  lspManager: null
90610
90645
  },
90611
90646
  diagnostics: createFreshDiagnostics(),
@@ -91120,11 +91155,22 @@ function resetSdkInitState() {
91120
91155
  r.initJsonSchema = null;
91121
91156
  r.registeredHooks = null;
91122
91157
  }
91123
- function setExplicitPluginRuntimeContext(dataPaths, lspManager) {
91158
+ function setExplicitPluginRuntimeContext(dataPaths, lspManager, contentVariables) {
91124
91159
  const registries = getQueryContext().registries;
91125
91160
  registries.pluginDataPaths = new Map(dataPaths);
91161
+ registries.pluginContentVariables = { ...contentVariables };
91126
91162
  registries.lspManager = lspManager;
91127
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
+ }
91128
91174
  function tryGetExplicitPluginDataPath(pluginId) {
91129
91175
  try {
91130
91176
  return getQueryContext().registries.pluginDataPaths.get(pluginId);
@@ -91590,6 +91636,7 @@ __export(exports_state, {
91590
91636
  setCwdState: () => setCwdState2,
91591
91637
  setDirectConnectServerUrl: () => setDirectConnectServerUrl,
91592
91638
  setEnvVar: () => setEnvVar,
91639
+ setExplicitPluginRuntimeBundle: () => setExplicitPluginRuntimeBundle,
91593
91640
  setExplicitPluginRuntimeContext: () => setExplicitPluginRuntimeContext,
91594
91641
  setFastModeHeaderLatched: () => setFastModeHeaderLatched2,
91595
91642
  setFlagSettingsInline: () => setFlagSettingsInline,
@@ -91626,6 +91673,7 @@ __export(exports_state, {
91626
91673
  snapshotOutputTokensForTurn: () => snapshotOutputTokensForTurn,
91627
91674
  switchSession: () => switchSession,
91628
91675
  tryGetExplicitPluginDataPath: () => tryGetExplicitPluginDataPath,
91676
+ tryGetPluginContentVariables: () => tryGetPluginContentVariables,
91629
91677
  tryGetQueryContext: () => tryGetQueryContext,
91630
91678
  tryGetSessionLspManager: () => tryGetSessionLspManager,
91631
91679
  unregisterCreatedTeam: () => unregisterCreatedTeam
@@ -107266,6 +107314,7 @@ var init_TaskOutput = __esm(() => {
107266
107314
  init_stringUtils();
107267
107315
  init_diskOutput();
107268
107316
  init_fsOperations();
107317
+ init_branding();
107269
107318
  DEFAULT_MAX_MEMORY = 8 * 1024 * 1024;
107270
107319
  TaskOutput = class TaskOutput {
107271
107320
  taskId;
@@ -107453,7 +107502,7 @@ Output truncated (${sizeKB}KB total). Full output saved to: ${this.path}`;
107453
107502
  } catch (err) {
107454
107503
  const code = err instanceof Error && "code" in err ? String(err.code) : "unknown";
107455
107504
  logForDebugging(`TaskOutput.#readStdoutFromFile: failed to read ${this.path} (${code}): ${err}`);
107456
- return `<bash output unavailable: output file ${this.path} could not be read (${code}). This usually means another Claude Code process in the same project deleted it during startup cleanup.>`;
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.>`;
107457
107506
  }
107458
107507
  }
107459
107508
  getStderr() {
@@ -113094,6 +113143,11 @@ function substitutePluginVariables(value, plugin) {
113094
113143
  }
113095
113144
  return out;
113096
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
+ }
113097
113151
  function substituteUserConfigVariables(value, userConfig) {
113098
113152
  return value.replace(/\$\{user_config\.([^}]+)\}/g, (_match, key) => {
113099
113153
  const configValue = userConfig[key];
@@ -122431,7 +122485,7 @@ function getErrorMessageIfRefusal(stopReason, model) {
122431
122485
  }
122432
122486
  logEvent("tengu_refusal_api_response", {});
122433
122487
  const usagePolicyUrl = isFamily(getProvider(), "firstParty") ? "https://www.anthropic.com/legal/aup" : "your provider's acceptable use policy";
122434
- const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}: Claude Code 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}: Claude Code 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 Claude Code to assist with a different task.`;
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.`;
122435
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." : "";
122436
122490
  return createAssistantAPIErrorMessage({
122437
122491
  content: baseMessage + modelSuggestion,
@@ -122478,6 +122532,7 @@ var init_errors7 = __esm(() => {
122478
122532
  init_claudeAiLimits();
122479
122533
  init_mocking();
122480
122534
  init_errorUtils();
122535
+ init_branding();
122481
122536
  });
122482
122537
 
122483
122538
  // src/providers/shared/retry.ts
@@ -166883,40 +166938,6 @@ var init_p_map = __esm(() => {
166883
166938
  pMapSkip = Symbol("skip");
166884
166939
  });
166885
166940
 
166886
- // src/session/bridge/sessionIdCompat.ts
166887
- function toCompatSessionId(id) {
166888
- if (!id.startsWith("cse_"))
166889
- return id;
166890
- if (_isCseShimEnabled && !_isCseShimEnabled())
166891
- return id;
166892
- return "session_" + id.slice("cse_".length);
166893
- }
166894
- var _isCseShimEnabled;
166895
-
166896
- // src/constants/product.ts
166897
- function isRemoteSessionStaging(sessionId, ingressUrl) {
166898
- return sessionId?.includes("_staging_") === true || ingressUrl?.includes("staging") === true;
166899
- }
166900
- function isRemoteSessionLocal(sessionId, ingressUrl) {
166901
- return sessionId?.includes("_local_") === true || ingressUrl?.includes("localhost") === true;
166902
- }
166903
- function getClaudeAiBaseUrl(sessionId, ingressUrl) {
166904
- if (isRemoteSessionLocal(sessionId, ingressUrl)) {
166905
- return CLAUDE_AI_LOCAL_BASE_URL;
166906
- }
166907
- if (isRemoteSessionStaging(sessionId, ingressUrl)) {
166908
- return CLAUDE_AI_STAGING_BASE_URL;
166909
- }
166910
- return CLAUDE_AI_BASE_URL;
166911
- }
166912
- function getRemoteSessionUrl(sessionId, ingressUrl) {
166913
- ;
166914
- const compatId = toCompatSessionId(sessionId);
166915
- const baseUrl = getClaudeAiBaseUrl(compatId, ingressUrl);
166916
- return `${baseUrl}/code/${compatId}`;
166917
- }
166918
- 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";
166919
-
166920
166941
  // node_modules/.bun/semver@7.7.4/node_modules/semver/internal/constants.js
166921
166942
  var require_constants7 = __commonJS(function(exports, module) {
166922
166943
  var SEMVER_SPEC_VERSION = "2.0.0";
@@ -171661,7 +171682,7 @@ function normalizeCodexMcpFields(input) {
171661
171682
  }
171662
171683
 
171663
171684
  // src/capabilities/plugins/mcpPluginIntegration.ts
171664
- import { join as join40 } from "path";
171685
+ import { join as join40, resolve as resolvePath } from "path";
171665
171686
  async function loadMcpServersFromMcpb(plugin, mcpbPath, errors) {
171666
171687
  try {
171667
171688
  logForDebugging(`Loading MCP servers from MCPB: ${mcpbPath}`);
@@ -171871,6 +171892,9 @@ function resolvePluginMcpEnvironment(config, plugin, userConfig, errors, pluginN
171871
171892
  if (stdioConfig.args) {
171872
171893
  stdioConfig.args = stdioConfig.args.map((arg) => resolveValue(arg));
171873
171894
  }
171895
+ if (stdioConfig.cwd) {
171896
+ stdioConfig.cwd = resolvePath(plugin.path, resolveValue(stdioConfig.cwd));
171897
+ }
171874
171898
  const resolvedEnv = {
171875
171899
  CLAUDE_PLUGIN_ROOT: plugin.path,
171876
171900
  CLAUDE_PLUGIN_DATA: plugin.dataPath ?? getPluginDataDir(plugin.source),
@@ -172435,160 +172459,6 @@ var init_agentMemorySnapshot = __esm(() => {
172435
172459
  }));
172436
172460
  });
172437
172461
 
172438
- // src/capabilities/tools/AgentTool/built-in/claudeCodeGuideAgent.ts
172439
- function getClaudeCodeGuideBasePrompt() {
172440
- const localSearchHint = hasEmbeddedSearchTools() ? `${FILE_READ_TOOL_NAME}, \`find\`, and \`grep\`` : `${FILE_READ_TOOL_NAME}, ${GLOB_TOOL_NAME}, and ${GREP_TOOL_NAME}`;
172441
- 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.
172442
-
172443
- **Your expertise spans three domains:**
172444
-
172445
- 1. **Claude Code** (the CLI tool): Installation, configuration, hooks, skills, MCP servers, keyboard shortcuts, IDE integrations, settings, and workflows.
172446
-
172447
- 2. **Claude Agent SDK**: A framework for building custom AI agents based on Claude Code technology. Available for Node.js/TypeScript and Python.
172448
-
172449
- 3. **Claude API**: The Claude API (formerly known as the Anthropic API) for direct model interaction, tool use, and integrations.
172450
-
172451
- **Documentation sources:**
172452
-
172453
- - **Claude Code docs** (${CLAUDE_CODE_DOCS_MAP_URL}): Fetch this for questions about the Claude Code CLI tool, including:
172454
- - Installation, setup, and getting started
172455
- - Hooks (pre/post command execution)
172456
- - Custom skills
172457
- - MCP server configuration
172458
- - IDE integrations (VS Code, JetBrains)
172459
- - Settings files and configuration
172460
- - Keyboard shortcuts and hotkeys
172461
- - Subagents and plugins
172462
- - Sandboxing and security
172463
-
172464
- - **Claude Agent SDK docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about building agents with the SDK, including:
172465
- - SDK overview and getting started (Python and TypeScript)
172466
- - Agent configuration + custom tools
172467
- - Session management and permissions
172468
- - MCP integration in agents
172469
- - Hosting and deployment
172470
- - Cost tracking and context management
172471
- Note: Agent SDK docs are part of the Claude API documentation at the same URL.
172472
-
172473
- - **Claude API docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about the Claude API (formerly the Anthropic API), including:
172474
- - Messages API and streaming
172475
- - 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)
172476
- - Vision, PDF support, and citations
172477
- - Extended thinking and structured outputs
172478
- - MCP connector for remote MCP servers
172479
- - Cloud provider integrations (Bedrock, Vertex AI, Foundry)
172480
-
172481
- **Approach:**
172482
- 1. Determine which domain the user's question falls into
172483
- 2. Use ${WEB_FETCH_TOOL_NAME} to fetch the appropriate docs map
172484
- 3. Identify the most relevant documentation URLs from the map
172485
- 4. Fetch the specific documentation pages
172486
- 5. Provide clear, actionable guidance based on official documentation
172487
- 6. Use ${WEB_SEARCH_TOOL_NAME} if docs don't cover the topic
172488
- 7. Reference local project files (CLAUDE.md, .claude/ directory) when relevant using ${localSearchHint}
172489
-
172490
- **Guidelines:**
172491
- - Always prioritize official documentation over assumptions
172492
- - Keep responses concise and actionable
172493
- - Include specific examples or code snippets when helpful
172494
- - Reference exact documentation URLs in your responses
172495
- - Help users discover features by proactively suggesting related commands, shortcuts, or capabilities
172496
-
172497
- Complete the user's request by providing accurate, documentation-based guidance.`;
172498
- }
172499
- function getFeedbackGuideline() {
172500
- if (isUsing3PServices()) {
172501
- 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"}`;
172502
- }
172503
- 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";
172504
- }
172505
- 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;
172506
- var init_claudeCodeGuideAgent = __esm(() => {
172507
- init_auth();
172508
- init_embeddedTools();
172509
- init_settings2();
172510
- init_slowOperations();
172511
- CLAUDE_CODE_GUIDE_AGENT = {
172512
- agentType: CLAUDE_CODE_GUIDE_AGENT_TYPE,
172513
- 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}.`,
172514
- tools: hasEmbeddedSearchTools() ? [
172515
- BASH_TOOL_NAME,
172516
- FILE_READ_TOOL_NAME,
172517
- WEB_FETCH_TOOL_NAME,
172518
- WEB_SEARCH_TOOL_NAME
172519
- ] : [
172520
- GLOB_TOOL_NAME,
172521
- GREP_TOOL_NAME,
172522
- FILE_READ_TOOL_NAME,
172523
- WEB_FETCH_TOOL_NAME,
172524
- WEB_SEARCH_TOOL_NAME
172525
- ],
172526
- source: "built-in",
172527
- baseDir: "built-in",
172528
- model: "haiku",
172529
- permissionMode: "dontAsk",
172530
- getSystemPrompt({ toolUseContext }) {
172531
- const commands = toolUseContext.options.commands;
172532
- const contextSections = [];
172533
- const customCommands = commands.filter((cmd) => cmd.type === "prompt");
172534
- if (customCommands.length > 0) {
172535
- const commandList = customCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
172536
- `);
172537
- contextSections.push(`**Available custom skills in this project:**
172538
- ${commandList}`);
172539
- }
172540
- const customAgents = toolUseContext.options.agentDefinitions.activeAgents.filter((a) => a.source !== "built-in");
172541
- if (customAgents.length > 0) {
172542
- const agentList = customAgents.map((a) => `- ${a.agentType}: ${a.whenToUse}`).join(`
172543
- `);
172544
- contextSections.push(`**Available custom agents configured:**
172545
- ${agentList}`);
172546
- }
172547
- const mcpClients = toolUseContext.options.mcpClients;
172548
- if (mcpClients && mcpClients.length > 0) {
172549
- const mcpList = mcpClients.map((client) => `- ${client.name}`).join(`
172550
- `);
172551
- contextSections.push(`**Configured MCP servers:**
172552
- ${mcpList}`);
172553
- }
172554
- const pluginCommands = commands.filter((cmd) => cmd.type === "prompt" && cmd.source === "plugin");
172555
- if (pluginCommands.length > 0) {
172556
- const pluginList = pluginCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
172557
- `);
172558
- contextSections.push(`**Available plugin skills:**
172559
- ${pluginList}`);
172560
- }
172561
- const settings = getSettings_DEPRECATED();
172562
- if (Object.keys(settings).length > 0) {
172563
- const settingsJson = jsonStringify(settings, null, 2);
172564
- contextSections.push(`**User's settings.json:**
172565
- \`\`\`json
172566
- ${settingsJson}
172567
- \`\`\``);
172568
- }
172569
- const feedbackGuideline = getFeedbackGuideline();
172570
- const basePromptWithFeedback = `${getClaudeCodeGuideBasePrompt()}
172571
- ${feedbackGuideline}`;
172572
- if (contextSections.length > 0) {
172573
- return `${basePromptWithFeedback}
172574
-
172575
- ---
172576
-
172577
- # User's Current Configuration
172578
-
172579
- The user has the following custom setup in their environment:
172580
-
172581
- ${contextSections.join(`
172582
-
172583
- `)}
172584
-
172585
- When answering questions, consider these configured features and proactively suggest them when relevant.`;
172586
- }
172587
- return basePromptWithFeedback;
172588
- }
172589
- };
172590
- });
172591
-
172592
172462
  // src/capabilities/tools/AgentTool/built-in/exploreAgent.ts
172593
172463
  function getExploreSystemPrompt() {
172594
172464
  const embedded = hasEmbeddedSearchTools();
@@ -173063,10 +172933,6 @@ function getBuiltInAgents() {
173063
172933
  if (areExplorePlanAgentsEnabled()) {
173064
172934
  agents.push(EXPLORE_AGENT, PLAN_AGENT);
173065
172935
  }
173066
- const isNonSdkEntrypoint = resolveEnvVar("ENTRYPOINT") !== "sdk-ts" && resolveEnvVar("ENTRYPOINT") !== "sdk-py" && resolveEnvVar("ENTRYPOINT") !== "sdk-cli";
173067
- if (isNonSdkEntrypoint) {
173068
- agents.push(CLAUDE_CODE_GUIDE_AGENT);
173069
- }
173070
172936
  if (false) {}
173071
172937
  return agents;
173072
172938
  }
@@ -173076,7 +172942,6 @@ function resolveSdkAgents(hostAgents) {
173076
172942
  var init_builtInAgents = __esm(() => {
173077
172943
  init_state();
173078
172944
  init_envUtils();
173079
- init_claudeCodeGuideAgent();
173080
172945
  init_exploreAgent();
173081
172946
  init_generalPurposeAgent();
173082
172947
  init_planAgent();
@@ -176884,6 +176749,40 @@ var init_agentSummary = __esm(() => {
176884
176749
  init_sessionStorage();
176885
176750
  });
176886
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
+
176887
176786
  // src/session/tasks.ts
176888
176787
  import { join as join44 } from "path";
176889
176788
  function notifyTasksUpdated() {
@@ -177551,7 +177450,6 @@ NOTE: You just closed out 3+ tasks and none of them was a verification step. Bef
177551
177450
  }
177552
177451
  });
177553
177452
  });
177554
-
177555
177453
  // src/providers/anthropic/policyLimits/types.ts
177556
177454
  var PolicyLimitsResponseSchema;
177557
177455
  var init_types8 = __esm(() => {
@@ -179298,7 +179196,8 @@ var init_coreSchemas = __esm(() => {
179298
179196
  type: literal("stdio").optional(),
179299
179197
  command: string2(),
179300
179198
  args: array(string2()).optional(),
179301
- env: record(string2(), string2()).optional()
179199
+ env: record(string2(), string2()).optional(),
179200
+ cwd: string2().optional()
179302
179201
  }));
179303
179202
  McpSSEServerConfigSchema2 = lazySchema(() => object2({
179304
179203
  type: literal("sse"),
@@ -185339,7 +185238,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
185339
185238
  if (validator && !validator(args)) {
185340
185239
  return {
185341
185240
  behavior: "ask",
185342
- message: `${command} with flags requires manual approval to ensure path safety. For security, Claude Code cannot automatically validate ${command} commands that use flags, as some flags like --target-directory=PATH can bypass path validation.`,
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.`,
185343
185242
  decisionReason: {
185344
185243
  type: "other",
185345
185244
  reason: `${command} command with flags requires manual approval`
@@ -185349,7 +185248,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
185349
185248
  if (compoundCommandHasCd && operationType !== "read") {
185350
185249
  return {
185351
185250
  behavior: "ask",
185352
- message: `Commands that change directories and perform write operations require explicit approval to ensure paths are evaluated correctly. For security, Claude Code cannot automatically determine the final working directory when 'cd' is used in compound commands.`,
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.`,
185353
185252
  decisionReason: {
185354
185253
  type: "other",
185355
185254
  reason: "Compound command contains cd with write operation - manual approval required to prevent path resolution bypass"
@@ -185361,7 +185260,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
185361
185260
  if (!allowed) {
185362
185261
  const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
185363
185262
  const dirListStr = formatDirectoryList(workingDirs);
185364
- const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : `${command} in '${resolvedPath}' was blocked. For security, Claude Code may only ${ACTION_VERBS[command]} the allowed working directories for this session: ${dirListStr}.`;
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}.`;
185365
185264
  if (decisionReason?.type === "rule") {
185366
185265
  return {
185367
185266
  behavior: "deny",
@@ -185486,7 +185385,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
185486
185385
  if (compoundCommandHasCd && redirections.length > 0) {
185487
185386
  return {
185488
185387
  behavior: "ask",
185489
- message: `Commands that change directories and write via output redirection require explicit approval to ensure paths are evaluated correctly. For security, Claude Code cannot automatically determine the final working directory when 'cd' is used in compound commands.`,
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.`,
185490
185389
  decisionReason: {
185491
185390
  type: "other",
185492
185391
  reason: "Compound command contains cd with output redirection - manual approval required to prevent path resolution bypass"
@@ -185501,7 +185400,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
185501
185400
  if (!allowed) {
185502
185401
  const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
185503
185402
  const dirListStr = formatDirectoryList(workingDirs);
185504
- 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, Claude Code may only write to files in the allowed working directories for this session: ${dirListStr}.`;
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}.`;
185505
185404
  if (decisionReason?.type === "rule") {
185506
185405
  return {
185507
185406
  behavior: "deny",
@@ -185708,6 +185607,7 @@ var init_pathValidation2 = __esm(() => {
185708
185607
  init_pathValidation();
185709
185608
  init_bashPermissions();
185710
185609
  init_sedValidation();
185610
+ init_branding();
185711
185611
  PATH_EXTRACTORS = {
185712
185612
  cd: (args) => args.length === 0 ? [homedir16()] : [args.join(" ")],
185713
185613
  ls: (args) => {
@@ -198207,7 +198107,7 @@ function validateInputForSettingsFileEdit(filePath, originalContent, getUpdatedC
198207
198107
  if (!afterValidation.isValid) {
198208
198108
  return {
198209
198109
  result: false,
198210
- message: `Claude Code settings.json validation failed after edit:
198110
+ message: `settings.json validation failed after edit:
198211
198111
  ${afterValidation.error}
198212
198112
 
198213
198113
  Full schema:
@@ -200491,7 +200391,7 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
200491
200391
  logForDebugging(`Looking for shell config file: ${configFile}`);
200492
200392
  const configFileExists = await pathExists(configFile);
200493
200393
  if (!configFileExists) {
200494
- logForDebugging(`Shell config file not found: ${configFile}, creating snapshot with Claude Code defaults only`);
200394
+ logForDebugging(`Shell config file not found: ${configFile}, creating snapshot with ${getBranding().productName} defaults only`);
200495
200395
  }
200496
200396
  const timestamp = Date.now();
200497
200397
  const randomId = Math.random().toString(36).substring(2, 8);
@@ -200604,6 +200504,7 @@ var init_ShellSnapshot = __esm(() => {
200604
200504
  init_subprocessEnv();
200605
200505
  init_shellQuote();
200606
200506
  init_state2();
200507
+ init_branding();
200607
200508
  VCS_DIRECTORIES_TO_EXCLUDE2 = [
200608
200509
  ".git",
200609
200510
  ".svn",
@@ -211414,6 +211315,7 @@ ${content}`;
211414
211315
  source: sourceName,
211415
211316
  dataPath: pluginDataPath
211416
211317
  });
211318
+ finalContent = substitutePluginContentVariables(finalContent);
211417
211319
  if (pluginManifest.userConfig) {
211418
211320
  finalContent = substituteUserConfigInContent(finalContent, loadPluginOptions(sourceName), pluginManifest.userConfig);
211419
211321
  }
@@ -217002,7 +216904,7 @@ async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl,
217002
216904
  }
217003
216905
  if (code) {
217004
216906
  res.writeHead(200, { "Content-Type": "text/html" });
217005
- res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to Claude Code.</p>`);
216907
+ res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to ${import_xss2.default(getBranding().productName)}.</p>`);
217006
216908
  cleanup();
217007
216909
  resolveOnce(code);
217008
216910
  }
@@ -217168,7 +217070,7 @@ class ClaudeAuthProvider {
217168
217070
  }
217169
217071
  get clientMetadata() {
217170
217072
  const metadata = {
217171
- client_name: `Claude Code (${this.serverName})`,
217073
+ client_name: `${getBranding().productName} (${this.serverName})`,
217172
217074
  redirect_uris: [this.redirectUri],
217173
217075
  grant_types: ["authorization_code", "refresh_token"],
217174
217076
  response_types: ["code"],
@@ -217187,7 +217089,7 @@ class ClaudeAuthProvider {
217187
217089
  logMCPDebug(this.serverName, `Using CIMD URL from env: ${override}`);
217188
217090
  return override;
217189
217091
  }
217190
- return MCP_CLIENT_METADATA_URL;
217092
+ return getBranding().mcpOAuthClientMetadataUrl;
217191
217093
  }
217192
217094
  setMetadata(metadata) {
217193
217095
  this._metadata = metadata;
@@ -217755,7 +217657,7 @@ var init_auth6 = __esm(() => {
217755
217657
  init_auth5();
217756
217658
  init_errors8();
217757
217659
  init_auth4();
217758
- init_oauth();
217660
+ init_branding();
217759
217661
  init_browser();
217760
217662
  init_envUtils();
217761
217663
  init_errors5();
@@ -222655,7 +222557,7 @@ function isIncludedMcpTool(tool) {
222655
222557
  return !tool.name.startsWith("mcp__ide__") || ALLOWED_IDE_TOOLS.includes(tool.name);
222656
222558
  }
222657
222559
  function getServerCacheKey(name, serverRef) {
222658
- return `${name}-${jsonStringify(serverRef)}`;
222560
+ return `${name}-${jsonStringify(serverRef)}-${jsonStringify(getBranding())}`;
222659
222561
  }
222660
222562
  async function clearServerCache(name, serverRef) {
222661
222563
  const key = getServerCacheKey(name, serverRef);
@@ -223270,6 +223172,7 @@ var init_client5 = __esm(() => {
223270
223172
  ALLOWED_IDE_TOOLS = ["mcp__ide__executeCode", "mcp__ide__getDiagnostics"];
223271
223173
  connectToServer = memoize_default(async (name, serverRef, serverStats) => {
223272
223174
  const connectStartTime = Date.now();
223175
+ const cacheKey = getServerCacheKey(name, serverRef);
223273
223176
  let inProcessServer;
223274
223177
  try {
223275
223178
  let transport;
@@ -223468,6 +223371,7 @@ var init_client5 = __esm(() => {
223468
223371
  ...subprocessEnv(),
223469
223372
  ...serverRef.env
223470
223373
  },
223374
+ ...serverRef.cwd ? { cwd: serverRef.cwd } : {},
223471
223375
  stderr: "pipe"
223472
223376
  });
223473
223377
  } else {
@@ -223489,10 +223393,8 @@ var init_client5 = __esm(() => {
223489
223393
  }
223490
223394
  }
223491
223395
  const client = new Client({
223492
- name: TELEMETRY_SERVICE_NAME,
223493
223396
  ...getMcpClientInfo(),
223494
- version: "99.0.0",
223495
- websiteUrl: PRODUCT_URL
223397
+ version: "99.0.0"
223496
223398
  }, {
223497
223399
  capabilities: {
223498
223400
  roots: {},
@@ -223702,12 +223604,11 @@ var init_client5 = __esm(() => {
223702
223604
  const uptime = Date.now() - connectionStartTime;
223703
223605
  const transportType = serverRef.type ?? "unknown";
223704
223606
  logMCPDebug(name, `${transportType.toUpperCase()} connection closed after ${Math.floor(uptime / 1000)}s (${hasErrorOccurred ? "with errors" : "cleanly"})`);
223705
- const key = getServerCacheKey(name, serverRef);
223706
223607
  fetchToolsForClient.cache.delete(name);
223707
223608
  fetchResourcesForClient.cache.delete(name);
223708
223609
  fetchCommandsForClient.cache.delete(name);
223709
223610
  if (false) {}
223710
- connectToServer.cache.delete(key);
223611
+ connectToServer.cache.delete(cacheKey);
223711
223612
  logMCPDebug(name, `Cleared connection cache for reconnection`);
223712
223613
  if (originalOnclose) {
223713
223614
  originalOnclose();
@@ -224315,12 +224216,11 @@ async function* runPostToolUseFailureHooks(toolUseContext, tool, toolUseID, mess
224315
224216
  }
224316
224217
  async function resolveHookPermissionDecision(hookPermissionResult, tool, input, toolUseContext, canUseTool, assistantMessage, toolUseID) {
224317
224218
  const requiresInteraction = tool.requiresUserInteraction?.();
224318
- const requireCanUseTool = toolUseContext.requireCanUseTool;
224319
224219
  if (hookPermissionResult?.behavior === "allow") {
224320
224220
  const hookInput = hookPermissionResult.updatedInput ?? input;
224321
224221
  const interactionSatisfied = requiresInteraction && hookPermissionResult.updatedInput !== undefined;
224322
- if (requiresInteraction && !interactionSatisfied || requireCanUseTool) {
224323
- logForDebugging(`Hook approved tool use for ${tool.name}, but canUseTool is required`);
224222
+ if (!interactionSatisfied) {
224223
+ logForDebugging(`Hook approved tool use for ${tool.name}, deferring final decision to canUseTool`);
224324
224224
  return {
224325
224225
  decision: await consumePermissionPreDecision(toolUseContext, toolUseID, hookInput, () => canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID)),
224326
224226
  input: hookInput
@@ -224328,7 +224228,7 @@ async function resolveHookPermissionDecision(hookPermissionResult, tool, input,
224328
224228
  }
224329
224229
  const ruleCheck = await checkRuleBasedPermissions(tool, hookInput, toolUseContext);
224330
224230
  if (ruleCheck === null) {
224331
- logForDebugging(interactionSatisfied ? `Hook satisfied user interaction for ${tool.name} via updatedInput` : `Hook approved tool use for ${tool.name}, bypassing permission prompt`);
224231
+ logForDebugging(`Hook satisfied user interaction for ${tool.name} via updatedInput`);
224332
224232
  return { decision: hookPermissionResult, input: hookInput };
224333
224233
  }
224334
224234
  if (ruleCheck.behavior === "deny") {
@@ -227396,7 +227296,7 @@ function getAnthropicEnvMetadata() {
227396
227296
  function getBuildAgeMinutes() {
227397
227297
  if (false)
227398
227298
  ;
227399
- const buildTime = new Date("2026-10-19T06:49:44.552Z").getTime();
227299
+ const buildTime = new Date("2026-10-20T14:00:47.620Z").getTime();
227400
227300
  if (isNaN(buildTime))
227401
227301
  return;
227402
227302
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -241214,7 +241114,7 @@ function AUTO_REJECT_MESSAGE(toolName) {
241214
241114
  return `Permission to use ${toolName} has been denied. ${DENIAL_WORKAROUND_GUIDANCE}`;
241215
241115
  }
241216
241116
  function DONT_ASK_REJECT_MESSAGE(toolName) {
241217
- return `Permission to use ${toolName} has been denied because Claude Code is running in don't ask mode. ${DENIAL_WORKAROUND_GUIDANCE}`;
241117
+ return `Permission to use ${toolName} has been denied because ${getBranding().productName} is running in don't ask mode. ${DENIAL_WORKAROUND_GUIDANCE}`;
241218
241118
  }
241219
241119
  function isSyntheticMessage(message) {
241220
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);
@@ -243971,6 +243871,7 @@ var init_messages4 = __esm(() => {
243971
243871
  init_tasks();
243972
243872
  init_toolSearch();
243973
243873
  init_state2();
243874
+ init_branding();
243974
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.`;
243975
243876
  SYNTHETIC_MESSAGES = new Set([
243976
243877
  INTERRUPT_MESSAGE,
@@ -273327,10 +273228,11 @@ init_http2();
273327
273228
  init_log2();
273328
273229
  init_state2();
273329
273230
  init_mcpOutputStorage();
273231
+ init_branding();
273330
273232
  init_settings2();
273331
273233
  class DomainBlockedError extends Error {
273332
273234
  constructor(domain) {
273333
- super(`Claude Code is unable to fetch from ${domain}`);
273235
+ super(`${getBranding().productName} is unable to fetch from ${domain}`);
273334
273236
  this.name = "DomainBlockedError";
273335
273237
  }
273336
273238
  }
@@ -278673,6 +278575,7 @@ async function stageManagedPluginSnapshot(snapshot, appliedState) {
278673
278575
  try {
278674
278576
  for (const plugin of snapshot.plugins)
278675
278577
  validateManagedPlugin(plugin);
278578
+ const contentVariables = validateContentVariables(snapshot.contentVariables);
278676
278579
  const bundle = await stageResolvedPlugins(snapshot.revision, snapshot.plugins.map((plugin) => ({
278677
278580
  id: plugin.id,
278678
278581
  path: plugin.source.path,
@@ -278682,7 +278585,7 @@ async function stageManagedPluginSnapshot(snapshot, appliedState) {
278682
278585
  })));
278683
278586
  return {
278684
278587
  status: "staged",
278685
- bundle,
278588
+ bundle: { ...bundle, contentVariables },
278686
278589
  result: {
278687
278590
  status: "applied",
278688
278591
  requestedRevision: snapshot.revision,
@@ -278712,6 +278615,20 @@ async function inspectPluginSnapshot(snapshot) {
278712
278615
  return rejectResult(snapshot.revision, appliedState, error);
278713
278616
  }
278714
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
+ }
278715
278632
  function validateManagedPlugin(plugin) {
278716
278633
  if (plugin.source.type !== "local")
278717
278634
  throw new Error(`Unsupported plugin source for ${plugin.id}`);
@@ -279124,7 +279041,6 @@ function runSdkQueryRuntime(params) {
279124
279041
  const [clientTransport, serverTransport] = createLinkedTransportPair();
279125
279042
  await inProcessServer.connect(serverTransport);
279126
279043
  const client = new Client({
279127
- name: "claude-code",
279128
279044
  ...getMcpClientInfo(),
279129
279045
  version: "99.0.0"
279130
279046
  }, {
@@ -279165,7 +279081,7 @@ function runSdkQueryRuntime(params) {
279165
279081
  activePluginBundle = await stageStaticLocalPlugins(options.plugins, cwd);
279166
279082
  }
279167
279083
  if (activePluginBundle) {
279168
- setExplicitPluginRuntimeContext(activePluginBundle.dataPaths, activePluginBundle.lspManager);
279084
+ setExplicitPluginRuntimeBundle(activePluginBundle);
279169
279085
  registerHookCallbacks2(activePluginBundle.hooks);
279170
279086
  }
279171
279087
  const shellCapabilities = await initializeShellCapabilities();
@@ -279565,7 +279481,7 @@ class SessionRuntime {
279565
279481
  this.projectContextIds.add(ctx.identity.sessionId);
279566
279482
  await runWithQueryContext(ctx, async () => {
279567
279483
  if (this.pluginBundle) {
279568
- setExplicitPluginRuntimeContext(this.pluginBundle.dataPaths, this.pluginBundle.lspManager);
279484
+ setExplicitPluginRuntimeBundle(this.pluginBundle);
279569
279485
  registerHookCallbacks2(this.pluginBundle.hooks);
279570
279486
  }
279571
279487
  if (this.baseOptions.hooks) {
@@ -280584,4 +280500,4 @@ export {
280584
280500
  watchScheduledTasks
280585
280501
  };
280586
280502
 
280587
- //# debugId=E5F427337E592C6D64756E2164756E21
280503
+ //# debugId=7F28B624A121A3CF64756E2164756E21