@opencow-ai/opencow-agent-sdk 0.4.26 → 0.4.28
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/types.d.ts +3 -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 +228 -241
- package/dist/client.js +288 -257
- package/dist/constants/oauth.d.ts +0 -8
- package/dist/controller/compact/compact.d.ts +8 -2
- package/dist/controller/dispatch/toolHooks.d.ts +4 -3
- package/dist/controller/loop.d.ts +2 -1
- package/dist/entrypoints/sdk/controlSchemas.d.ts +25 -0
- package/dist/entrypoints/sdk/coreSchemas.d.ts +16 -0
- package/dist/entrypoints/sdk/runtimeTypes.d.ts +21 -0
- package/dist/providers/shared/retry.d.ts +13 -1
- package/dist/sdk.js +288 -257
- package/dist/session/branding.d.ts +4 -0
- package/dist/session/brandingConfig.d.ts +16 -0
- package/dist/session/contextSnapshot.d.ts +14 -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/contextSnapshot.d.ts +17 -0
- package/package.json +1 -1
- package/dist/capabilities/tools/AgentTool/built-in/claudeCodeGuideAgent.d.ts +0 -3
package/dist/cli.mjs
CHANGED
|
@@ -711,21 +711,49 @@ var init_errors = __esm(() => {
|
|
|
711
711
|
});
|
|
712
712
|
|
|
713
713
|
// src/session/brandingConfig.ts
|
|
714
|
+
function toProductSlug(value) {
|
|
715
|
+
const slug = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
716
|
+
return slug || PRODUCT_SLUG_FALLBACK;
|
|
717
|
+
}
|
|
714
718
|
function normalizeBrandName(value, fallback) {
|
|
715
719
|
const normalized = value?.replace(/[\u0000-\u001f\u007f]+/g, " ").replace(/\s+/g, " ").trim();
|
|
716
720
|
return normalized ? normalized.slice(0, 80) : fallback;
|
|
717
721
|
}
|
|
722
|
+
function optionalUrl(key, value) {
|
|
723
|
+
const trimmed = value?.trim();
|
|
724
|
+
return trimmed ? { [key]: trimmed } : {};
|
|
725
|
+
}
|
|
726
|
+
function validatedProductUrl(value) {
|
|
727
|
+
const trimmed = value?.trim();
|
|
728
|
+
if (!trimmed)
|
|
729
|
+
return {};
|
|
730
|
+
let protocol;
|
|
731
|
+
try {
|
|
732
|
+
protocol = new URL(trimmed).protocol;
|
|
733
|
+
} catch {
|
|
734
|
+
throw new TypeError(`branding.productUrl is not a valid URL: ${trimmed}`);
|
|
735
|
+
}
|
|
736
|
+
if (protocol !== "https:" && protocol !== "http:" || /[^\x21-\x7e]/.test(trimmed)) {
|
|
737
|
+
throw new TypeError(`branding.productUrl must be an ASCII http(s) URL: ${trimmed}`);
|
|
738
|
+
}
|
|
739
|
+
return { productUrl: trimmed };
|
|
740
|
+
}
|
|
718
741
|
function resolveBranding(options) {
|
|
719
742
|
const productName = normalizeBrandName(options?.productName, DEFAULT_BRANDING.productName);
|
|
743
|
+
const explicitSlug = options?.productSlug?.trim();
|
|
720
744
|
return Object.freeze({
|
|
721
745
|
productName,
|
|
722
|
-
|
|
746
|
+
productSlug: toProductSlug(explicitSlug || productName),
|
|
747
|
+
assistantName: normalizeBrandName(options?.assistantName, productName),
|
|
748
|
+
...optionalUrl("mcpOAuthClientMetadataUrl", options?.mcpOAuthClientMetadataUrl),
|
|
749
|
+
...validatedProductUrl(options?.productUrl)
|
|
723
750
|
});
|
|
724
751
|
}
|
|
725
|
-
var DEFAULT_BRANDING;
|
|
752
|
+
var DEFAULT_BRANDING, PRODUCT_SLUG_FALLBACK = "app";
|
|
726
753
|
var init_brandingConfig = __esm(() => {
|
|
727
754
|
DEFAULT_BRANDING = Object.freeze({
|
|
728
755
|
productName: "Agentic",
|
|
756
|
+
productSlug: "agentic",
|
|
729
757
|
assistantName: "Agentic"
|
|
730
758
|
});
|
|
731
759
|
});
|
|
@@ -742,12 +770,17 @@ function getAssistantIdentityPrompt() {
|
|
|
742
770
|
return `You are ${getBranding().assistantName}, an agentic coding assistant.`;
|
|
743
771
|
}
|
|
744
772
|
function getMcpClientInfo() {
|
|
745
|
-
const { productName } = getBranding();
|
|
773
|
+
const { productName, productSlug, productUrl } = getBranding();
|
|
746
774
|
return {
|
|
775
|
+
name: productSlug,
|
|
747
776
|
title: `${productName} Coding Client`,
|
|
748
|
-
description: `${productName} agentic coding client
|
|
777
|
+
description: `${productName} agentic coding client`,
|
|
778
|
+
...productUrl ? { websiteUrl: productUrl } : {}
|
|
749
779
|
};
|
|
750
780
|
}
|
|
781
|
+
function getProductUserAgentToken() {
|
|
782
|
+
return getBranding().productSlug;
|
|
783
|
+
}
|
|
751
784
|
var brandingStorage;
|
|
752
785
|
var init_branding = __esm(() => {
|
|
753
786
|
init_brandingConfig();
|
|
@@ -6887,7 +6920,7 @@ function getOauthConfig() {
|
|
|
6887
6920
|
}
|
|
6888
6921
|
return config;
|
|
6889
6922
|
}
|
|
6890
|
-
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,
|
|
6923
|
+
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;
|
|
6891
6924
|
var init_oauth = __esm(() => {
|
|
6892
6925
|
init_envUtils();
|
|
6893
6926
|
init_envVars();
|
|
@@ -22902,7 +22935,7 @@ var GIT_ROOT_NOT_FOUND, findGitRootImpl, findGitRoot, resolveCanonicalRoot, find
|
|
|
22902
22935
|
return getWorktreeCountFromFs();
|
|
22903
22936
|
}, stashToCleanState = async (message) => {
|
|
22904
22937
|
try {
|
|
22905
|
-
const stashMessage = message ||
|
|
22938
|
+
const stashMessage = message || `${getBranding().productName} auto-stash - ${new Date().toISOString()}`;
|
|
22906
22939
|
const { untracked } = await getFileStatus();
|
|
22907
22940
|
if (untracked.length > 0) {
|
|
22908
22941
|
const { code: addCode } = await execFileNoThrow(gitExe(), ["add", ...untracked], { preserveOutputOnError: false });
|
|
@@ -22929,6 +22962,7 @@ var init_git = __esm(() => {
|
|
|
22929
22962
|
init_log3();
|
|
22930
22963
|
init_memoize2();
|
|
22931
22964
|
init_which();
|
|
22965
|
+
init_branding();
|
|
22932
22966
|
GIT_ROOT_NOT_FOUND = Symbol("git-root-not-found");
|
|
22933
22967
|
findGitRootImpl = memoizeWithLRU((startPath) => {
|
|
22934
22968
|
const startTime = Date.now();
|
|
@@ -25744,7 +25778,8 @@ var init_types2 = __esm(() => {
|
|
|
25744
25778
|
type: literal("stdio").optional(),
|
|
25745
25779
|
command: string2().min(1, "Command cannot be empty"),
|
|
25746
25780
|
args: array(string2()).default([]),
|
|
25747
|
-
env: record(string2(), string2()).optional()
|
|
25781
|
+
env: record(string2(), string2()).optional(),
|
|
25782
|
+
cwd: string2().optional()
|
|
25748
25783
|
}));
|
|
25749
25784
|
McpXaaConfigSchema = lazySchema(() => boolean2());
|
|
25750
25785
|
McpOAuthConfigSchema = lazySchema(() => object({
|
|
@@ -26740,7 +26775,7 @@ var init_types3 = __esm(() => {
|
|
|
26740
26775
|
allow: array(PermissionRuleSchema()).optional().describe("List of permission rules for allowed operations"),
|
|
26741
26776
|
deny: array(PermissionRuleSchema()).optional().describe("List of permission rules for denied operations"),
|
|
26742
26777
|
ask: array(PermissionRuleSchema()).optional().describe("List of permission rules that should always prompt for confirmation"),
|
|
26743
|
-
defaultMode: _enum(EXTERNAL_PERMISSION_MODES).optional().describe("Default permission mode when
|
|
26778
|
+
defaultMode: _enum(EXTERNAL_PERMISSION_MODES).optional().describe("Default permission mode when the agent needs access"),
|
|
26744
26779
|
disableBypassPermissionsMode: _enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),
|
|
26745
26780
|
...{},
|
|
26746
26781
|
additionalDirectories: array(string2()).optional().describe("Additional directories to include in the permission scope")
|
|
@@ -26785,7 +26820,7 @@ var init_types3 = __esm(() => {
|
|
|
26785
26820
|
"mcp"
|
|
26786
26821
|
];
|
|
26787
26822
|
SettingsSchema = lazySchema(() => object({
|
|
26788
|
-
$schema: literal(CLAUDE_CODE_SETTINGS_SCHEMA_URL).optional().describe("JSON Schema reference for
|
|
26823
|
+
$schema: literal(CLAUDE_CODE_SETTINGS_SCHEMA_URL).optional().describe("JSON Schema reference for settings"),
|
|
26789
26824
|
apiKeyHelper: string2().optional().describe("Path to a script that outputs authentication values"),
|
|
26790
26825
|
awsCredentialExport: string2().optional().describe("Path to a script that exports AWS credentials"),
|
|
26791
26826
|
awsAuthRefresh: string2().optional().describe("Path to a script that refreshes AWS authentication"),
|
|
@@ -26793,7 +26828,7 @@ var init_types3 = __esm(() => {
|
|
|
26793
26828
|
...isEnvTruthy(resolveEnvVar("ENABLE_XAA")) ? {
|
|
26794
26829
|
xaaIdp: object({
|
|
26795
26830
|
issuer: string2().url().describe("IdP issuer URL for OIDC discovery"),
|
|
26796
|
-
clientId: string2().describe("
|
|
26831
|
+
clientId: string2().describe("The client_id registered at the IdP"),
|
|
26797
26832
|
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.")
|
|
26798
26833
|
}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")
|
|
26799
26834
|
} : {},
|
|
@@ -26803,10 +26838,10 @@ var init_types3 = __esm(() => {
|
|
|
26803
26838
|
}).optional().describe("Custom file suggestion configuration for @ mentions"),
|
|
26804
26839
|
respectGitignore: boolean2().optional().describe("Whether file picker should respect .gitignore files (default: true). " + "Note: .ignore files are always respected."),
|
|
26805
26840
|
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."),
|
|
26806
|
-
env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for
|
|
26841
|
+
env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for agent sessions"),
|
|
26807
26842
|
includeGitInstructions: boolean2().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),
|
|
26808
26843
|
permissions: PermissionsSchema().optional().describe("Tool usage permissions configuration"),
|
|
26809
|
-
model: string2().optional().describe("Override the default model used by
|
|
26844
|
+
model: string2().optional().describe("Override the default model used by the agent"),
|
|
26810
26845
|
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."),
|
|
26811
26846
|
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."),
|
|
26812
26847
|
enableAllProjectMcpServers: boolean2().optional().describe("Whether to automatically approve all MCP servers in the project"),
|
|
@@ -49640,11 +49675,6 @@ function parseAnthropicStreamChunk(chunk) {
|
|
|
49640
49675
|
return [chunk];
|
|
49641
49676
|
}
|
|
49642
49677
|
|
|
49643
|
-
// src/providers/shared/userAgent.ts
|
|
49644
|
-
function getClaudeCodeUserAgent() {
|
|
49645
|
-
return `claude-code/${"99.0.0"}`;
|
|
49646
|
-
}
|
|
49647
|
-
|
|
49648
49678
|
// src/session/workloadContext.ts
|
|
49649
49679
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
49650
49680
|
function getWorkload() {
|
|
@@ -49679,11 +49709,12 @@ function getMCPUserAgent() {
|
|
|
49679
49709
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
49680
49710
|
}
|
|
49681
49711
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
49682
|
-
return
|
|
49712
|
+
return `${getProductUserAgentToken()}/${"99.0.0"}${suffix}`;
|
|
49683
49713
|
}
|
|
49684
49714
|
function getWebFetchUserAgent() {
|
|
49685
|
-
const
|
|
49686
|
-
|
|
49715
|
+
const { productSlug, productUrl } = getBranding();
|
|
49716
|
+
const contact = productUrl ? `; +${productUrl}` : "";
|
|
49717
|
+
return `${productSlug}-User (${productSlug}/${"99.0.0"}${contact})`;
|
|
49687
49718
|
}
|
|
49688
49719
|
function getAuthHeaders() {
|
|
49689
49720
|
if (isClaudeAISubscriber()) {
|
|
@@ -49737,6 +49768,7 @@ var init_http2 = __esm(() => {
|
|
|
49737
49768
|
init_auth();
|
|
49738
49769
|
init_state();
|
|
49739
49770
|
init_workloadContext();
|
|
49771
|
+
init_branding();
|
|
49740
49772
|
});
|
|
49741
49773
|
|
|
49742
49774
|
// src/providers/shared/model/providers.ts
|
|
@@ -81127,6 +81159,7 @@ function buildQueryContextFromSdk(options) {
|
|
|
81127
81159
|
loaded: createSignal()
|
|
81128
81160
|
},
|
|
81129
81161
|
pluginDataPaths: new Map,
|
|
81162
|
+
pluginContentVariables: {},
|
|
81130
81163
|
lspManager: null
|
|
81131
81164
|
},
|
|
81132
81165
|
diagnostics: createFreshDiagnostics(),
|
|
@@ -81763,11 +81796,22 @@ function resetSdkInitState() {
|
|
|
81763
81796
|
r.initJsonSchema = null;
|
|
81764
81797
|
r.registeredHooks = null;
|
|
81765
81798
|
}
|
|
81766
|
-
function setExplicitPluginRuntimeContext(dataPaths, lspManager) {
|
|
81799
|
+
function setExplicitPluginRuntimeContext(dataPaths, lspManager, contentVariables) {
|
|
81767
81800
|
const registries = getQueryContext().registries;
|
|
81768
81801
|
registries.pluginDataPaths = new Map(dataPaths);
|
|
81802
|
+
registries.pluginContentVariables = { ...contentVariables };
|
|
81769
81803
|
registries.lspManager = lspManager;
|
|
81770
81804
|
}
|
|
81805
|
+
function setExplicitPluginRuntimeBundle(bundle) {
|
|
81806
|
+
setExplicitPluginRuntimeContext(bundle.dataPaths, bundle.lspManager, bundle.contentVariables ?? {});
|
|
81807
|
+
}
|
|
81808
|
+
function tryGetPluginContentVariables() {
|
|
81809
|
+
try {
|
|
81810
|
+
return getQueryContext().registries.pluginContentVariables;
|
|
81811
|
+
} catch {
|
|
81812
|
+
return {};
|
|
81813
|
+
}
|
|
81814
|
+
}
|
|
81771
81815
|
function tryGetExplicitPluginDataPath(pluginId) {
|
|
81772
81816
|
try {
|
|
81773
81817
|
return getQueryContext().registries.pluginDataPaths.get(pluginId);
|
|
@@ -82233,6 +82277,7 @@ __export(exports_state, {
|
|
|
82233
82277
|
setCwdState: () => setCwdState,
|
|
82234
82278
|
setDirectConnectServerUrl: () => setDirectConnectServerUrl,
|
|
82235
82279
|
setEnvVar: () => setEnvVar,
|
|
82280
|
+
setExplicitPluginRuntimeBundle: () => setExplicitPluginRuntimeBundle,
|
|
82236
82281
|
setExplicitPluginRuntimeContext: () => setExplicitPluginRuntimeContext,
|
|
82237
82282
|
setFastModeHeaderLatched: () => setFastModeHeaderLatched,
|
|
82238
82283
|
setFlagSettingsInline: () => setFlagSettingsInline,
|
|
@@ -82269,6 +82314,7 @@ __export(exports_state, {
|
|
|
82269
82314
|
snapshotOutputTokensForTurn: () => snapshotOutputTokensForTurn,
|
|
82270
82315
|
switchSession: () => switchSession,
|
|
82271
82316
|
tryGetExplicitPluginDataPath: () => tryGetExplicitPluginDataPath,
|
|
82317
|
+
tryGetPluginContentVariables: () => tryGetPluginContentVariables,
|
|
82272
82318
|
tryGetQueryContext: () => tryGetQueryContext,
|
|
82273
82319
|
tryGetSessionLspManager: () => tryGetSessionLspManager,
|
|
82274
82320
|
unregisterCreatedTeam: () => unregisterCreatedTeam
|
|
@@ -82384,7 +82430,7 @@ function setMeter(meter, createCounter) {
|
|
|
82384
82430
|
description: "Number of git commits created"
|
|
82385
82431
|
});
|
|
82386
82432
|
STATE.costCounter = createCounter("claude_code.cost.usage", {
|
|
82387
|
-
description: "Cost of the
|
|
82433
|
+
description: "Cost of the agent session",
|
|
82388
82434
|
unit: "USD"
|
|
82389
82435
|
});
|
|
82390
82436
|
STATE.tokenCounter = createCounter("claude_code.token.usage", {
|
|
@@ -84260,6 +84306,7 @@ function createBootQueryContext() {
|
|
|
84260
84306
|
loaded: createSignal()
|
|
84261
84307
|
},
|
|
84262
84308
|
pluginDataPaths: new Map,
|
|
84309
|
+
pluginContentVariables: {},
|
|
84263
84310
|
lspManager: null
|
|
84264
84311
|
},
|
|
84265
84312
|
diagnostics: createFreshDiagnostics(),
|
|
@@ -84351,6 +84398,7 @@ function deriveSubagentRegistries(parent) {
|
|
|
84351
84398
|
skillListingSuppressNext: false,
|
|
84352
84399
|
dynamicSkills: parent.dynamicSkills,
|
|
84353
84400
|
pluginDataPaths: parent.pluginDataPaths,
|
|
84401
|
+
pluginContentVariables: parent.pluginContentVariables,
|
|
84354
84402
|
lspManager: parent.lspManager
|
|
84355
84403
|
};
|
|
84356
84404
|
}
|
|
@@ -86678,7 +86726,7 @@ function printStartupScreen() {
|
|
|
86678
86726
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
86679
86727
|
out.push(boxRow(sRow, W, sLen));
|
|
86680
86728
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W - 2)}╝${RESET}`);
|
|
86681
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.
|
|
86729
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.28"}${RESET}`);
|
|
86682
86730
|
out.push("");
|
|
86683
86731
|
process.stdout.write(out.join(`
|
|
86684
86732
|
`) + `
|
|
@@ -87720,7 +87768,7 @@ function getRemoteSessionUrl(sessionId, ingressUrl) {
|
|
|
87720
87768
|
const baseUrl = getClaudeAiBaseUrl(compatId, ingressUrl);
|
|
87721
87769
|
return `${baseUrl}/code/${compatId}`;
|
|
87722
87770
|
}
|
|
87723
|
-
var
|
|
87771
|
+
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";
|
|
87724
87772
|
|
|
87725
87773
|
// src/constants/system.ts
|
|
87726
87774
|
function isCLISyspromptPrefix(value) {
|
|
@@ -105057,6 +105105,10 @@ function tokenCountWithEstimation(messages) {
|
|
|
105057
105105
|
}
|
|
105058
105106
|
return getTokenCountFromUsage(usage) + roughTokenCountEstimationForMessages(messages.slice(i + 1));
|
|
105059
105107
|
}
|
|
105108
|
+
const baselineTokens = message?.contextBaselineTokens;
|
|
105109
|
+
if (typeof baselineTokens === "number" && Number.isFinite(baselineTokens) && baselineTokens >= 0) {
|
|
105110
|
+
return baselineTokens + roughTokenCountEstimationForMessages(messages.slice(i + 1));
|
|
105111
|
+
}
|
|
105060
105112
|
i--;
|
|
105061
105113
|
}
|
|
105062
105114
|
return roughTokenCountEstimationForMessages(messages);
|
|
@@ -106162,6 +106214,7 @@ var init_TaskOutput = __esm(() => {
|
|
|
106162
106214
|
init_stringUtils();
|
|
106163
106215
|
init_diskOutput();
|
|
106164
106216
|
init_fsOperations();
|
|
106217
|
+
init_branding();
|
|
106165
106218
|
DEFAULT_MAX_MEMORY = 8 * 1024 * 1024;
|
|
106166
106219
|
TaskOutput = class TaskOutput {
|
|
106167
106220
|
taskId;
|
|
@@ -106349,7 +106402,7 @@ Output truncated (${sizeKB}KB total). Full output saved to: ${this.path}`;
|
|
|
106349
106402
|
} catch (err) {
|
|
106350
106403
|
const code = err instanceof Error && "code" in err ? String(err.code) : "unknown";
|
|
106351
106404
|
logForDebugging2(`TaskOutput.#readStdoutFromFile: failed to read ${this.path} (${code}): ${err}`);
|
|
106352
|
-
return `<bash output unavailable: output file ${this.path} could not be read (${code}). This usually means another
|
|
106405
|
+
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.>`;
|
|
106353
106406
|
}
|
|
106354
106407
|
}
|
|
106355
106408
|
getStderr() {
|
|
@@ -110129,7 +110182,7 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
110129
110182
|
logForDebugging2(`Looking for shell config file: ${configFile}`);
|
|
110130
110183
|
const configFileExists = await pathExists(configFile);
|
|
110131
110184
|
if (!configFileExists) {
|
|
110132
|
-
logForDebugging2(`Shell config file not found: ${configFile}, creating snapshot with
|
|
110185
|
+
logForDebugging2(`Shell config file not found: ${configFile}, creating snapshot with ${getBranding().productName} defaults only`);
|
|
110133
110186
|
}
|
|
110134
110187
|
const timestamp = Date.now();
|
|
110135
110188
|
const randomId = Math.random().toString(36).substring(2, 8);
|
|
@@ -110242,6 +110295,7 @@ var init_ShellSnapshot = __esm(() => {
|
|
|
110242
110295
|
init_subprocessEnv();
|
|
110243
110296
|
init_shellQuote();
|
|
110244
110297
|
init_state();
|
|
110298
|
+
init_branding();
|
|
110245
110299
|
VCS_DIRECTORIES_TO_EXCLUDE = [
|
|
110246
110300
|
".git",
|
|
110247
110301
|
".svn",
|
|
@@ -135256,6 +135310,11 @@ function substitutePluginVariables(value, plugin) {
|
|
|
135256
135310
|
}
|
|
135257
135311
|
return out;
|
|
135258
135312
|
}
|
|
135313
|
+
function substitutePluginContentVariables(value, variables = tryGetPluginContentVariables()) {
|
|
135314
|
+
if (Object.keys(variables).length === 0)
|
|
135315
|
+
return value;
|
|
135316
|
+
return value.replace(/\$\{([A-Z][A-Z0-9_]*)\}/g, (match, name) => Object.hasOwn(variables, name) ? variables[name] : match);
|
|
135317
|
+
}
|
|
135259
135318
|
function substituteUserConfigVariables(value, userConfig) {
|
|
135260
135319
|
return value.replace(/\$\{user_config\.([^}]+)\}/g, (_match, key) => {
|
|
135261
135320
|
const configValue = userConfig[key];
|
|
@@ -135299,7 +135358,7 @@ var init_pluginOptionsStorage = __esm(() => {
|
|
|
135299
135358
|
});
|
|
135300
135359
|
|
|
135301
135360
|
// src/capabilities/plugins/mcpPluginIntegration.ts
|
|
135302
|
-
import { join as join47 } from "path";
|
|
135361
|
+
import { join as join47, resolve as resolvePath } from "path";
|
|
135303
135362
|
async function loadMcpServersFromMcpb(plugin, mcpbPath, errors) {
|
|
135304
135363
|
try {
|
|
135305
135364
|
logForDebugging2(`Loading MCP servers from MCPB: ${mcpbPath}`);
|
|
@@ -135532,6 +135591,9 @@ function resolvePluginMcpEnvironment(config, plugin, userConfig, errors, pluginN
|
|
|
135532
135591
|
if (stdioConfig.args) {
|
|
135533
135592
|
stdioConfig.args = stdioConfig.args.map((arg) => resolveValue(arg));
|
|
135534
135593
|
}
|
|
135594
|
+
if (stdioConfig.cwd) {
|
|
135595
|
+
stdioConfig.cwd = resolvePath(plugin.path, resolveValue(stdioConfig.cwd));
|
|
135596
|
+
}
|
|
135535
135597
|
const resolvedEnv = {
|
|
135536
135598
|
CLAUDE_PLUGIN_ROOT: plugin.path,
|
|
135537
135599
|
CLAUDE_PLUGIN_DATA: plugin.dataPath ?? getPluginDataDir(plugin.source),
|
|
@@ -136256,160 +136318,6 @@ var init_agentMemorySnapshot = __esm(() => {
|
|
|
136256
136318
|
}));
|
|
136257
136319
|
});
|
|
136258
136320
|
|
|
136259
|
-
// src/capabilities/tools/AgentTool/built-in/claudeCodeGuideAgent.ts
|
|
136260
|
-
function getClaudeCodeGuideBasePrompt() {
|
|
136261
|
-
const localSearchHint = hasEmbeddedSearchTools() ? `${FILE_READ_TOOL_NAME}, \`find\`, and \`grep\`` : `${FILE_READ_TOOL_NAME}, ${GLOB_TOOL_NAME}, and ${GREP_TOOL_NAME}`;
|
|
136262
|
-
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.
|
|
136263
|
-
|
|
136264
|
-
**Your expertise spans three domains:**
|
|
136265
|
-
|
|
136266
|
-
1. **Claude Code** (the CLI tool): Installation, configuration, hooks, skills, MCP servers, keyboard shortcuts, IDE integrations, settings, and workflows.
|
|
136267
|
-
|
|
136268
|
-
2. **Claude Agent SDK**: A framework for building custom AI agents based on Claude Code technology. Available for Node.js/TypeScript and Python.
|
|
136269
|
-
|
|
136270
|
-
3. **Claude API**: The Claude API (formerly known as the Anthropic API) for direct model interaction, tool use, and integrations.
|
|
136271
|
-
|
|
136272
|
-
**Documentation sources:**
|
|
136273
|
-
|
|
136274
|
-
- **Claude Code docs** (${CLAUDE_CODE_DOCS_MAP_URL}): Fetch this for questions about the Claude Code CLI tool, including:
|
|
136275
|
-
- Installation, setup, and getting started
|
|
136276
|
-
- Hooks (pre/post command execution)
|
|
136277
|
-
- Custom skills
|
|
136278
|
-
- MCP server configuration
|
|
136279
|
-
- IDE integrations (VS Code, JetBrains)
|
|
136280
|
-
- Settings files and configuration
|
|
136281
|
-
- Keyboard shortcuts and hotkeys
|
|
136282
|
-
- Subagents and plugins
|
|
136283
|
-
- Sandboxing and security
|
|
136284
|
-
|
|
136285
|
-
- **Claude Agent SDK docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about building agents with the SDK, including:
|
|
136286
|
-
- SDK overview and getting started (Python and TypeScript)
|
|
136287
|
-
- Agent configuration + custom tools
|
|
136288
|
-
- Session management and permissions
|
|
136289
|
-
- MCP integration in agents
|
|
136290
|
-
- Hosting and deployment
|
|
136291
|
-
- Cost tracking and context management
|
|
136292
|
-
Note: Agent SDK docs are part of the Claude API documentation at the same URL.
|
|
136293
|
-
|
|
136294
|
-
- **Claude API docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about the Claude API (formerly the Anthropic API), including:
|
|
136295
|
-
- Messages API and streaming
|
|
136296
|
-
- 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)
|
|
136297
|
-
- Vision, PDF support, and citations
|
|
136298
|
-
- Extended thinking and structured outputs
|
|
136299
|
-
- MCP connector for remote MCP servers
|
|
136300
|
-
- Cloud provider integrations (Bedrock, Vertex AI, Foundry)
|
|
136301
|
-
|
|
136302
|
-
**Approach:**
|
|
136303
|
-
1. Determine which domain the user's question falls into
|
|
136304
|
-
2. Use ${WEB_FETCH_TOOL_NAME} to fetch the appropriate docs map
|
|
136305
|
-
3. Identify the most relevant documentation URLs from the map
|
|
136306
|
-
4. Fetch the specific documentation pages
|
|
136307
|
-
5. Provide clear, actionable guidance based on official documentation
|
|
136308
|
-
6. Use ${WEB_SEARCH_TOOL_NAME} if docs don't cover the topic
|
|
136309
|
-
7. Reference local project files (CLAUDE.md, .claude/ directory) when relevant using ${localSearchHint}
|
|
136310
|
-
|
|
136311
|
-
**Guidelines:**
|
|
136312
|
-
- Always prioritize official documentation over assumptions
|
|
136313
|
-
- Keep responses concise and actionable
|
|
136314
|
-
- Include specific examples or code snippets when helpful
|
|
136315
|
-
- Reference exact documentation URLs in your responses
|
|
136316
|
-
- Help users discover features by proactively suggesting related commands, shortcuts, or capabilities
|
|
136317
|
-
|
|
136318
|
-
Complete the user's request by providing accurate, documentation-based guidance.`;
|
|
136319
|
-
}
|
|
136320
|
-
function getFeedbackGuideline() {
|
|
136321
|
-
if (isUsing3PServices()) {
|
|
136322
|
-
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"}`;
|
|
136323
|
-
}
|
|
136324
|
-
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";
|
|
136325
|
-
}
|
|
136326
|
-
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;
|
|
136327
|
-
var init_claudeCodeGuideAgent = __esm(() => {
|
|
136328
|
-
init_auth();
|
|
136329
|
-
init_embeddedTools();
|
|
136330
|
-
init_settings2();
|
|
136331
|
-
init_slowOperations();
|
|
136332
|
-
CLAUDE_CODE_GUIDE_AGENT = {
|
|
136333
|
-
agentType: CLAUDE_CODE_GUIDE_AGENT_TYPE,
|
|
136334
|
-
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}.`,
|
|
136335
|
-
tools: hasEmbeddedSearchTools() ? [
|
|
136336
|
-
BASH_TOOL_NAME,
|
|
136337
|
-
FILE_READ_TOOL_NAME,
|
|
136338
|
-
WEB_FETCH_TOOL_NAME,
|
|
136339
|
-
WEB_SEARCH_TOOL_NAME
|
|
136340
|
-
] : [
|
|
136341
|
-
GLOB_TOOL_NAME,
|
|
136342
|
-
GREP_TOOL_NAME,
|
|
136343
|
-
FILE_READ_TOOL_NAME,
|
|
136344
|
-
WEB_FETCH_TOOL_NAME,
|
|
136345
|
-
WEB_SEARCH_TOOL_NAME
|
|
136346
|
-
],
|
|
136347
|
-
source: "built-in",
|
|
136348
|
-
baseDir: "built-in",
|
|
136349
|
-
model: "haiku",
|
|
136350
|
-
permissionMode: "dontAsk",
|
|
136351
|
-
getSystemPrompt({ toolUseContext }) {
|
|
136352
|
-
const commands = toolUseContext.options.commands;
|
|
136353
|
-
const contextSections = [];
|
|
136354
|
-
const customCommands = commands.filter((cmd) => cmd.type === "prompt");
|
|
136355
|
-
if (customCommands.length > 0) {
|
|
136356
|
-
const commandList = customCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
|
|
136357
|
-
`);
|
|
136358
|
-
contextSections.push(`**Available custom skills in this project:**
|
|
136359
|
-
${commandList}`);
|
|
136360
|
-
}
|
|
136361
|
-
const customAgents = toolUseContext.options.agentDefinitions.activeAgents.filter((a) => a.source !== "built-in");
|
|
136362
|
-
if (customAgents.length > 0) {
|
|
136363
|
-
const agentList = customAgents.map((a) => `- ${a.agentType}: ${a.whenToUse}`).join(`
|
|
136364
|
-
`);
|
|
136365
|
-
contextSections.push(`**Available custom agents configured:**
|
|
136366
|
-
${agentList}`);
|
|
136367
|
-
}
|
|
136368
|
-
const mcpClients = toolUseContext.options.mcpClients;
|
|
136369
|
-
if (mcpClients && mcpClients.length > 0) {
|
|
136370
|
-
const mcpList = mcpClients.map((client) => `- ${client.name}`).join(`
|
|
136371
|
-
`);
|
|
136372
|
-
contextSections.push(`**Configured MCP servers:**
|
|
136373
|
-
${mcpList}`);
|
|
136374
|
-
}
|
|
136375
|
-
const pluginCommands = commands.filter((cmd) => cmd.type === "prompt" && cmd.source === "plugin");
|
|
136376
|
-
if (pluginCommands.length > 0) {
|
|
136377
|
-
const pluginList = pluginCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
|
|
136378
|
-
`);
|
|
136379
|
-
contextSections.push(`**Available plugin skills:**
|
|
136380
|
-
${pluginList}`);
|
|
136381
|
-
}
|
|
136382
|
-
const settings = getSettings_DEPRECATED();
|
|
136383
|
-
if (Object.keys(settings).length > 0) {
|
|
136384
|
-
const settingsJson = jsonStringify(settings, null, 2);
|
|
136385
|
-
contextSections.push(`**User's settings.json:**
|
|
136386
|
-
\`\`\`json
|
|
136387
|
-
${settingsJson}
|
|
136388
|
-
\`\`\``);
|
|
136389
|
-
}
|
|
136390
|
-
const feedbackGuideline = getFeedbackGuideline();
|
|
136391
|
-
const basePromptWithFeedback = `${getClaudeCodeGuideBasePrompt()}
|
|
136392
|
-
${feedbackGuideline}`;
|
|
136393
|
-
if (contextSections.length > 0) {
|
|
136394
|
-
return `${basePromptWithFeedback}
|
|
136395
|
-
|
|
136396
|
-
---
|
|
136397
|
-
|
|
136398
|
-
# User's Current Configuration
|
|
136399
|
-
|
|
136400
|
-
The user has the following custom setup in their environment:
|
|
136401
|
-
|
|
136402
|
-
${contextSections.join(`
|
|
136403
|
-
|
|
136404
|
-
`)}
|
|
136405
|
-
|
|
136406
|
-
When answering questions, consider these configured features and proactively suggest them when relevant.`;
|
|
136407
|
-
}
|
|
136408
|
-
return basePromptWithFeedback;
|
|
136409
|
-
}
|
|
136410
|
-
};
|
|
136411
|
-
});
|
|
136412
|
-
|
|
136413
136321
|
// src/capabilities/tools/AgentTool/built-in/exploreAgent.ts
|
|
136414
136322
|
function getExploreSystemPrompt() {
|
|
136415
136323
|
const embedded = hasEmbeddedSearchTools();
|
|
@@ -136876,17 +136784,12 @@ function getBuiltInAgents() {
|
|
|
136876
136784
|
if (areExplorePlanAgentsEnabled()) {
|
|
136877
136785
|
agents.push(EXPLORE_AGENT, PLAN_AGENT);
|
|
136878
136786
|
}
|
|
136879
|
-
const isNonSdkEntrypoint = resolveEnvVar("ENTRYPOINT") !== "sdk-ts" && resolveEnvVar("ENTRYPOINT") !== "sdk-py" && resolveEnvVar("ENTRYPOINT") !== "sdk-cli";
|
|
136880
|
-
if (isNonSdkEntrypoint) {
|
|
136881
|
-
agents.push(CLAUDE_CODE_GUIDE_AGENT);
|
|
136882
|
-
}
|
|
136883
136787
|
if (false) {}
|
|
136884
136788
|
return agents;
|
|
136885
136789
|
}
|
|
136886
136790
|
var init_builtInAgents = __esm(() => {
|
|
136887
136791
|
init_state2();
|
|
136888
136792
|
init_envUtils();
|
|
136889
|
-
init_claudeCodeGuideAgent();
|
|
136890
136793
|
init_exploreAgent();
|
|
136891
136794
|
init_generalPurposeAgent();
|
|
136892
136795
|
init_planAgent();
|
|
@@ -138862,7 +138765,7 @@ function getErrorMessageIfRefusal(stopReason, model) {
|
|
|
138862
138765
|
}
|
|
138863
138766
|
logEvent("tengu_refusal_api_response", {});
|
|
138864
138767
|
const usagePolicyUrl = isFamily(getProvider(), "firstParty") ? "https://www.anthropic.com/legal/aup" : "your provider's acceptable use policy";
|
|
138865
|
-
const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}:
|
|
138768
|
+
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.`;
|
|
138866
138769
|
const modelSuggestion = model !== "claude-sonnet-4-20250514" ? " If you are seeing this refusal repeatedly, try running /model claude-sonnet-4-20250514 to switch models." : "";
|
|
138867
138770
|
return createAssistantAPIErrorMessage({
|
|
138868
138771
|
content: baseMessage + modelSuggestion,
|
|
@@ -138909,6 +138812,7 @@ var init_errors8 = __esm(() => {
|
|
|
138909
138812
|
init_claudeAiLimits();
|
|
138910
138813
|
init_mocking();
|
|
138911
138814
|
init_errorUtils();
|
|
138815
|
+
init_branding();
|
|
138912
138816
|
});
|
|
138913
138817
|
|
|
138914
138818
|
// src/providers/shared/retry.ts
|
|
@@ -138930,6 +138834,9 @@ function wrapBodyTransportError(error) {
|
|
|
138930
138834
|
return new APIConnectionError({ message: error.message, cause: error });
|
|
138931
138835
|
}
|
|
138932
138836
|
function toReplayableStreamError(error) {
|
|
138837
|
+
if (error instanceof EmptyStreamError) {
|
|
138838
|
+
return new APIConnectionError({ message: error.message, cause: error });
|
|
138839
|
+
}
|
|
138933
138840
|
const wrapped = error instanceof Error && error.message.startsWith(STREAM_WATCHDOG_ABORT_PREFIX) ? new APIConnectionError({ message: error.message, cause: error }) : wrapBodyTransportError(error);
|
|
138934
138841
|
if (!(wrapped instanceof APIConnectionError) || wrapped instanceof APIConnectionTimeoutError || extractConnectionErrorDetails(wrapped)?.isSSLError) {
|
|
138935
138842
|
return null;
|
|
@@ -139388,7 +139295,7 @@ function getRateLimitResetDelayMs(error) {
|
|
|
139388
139295
|
}
|
|
139389
139296
|
return null;
|
|
139390
139297
|
}
|
|
139391
|
-
var abortError = () => new APIUserAbortError, DEFAULT_MAX_RETRIES = 10, FLOOR_OUTPUT_TOKENS = 3000, MAX_529_RETRIES = 3, BASE_DELAY_MS = 500, FOREGROUND_529_RETRY_SOURCES, CONNECTION_WAIT_INITIAL_DELAY_MS = 5000, CONNECTION_WAIT_MAX_DELAY_MS = 60000, BODY_TRANSPORT_FAILURE_RE, STREAM_WATCHDOG_ABORT_PREFIX = "Stream idle timeout", PERSISTENT_MAX_BACKOFF_MS, PERSISTENT_RESET_CAP_MS, HEARTBEAT_INTERVAL_MS = 30000, DEFAULT_CONNECTION_WAIT_BACKOFF, CannotRetryError, FallbackTriggeredError, DEFAULT_FAST_MODE_FALLBACK_HOLD_MS, SHORT_RETRY_THRESHOLD_MS, MIN_COOLDOWN_MS;
|
|
139298
|
+
var abortError = () => new APIUserAbortError, DEFAULT_MAX_RETRIES = 10, FLOOR_OUTPUT_TOKENS = 3000, MAX_529_RETRIES = 3, BASE_DELAY_MS = 500, FOREGROUND_529_RETRY_SOURCES, CONNECTION_WAIT_INITIAL_DELAY_MS = 5000, CONNECTION_WAIT_MAX_DELAY_MS = 60000, BODY_TRANSPORT_FAILURE_RE, STREAM_WATCHDOG_ABORT_PREFIX = "Stream idle timeout", EmptyStreamError, PERSISTENT_MAX_BACKOFF_MS, PERSISTENT_RESET_CAP_MS, HEARTBEAT_INTERVAL_MS = 30000, DEFAULT_CONNECTION_WAIT_BACKOFF, CannotRetryError, FallbackTriggeredError, DEFAULT_FAST_MODE_FALLBACK_HOLD_MS, SHORT_RETRY_THRESHOLD_MS, MIN_COOLDOWN_MS;
|
|
139392
139299
|
var init_retry = __esm(() => {
|
|
139393
139300
|
init_sdk();
|
|
139394
139301
|
init_aws();
|
|
@@ -139425,6 +139332,12 @@ var init_retry = __esm(() => {
|
|
|
139425
139332
|
...[]
|
|
139426
139333
|
]);
|
|
139427
139334
|
BODY_TRANSPORT_FAILURE_RE = /socket connection was closed|^terminated$|other side closed|fetch failed/i;
|
|
139335
|
+
EmptyStreamError = class EmptyStreamError extends Error {
|
|
139336
|
+
constructor(message = "Stream ended before completing the response") {
|
|
139337
|
+
super(message);
|
|
139338
|
+
this.name = "EmptyStreamError";
|
|
139339
|
+
}
|
|
139340
|
+
};
|
|
139428
139341
|
PERSISTENT_MAX_BACKOFF_MS = 5 * 60 * 1000;
|
|
139429
139342
|
PERSISTENT_RESET_CAP_MS = 6 * 60 * 60 * 1000;
|
|
139430
139343
|
DEFAULT_CONNECTION_WAIT_BACKOFF = {
|
|
@@ -231366,12 +231279,11 @@ async function* runPostToolUseFailureHooks(toolUseContext, tool, toolUseID, mess
|
|
|
231366
231279
|
}
|
|
231367
231280
|
async function resolveHookPermissionDecision(hookPermissionResult, tool, input, toolUseContext, canUseTool, assistantMessage, toolUseID) {
|
|
231368
231281
|
const requiresInteraction = tool.requiresUserInteraction?.();
|
|
231369
|
-
const requireCanUseTool = toolUseContext.requireCanUseTool;
|
|
231370
231282
|
if (hookPermissionResult?.behavior === "allow") {
|
|
231371
231283
|
const hookInput = hookPermissionResult.updatedInput ?? input;
|
|
231372
231284
|
const interactionSatisfied = requiresInteraction && hookPermissionResult.updatedInput !== undefined;
|
|
231373
|
-
if (
|
|
231374
|
-
logForDebugging2(`Hook approved tool use for ${tool.name},
|
|
231285
|
+
if (!interactionSatisfied) {
|
|
231286
|
+
logForDebugging2(`Hook approved tool use for ${tool.name}, deferring final decision to canUseTool`);
|
|
231375
231287
|
return {
|
|
231376
231288
|
decision: await consumePermissionPreDecision(toolUseContext, toolUseID, hookInput, () => canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID)),
|
|
231377
231289
|
input: hookInput
|
|
@@ -231379,7 +231291,7 @@ async function resolveHookPermissionDecision(hookPermissionResult, tool, input,
|
|
|
231379
231291
|
}
|
|
231380
231292
|
const ruleCheck = await checkRuleBasedPermissions(tool, hookInput, toolUseContext);
|
|
231381
231293
|
if (ruleCheck === null) {
|
|
231382
|
-
logForDebugging2(
|
|
231294
|
+
logForDebugging2(`Hook satisfied user interaction for ${tool.name} via updatedInput`);
|
|
231383
231295
|
return { decision: hookPermissionResult, input: hookInput };
|
|
231384
231296
|
}
|
|
231385
231297
|
if (ruleCheck.behavior === "deny") {
|
|
@@ -235260,7 +235172,7 @@ function getAnthropicEnvMetadata() {
|
|
|
235260
235172
|
function getBuildAgeMinutes() {
|
|
235261
235173
|
if (false)
|
|
235262
235174
|
;
|
|
235263
|
-
const buildTime = new Date("2026-10-
|
|
235175
|
+
const buildTime = new Date("2026-10-24T12:55:52.344Z").getTime();
|
|
235264
235176
|
if (isNaN(buildTime))
|
|
235265
235177
|
return;
|
|
235266
235178
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -237580,7 +237492,7 @@ function hookSourceDescriptionDisplayString(source) {
|
|
|
237580
237492
|
case "sessionHook":
|
|
237581
237493
|
return "Session hooks (in-memory, temporary)";
|
|
237582
237494
|
case "builtinHook":
|
|
237583
|
-
return "Built-in hooks (registered internally
|
|
237495
|
+
return "Built-in hooks (registered internally)";
|
|
237584
237496
|
default:
|
|
237585
237497
|
return source;
|
|
237586
237498
|
}
|
|
@@ -239847,6 +239759,11 @@ NOTE: You just closed out 3+ tasks and none of them was a verification step. Bef
|
|
|
239847
239759
|
});
|
|
239848
239760
|
});
|
|
239849
239761
|
|
|
239762
|
+
// src/providers/shared/userAgent.ts
|
|
239763
|
+
function getClaudeCodeUserAgent() {
|
|
239764
|
+
return `claude-code/${"99.0.0"}`;
|
|
239765
|
+
}
|
|
239766
|
+
|
|
239850
239767
|
// src/providers/anthropic/policyLimits/types.ts
|
|
239851
239768
|
var PolicyLimitsResponseSchema;
|
|
239852
239769
|
var init_types8 = __esm(() => {
|
|
@@ -242328,7 +242245,8 @@ var init_coreSchemas = __esm(() => {
|
|
|
242328
242245
|
type: literal("stdio").optional(),
|
|
242329
242246
|
command: string2(),
|
|
242330
242247
|
args: array(string2()).optional(),
|
|
242331
|
-
env: record(string2(), string2()).optional()
|
|
242248
|
+
env: record(string2(), string2()).optional(),
|
|
242249
|
+
cwd: string2().optional()
|
|
242332
242250
|
}));
|
|
242333
242251
|
McpSSEServerConfigSchema2 = lazySchema(() => object({
|
|
242334
242252
|
type: literal("sse"),
|
|
@@ -243077,6 +242995,11 @@ var init_coreSchemas = __esm(() => {
|
|
|
243077
242995
|
trigger: _enum(["manual", "auto"]),
|
|
243078
242996
|
pre_tokens: number2(),
|
|
243079
242997
|
post_tokens: number2().optional().describe("Estimated resulting context size after compaction."),
|
|
242998
|
+
context_snapshot: object({
|
|
242999
|
+
schemaVersion: literal(1),
|
|
243000
|
+
messages: array(unknown()),
|
|
243001
|
+
baselineTokens: number2()
|
|
243002
|
+
}).optional().describe("Opaque canonical post-compact context. Hosts persist and return it unchanged via Options.initialContextSnapshot."),
|
|
243080
243003
|
preserved_segment: object({
|
|
243081
243004
|
head_uuid: UUIDPlaceholder(),
|
|
243082
243005
|
anchor_uuid: UUIDPlaceholder(),
|
|
@@ -248743,7 +248666,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
248743
248666
|
if (validator && !validator(args)) {
|
|
248744
248667
|
return {
|
|
248745
248668
|
behavior: "ask",
|
|
248746
|
-
message: `${command} with flags requires manual approval to ensure path safety. For security,
|
|
248669
|
+
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.`,
|
|
248747
248670
|
decisionReason: {
|
|
248748
248671
|
type: "other",
|
|
248749
248672
|
reason: `${command} command with flags requires manual approval`
|
|
@@ -248753,7 +248676,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
248753
248676
|
if (compoundCommandHasCd && operationType !== "read") {
|
|
248754
248677
|
return {
|
|
248755
248678
|
behavior: "ask",
|
|
248756
|
-
message: `Commands that change directories and perform write operations require explicit approval to ensure paths are evaluated correctly. For security,
|
|
248679
|
+
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.`,
|
|
248757
248680
|
decisionReason: {
|
|
248758
248681
|
type: "other",
|
|
248759
248682
|
reason: "Compound command contains cd with write operation - manual approval required to prevent path resolution bypass"
|
|
@@ -248765,7 +248688,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
248765
248688
|
if (!allowed) {
|
|
248766
248689
|
const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
|
|
248767
248690
|
const dirListStr = formatDirectoryList(workingDirs);
|
|
248768
|
-
const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : `${command} in '${resolvedPath}' was blocked. For security,
|
|
248691
|
+
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}.`;
|
|
248769
248692
|
if (decisionReason?.type === "rule") {
|
|
248770
248693
|
return {
|
|
248771
248694
|
behavior: "deny",
|
|
@@ -248890,7 +248813,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
|
|
|
248890
248813
|
if (compoundCommandHasCd && redirections.length > 0) {
|
|
248891
248814
|
return {
|
|
248892
248815
|
behavior: "ask",
|
|
248893
|
-
message: `Commands that change directories and write via output redirection require explicit approval to ensure paths are evaluated correctly. For security,
|
|
248816
|
+
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.`,
|
|
248894
248817
|
decisionReason: {
|
|
248895
248818
|
type: "other",
|
|
248896
248819
|
reason: "Compound command contains cd with output redirection - manual approval required to prevent path resolution bypass"
|
|
@@ -248905,7 +248828,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
|
|
|
248905
248828
|
if (!allowed) {
|
|
248906
248829
|
const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
|
|
248907
248830
|
const dirListStr = formatDirectoryList(workingDirs);
|
|
248908
|
-
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,
|
|
248831
|
+
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}.`;
|
|
248909
248832
|
if (decisionReason?.type === "rule") {
|
|
248910
248833
|
return {
|
|
248911
248834
|
behavior: "deny",
|
|
@@ -249112,6 +249035,7 @@ var init_pathValidation2 = __esm(() => {
|
|
|
249112
249035
|
init_pathValidation();
|
|
249113
249036
|
init_bashPermissions();
|
|
249114
249037
|
init_sedValidation();
|
|
249038
|
+
init_branding();
|
|
249115
249039
|
PATH_EXTRACTORS = {
|
|
249116
249040
|
cd: (args) => args.length === 0 ? [homedir18()] : [args.join(" ")],
|
|
249117
249041
|
ls: (args) => {
|
|
@@ -262129,7 +262053,7 @@ function validateInputForSettingsFileEdit(filePath, originalContent, getUpdatedC
|
|
|
262129
262053
|
if (!afterValidation.isValid) {
|
|
262130
262054
|
return {
|
|
262131
262055
|
result: false,
|
|
262132
|
-
message: `
|
|
262056
|
+
message: `settings.json validation failed after edit:
|
|
262133
262057
|
${afterValidation.error}
|
|
262134
262058
|
|
|
262135
262059
|
Full schema:
|
|
@@ -273999,6 +273923,7 @@ ${content}`;
|
|
|
273999
273923
|
source: sourceName,
|
|
274000
273924
|
dataPath: pluginDataPath
|
|
274001
273925
|
});
|
|
273926
|
+
finalContent = substitutePluginContentVariables(finalContent);
|
|
274002
273927
|
if (pluginManifest.userConfig) {
|
|
274003
273928
|
finalContent = substituteUserConfigInContent(finalContent, loadPluginOptions(sourceName), pluginManifest.userConfig);
|
|
274004
273929
|
}
|
|
@@ -281437,7 +281362,7 @@ async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl,
|
|
|
281437
281362
|
}
|
|
281438
281363
|
if (code) {
|
|
281439
281364
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
281440
|
-
res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to
|
|
281365
|
+
res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to ${import_xss2.default(getBranding().productName)}.</p>`);
|
|
281441
281366
|
cleanup();
|
|
281442
281367
|
resolveOnce(code);
|
|
281443
281368
|
}
|
|
@@ -281603,7 +281528,7 @@ class ClaudeAuthProvider {
|
|
|
281603
281528
|
}
|
|
281604
281529
|
get clientMetadata() {
|
|
281605
281530
|
const metadata = {
|
|
281606
|
-
client_name:
|
|
281531
|
+
client_name: `${getBranding().productName} (${this.serverName})`,
|
|
281607
281532
|
redirect_uris: [this.redirectUri],
|
|
281608
281533
|
grant_types: ["authorization_code", "refresh_token"],
|
|
281609
281534
|
response_types: ["code"],
|
|
@@ -281622,7 +281547,7 @@ class ClaudeAuthProvider {
|
|
|
281622
281547
|
logMCPDebug(this.serverName, `Using CIMD URL from env: ${override}`);
|
|
281623
281548
|
return override;
|
|
281624
281549
|
}
|
|
281625
|
-
return
|
|
281550
|
+
return getBranding().mcpOAuthClientMetadataUrl;
|
|
281626
281551
|
}
|
|
281627
281552
|
setMetadata(metadata) {
|
|
281628
281553
|
this._metadata = metadata;
|
|
@@ -282248,7 +282173,7 @@ var init_auth6 = __esm(() => {
|
|
|
282248
282173
|
init_errors7();
|
|
282249
282174
|
init_auth4();
|
|
282250
282175
|
init_axios2();
|
|
282251
|
-
|
|
282176
|
+
init_branding();
|
|
282252
282177
|
init_browser();
|
|
282253
282178
|
init_envUtils();
|
|
282254
282179
|
init_errors2();
|
|
@@ -287044,7 +286969,7 @@ function isIncludedMcpTool(tool) {
|
|
|
287044
286969
|
return !tool.name.startsWith("mcp__ide__") || ALLOWED_IDE_TOOLS.includes(tool.name);
|
|
287045
286970
|
}
|
|
287046
286971
|
function getServerCacheKey(name, serverRef) {
|
|
287047
|
-
return `${name}-${jsonStringify(serverRef)}`;
|
|
286972
|
+
return `${name}-${jsonStringify(serverRef)}-${jsonStringify(getBranding())}`;
|
|
287048
286973
|
}
|
|
287049
286974
|
async function clearServerCache(name, serverRef) {
|
|
287050
286975
|
const key = getServerCacheKey(name, serverRef);
|
|
@@ -287636,10 +287561,8 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
287636
287561
|
const results = await Promise.allSettled(Object.entries(sdkMcpConfigs).map(async ([name, config]) => {
|
|
287637
287562
|
const transport = new SdkControlClientTransport(name, sendMcpMessage);
|
|
287638
287563
|
const client = new Client({
|
|
287639
|
-
name: TELEMETRY_SERVICE_NAME,
|
|
287640
287564
|
...getMcpClientInfo(),
|
|
287641
|
-
version: "99.0.0"
|
|
287642
|
-
websiteUrl: PRODUCT_URL
|
|
287565
|
+
version: "99.0.0"
|
|
287643
287566
|
}, {
|
|
287644
287567
|
capabilities: {}
|
|
287645
287568
|
});
|
|
@@ -287768,6 +287691,7 @@ var init_client5 = __esm(() => {
|
|
|
287768
287691
|
ALLOWED_IDE_TOOLS = ["mcp__ide__executeCode", "mcp__ide__getDiagnostics"];
|
|
287769
287692
|
connectToServer = memoize_default(async (name, serverRef, serverStats) => {
|
|
287770
287693
|
const connectStartTime = Date.now();
|
|
287694
|
+
const cacheKey = getServerCacheKey(name, serverRef);
|
|
287771
287695
|
let inProcessServer;
|
|
287772
287696
|
try {
|
|
287773
287697
|
let transport;
|
|
@@ -287966,6 +287890,7 @@ var init_client5 = __esm(() => {
|
|
|
287966
287890
|
...subprocessEnv(),
|
|
287967
287891
|
...serverRef.env
|
|
287968
287892
|
},
|
|
287893
|
+
...serverRef.cwd ? { cwd: serverRef.cwd } : {},
|
|
287969
287894
|
stderr: "pipe"
|
|
287970
287895
|
});
|
|
287971
287896
|
} else {
|
|
@@ -287987,10 +287912,8 @@ var init_client5 = __esm(() => {
|
|
|
287987
287912
|
}
|
|
287988
287913
|
}
|
|
287989
287914
|
const client = new Client({
|
|
287990
|
-
name: TELEMETRY_SERVICE_NAME,
|
|
287991
287915
|
...getMcpClientInfo(),
|
|
287992
|
-
version: "99.0.0"
|
|
287993
|
-
websiteUrl: PRODUCT_URL
|
|
287916
|
+
version: "99.0.0"
|
|
287994
287917
|
}, {
|
|
287995
287918
|
capabilities: {
|
|
287996
287919
|
roots: {},
|
|
@@ -288200,12 +288123,11 @@ var init_client5 = __esm(() => {
|
|
|
288200
288123
|
const uptime = Date.now() - connectionStartTime;
|
|
288201
288124
|
const transportType = serverRef.type ?? "unknown";
|
|
288202
288125
|
logMCPDebug(name, `${transportType.toUpperCase()} connection closed after ${Math.floor(uptime / 1000)}s (${hasErrorOccurred ? "with errors" : "cleanly"})`);
|
|
288203
|
-
const key = getServerCacheKey(name, serverRef);
|
|
288204
288126
|
fetchToolsForClient.cache.delete(name);
|
|
288205
288127
|
fetchResourcesForClient.cache.delete(name);
|
|
288206
288128
|
fetchCommandsForClient.cache.delete(name);
|
|
288207
288129
|
if (false) {}
|
|
288208
|
-
connectToServer.cache.delete(
|
|
288130
|
+
connectToServer.cache.delete(cacheKey);
|
|
288209
288131
|
logMCPDebug(name, `Cleared connection cache for reconnection`);
|
|
288210
288132
|
if (originalOnclose) {
|
|
288211
288133
|
originalOnclose();
|
|
@@ -292016,6 +291938,41 @@ var init_contextAnalysis = __esm(() => {
|
|
|
292016
291938
|
init_slowOperations();
|
|
292017
291939
|
});
|
|
292018
291940
|
|
|
291941
|
+
// src/session/contextSnapshot.ts
|
|
291942
|
+
function cloneSnapshotMessage(message) {
|
|
291943
|
+
if (message.type !== "system" || message.subtype !== "compact_boundary") {
|
|
291944
|
+
return message;
|
|
291945
|
+
}
|
|
291946
|
+
const { contextSnapshot: _ignored, ...compactMetadata } = message.compactMetadata;
|
|
291947
|
+
return {
|
|
291948
|
+
...message,
|
|
291949
|
+
compactMetadata
|
|
291950
|
+
};
|
|
291951
|
+
}
|
|
291952
|
+
function isSnapshotMessage(message) {
|
|
291953
|
+
return CONTEXT_SNAPSHOT_MESSAGE_TYPES.has(message.type);
|
|
291954
|
+
}
|
|
291955
|
+
function buildContextSnapshot(messages) {
|
|
291956
|
+
const snapshotMessages = messages.filter(isSnapshotMessage).map(cloneSnapshotMessage);
|
|
291957
|
+
if (snapshotMessages.length === 0)
|
|
291958
|
+
return;
|
|
291959
|
+
return {
|
|
291960
|
+
schemaVersion: 1,
|
|
291961
|
+
messages: snapshotMessages,
|
|
291962
|
+
baselineTokens: tokenCountWithEstimation(snapshotMessages)
|
|
291963
|
+
};
|
|
291964
|
+
}
|
|
291965
|
+
var CONTEXT_SNAPSHOT_MESSAGE_TYPES;
|
|
291966
|
+
var init_contextSnapshot = __esm(() => {
|
|
291967
|
+
init_tokens();
|
|
291968
|
+
CONTEXT_SNAPSHOT_MESSAGE_TYPES = new Set([
|
|
291969
|
+
"assistant",
|
|
291970
|
+
"user",
|
|
291971
|
+
"attachment",
|
|
291972
|
+
"system"
|
|
291973
|
+
]);
|
|
291974
|
+
});
|
|
291975
|
+
|
|
292019
291976
|
// src/session/memory/memdir/types.ts
|
|
292020
291977
|
var MEMORY_TYPE_VALUES;
|
|
292021
291978
|
var init_types10 = __esm(() => {
|
|
@@ -292597,6 +292554,15 @@ function buildPostCompactMessages(result) {
|
|
|
292597
292554
|
...result.hookResults
|
|
292598
292555
|
];
|
|
292599
292556
|
}
|
|
292557
|
+
function attachContextSnapshot(result) {
|
|
292558
|
+
if (!result.boundaryMarker?.compactMetadata)
|
|
292559
|
+
return result;
|
|
292560
|
+
const snapshot = buildContextSnapshot(buildPostCompactMessages(result));
|
|
292561
|
+
if (snapshot) {
|
|
292562
|
+
result.boundaryMarker.compactMetadata.contextSnapshot = snapshot;
|
|
292563
|
+
}
|
|
292564
|
+
return result;
|
|
292565
|
+
}
|
|
292600
292566
|
function annotateBoundaryWithPreservedSegment(boundary, anchorUuid, messagesToKeep) {
|
|
292601
292567
|
const keep = messagesToKeep ?? [];
|
|
292602
292568
|
if (keep.length === 0)
|
|
@@ -293370,6 +293336,7 @@ var init_compact = __esm(() => {
|
|
|
293370
293336
|
init_debug();
|
|
293371
293337
|
init_errors2();
|
|
293372
293338
|
init_fileStateCache();
|
|
293339
|
+
init_contextSnapshot();
|
|
293373
293340
|
init_forkedAgent();
|
|
293374
293341
|
init_hooks2();
|
|
293375
293342
|
init_log3();
|
|
@@ -294150,7 +294117,7 @@ async function autoCompactIfNeeded(messages, toolUseContext, cacheSafeParams, qu
|
|
|
294150
294117
|
markPostCompaction2();
|
|
294151
294118
|
return {
|
|
294152
294119
|
wasCompacted: true,
|
|
294153
|
-
compactionResult: sessionMemoryResult
|
|
294120
|
+
compactionResult: attachContextSnapshot(sessionMemoryResult)
|
|
294154
294121
|
};
|
|
294155
294122
|
}
|
|
294156
294123
|
try {
|
|
@@ -294159,7 +294126,7 @@ async function autoCompactIfNeeded(messages, toolUseContext, cacheSafeParams, qu
|
|
|
294159
294126
|
runPostCompactCleanup(querySource);
|
|
294160
294127
|
return {
|
|
294161
294128
|
wasCompacted: true,
|
|
294162
|
-
compactionResult,
|
|
294129
|
+
compactionResult: attachContextSnapshot(compactionResult),
|
|
294163
294130
|
consecutiveFailures: 0
|
|
294164
294131
|
};
|
|
294165
294132
|
} catch (error) {
|
|
@@ -294184,13 +294151,19 @@ async function manualCompact(messages, toolUseContext, cacheSafeParams, instruct
|
|
|
294184
294151
|
setLastSummarizedMessageId(undefined);
|
|
294185
294152
|
runPostCompactCleanup();
|
|
294186
294153
|
markPostCompaction2();
|
|
294187
|
-
return {
|
|
294154
|
+
return {
|
|
294155
|
+
wasCompacted: true,
|
|
294156
|
+
compactionResult: attachContextSnapshot(sessionMemoryResult)
|
|
294157
|
+
};
|
|
294188
294158
|
}
|
|
294189
294159
|
}
|
|
294190
294160
|
const compactionResult = await deps.compactConversation(messages, toolUseContext, cacheSafeParams, false, instructions, false);
|
|
294191
294161
|
setLastSummarizedMessageId(undefined);
|
|
294192
294162
|
runPostCompactCleanup();
|
|
294193
|
-
return {
|
|
294163
|
+
return {
|
|
294164
|
+
wasCompacted: true,
|
|
294165
|
+
compactionResult: attachContextSnapshot(compactionResult)
|
|
294166
|
+
};
|
|
294194
294167
|
}
|
|
294195
294168
|
var MAX_OUTPUT_TOKENS_FOR_SUMMARY = 20000, AUTOCOMPACT_BUFFER_TOKENS = 13000, WARNING_THRESHOLD_BUFFER_TOKENS = 20000, ERROR_THRESHOLD_BUFFER_TOKENS = 20000, MANUAL_COMPACT_BUFFER_TOKENS = 3000, MAX_CONSECUTIVE_AUTOCOMPACT_FAILURES = 3;
|
|
294196
294169
|
var init_autoCompact = __esm(() => {
|
|
@@ -298081,12 +298054,15 @@ ${deferredToolList}
|
|
|
298081
298054
|
throw new Error("Stream idle timeout - no chunks received");
|
|
298082
298055
|
}
|
|
298083
298056
|
if (!partialMessage || newMessages.length === 0 && !stopReason) {
|
|
298084
|
-
logForDebugging2(!partialMessage ? "Stream completed without receiving message_start event - triggering non-streaming fallback" : "Stream completed with message_start but no content blocks completed -
|
|
298057
|
+
logForDebugging2(!partialMessage ? "Stream completed without receiving message_start event - triggering non-streaming fallback" : "Stream completed with message_start but no content blocks completed - incomplete stream", { level: "error" });
|
|
298085
298058
|
logEvent("tengu_stream_no_events", {
|
|
298086
298059
|
model: options.model,
|
|
298087
298060
|
request_id: streamRequestId ?? "unknown"
|
|
298088
298061
|
});
|
|
298089
|
-
|
|
298062
|
+
if (!partialMessage) {
|
|
298063
|
+
throw new Error("Stream ended without receiving any events");
|
|
298064
|
+
}
|
|
298065
|
+
throw new EmptyStreamError;
|
|
298090
298066
|
}
|
|
298091
298067
|
if (stallCount > 0) {
|
|
298092
298068
|
logForDebugging2(`Streaming completed with ${stallCount} stall(s), total stall time: ${(totalStallTime / 1000).toFixed(1)}s`, { level: "warn" });
|
|
@@ -298131,6 +298107,9 @@ ${deferredToolList}
|
|
|
298131
298107
|
throw new APIConnectionTimeoutError({ message: "Request timed out" });
|
|
298132
298108
|
}
|
|
298133
298109
|
}
|
|
298110
|
+
if (options.streamReplayEscape && newMessages.length === 0 && !signal.aborted && toReplayableStreamError(streamingError)) {
|
|
298111
|
+
throw streamingError;
|
|
298112
|
+
}
|
|
298134
298113
|
const disableFallback = isEnvTruthy(resolveEnvVar("DISABLE_NONSTREAMING_FALLBACK")) || getFeatureValue_CACHED_MAY_BE_STALE("tengu_disable_streaming_to_non_streaming_fallback", false);
|
|
298135
298114
|
if (disableFallback) {
|
|
298136
298115
|
logForDebugging2(`Error streaming (non-streaming fallback disabled): ${errorMessage(streamingError)}`, { level: "error" });
|
|
@@ -301151,7 +301130,7 @@ function AUTO_REJECT_MESSAGE(toolName) {
|
|
|
301151
301130
|
return `Permission to use ${toolName} has been denied. ${DENIAL_WORKAROUND_GUIDANCE}`;
|
|
301152
301131
|
}
|
|
301153
301132
|
function DONT_ASK_REJECT_MESSAGE(toolName) {
|
|
301154
|
-
return `Permission to use ${toolName} has been denied because
|
|
301133
|
+
return `Permission to use ${toolName} has been denied because ${getBranding().productName} is running in don't ask mode. ${DENIAL_WORKAROUND_GUIDANCE}`;
|
|
301155
301134
|
}
|
|
301156
301135
|
function isSyntheticMessage(message) {
|
|
301157
301136
|
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);
|
|
@@ -304343,6 +304322,7 @@ var init_messages4 = __esm(() => {
|
|
|
304343
304322
|
init_tasks();
|
|
304344
304323
|
init_toolSearch();
|
|
304345
304324
|
init_state();
|
|
304325
|
+
init_branding();
|
|
304346
304326
|
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.`;
|
|
304347
304327
|
SYNTHETIC_MESSAGES = new Set([
|
|
304348
304328
|
INTERRUPT_MESSAGE,
|
|
@@ -369441,11 +369421,12 @@ var init_utils8 = __esm(() => {
|
|
|
369441
369421
|
init_log3();
|
|
369442
369422
|
init_state();
|
|
369443
369423
|
init_mcpOutputStorage();
|
|
369424
|
+
init_branding();
|
|
369444
369425
|
init_settings2();
|
|
369445
369426
|
init_preapproved();
|
|
369446
369427
|
DomainBlockedError = class DomainBlockedError extends Error {
|
|
369447
369428
|
constructor(domain) {
|
|
369448
|
-
super(
|
|
369429
|
+
super(`${getBranding().productName} is unable to fetch from ${domain}`);
|
|
369449
369430
|
this.name = "DomainBlockedError";
|
|
369450
369431
|
}
|
|
369451
369432
|
};
|
|
@@ -389663,7 +389644,7 @@ async function enrollTrustedDevice() {
|
|
|
389663
389644
|
const baseUrl = getOauthConfig().BASE_API_URL;
|
|
389664
389645
|
let response;
|
|
389665
389646
|
try {
|
|
389666
|
-
response = await axios_default.post(`${baseUrl}/api/auth/trusted_devices`, { display_name:
|
|
389647
|
+
response = await axios_default.post(`${baseUrl}/api/auth/trusted_devices`, { display_name: `${getBranding().productName} on ${hostname2()} · ${process.platform}` }, {
|
|
389667
389648
|
headers: {
|
|
389668
389649
|
Authorization: `Bearer ${accessToken}`,
|
|
389669
389650
|
"Content-Type": "application/json"
|
|
@@ -389715,6 +389696,7 @@ var init_trustedDevice = __esm(() => {
|
|
|
389715
389696
|
init_privacyLevel();
|
|
389716
389697
|
init_secureStorage();
|
|
389717
389698
|
init_slowOperations();
|
|
389699
|
+
init_branding();
|
|
389718
389700
|
readStoredToken = memoize_default(() => {
|
|
389719
389701
|
const envToken = process.env.CLAUDE_TRUSTED_DEVICE_TOKEN;
|
|
389720
389702
|
if (envToken) {
|
|
@@ -435223,10 +435205,10 @@ var init_fuse = __esm(() => {
|
|
|
435223
435205
|
});
|
|
435224
435206
|
|
|
435225
435207
|
// missing-module-stub:/home/runner/work/opencow-agent-sdk/opencow-agent-sdk/src/cli/suggestions/skillUsageTracking.js
|
|
435226
|
-
var noop17 = () => null,
|
|
435208
|
+
var noop17 = () => null, getSkillUsageScore, recordSkillUsage2;
|
|
435227
435209
|
var init_skillUsageTracking2 = __esm(() => {
|
|
435228
|
-
recordSkillUsage2 = noop17;
|
|
435229
435210
|
getSkillUsageScore = noop17;
|
|
435211
|
+
recordSkillUsage2 = noop17;
|
|
435230
435212
|
});
|
|
435231
435213
|
|
|
435232
435214
|
// src/cli/suggestions/commandSuggestions.ts
|
|
@@ -445919,6 +445901,9 @@ function toSDKCompactMetadata(meta) {
|
|
|
445919
445901
|
trigger: meta.trigger,
|
|
445920
445902
|
pre_tokens: meta.preTokens,
|
|
445921
445903
|
...meta.postTokens !== undefined && { post_tokens: meta.postTokens },
|
|
445904
|
+
...meta.contextSnapshot !== undefined && {
|
|
445905
|
+
context_snapshot: meta.contextSnapshot
|
|
445906
|
+
},
|
|
445922
445907
|
...seg && {
|
|
445923
445908
|
preserved_segment: {
|
|
445924
445909
|
head_uuid: seg.headUuid,
|
|
@@ -445934,6 +445919,9 @@ function fromSDKCompactMetadata(meta) {
|
|
|
445934
445919
|
trigger: meta.trigger,
|
|
445935
445920
|
preTokens: meta.pre_tokens,
|
|
445936
445921
|
...meta.post_tokens !== undefined && { postTokens: meta.post_tokens },
|
|
445922
|
+
...meta.context_snapshot !== undefined && {
|
|
445923
|
+
contextSnapshot: meta.context_snapshot
|
|
445924
|
+
},
|
|
445937
445925
|
...seg && {
|
|
445938
445926
|
preservedSegment: {
|
|
445939
445927
|
headUuid: seg.head_uuid,
|
|
@@ -480217,7 +480205,7 @@ function buildPrimarySection() {
|
|
|
480217
480205
|
}, undefined, false, undefined, this);
|
|
480218
480206
|
return [{
|
|
480219
480207
|
label: "Version",
|
|
480220
|
-
value: "0.4.
|
|
480208
|
+
value: "0.4.28"
|
|
480221
480209
|
}, {
|
|
480222
480210
|
label: "Session name",
|
|
480223
480211
|
value: nameValue
|
|
@@ -506721,7 +506709,7 @@ async function validatePluginManifest(filePath) {
|
|
|
506721
506709
|
delete stripped[key];
|
|
506722
506710
|
warnings.push({
|
|
506723
506711
|
path: key,
|
|
506724
|
-
message: `Field '${key}' belongs in the marketplace entry (marketplace.json), ` + `not plugin.json. It's harmless here but unused —
|
|
506712
|
+
message: `Field '${key}' belongs in the marketplace entry (marketplace.json), ` + `not plugin.json. It's harmless here but unused — ${getBranding().productName} ` + `ignores it at load time.`
|
|
506725
506713
|
});
|
|
506726
506714
|
}
|
|
506727
506715
|
toValidate = stripped;
|
|
@@ -506736,7 +506724,7 @@ async function validatePluginManifest(filePath) {
|
|
|
506736
506724
|
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(manifest.name)) {
|
|
506737
506725
|
warnings.push({
|
|
506738
506726
|
path: "name",
|
|
506739
|
-
message: `Plugin name "${manifest.name}" is not kebab-case.
|
|
506727
|
+
message: `Plugin name "${manifest.name}" is not kebab-case. ${getBranding().productName} accepts ` + `it, but the Claude.ai marketplace sync requires kebab-case ` + `(lowercase letters, digits, and hyphens only, e.g., "my-plugin").`
|
|
506740
506728
|
});
|
|
506741
506729
|
}
|
|
506742
506730
|
if (!manifest.version) {
|
|
@@ -507172,6 +507160,7 @@ var init_validatePlugin = __esm(() => {
|
|
|
507172
507160
|
init_slowOperations();
|
|
507173
507161
|
init_schemas3();
|
|
507174
507162
|
init_fsOperations();
|
|
507163
|
+
init_branding();
|
|
507175
507164
|
MARKETPLACE_ONLY_MANIFEST_FIELDS = new Set([
|
|
507176
507165
|
"category",
|
|
507177
507166
|
"source",
|
|
@@ -528296,7 +528285,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
528296
528285
|
var call58 = async () => {
|
|
528297
528286
|
return {
|
|
528298
528287
|
type: "text",
|
|
528299
|
-
value: `${"99.0.0"} (built ${"2026-10-
|
|
528288
|
+
value: `${"99.0.0"} (built ${"2026-10-24T12:55:52.344Z"})`
|
|
528300
528289
|
};
|
|
528301
528290
|
}, version2, version_default;
|
|
528302
528291
|
var init_version = __esm(() => {
|
|
@@ -545975,7 +545964,7 @@ function WelcomeV2() {
|
|
|
545975
545964
|
dimColor: true,
|
|
545976
545965
|
children: [
|
|
545977
545966
|
"v",
|
|
545978
|
-
"0.4.
|
|
545967
|
+
"0.4.28",
|
|
545979
545968
|
" "
|
|
545980
545969
|
]
|
|
545981
545970
|
}, undefined, true, undefined, this)
|
|
@@ -546175,7 +546164,7 @@ function WelcomeV2() {
|
|
|
546175
546164
|
dimColor: true,
|
|
546176
546165
|
children: [
|
|
546177
546166
|
"v",
|
|
546178
|
-
"0.4.
|
|
546167
|
+
"0.4.28",
|
|
546179
546168
|
" "
|
|
546180
546169
|
]
|
|
546181
546170
|
}, undefined, true, undefined, this)
|
|
@@ -546401,7 +546390,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
546401
546390
|
dimColor: true,
|
|
546402
546391
|
children: [
|
|
546403
546392
|
"v",
|
|
546404
|
-
"0.4.
|
|
546393
|
+
"0.4.28",
|
|
546405
546394
|
" "
|
|
546406
546395
|
]
|
|
546407
546396
|
}, undefined, true, undefined, this);
|
|
@@ -546655,7 +546644,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
546655
546644
|
dimColor: true,
|
|
546656
546645
|
children: [
|
|
546657
546646
|
"v",
|
|
546658
|
-
"0.4.
|
|
546647
|
+
"0.4.28",
|
|
546659
546648
|
" "
|
|
546660
546649
|
]
|
|
546661
546650
|
}, undefined, true, undefined, this);
|
|
@@ -550136,9 +550125,8 @@ Remember that settings are in:
|
|
|
550136
550125
|
|
|
550137
550126
|
1. Review the user's issue description
|
|
550138
550127
|
2. The last ${DEFAULT_DEBUG_LINES_READ} lines show the debug file format. Look for [ERROR] and [WARN] entries, stack traces, and failure patterns across the file
|
|
550139
|
-
3.
|
|
550140
|
-
4.
|
|
550141
|
-
5. Suggest concrete fixes or next steps
|
|
550128
|
+
3. Explain what you found in plain language
|
|
550129
|
+
4. Suggest concrete fixes or next steps
|
|
550142
550130
|
`;
|
|
550143
550131
|
return [{ type: "text", text: prompt }];
|
|
550144
550132
|
}
|
|
@@ -550146,7 +550134,6 @@ Remember that settings are in:
|
|
|
550146
550134
|
}
|
|
550147
550135
|
var DEFAULT_DEBUG_LINES_READ = 20, TAIL_READ_BYTES;
|
|
550148
550136
|
var init_debug3 = __esm(() => {
|
|
550149
|
-
init_claudeCodeGuideAgent();
|
|
550150
550137
|
init_settings2();
|
|
550151
550138
|
init_debug();
|
|
550152
550139
|
init_errors2();
|
|
@@ -550299,7 +550286,7 @@ var init_schema2 = __esm(() => {
|
|
|
550299
550286
|
$schema: string2().optional().describe("JSON Schema URL for editor validation"),
|
|
550300
550287
|
$docs: string2().optional().describe("Documentation URL"),
|
|
550301
550288
|
bindings: array(KeybindingBlockSchema()).describe("Array of keybinding blocks by context")
|
|
550302
|
-
}).describe("
|
|
550289
|
+
}).describe("Keybindings configuration. Customize keyboard shortcuts by context."));
|
|
550303
550290
|
});
|
|
550304
550291
|
|
|
550305
550292
|
// src/cli/skills/bundled/keybindings.ts
|
|
@@ -567414,7 +567401,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
567414
567401
|
pendingHookMessages
|
|
567415
567402
|
}, renderAndRun);
|
|
567416
567403
|
}
|
|
567417
|
-
}).version("0.4.
|
|
567404
|
+
}).version("0.4.28 (OpenCow)", "-v, --version", "Output the version number");
|
|
567418
567405
|
program.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
567419
567406
|
program.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
567420
567407
|
if (canUserConfigureAdvisor()) {
|
|
@@ -568009,7 +567996,7 @@ if (false) {}
|
|
|
568009
567996
|
async function main2() {
|
|
568010
567997
|
const args = process.argv.slice(2);
|
|
568011
567998
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
568012
|
-
console.log(`${"0.4.
|
|
567999
|
+
console.log(`${"0.4.28"} (OpenCow)`);
|
|
568013
568000
|
return;
|
|
568014
568001
|
}
|
|
568015
568002
|
if (args.includes("--provider")) {
|
|
@@ -568109,4 +568096,4 @@ async function main2() {
|
|
|
568109
568096
|
}
|
|
568110
568097
|
main2();
|
|
568111
568098
|
|
|
568112
|
-
//# debugId=
|
|
568099
|
+
//# debugId=9998D5AD757C65B264756E2164756E21
|