@opencow-ai/opencow-agent-sdk 0.4.25 → 0.4.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capabilities/mcp/codexConfigFields.d.ts +20 -0
- package/dist/capabilities/mcp/envExpansion.d.ts +4 -1
- package/dist/capabilities/mcp/types.d.ts +3 -0
- package/dist/capabilities/plugins/lspPluginIntegration.d.ts +1 -0
- package/dist/capabilities/plugins/mcpPluginIntegration.d.ts +1 -0
- package/dist/capabilities/plugins/pluginOptionsStorage.d.ts +6 -0
- package/dist/capabilities/plugins/schemas.d.ts +6 -0
- package/dist/capabilities/plugins/sdkPluginRuntime.d.ts +2 -0
- package/dist/cli.mjs +285 -242
- package/dist/client.js +263 -261
- package/dist/constants/envVars.d.ts +1 -0
- package/dist/constants/oauth.d.ts +0 -8
- package/dist/controller/dispatch/toolHooks.d.ts +4 -3
- package/dist/entrypoints/sdk/controlSchemas.d.ts +20 -0
- package/dist/entrypoints/sdk/coreSchemas.d.ts +6 -0
- package/dist/entrypoints/sdk/runtimeTypes.d.ts +24 -0
- package/dist/sdk.js +263 -261
- package/dist/session/attachments.d.ts +9 -0
- package/dist/session/branding.d.ts +4 -0
- package/dist/session/brandingConfig.d.ts +16 -0
- package/dist/session/state/index.d.ts +1 -1
- package/dist/session/state/registries.d.ts +8 -1
- package/dist/session/state/types.d.ts +2 -0
- package/dist/types/plugin.d.ts +5 -0
- package/package.json +1 -1
- package/dist/capabilities/tools/AgentTool/built-in/claudeCodeGuideAgent.d.ts +0 -3
package/dist/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();
|
|
@@ -974,6 +1007,11 @@ var init_paths = __esm(() => {
|
|
|
974
1007
|
});
|
|
975
1008
|
|
|
976
1009
|
// src/session/layout/LayoutProfile.ts
|
|
1010
|
+
var exports_LayoutProfile = {};
|
|
1011
|
+
__export(exports_LayoutProfile, {
|
|
1012
|
+
DEFAULT_LAYOUT_PROFILE: () => DEFAULT_LAYOUT_PROFILE,
|
|
1013
|
+
resolveLayoutProfile: () => resolveLayoutProfile
|
|
1014
|
+
});
|
|
977
1015
|
function resolveBinding(binding) {
|
|
978
1016
|
if (typeof binding === "string") {
|
|
979
1017
|
return BUILT_IN_BINDINGS[binding];
|
|
@@ -6882,7 +6920,7 @@ function getOauthConfig() {
|
|
|
6882
6920
|
}
|
|
6883
6921
|
return config;
|
|
6884
6922
|
}
|
|
6885
|
-
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;
|
|
6886
6924
|
var init_oauth = __esm(() => {
|
|
6887
6925
|
init_envUtils();
|
|
6888
6926
|
init_envVars();
|
|
@@ -22897,7 +22935,7 @@ var GIT_ROOT_NOT_FOUND, findGitRootImpl, findGitRoot, resolveCanonicalRoot, find
|
|
|
22897
22935
|
return getWorktreeCountFromFs();
|
|
22898
22936
|
}, stashToCleanState = async (message) => {
|
|
22899
22937
|
try {
|
|
22900
|
-
const stashMessage = message ||
|
|
22938
|
+
const stashMessage = message || `${getBranding().productName} auto-stash - ${new Date().toISOString()}`;
|
|
22901
22939
|
const { untracked } = await getFileStatus();
|
|
22902
22940
|
if (untracked.length > 0) {
|
|
22903
22941
|
const { code: addCode } = await execFileNoThrow(gitExe(), ["add", ...untracked], { preserveOutputOnError: false });
|
|
@@ -22924,6 +22962,7 @@ var init_git = __esm(() => {
|
|
|
22924
22962
|
init_log3();
|
|
22925
22963
|
init_memoize2();
|
|
22926
22964
|
init_which();
|
|
22965
|
+
init_branding();
|
|
22927
22966
|
GIT_ROOT_NOT_FOUND = Symbol("git-root-not-found");
|
|
22928
22967
|
findGitRootImpl = memoizeWithLRU((startPath) => {
|
|
22929
22968
|
const startTime = Date.now();
|
|
@@ -25739,7 +25778,8 @@ var init_types2 = __esm(() => {
|
|
|
25739
25778
|
type: literal("stdio").optional(),
|
|
25740
25779
|
command: string2().min(1, "Command cannot be empty"),
|
|
25741
25780
|
args: array(string2()).default([]),
|
|
25742
|
-
env: record(string2(), string2()).optional()
|
|
25781
|
+
env: record(string2(), string2()).optional(),
|
|
25782
|
+
cwd: string2().optional()
|
|
25743
25783
|
}));
|
|
25744
25784
|
McpXaaConfigSchema = lazySchema(() => boolean2());
|
|
25745
25785
|
McpOAuthConfigSchema = lazySchema(() => object({
|
|
@@ -26735,7 +26775,7 @@ var init_types3 = __esm(() => {
|
|
|
26735
26775
|
allow: array(PermissionRuleSchema()).optional().describe("List of permission rules for allowed operations"),
|
|
26736
26776
|
deny: array(PermissionRuleSchema()).optional().describe("List of permission rules for denied operations"),
|
|
26737
26777
|
ask: array(PermissionRuleSchema()).optional().describe("List of permission rules that should always prompt for confirmation"),
|
|
26738
|
-
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"),
|
|
26739
26779
|
disableBypassPermissionsMode: _enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),
|
|
26740
26780
|
...{},
|
|
26741
26781
|
additionalDirectories: array(string2()).optional().describe("Additional directories to include in the permission scope")
|
|
@@ -26780,7 +26820,7 @@ var init_types3 = __esm(() => {
|
|
|
26780
26820
|
"mcp"
|
|
26781
26821
|
];
|
|
26782
26822
|
SettingsSchema = lazySchema(() => object({
|
|
26783
|
-
$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"),
|
|
26784
26824
|
apiKeyHelper: string2().optional().describe("Path to a script that outputs authentication values"),
|
|
26785
26825
|
awsCredentialExport: string2().optional().describe("Path to a script that exports AWS credentials"),
|
|
26786
26826
|
awsAuthRefresh: string2().optional().describe("Path to a script that refreshes AWS authentication"),
|
|
@@ -26788,7 +26828,7 @@ var init_types3 = __esm(() => {
|
|
|
26788
26828
|
...isEnvTruthy(resolveEnvVar("ENABLE_XAA")) ? {
|
|
26789
26829
|
xaaIdp: object({
|
|
26790
26830
|
issuer: string2().url().describe("IdP issuer URL for OIDC discovery"),
|
|
26791
|
-
clientId: string2().describe("
|
|
26831
|
+
clientId: string2().describe("The client_id registered at the IdP"),
|
|
26792
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.")
|
|
26793
26833
|
}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")
|
|
26794
26834
|
} : {},
|
|
@@ -26798,10 +26838,10 @@ var init_types3 = __esm(() => {
|
|
|
26798
26838
|
}).optional().describe("Custom file suggestion configuration for @ mentions"),
|
|
26799
26839
|
respectGitignore: boolean2().optional().describe("Whether file picker should respect .gitignore files (default: true). " + "Note: .ignore files are always respected."),
|
|
26800
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."),
|
|
26801
|
-
env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for
|
|
26841
|
+
env: EnvironmentVariablesSchema().optional().describe("Environment variables to set for agent sessions"),
|
|
26802
26842
|
includeGitInstructions: boolean2().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),
|
|
26803
26843
|
permissions: PermissionsSchema().optional().describe("Tool usage permissions configuration"),
|
|
26804
|
-
model: string2().optional().describe("Override the default model used by
|
|
26844
|
+
model: string2().optional().describe("Override the default model used by the agent"),
|
|
26805
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."),
|
|
26806
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."),
|
|
26807
26847
|
enableAllProjectMcpServers: boolean2().optional().describe("Whether to automatically approve all MCP servers in the project"),
|
|
@@ -47761,6 +47801,63 @@ var init_toolSchemaCache = __esm(() => {
|
|
|
47761
47801
|
});
|
|
47762
47802
|
|
|
47763
47803
|
// src/providers/shared/auth.ts
|
|
47804
|
+
var exports_auth = {};
|
|
47805
|
+
__export(exports_auth, {
|
|
47806
|
+
calculateApiKeyHelperTTL: () => calculateApiKeyHelperTTL,
|
|
47807
|
+
checkAndRefreshOAuthTokenIfNeeded: () => checkAndRefreshOAuthTokenIfNeeded,
|
|
47808
|
+
checkGcpCredentialsValid: () => checkGcpCredentialsValid,
|
|
47809
|
+
clearApiKeyHelperCache: () => clearApiKeyHelperCache,
|
|
47810
|
+
clearAwsCredentialsCache: () => clearAwsCredentialsCache,
|
|
47811
|
+
clearGcpCredentialsCache: () => clearGcpCredentialsCache,
|
|
47812
|
+
clearOAuthTokenCache: () => clearOAuthTokenCache,
|
|
47813
|
+
getAccountInformation: () => getAccountInformation,
|
|
47814
|
+
getAnthropicApiKey: () => getAnthropicApiKey,
|
|
47815
|
+
getAnthropicApiKeyWithSource: () => getAnthropicApiKeyWithSource,
|
|
47816
|
+
getApiKeyFromApiKeyHelper: () => getApiKeyFromApiKeyHelper,
|
|
47817
|
+
getApiKeyFromApiKeyHelperCached: () => getApiKeyFromApiKeyHelperCached,
|
|
47818
|
+
getApiKeyFromConfigOrMacOSKeychain: () => getApiKeyFromConfigOrMacOSKeychain,
|
|
47819
|
+
getApiKeyHelperElapsedMs: () => getApiKeyHelperElapsedMs,
|
|
47820
|
+
getAuthTokenSource: () => getAuthTokenSource,
|
|
47821
|
+
getClaudeAIOAuthTokens: () => getClaudeAIOAuthTokens,
|
|
47822
|
+
getClaudeAIOAuthTokensAsync: () => getClaudeAIOAuthTokensAsync,
|
|
47823
|
+
getConfiguredApiKeyHelper: () => getConfiguredApiKeyHelper,
|
|
47824
|
+
getOauthAccountInfo: () => getOauthAccountInfo,
|
|
47825
|
+
getOtelHeadersFromHelper: () => getOtelHeadersFromHelper,
|
|
47826
|
+
getRateLimitTier: () => getRateLimitTier,
|
|
47827
|
+
getSubscriptionName: () => getSubscriptionName,
|
|
47828
|
+
getSubscriptionType: () => getSubscriptionType,
|
|
47829
|
+
handleOAuth401Error: () => handleOAuth401Error,
|
|
47830
|
+
hasAnthropicApiKeyAuth: () => hasAnthropicApiKeyAuth,
|
|
47831
|
+
hasOpusAccess: () => hasOpusAccess,
|
|
47832
|
+
hasProfileScope: () => hasProfileScope,
|
|
47833
|
+
is1PApiCustomer: () => is1PApiCustomer,
|
|
47834
|
+
isAnthropicAuthEnabled: () => isAnthropicAuthEnabled,
|
|
47835
|
+
isAwsAuthRefreshFromProjectSettings: () => isAwsAuthRefreshFromProjectSettings,
|
|
47836
|
+
isAwsCredentialExportFromProjectSettings: () => isAwsCredentialExportFromProjectSettings,
|
|
47837
|
+
isClaudeAISubscriber: () => isClaudeAISubscriber,
|
|
47838
|
+
isConsumerSubscriber: () => isConsumerSubscriber,
|
|
47839
|
+
isCustomApiKeyApproved: () => isCustomApiKeyApproved,
|
|
47840
|
+
isEnterpriseSubscriber: () => isEnterpriseSubscriber,
|
|
47841
|
+
isGcpAuthRefreshFromProjectSettings: () => isGcpAuthRefreshFromProjectSettings,
|
|
47842
|
+
isMaxSubscriber: () => isMaxSubscriber,
|
|
47843
|
+
isOtelHeadersHelperFromProjectOrLocalSettings: () => isOtelHeadersHelperFromProjectOrLocalSettings,
|
|
47844
|
+
isOverageProvisioningAllowed: () => isOverageProvisioningAllowed,
|
|
47845
|
+
isProSubscriber: () => isProSubscriber,
|
|
47846
|
+
isTeamPremiumSubscriber: () => isTeamPremiumSubscriber,
|
|
47847
|
+
isTeamSubscriber: () => isTeamSubscriber,
|
|
47848
|
+
isUsing3PServices: () => isUsing3PServices,
|
|
47849
|
+
prefetchApiKeyFromApiKeyHelperIfSafe: () => prefetchApiKeyFromApiKeyHelperIfSafe,
|
|
47850
|
+
prefetchAwsCredentialsAndBedRockInfoIfSafe: () => prefetchAwsCredentialsAndBedRockInfoIfSafe,
|
|
47851
|
+
prefetchGcpCredentialsIfSafe: () => prefetchGcpCredentialsIfSafe,
|
|
47852
|
+
refreshAndGetAwsCredentials: () => refreshAndGetAwsCredentials,
|
|
47853
|
+
refreshAwsAuth: () => refreshAwsAuth,
|
|
47854
|
+
refreshGcpAuth: () => refreshGcpAuth,
|
|
47855
|
+
refreshGcpCredentialsIfNeeded: () => refreshGcpCredentialsIfNeeded,
|
|
47856
|
+
removeApiKey: () => removeApiKey,
|
|
47857
|
+
saveApiKey: () => saveApiKey,
|
|
47858
|
+
saveOAuthTokensIfNeeded: () => saveOAuthTokensIfNeeded,
|
|
47859
|
+
validateForceLoginOrg: () => validateForceLoginOrg
|
|
47860
|
+
});
|
|
47764
47861
|
import { exec } from "child_process";
|
|
47765
47862
|
import { join as join18 } from "path";
|
|
47766
47863
|
function isManagedOAuthContext() {
|
|
@@ -48350,6 +48447,11 @@ async function saveApiKey(apiKey) {
|
|
|
48350
48447
|
getApiKeyFromConfigOrMacOSKeychain.cache.clear?.();
|
|
48351
48448
|
clearLegacyApiKeyPrefetch();
|
|
48352
48449
|
}
|
|
48450
|
+
function isCustomApiKeyApproved(apiKey) {
|
|
48451
|
+
const config = getGlobalConfig();
|
|
48452
|
+
const normalizedKey = normalizeApiKeyForConfig(apiKey);
|
|
48453
|
+
return config.customApiKeyResponses?.approved?.includes(normalizedKey) ?? false;
|
|
48454
|
+
}
|
|
48353
48455
|
async function removeApiKey() {
|
|
48354
48456
|
await maybeRemoveApiKeyFromMacOSKeychain();
|
|
48355
48457
|
saveGlobalConfig((current) => ({
|
|
@@ -48588,6 +48690,10 @@ function isOverageProvisioningAllowed() {
|
|
|
48588
48690
|
}
|
|
48589
48691
|
return true;
|
|
48590
48692
|
}
|
|
48693
|
+
function hasOpusAccess() {
|
|
48694
|
+
const subscriptionType = getSubscriptionType();
|
|
48695
|
+
return subscriptionType === "max" || subscriptionType === "enterprise" || subscriptionType === "team" || subscriptionType === "pro" || subscriptionType === null;
|
|
48696
|
+
}
|
|
48591
48697
|
function getSubscriptionType() {
|
|
48592
48698
|
if (shouldUseMockSubscription()) {
|
|
48593
48699
|
return getMockSubscriptionType();
|
|
@@ -49569,11 +49675,6 @@ function parseAnthropicStreamChunk(chunk) {
|
|
|
49569
49675
|
return [chunk];
|
|
49570
49676
|
}
|
|
49571
49677
|
|
|
49572
|
-
// src/providers/shared/userAgent.ts
|
|
49573
|
-
function getClaudeCodeUserAgent() {
|
|
49574
|
-
return `claude-code/${"99.0.0"}`;
|
|
49575
|
-
}
|
|
49576
|
-
|
|
49577
49678
|
// src/session/workloadContext.ts
|
|
49578
49679
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
49579
49680
|
function getWorkload() {
|
|
@@ -49608,11 +49709,12 @@ function getMCPUserAgent() {
|
|
|
49608
49709
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
49609
49710
|
}
|
|
49610
49711
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
49611
|
-
return
|
|
49712
|
+
return `${getProductUserAgentToken()}/${"99.0.0"}${suffix}`;
|
|
49612
49713
|
}
|
|
49613
49714
|
function getWebFetchUserAgent() {
|
|
49614
|
-
const
|
|
49615
|
-
|
|
49715
|
+
const { productSlug, productUrl } = getBranding();
|
|
49716
|
+
const contact = productUrl ? `; +${productUrl}` : "";
|
|
49717
|
+
return `${productSlug}-User (${productSlug}/${"99.0.0"}${contact})`;
|
|
49616
49718
|
}
|
|
49617
49719
|
function getAuthHeaders() {
|
|
49618
49720
|
if (isClaudeAISubscriber()) {
|
|
@@ -49666,6 +49768,7 @@ var init_http2 = __esm(() => {
|
|
|
49666
49768
|
init_auth();
|
|
49667
49769
|
init_state();
|
|
49668
49770
|
init_workloadContext();
|
|
49771
|
+
init_branding();
|
|
49669
49772
|
});
|
|
49670
49773
|
|
|
49671
49774
|
// src/providers/shared/model/providers.ts
|
|
@@ -80953,7 +81056,7 @@ function buildQueryContextFromSdk(options) {
|
|
|
80953
81056
|
const memoryBaseDir = resolveEnvVar("REMOTE_MEMORY_DIR") ?? configHomeDir;
|
|
80954
81057
|
const autoMemEnvOverride = resolveEnvVar("MEMORY_PATH_OVERRIDE");
|
|
80955
81058
|
const autoMemSettingsOverride = resolvedFileSystemLayer === "disabled" ? undefined : readAutoMemSettingsOverride();
|
|
80956
|
-
init_managedPath();
|
|
81059
|
+
const { getManagedFilePath } = (init_managedPath(), __toCommonJS(exports_managedPath));
|
|
80957
81060
|
const paths = computeSessionPaths({
|
|
80958
81061
|
cwd,
|
|
80959
81062
|
projectRoot: cwd,
|
|
@@ -81056,6 +81159,7 @@ function buildQueryContextFromSdk(options) {
|
|
|
81056
81159
|
loaded: createSignal()
|
|
81057
81160
|
},
|
|
81058
81161
|
pluginDataPaths: new Map,
|
|
81162
|
+
pluginContentVariables: {},
|
|
81059
81163
|
lspManager: null
|
|
81060
81164
|
},
|
|
81061
81165
|
diagnostics: createFreshDiagnostics(),
|
|
@@ -81692,11 +81796,22 @@ function resetSdkInitState() {
|
|
|
81692
81796
|
r.initJsonSchema = null;
|
|
81693
81797
|
r.registeredHooks = null;
|
|
81694
81798
|
}
|
|
81695
|
-
function setExplicitPluginRuntimeContext(dataPaths, lspManager) {
|
|
81799
|
+
function setExplicitPluginRuntimeContext(dataPaths, lspManager, contentVariables) {
|
|
81696
81800
|
const registries = getQueryContext().registries;
|
|
81697
81801
|
registries.pluginDataPaths = new Map(dataPaths);
|
|
81802
|
+
registries.pluginContentVariables = { ...contentVariables };
|
|
81698
81803
|
registries.lspManager = lspManager;
|
|
81699
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
|
+
}
|
|
81700
81815
|
function tryGetExplicitPluginDataPath(pluginId) {
|
|
81701
81816
|
try {
|
|
81702
81817
|
return getQueryContext().registries.pluginDataPaths.get(pluginId);
|
|
@@ -82162,6 +82277,7 @@ __export(exports_state, {
|
|
|
82162
82277
|
setCwdState: () => setCwdState,
|
|
82163
82278
|
setDirectConnectServerUrl: () => setDirectConnectServerUrl,
|
|
82164
82279
|
setEnvVar: () => setEnvVar,
|
|
82280
|
+
setExplicitPluginRuntimeBundle: () => setExplicitPluginRuntimeBundle,
|
|
82165
82281
|
setExplicitPluginRuntimeContext: () => setExplicitPluginRuntimeContext,
|
|
82166
82282
|
setFastModeHeaderLatched: () => setFastModeHeaderLatched,
|
|
82167
82283
|
setFlagSettingsInline: () => setFlagSettingsInline,
|
|
@@ -82198,6 +82314,7 @@ __export(exports_state, {
|
|
|
82198
82314
|
snapshotOutputTokensForTurn: () => snapshotOutputTokensForTurn,
|
|
82199
82315
|
switchSession: () => switchSession,
|
|
82200
82316
|
tryGetExplicitPluginDataPath: () => tryGetExplicitPluginDataPath,
|
|
82317
|
+
tryGetPluginContentVariables: () => tryGetPluginContentVariables,
|
|
82201
82318
|
tryGetQueryContext: () => tryGetQueryContext,
|
|
82202
82319
|
tryGetSessionLspManager: () => tryGetSessionLspManager,
|
|
82203
82320
|
unregisterCreatedTeam: () => unregisterCreatedTeam
|
|
@@ -82313,7 +82430,7 @@ function setMeter(meter, createCounter) {
|
|
|
82313
82430
|
description: "Number of git commits created"
|
|
82314
82431
|
});
|
|
82315
82432
|
STATE.costCounter = createCounter("claude_code.cost.usage", {
|
|
82316
|
-
description: "Cost of the
|
|
82433
|
+
description: "Cost of the agent session",
|
|
82317
82434
|
unit: "USD"
|
|
82318
82435
|
});
|
|
82319
82436
|
STATE.tokenCounter = createCounter("claude_code.token.usage", {
|
|
@@ -83882,6 +83999,11 @@ var init_platform2 = __esm(() => {
|
|
|
83882
83999
|
});
|
|
83883
84000
|
|
|
83884
84001
|
// src/session/settings/managedPath.ts
|
|
84002
|
+
var exports_managedPath = {};
|
|
84003
|
+
__export(exports_managedPath, {
|
|
84004
|
+
getManagedFilePath: () => getManagedFilePath,
|
|
84005
|
+
getManagedSettingsDropInDir: () => getManagedSettingsDropInDir
|
|
84006
|
+
});
|
|
83885
84007
|
import { join as join22 } from "path";
|
|
83886
84008
|
var getManagedFilePath, getManagedSettingsDropInDir;
|
|
83887
84009
|
var init_managedPath = __esm(() => {
|
|
@@ -84078,8 +84200,8 @@ function createBootQueryContext() {
|
|
|
84078
84200
|
}
|
|
84079
84201
|
const sessionId = randomUUID();
|
|
84080
84202
|
init_paths();
|
|
84081
|
-
init_LayoutProfile();
|
|
84082
|
-
init_managedPath();
|
|
84203
|
+
const { DEFAULT_LAYOUT_PROFILE } = (init_LayoutProfile(), __toCommonJS(exports_LayoutProfile));
|
|
84204
|
+
const { getManagedFilePath } = (init_managedPath(), __toCommonJS(exports_managedPath));
|
|
84083
84205
|
const { homedir } = __require("node:os");
|
|
84084
84206
|
const bootConfigHomeDir = process.env.CLAUDE_CONFIG_DIR ? process.env.CLAUDE_CONFIG_DIR.normalize("NFC") : (homedir() + "/.opencow").normalize("NFC");
|
|
84085
84207
|
const bootMemoryBaseDir = resolveEnvVar("REMOTE_MEMORY_DIR") ?? bootConfigHomeDir;
|
|
@@ -84184,6 +84306,7 @@ function createBootQueryContext() {
|
|
|
84184
84306
|
loaded: createSignal()
|
|
84185
84307
|
},
|
|
84186
84308
|
pluginDataPaths: new Map,
|
|
84309
|
+
pluginContentVariables: {},
|
|
84187
84310
|
lspManager: null
|
|
84188
84311
|
},
|
|
84189
84312
|
diagnostics: createFreshDiagnostics(),
|
|
@@ -84275,6 +84398,7 @@ function deriveSubagentRegistries(parent) {
|
|
|
84275
84398
|
skillListingSuppressNext: false,
|
|
84276
84399
|
dynamicSkills: parent.dynamicSkills,
|
|
84277
84400
|
pluginDataPaths: parent.pluginDataPaths,
|
|
84401
|
+
pluginContentVariables: parent.pluginContentVariables,
|
|
84278
84402
|
lspManager: parent.lspManager
|
|
84279
84403
|
};
|
|
84280
84404
|
}
|
|
@@ -84555,6 +84679,7 @@ var init_envVars = __esm(() => {
|
|
|
84555
84679
|
DISABLE_EARLY_INPUT: envVar("OPENCOW_DISABLE_EARLY_INPUT"),
|
|
84556
84680
|
ENABLE_EXTENDED_KEYS: envVar("OPENCOW_ENABLE_EXTENDED_KEYS"),
|
|
84557
84681
|
ENABLE_STREAM_WATCHDOG: envVar("OPENCOW_ENABLE_STREAM_WATCHDOG"),
|
|
84682
|
+
SKILL_LISTING: envVar("OPENCOW_SKILL_LISTING"),
|
|
84558
84683
|
STREAM_IDLE_TIMEOUT_MS: envVar("OPENCOW_STREAM_IDLE_TIMEOUT_MS"),
|
|
84559
84684
|
UNBOUNDED_CONNECTION_RETRY: envVar("OPENCOW_UNBOUNDED_CONNECTION_RETRY"),
|
|
84560
84685
|
STREAM_REPLAY_RETRIES: envVar("OPENCOW_STREAM_REPLAY_RETRIES"),
|
|
@@ -86601,7 +86726,7 @@ function printStartupScreen() {
|
|
|
86601
86726
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
86602
86727
|
out.push(boxRow(sRow, W, sLen));
|
|
86603
86728
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W - 2)}╝${RESET}`);
|
|
86604
|
-
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.27"}${RESET}`);
|
|
86605
86730
|
out.push("");
|
|
86606
86731
|
process.stdout.write(out.join(`
|
|
86607
86732
|
`) + `
|
|
@@ -87643,7 +87768,7 @@ function getRemoteSessionUrl(sessionId, ingressUrl) {
|
|
|
87643
87768
|
const baseUrl = getClaudeAiBaseUrl(compatId, ingressUrl);
|
|
87644
87769
|
return `${baseUrl}/code/${compatId}`;
|
|
87645
87770
|
}
|
|
87646
|
-
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";
|
|
87647
87772
|
|
|
87648
87773
|
// src/constants/system.ts
|
|
87649
87774
|
function isCLISyspromptPrefix(value) {
|
|
@@ -106085,6 +106210,7 @@ var init_TaskOutput = __esm(() => {
|
|
|
106085
106210
|
init_stringUtils();
|
|
106086
106211
|
init_diskOutput();
|
|
106087
106212
|
init_fsOperations();
|
|
106213
|
+
init_branding();
|
|
106088
106214
|
DEFAULT_MAX_MEMORY = 8 * 1024 * 1024;
|
|
106089
106215
|
TaskOutput = class TaskOutput {
|
|
106090
106216
|
taskId;
|
|
@@ -106272,7 +106398,7 @@ Output truncated (${sizeKB}KB total). Full output saved to: ${this.path}`;
|
|
|
106272
106398
|
} catch (err) {
|
|
106273
106399
|
const code = err instanceof Error && "code" in err ? String(err.code) : "unknown";
|
|
106274
106400
|
logForDebugging2(`TaskOutput.#readStdoutFromFile: failed to read ${this.path} (${code}): ${err}`);
|
|
106275
|
-
return `<bash output unavailable: output file ${this.path} could not be read (${code}). This usually means another
|
|
106401
|
+
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.>`;
|
|
106276
106402
|
}
|
|
106277
106403
|
}
|
|
106278
106404
|
getStderr() {
|
|
@@ -110052,7 +110178,7 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
110052
110178
|
logForDebugging2(`Looking for shell config file: ${configFile}`);
|
|
110053
110179
|
const configFileExists = await pathExists(configFile);
|
|
110054
110180
|
if (!configFileExists) {
|
|
110055
|
-
logForDebugging2(`Shell config file not found: ${configFile}, creating snapshot with
|
|
110181
|
+
logForDebugging2(`Shell config file not found: ${configFile}, creating snapshot with ${getBranding().productName} defaults only`);
|
|
110056
110182
|
}
|
|
110057
110183
|
const timestamp = Date.now();
|
|
110058
110184
|
const randomId = Math.random().toString(36).substring(2, 8);
|
|
@@ -110165,6 +110291,7 @@ var init_ShellSnapshot = __esm(() => {
|
|
|
110165
110291
|
init_subprocessEnv();
|
|
110166
110292
|
init_shellQuote();
|
|
110167
110293
|
init_state();
|
|
110294
|
+
init_branding();
|
|
110168
110295
|
VCS_DIRECTORIES_TO_EXCLUDE = [
|
|
110169
110296
|
".git",
|
|
110170
110297
|
".svn",
|
|
@@ -131694,11 +131821,11 @@ function getPluginErrorMessage(error) {
|
|
|
131694
131821
|
}
|
|
131695
131822
|
|
|
131696
131823
|
// src/capabilities/mcp/envExpansion.ts
|
|
131697
|
-
function expandEnvVarsInString(value) {
|
|
131824
|
+
function expandEnvVarsInString(value, env = process.env) {
|
|
131698
131825
|
const missingVars = [];
|
|
131699
131826
|
const expanded = value.replace(/\$\{([^}]+)\}/g, (match, varContent) => {
|
|
131700
131827
|
const [varName, defaultValue] = varContent.split(":-", 2);
|
|
131701
|
-
const envValue =
|
|
131828
|
+
const envValue = env[varName];
|
|
131702
131829
|
if (envValue !== undefined) {
|
|
131703
131830
|
return envValue;
|
|
131704
131831
|
}
|
|
@@ -131714,6 +131841,61 @@ function expandEnvVarsInString(value) {
|
|
|
131714
131841
|
};
|
|
131715
131842
|
}
|
|
131716
131843
|
|
|
131844
|
+
// src/capabilities/mcp/codexConfigFields.ts
|
|
131845
|
+
function isPlainObject6(value) {
|
|
131846
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
131847
|
+
}
|
|
131848
|
+
function setMissing(record, key, value) {
|
|
131849
|
+
if (record[key] !== undefined)
|
|
131850
|
+
return;
|
|
131851
|
+
record[key] = value;
|
|
131852
|
+
}
|
|
131853
|
+
function recordFor(config, key) {
|
|
131854
|
+
const existing = config[key];
|
|
131855
|
+
if (isPlainObject6(existing))
|
|
131856
|
+
return existing;
|
|
131857
|
+
const created = {};
|
|
131858
|
+
config[key] = created;
|
|
131859
|
+
return created;
|
|
131860
|
+
}
|
|
131861
|
+
function stringRecordEntries(value) {
|
|
131862
|
+
if (!isPlainObject6(value))
|
|
131863
|
+
return [];
|
|
131864
|
+
return Object.entries(value).filter((entry) => typeof entry[1] === "string");
|
|
131865
|
+
}
|
|
131866
|
+
function normalizeCodexMcpFields(input) {
|
|
131867
|
+
if (!isPlainObject6(input))
|
|
131868
|
+
return {};
|
|
131869
|
+
const config = structuredClone(input);
|
|
131870
|
+
const envVars = config["env_vars"];
|
|
131871
|
+
if (Array.isArray(envVars)) {
|
|
131872
|
+
for (const name of envVars.filter((item) => typeof item === "string")) {
|
|
131873
|
+
setMissing(recordFor(config, "env"), name, `\${${name}}`);
|
|
131874
|
+
}
|
|
131875
|
+
delete config["env_vars"];
|
|
131876
|
+
}
|
|
131877
|
+
const envHttpHeaders = config["env_http_headers"];
|
|
131878
|
+
if (isPlainObject6(envHttpHeaders)) {
|
|
131879
|
+
for (const [header, varName] of stringRecordEntries(envHttpHeaders)) {
|
|
131880
|
+
setMissing(recordFor(config, "headers"), header, `\${${varName}}`);
|
|
131881
|
+
}
|
|
131882
|
+
delete config["env_http_headers"];
|
|
131883
|
+
}
|
|
131884
|
+
const bearer = config["bearer_token_env_var"];
|
|
131885
|
+
if (typeof bearer === "string" && bearer.trim()) {
|
|
131886
|
+
setMissing(recordFor(config, "headers"), "Authorization", `Bearer \${${bearer.trim()}}`);
|
|
131887
|
+
delete config["bearer_token_env_var"];
|
|
131888
|
+
}
|
|
131889
|
+
const httpHeaders = config["http_headers"];
|
|
131890
|
+
if (isPlainObject6(httpHeaders)) {
|
|
131891
|
+
for (const [header, value] of stringRecordEntries(httpHeaders)) {
|
|
131892
|
+
setMissing(recordFor(config, "headers"), header, value);
|
|
131893
|
+
}
|
|
131894
|
+
delete config["http_headers"];
|
|
131895
|
+
}
|
|
131896
|
+
return config;
|
|
131897
|
+
}
|
|
131898
|
+
|
|
131717
131899
|
// native-stub:@anthropic-ai/mcpb
|
|
131718
131900
|
var exports_mcpb = {};
|
|
131719
131901
|
__export(exports_mcpb, {
|
|
@@ -135124,6 +135306,11 @@ function substitutePluginVariables(value, plugin) {
|
|
|
135124
135306
|
}
|
|
135125
135307
|
return out;
|
|
135126
135308
|
}
|
|
135309
|
+
function substitutePluginContentVariables(value, variables = tryGetPluginContentVariables()) {
|
|
135310
|
+
if (Object.keys(variables).length === 0)
|
|
135311
|
+
return value;
|
|
135312
|
+
return value.replace(/\$\{([A-Z][A-Z0-9_]*)\}/g, (match, name) => Object.hasOwn(variables, name) ? variables[name] : match);
|
|
135313
|
+
}
|
|
135127
135314
|
function substituteUserConfigVariables(value, userConfig) {
|
|
135128
135315
|
return value.replace(/\$\{user_config\.([^}]+)\}/g, (_match, key) => {
|
|
135129
135316
|
const configValue = userConfig[key];
|
|
@@ -135167,7 +135354,7 @@ var init_pluginOptionsStorage = __esm(() => {
|
|
|
135167
135354
|
});
|
|
135168
135355
|
|
|
135169
135356
|
// src/capabilities/plugins/mcpPluginIntegration.ts
|
|
135170
|
-
import { join as join47 } from "path";
|
|
135357
|
+
import { join as join47, resolve as resolvePath } from "path";
|
|
135171
135358
|
async function loadMcpServersFromMcpb(plugin, mcpbPath, errors) {
|
|
135172
135359
|
try {
|
|
135173
135360
|
logForDebugging2(`Loading MCP servers from MCPB: ${mcpbPath}`);
|
|
@@ -135298,7 +135485,7 @@ async function loadMcpServersFromFile(pluginPath, relativePath, errors, plugin,
|
|
|
135298
135485
|
const mcpServers = parsed.mcpServers || parsed;
|
|
135299
135486
|
const validatedServers = {};
|
|
135300
135487
|
for (const [name, config] of Object.entries(mcpServers)) {
|
|
135301
|
-
const result = McpServerConfigSchema().safeParse(config);
|
|
135488
|
+
const result = McpServerConfigSchema().safeParse(normalizeCodexMcpFields(config));
|
|
135302
135489
|
if (result.success) {
|
|
135303
135490
|
validatedServers[name] = result.data;
|
|
135304
135491
|
} else {
|
|
@@ -135379,12 +135566,13 @@ function buildMcpUserConfig(plugin, serverName) {
|
|
|
135379
135566
|
}
|
|
135380
135567
|
function resolvePluginMcpEnvironment(config, plugin, userConfig, errors, pluginName, serverName) {
|
|
135381
135568
|
const allMissingVars = [];
|
|
135569
|
+
const envLookup = plugin.env ? { ...process.env, ...plugin.env } : process.env;
|
|
135382
135570
|
const resolveValue = (value) => {
|
|
135383
135571
|
let resolved = substitutePluginVariables(value, plugin);
|
|
135384
135572
|
if (userConfig) {
|
|
135385
135573
|
resolved = substituteUserConfigVariables(resolved, userConfig);
|
|
135386
135574
|
}
|
|
135387
|
-
const { expanded, missingVars } = expandEnvVarsInString(resolved);
|
|
135575
|
+
const { expanded, missingVars } = expandEnvVarsInString(resolved, envLookup);
|
|
135388
135576
|
allMissingVars.push(...missingVars);
|
|
135389
135577
|
return expanded;
|
|
135390
135578
|
};
|
|
@@ -135399,6 +135587,9 @@ function resolvePluginMcpEnvironment(config, plugin, userConfig, errors, pluginN
|
|
|
135399
135587
|
if (stdioConfig.args) {
|
|
135400
135588
|
stdioConfig.args = stdioConfig.args.map((arg) => resolveValue(arg));
|
|
135401
135589
|
}
|
|
135590
|
+
if (stdioConfig.cwd) {
|
|
135591
|
+
stdioConfig.cwd = resolvePath(plugin.path, resolveValue(stdioConfig.cwd));
|
|
135592
|
+
}
|
|
135402
135593
|
const resolvedEnv = {
|
|
135403
135594
|
CLAUDE_PLUGIN_ROOT: plugin.path,
|
|
135404
135595
|
CLAUDE_PLUGIN_DATA: plugin.dataPath ?? getPluginDataDir(plugin.source),
|
|
@@ -136123,160 +136314,6 @@ var init_agentMemorySnapshot = __esm(() => {
|
|
|
136123
136314
|
}));
|
|
136124
136315
|
});
|
|
136125
136316
|
|
|
136126
|
-
// src/capabilities/tools/AgentTool/built-in/claudeCodeGuideAgent.ts
|
|
136127
|
-
function getClaudeCodeGuideBasePrompt() {
|
|
136128
|
-
const localSearchHint = hasEmbeddedSearchTools() ? `${FILE_READ_TOOL_NAME}, \`find\`, and \`grep\`` : `${FILE_READ_TOOL_NAME}, ${GLOB_TOOL_NAME}, and ${GREP_TOOL_NAME}`;
|
|
136129
|
-
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.
|
|
136130
|
-
|
|
136131
|
-
**Your expertise spans three domains:**
|
|
136132
|
-
|
|
136133
|
-
1. **Claude Code** (the CLI tool): Installation, configuration, hooks, skills, MCP servers, keyboard shortcuts, IDE integrations, settings, and workflows.
|
|
136134
|
-
|
|
136135
|
-
2. **Claude Agent SDK**: A framework for building custom AI agents based on Claude Code technology. Available for Node.js/TypeScript and Python.
|
|
136136
|
-
|
|
136137
|
-
3. **Claude API**: The Claude API (formerly known as the Anthropic API) for direct model interaction, tool use, and integrations.
|
|
136138
|
-
|
|
136139
|
-
**Documentation sources:**
|
|
136140
|
-
|
|
136141
|
-
- **Claude Code docs** (${CLAUDE_CODE_DOCS_MAP_URL}): Fetch this for questions about the Claude Code CLI tool, including:
|
|
136142
|
-
- Installation, setup, and getting started
|
|
136143
|
-
- Hooks (pre/post command execution)
|
|
136144
|
-
- Custom skills
|
|
136145
|
-
- MCP server configuration
|
|
136146
|
-
- IDE integrations (VS Code, JetBrains)
|
|
136147
|
-
- Settings files and configuration
|
|
136148
|
-
- Keyboard shortcuts and hotkeys
|
|
136149
|
-
- Subagents and plugins
|
|
136150
|
-
- Sandboxing and security
|
|
136151
|
-
|
|
136152
|
-
- **Claude Agent SDK docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about building agents with the SDK, including:
|
|
136153
|
-
- SDK overview and getting started (Python and TypeScript)
|
|
136154
|
-
- Agent configuration + custom tools
|
|
136155
|
-
- Session management and permissions
|
|
136156
|
-
- MCP integration in agents
|
|
136157
|
-
- Hosting and deployment
|
|
136158
|
-
- Cost tracking and context management
|
|
136159
|
-
Note: Agent SDK docs are part of the Claude API documentation at the same URL.
|
|
136160
|
-
|
|
136161
|
-
- **Claude API docs** (${CDP_DOCS_MAP_URL}): Fetch this for questions about the Claude API (formerly the Anthropic API), including:
|
|
136162
|
-
- Messages API and streaming
|
|
136163
|
-
- 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)
|
|
136164
|
-
- Vision, PDF support, and citations
|
|
136165
|
-
- Extended thinking and structured outputs
|
|
136166
|
-
- MCP connector for remote MCP servers
|
|
136167
|
-
- Cloud provider integrations (Bedrock, Vertex AI, Foundry)
|
|
136168
|
-
|
|
136169
|
-
**Approach:**
|
|
136170
|
-
1. Determine which domain the user's question falls into
|
|
136171
|
-
2. Use ${WEB_FETCH_TOOL_NAME} to fetch the appropriate docs map
|
|
136172
|
-
3. Identify the most relevant documentation URLs from the map
|
|
136173
|
-
4. Fetch the specific documentation pages
|
|
136174
|
-
5. Provide clear, actionable guidance based on official documentation
|
|
136175
|
-
6. Use ${WEB_SEARCH_TOOL_NAME} if docs don't cover the topic
|
|
136176
|
-
7. Reference local project files (CLAUDE.md, .claude/ directory) when relevant using ${localSearchHint}
|
|
136177
|
-
|
|
136178
|
-
**Guidelines:**
|
|
136179
|
-
- Always prioritize official documentation over assumptions
|
|
136180
|
-
- Keep responses concise and actionable
|
|
136181
|
-
- Include specific examples or code snippets when helpful
|
|
136182
|
-
- Reference exact documentation URLs in your responses
|
|
136183
|
-
- Help users discover features by proactively suggesting related commands, shortcuts, or capabilities
|
|
136184
|
-
|
|
136185
|
-
Complete the user's request by providing accurate, documentation-based guidance.`;
|
|
136186
|
-
}
|
|
136187
|
-
function getFeedbackGuideline() {
|
|
136188
|
-
if (isUsing3PServices()) {
|
|
136189
|
-
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"}`;
|
|
136190
|
-
}
|
|
136191
|
-
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";
|
|
136192
|
-
}
|
|
136193
|
-
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;
|
|
136194
|
-
var init_claudeCodeGuideAgent = __esm(() => {
|
|
136195
|
-
init_auth();
|
|
136196
|
-
init_embeddedTools();
|
|
136197
|
-
init_settings2();
|
|
136198
|
-
init_slowOperations();
|
|
136199
|
-
CLAUDE_CODE_GUIDE_AGENT = {
|
|
136200
|
-
agentType: CLAUDE_CODE_GUIDE_AGENT_TYPE,
|
|
136201
|
-
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}.`,
|
|
136202
|
-
tools: hasEmbeddedSearchTools() ? [
|
|
136203
|
-
BASH_TOOL_NAME,
|
|
136204
|
-
FILE_READ_TOOL_NAME,
|
|
136205
|
-
WEB_FETCH_TOOL_NAME,
|
|
136206
|
-
WEB_SEARCH_TOOL_NAME
|
|
136207
|
-
] : [
|
|
136208
|
-
GLOB_TOOL_NAME,
|
|
136209
|
-
GREP_TOOL_NAME,
|
|
136210
|
-
FILE_READ_TOOL_NAME,
|
|
136211
|
-
WEB_FETCH_TOOL_NAME,
|
|
136212
|
-
WEB_SEARCH_TOOL_NAME
|
|
136213
|
-
],
|
|
136214
|
-
source: "built-in",
|
|
136215
|
-
baseDir: "built-in",
|
|
136216
|
-
model: "haiku",
|
|
136217
|
-
permissionMode: "dontAsk",
|
|
136218
|
-
getSystemPrompt({ toolUseContext }) {
|
|
136219
|
-
const commands = toolUseContext.options.commands;
|
|
136220
|
-
const contextSections = [];
|
|
136221
|
-
const customCommands = commands.filter((cmd) => cmd.type === "prompt");
|
|
136222
|
-
if (customCommands.length > 0) {
|
|
136223
|
-
const commandList = customCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
|
|
136224
|
-
`);
|
|
136225
|
-
contextSections.push(`**Available custom skills in this project:**
|
|
136226
|
-
${commandList}`);
|
|
136227
|
-
}
|
|
136228
|
-
const customAgents = toolUseContext.options.agentDefinitions.activeAgents.filter((a) => a.source !== "built-in");
|
|
136229
|
-
if (customAgents.length > 0) {
|
|
136230
|
-
const agentList = customAgents.map((a) => `- ${a.agentType}: ${a.whenToUse}`).join(`
|
|
136231
|
-
`);
|
|
136232
|
-
contextSections.push(`**Available custom agents configured:**
|
|
136233
|
-
${agentList}`);
|
|
136234
|
-
}
|
|
136235
|
-
const mcpClients = toolUseContext.options.mcpClients;
|
|
136236
|
-
if (mcpClients && mcpClients.length > 0) {
|
|
136237
|
-
const mcpList = mcpClients.map((client) => `- ${client.name}`).join(`
|
|
136238
|
-
`);
|
|
136239
|
-
contextSections.push(`**Configured MCP servers:**
|
|
136240
|
-
${mcpList}`);
|
|
136241
|
-
}
|
|
136242
|
-
const pluginCommands = commands.filter((cmd) => cmd.type === "prompt" && cmd.source === "plugin");
|
|
136243
|
-
if (pluginCommands.length > 0) {
|
|
136244
|
-
const pluginList = pluginCommands.map((cmd) => `- /${cmd.name}: ${cmd.description}`).join(`
|
|
136245
|
-
`);
|
|
136246
|
-
contextSections.push(`**Available plugin skills:**
|
|
136247
|
-
${pluginList}`);
|
|
136248
|
-
}
|
|
136249
|
-
const settings = getSettings_DEPRECATED();
|
|
136250
|
-
if (Object.keys(settings).length > 0) {
|
|
136251
|
-
const settingsJson = jsonStringify(settings, null, 2);
|
|
136252
|
-
contextSections.push(`**User's settings.json:**
|
|
136253
|
-
\`\`\`json
|
|
136254
|
-
${settingsJson}
|
|
136255
|
-
\`\`\``);
|
|
136256
|
-
}
|
|
136257
|
-
const feedbackGuideline = getFeedbackGuideline();
|
|
136258
|
-
const basePromptWithFeedback = `${getClaudeCodeGuideBasePrompt()}
|
|
136259
|
-
${feedbackGuideline}`;
|
|
136260
|
-
if (contextSections.length > 0) {
|
|
136261
|
-
return `${basePromptWithFeedback}
|
|
136262
|
-
|
|
136263
|
-
---
|
|
136264
|
-
|
|
136265
|
-
# User's Current Configuration
|
|
136266
|
-
|
|
136267
|
-
The user has the following custom setup in their environment:
|
|
136268
|
-
|
|
136269
|
-
${contextSections.join(`
|
|
136270
|
-
|
|
136271
|
-
`)}
|
|
136272
|
-
|
|
136273
|
-
When answering questions, consider these configured features and proactively suggest them when relevant.`;
|
|
136274
|
-
}
|
|
136275
|
-
return basePromptWithFeedback;
|
|
136276
|
-
}
|
|
136277
|
-
};
|
|
136278
|
-
});
|
|
136279
|
-
|
|
136280
136317
|
// src/capabilities/tools/AgentTool/built-in/exploreAgent.ts
|
|
136281
136318
|
function getExploreSystemPrompt() {
|
|
136282
136319
|
const embedded = hasEmbeddedSearchTools();
|
|
@@ -136743,17 +136780,12 @@ function getBuiltInAgents() {
|
|
|
136743
136780
|
if (areExplorePlanAgentsEnabled()) {
|
|
136744
136781
|
agents.push(EXPLORE_AGENT, PLAN_AGENT);
|
|
136745
136782
|
}
|
|
136746
|
-
const isNonSdkEntrypoint = resolveEnvVar("ENTRYPOINT") !== "sdk-ts" && resolveEnvVar("ENTRYPOINT") !== "sdk-py" && resolveEnvVar("ENTRYPOINT") !== "sdk-cli";
|
|
136747
|
-
if (isNonSdkEntrypoint) {
|
|
136748
|
-
agents.push(CLAUDE_CODE_GUIDE_AGENT);
|
|
136749
|
-
}
|
|
136750
136783
|
if (false) {}
|
|
136751
136784
|
return agents;
|
|
136752
136785
|
}
|
|
136753
136786
|
var init_builtInAgents = __esm(() => {
|
|
136754
136787
|
init_state2();
|
|
136755
136788
|
init_envUtils();
|
|
136756
|
-
init_claudeCodeGuideAgent();
|
|
136757
136789
|
init_exploreAgent();
|
|
136758
136790
|
init_generalPurposeAgent();
|
|
136759
136791
|
init_planAgent();
|
|
@@ -138729,7 +138761,7 @@ function getErrorMessageIfRefusal(stopReason, model) {
|
|
|
138729
138761
|
}
|
|
138730
138762
|
logEvent("tengu_refusal_api_response", {});
|
|
138731
138763
|
const usagePolicyUrl = isFamily(getProvider(), "firstParty") ? "https://www.anthropic.com/legal/aup" : "your provider's acceptable use policy";
|
|
138732
|
-
const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}:
|
|
138764
|
+
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.`;
|
|
138733
138765
|
const modelSuggestion = model !== "claude-sonnet-4-20250514" ? " If you are seeing this refusal repeatedly, try running /model claude-sonnet-4-20250514 to switch models." : "";
|
|
138734
138766
|
return createAssistantAPIErrorMessage({
|
|
138735
138767
|
content: baseMessage + modelSuggestion,
|
|
@@ -138776,6 +138808,7 @@ var init_errors8 = __esm(() => {
|
|
|
138776
138808
|
init_claudeAiLimits();
|
|
138777
138809
|
init_mocking();
|
|
138778
138810
|
init_errorUtils();
|
|
138811
|
+
init_branding();
|
|
138779
138812
|
});
|
|
138780
138813
|
|
|
138781
138814
|
// src/providers/shared/retry.ts
|
|
@@ -231233,12 +231266,11 @@ async function* runPostToolUseFailureHooks(toolUseContext, tool, toolUseID, mess
|
|
|
231233
231266
|
}
|
|
231234
231267
|
async function resolveHookPermissionDecision(hookPermissionResult, tool, input, toolUseContext, canUseTool, assistantMessage, toolUseID) {
|
|
231235
231268
|
const requiresInteraction = tool.requiresUserInteraction?.();
|
|
231236
|
-
const requireCanUseTool = toolUseContext.requireCanUseTool;
|
|
231237
231269
|
if (hookPermissionResult?.behavior === "allow") {
|
|
231238
231270
|
const hookInput = hookPermissionResult.updatedInput ?? input;
|
|
231239
231271
|
const interactionSatisfied = requiresInteraction && hookPermissionResult.updatedInput !== undefined;
|
|
231240
|
-
if (
|
|
231241
|
-
logForDebugging2(`Hook approved tool use for ${tool.name},
|
|
231272
|
+
if (!interactionSatisfied) {
|
|
231273
|
+
logForDebugging2(`Hook approved tool use for ${tool.name}, deferring final decision to canUseTool`);
|
|
231242
231274
|
return {
|
|
231243
231275
|
decision: await consumePermissionPreDecision(toolUseContext, toolUseID, hookInput, () => canUseTool(tool, hookInput, toolUseContext, assistantMessage, toolUseID)),
|
|
231244
231276
|
input: hookInput
|
|
@@ -231246,7 +231278,7 @@ async function resolveHookPermissionDecision(hookPermissionResult, tool, input,
|
|
|
231246
231278
|
}
|
|
231247
231279
|
const ruleCheck = await checkRuleBasedPermissions(tool, hookInput, toolUseContext);
|
|
231248
231280
|
if (ruleCheck === null) {
|
|
231249
|
-
logForDebugging2(
|
|
231281
|
+
logForDebugging2(`Hook satisfied user interaction for ${tool.name} via updatedInput`);
|
|
231250
231282
|
return { decision: hookPermissionResult, input: hookInput };
|
|
231251
231283
|
}
|
|
231252
231284
|
if (ruleCheck.behavior === "deny") {
|
|
@@ -235127,7 +235159,7 @@ function getAnthropicEnvMetadata() {
|
|
|
235127
235159
|
function getBuildAgeMinutes() {
|
|
235128
235160
|
if (false)
|
|
235129
235161
|
;
|
|
235130
|
-
const buildTime = new Date("2026-10-
|
|
235162
|
+
const buildTime = new Date("2026-10-20T14:00:47.620Z").getTime();
|
|
235131
235163
|
if (isNaN(buildTime))
|
|
235132
235164
|
return;
|
|
235133
235165
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -237447,7 +237479,7 @@ function hookSourceDescriptionDisplayString(source) {
|
|
|
237447
237479
|
case "sessionHook":
|
|
237448
237480
|
return "Session hooks (in-memory, temporary)";
|
|
237449
237481
|
case "builtinHook":
|
|
237450
|
-
return "Built-in hooks (registered internally
|
|
237482
|
+
return "Built-in hooks (registered internally)";
|
|
237451
237483
|
default:
|
|
237452
237484
|
return source;
|
|
237453
237485
|
}
|
|
@@ -239714,6 +239746,11 @@ NOTE: You just closed out 3+ tasks and none of them was a verification step. Bef
|
|
|
239714
239746
|
});
|
|
239715
239747
|
});
|
|
239716
239748
|
|
|
239749
|
+
// src/providers/shared/userAgent.ts
|
|
239750
|
+
function getClaudeCodeUserAgent() {
|
|
239751
|
+
return `claude-code/${"99.0.0"}`;
|
|
239752
|
+
}
|
|
239753
|
+
|
|
239717
239754
|
// src/providers/anthropic/policyLimits/types.ts
|
|
239718
239755
|
var PolicyLimitsResponseSchema;
|
|
239719
239756
|
var init_types8 = __esm(() => {
|
|
@@ -242195,7 +242232,8 @@ var init_coreSchemas = __esm(() => {
|
|
|
242195
242232
|
type: literal("stdio").optional(),
|
|
242196
242233
|
command: string2(),
|
|
242197
242234
|
args: array(string2()).optional(),
|
|
242198
|
-
env: record(string2(), string2()).optional()
|
|
242235
|
+
env: record(string2(), string2()).optional(),
|
|
242236
|
+
cwd: string2().optional()
|
|
242199
242237
|
}));
|
|
242200
242238
|
McpSSEServerConfigSchema2 = lazySchema(() => object({
|
|
242201
242239
|
type: literal("sse"),
|
|
@@ -248610,7 +248648,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
248610
248648
|
if (validator && !validator(args)) {
|
|
248611
248649
|
return {
|
|
248612
248650
|
behavior: "ask",
|
|
248613
|
-
message: `${command} with flags requires manual approval to ensure path safety. For security,
|
|
248651
|
+
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.`,
|
|
248614
248652
|
decisionReason: {
|
|
248615
248653
|
type: "other",
|
|
248616
248654
|
reason: `${command} command with flags requires manual approval`
|
|
@@ -248620,7 +248658,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
248620
248658
|
if (compoundCommandHasCd && operationType !== "read") {
|
|
248621
248659
|
return {
|
|
248622
248660
|
behavior: "ask",
|
|
248623
|
-
message: `Commands that change directories and perform write operations require explicit approval to ensure paths are evaluated correctly. For security,
|
|
248661
|
+
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.`,
|
|
248624
248662
|
decisionReason: {
|
|
248625
248663
|
type: "other",
|
|
248626
248664
|
reason: "Compound command contains cd with write operation - manual approval required to prevent path resolution bypass"
|
|
@@ -248632,7 +248670,7 @@ function validateCommandPaths(command, args, cwd, toolPermissionContext, compoun
|
|
|
248632
248670
|
if (!allowed) {
|
|
248633
248671
|
const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
|
|
248634
248672
|
const dirListStr = formatDirectoryList(workingDirs);
|
|
248635
|
-
const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : `${command} in '${resolvedPath}' was blocked. For security,
|
|
248673
|
+
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}.`;
|
|
248636
248674
|
if (decisionReason?.type === "rule") {
|
|
248637
248675
|
return {
|
|
248638
248676
|
behavior: "deny",
|
|
@@ -248757,7 +248795,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
|
|
|
248757
248795
|
if (compoundCommandHasCd && redirections.length > 0) {
|
|
248758
248796
|
return {
|
|
248759
248797
|
behavior: "ask",
|
|
248760
|
-
message: `Commands that change directories and write via output redirection require explicit approval to ensure paths are evaluated correctly. For security,
|
|
248798
|
+
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.`,
|
|
248761
248799
|
decisionReason: {
|
|
248762
248800
|
type: "other",
|
|
248763
248801
|
reason: "Compound command contains cd with output redirection - manual approval required to prevent path resolution bypass"
|
|
@@ -248772,7 +248810,7 @@ function validateOutputRedirections(redirections, cwd, toolPermissionContext, co
|
|
|
248772
248810
|
if (!allowed) {
|
|
248773
248811
|
const workingDirs = Array.from(allWorkingDirectories(toolPermissionContext));
|
|
248774
248812
|
const dirListStr = formatDirectoryList(workingDirs);
|
|
248775
|
-
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,
|
|
248813
|
+
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}.`;
|
|
248776
248814
|
if (decisionReason?.type === "rule") {
|
|
248777
248815
|
return {
|
|
248778
248816
|
behavior: "deny",
|
|
@@ -248979,6 +249017,7 @@ var init_pathValidation2 = __esm(() => {
|
|
|
248979
249017
|
init_pathValidation();
|
|
248980
249018
|
init_bashPermissions();
|
|
248981
249019
|
init_sedValidation();
|
|
249020
|
+
init_branding();
|
|
248982
249021
|
PATH_EXTRACTORS = {
|
|
248983
249022
|
cd: (args) => args.length === 0 ? [homedir18()] : [args.join(" ")],
|
|
248984
249023
|
ls: (args) => {
|
|
@@ -256556,12 +256595,13 @@ async function loadLspServersFromManifest(declaration, pluginPath, pluginName, e
|
|
|
256556
256595
|
}
|
|
256557
256596
|
function resolvePluginLspEnvironment(config, plugin, userConfig, _errors) {
|
|
256558
256597
|
const allMissingVars = [];
|
|
256598
|
+
const envLookup = plugin.env ? { ...process.env, ...plugin.env } : process.env;
|
|
256559
256599
|
const resolveValue = (value) => {
|
|
256560
256600
|
let resolved = substitutePluginVariables(value, plugin);
|
|
256561
256601
|
if (userConfig) {
|
|
256562
256602
|
resolved = substituteUserConfigVariables(resolved, userConfig);
|
|
256563
256603
|
}
|
|
256564
|
-
const { expanded, missingVars } = expandEnvVarsInString(resolved);
|
|
256604
|
+
const { expanded, missingVars } = expandEnvVarsInString(resolved, envLookup);
|
|
256565
256605
|
allMissingVars.push(...missingVars);
|
|
256566
256606
|
return expanded;
|
|
256567
256607
|
};
|
|
@@ -261995,7 +262035,7 @@ function validateInputForSettingsFileEdit(filePath, originalContent, getUpdatedC
|
|
|
261995
262035
|
if (!afterValidation.isValid) {
|
|
261996
262036
|
return {
|
|
261997
262037
|
result: false,
|
|
261998
|
-
message: `
|
|
262038
|
+
message: `settings.json validation failed after edit:
|
|
261999
262039
|
${afterValidation.error}
|
|
262000
262040
|
|
|
262001
262041
|
Full schema:
|
|
@@ -273865,6 +273905,7 @@ ${content}`;
|
|
|
273865
273905
|
source: sourceName,
|
|
273866
273906
|
dataPath: pluginDataPath
|
|
273867
273907
|
});
|
|
273908
|
+
finalContent = substitutePluginContentVariables(finalContent);
|
|
273868
273909
|
if (pluginManifest.userConfig) {
|
|
273869
273910
|
finalContent = substituteUserConfigInContent(finalContent, loadPluginOptions(sourceName), pluginManifest.userConfig);
|
|
273870
273911
|
}
|
|
@@ -281303,7 +281344,7 @@ async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl,
|
|
|
281303
281344
|
}
|
|
281304
281345
|
if (code) {
|
|
281305
281346
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
281306
|
-
res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to
|
|
281347
|
+
res.end(`<h1>Authentication Successful</h1><p>You can close this window. Return to ${import_xss2.default(getBranding().productName)}.</p>`);
|
|
281307
281348
|
cleanup();
|
|
281308
281349
|
resolveOnce(code);
|
|
281309
281350
|
}
|
|
@@ -281469,7 +281510,7 @@ class ClaudeAuthProvider {
|
|
|
281469
281510
|
}
|
|
281470
281511
|
get clientMetadata() {
|
|
281471
281512
|
const metadata = {
|
|
281472
|
-
client_name:
|
|
281513
|
+
client_name: `${getBranding().productName} (${this.serverName})`,
|
|
281473
281514
|
redirect_uris: [this.redirectUri],
|
|
281474
281515
|
grant_types: ["authorization_code", "refresh_token"],
|
|
281475
281516
|
response_types: ["code"],
|
|
@@ -281488,7 +281529,7 @@ class ClaudeAuthProvider {
|
|
|
281488
281529
|
logMCPDebug(this.serverName, `Using CIMD URL from env: ${override}`);
|
|
281489
281530
|
return override;
|
|
281490
281531
|
}
|
|
281491
|
-
return
|
|
281532
|
+
return getBranding().mcpOAuthClientMetadataUrl;
|
|
281492
281533
|
}
|
|
281493
281534
|
setMetadata(metadata) {
|
|
281494
281535
|
this._metadata = metadata;
|
|
@@ -282114,7 +282155,7 @@ var init_auth6 = __esm(() => {
|
|
|
282114
282155
|
init_errors7();
|
|
282115
282156
|
init_auth4();
|
|
282116
282157
|
init_axios2();
|
|
282117
|
-
|
|
282158
|
+
init_branding();
|
|
282118
282159
|
init_browser();
|
|
282119
282160
|
init_envUtils();
|
|
282120
282161
|
init_errors2();
|
|
@@ -286910,7 +286951,7 @@ function isIncludedMcpTool(tool) {
|
|
|
286910
286951
|
return !tool.name.startsWith("mcp__ide__") || ALLOWED_IDE_TOOLS.includes(tool.name);
|
|
286911
286952
|
}
|
|
286912
286953
|
function getServerCacheKey(name, serverRef) {
|
|
286913
|
-
return `${name}-${jsonStringify(serverRef)}`;
|
|
286954
|
+
return `${name}-${jsonStringify(serverRef)}-${jsonStringify(getBranding())}`;
|
|
286914
286955
|
}
|
|
286915
286956
|
async function clearServerCache(name, serverRef) {
|
|
286916
286957
|
const key = getServerCacheKey(name, serverRef);
|
|
@@ -287502,10 +287543,8 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
287502
287543
|
const results = await Promise.allSettled(Object.entries(sdkMcpConfigs).map(async ([name, config]) => {
|
|
287503
287544
|
const transport = new SdkControlClientTransport(name, sendMcpMessage);
|
|
287504
287545
|
const client = new Client({
|
|
287505
|
-
name: TELEMETRY_SERVICE_NAME,
|
|
287506
287546
|
...getMcpClientInfo(),
|
|
287507
|
-
version: "99.0.0"
|
|
287508
|
-
websiteUrl: PRODUCT_URL
|
|
287547
|
+
version: "99.0.0"
|
|
287509
287548
|
}, {
|
|
287510
287549
|
capabilities: {}
|
|
287511
287550
|
});
|
|
@@ -287634,6 +287673,7 @@ var init_client5 = __esm(() => {
|
|
|
287634
287673
|
ALLOWED_IDE_TOOLS = ["mcp__ide__executeCode", "mcp__ide__getDiagnostics"];
|
|
287635
287674
|
connectToServer = memoize_default(async (name, serverRef, serverStats) => {
|
|
287636
287675
|
const connectStartTime = Date.now();
|
|
287676
|
+
const cacheKey = getServerCacheKey(name, serverRef);
|
|
287637
287677
|
let inProcessServer;
|
|
287638
287678
|
try {
|
|
287639
287679
|
let transport;
|
|
@@ -287832,6 +287872,7 @@ var init_client5 = __esm(() => {
|
|
|
287832
287872
|
...subprocessEnv(),
|
|
287833
287873
|
...serverRef.env
|
|
287834
287874
|
},
|
|
287875
|
+
...serverRef.cwd ? { cwd: serverRef.cwd } : {},
|
|
287835
287876
|
stderr: "pipe"
|
|
287836
287877
|
});
|
|
287837
287878
|
} else {
|
|
@@ -287853,10 +287894,8 @@ var init_client5 = __esm(() => {
|
|
|
287853
287894
|
}
|
|
287854
287895
|
}
|
|
287855
287896
|
const client = new Client({
|
|
287856
|
-
name: TELEMETRY_SERVICE_NAME,
|
|
287857
287897
|
...getMcpClientInfo(),
|
|
287858
|
-
version: "99.0.0"
|
|
287859
|
-
websiteUrl: PRODUCT_URL
|
|
287898
|
+
version: "99.0.0"
|
|
287860
287899
|
}, {
|
|
287861
287900
|
capabilities: {
|
|
287862
287901
|
roots: {},
|
|
@@ -288066,12 +288105,11 @@ var init_client5 = __esm(() => {
|
|
|
288066
288105
|
const uptime = Date.now() - connectionStartTime;
|
|
288067
288106
|
const transportType = serverRef.type ?? "unknown";
|
|
288068
288107
|
logMCPDebug(name, `${transportType.toUpperCase()} connection closed after ${Math.floor(uptime / 1000)}s (${hasErrorOccurred ? "with errors" : "cleanly"})`);
|
|
288069
|
-
const key = getServerCacheKey(name, serverRef);
|
|
288070
288108
|
fetchToolsForClient.cache.delete(name);
|
|
288071
288109
|
fetchResourcesForClient.cache.delete(name);
|
|
288072
288110
|
fetchCommandsForClient.cache.delete(name);
|
|
288073
288111
|
if (false) {}
|
|
288074
|
-
connectToServer.cache.delete(
|
|
288112
|
+
connectToServer.cache.delete(cacheKey);
|
|
288075
288113
|
logMCPDebug(name, `Cleared connection cache for reconnection`);
|
|
288076
288114
|
if (originalOnclose) {
|
|
288077
288115
|
originalOnclose();
|
|
@@ -290124,7 +290162,7 @@ async function getAttachments(input, toolUseContext, ideSelection, queuedCommand
|
|
|
290124
290162
|
maybe("changed_files", () => getChangedFiles(context)),
|
|
290125
290163
|
maybe("nested_memory", () => getNestedMemoryAttachments(context)),
|
|
290126
290164
|
maybe("dynamic_skill", () => getDynamicSkillAttachments(context)),
|
|
290127
|
-
maybe("skill_listing", () => getSkillListingAttachments(context)),
|
|
290165
|
+
...isSkillListingEnabled() ? [maybe("skill_listing", () => getSkillListingAttachments(context))] : [],
|
|
290128
290166
|
maybe("plan_mode", () => getPlanModeAttachments(messages, toolUseContext)),
|
|
290129
290167
|
maybe("plan_mode_exit", () => getPlanModeExitAttachment(toolUseContext)),
|
|
290130
290168
|
...[],
|
|
@@ -290961,6 +290999,9 @@ function resetSentSkillNames() {
|
|
|
290961
290999
|
function suppressNextSkillListing() {
|
|
290962
291000
|
getQueryContext().registries.skillListingSuppressNext = true;
|
|
290963
291001
|
}
|
|
291002
|
+
function isSkillListingEnabled() {
|
|
291003
|
+
return !isEnvDefinedFalsy(resolveEnvVar("SKILL_LISTING"));
|
|
291004
|
+
}
|
|
290964
291005
|
async function getSkillListingAttachments(toolUseContext) {
|
|
290965
291006
|
if (false) {}
|
|
290966
291007
|
if (!toolUseContext.options.tools.some((t) => toolMatchesName2(t, SKILL_TOOL_NAME))) {
|
|
@@ -301014,7 +301055,7 @@ function AUTO_REJECT_MESSAGE(toolName) {
|
|
|
301014
301055
|
return `Permission to use ${toolName} has been denied. ${DENIAL_WORKAROUND_GUIDANCE}`;
|
|
301015
301056
|
}
|
|
301016
301057
|
function DONT_ASK_REJECT_MESSAGE(toolName) {
|
|
301017
|
-
return `Permission to use ${toolName} has been denied because
|
|
301058
|
+
return `Permission to use ${toolName} has been denied because ${getBranding().productName} is running in don't ask mode. ${DENIAL_WORKAROUND_GUIDANCE}`;
|
|
301018
301059
|
}
|
|
301019
301060
|
function isSyntheticMessage(message) {
|
|
301020
301061
|
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);
|
|
@@ -304206,6 +304247,7 @@ var init_messages4 = __esm(() => {
|
|
|
304206
304247
|
init_tasks();
|
|
304207
304248
|
init_toolSearch();
|
|
304208
304249
|
init_state();
|
|
304250
|
+
init_branding();
|
|
304209
304251
|
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.`;
|
|
304210
304252
|
SYNTHETIC_MESSAGES = new Set([
|
|
304211
304253
|
INTERRUPT_MESSAGE,
|
|
@@ -369304,11 +369346,12 @@ var init_utils8 = __esm(() => {
|
|
|
369304
369346
|
init_log3();
|
|
369305
369347
|
init_state();
|
|
369306
369348
|
init_mcpOutputStorage();
|
|
369349
|
+
init_branding();
|
|
369307
369350
|
init_settings2();
|
|
369308
369351
|
init_preapproved();
|
|
369309
369352
|
DomainBlockedError = class DomainBlockedError extends Error {
|
|
369310
369353
|
constructor(domain) {
|
|
369311
|
-
super(
|
|
369354
|
+
super(`${getBranding().productName} is unable to fetch from ${domain}`);
|
|
369312
369355
|
this.name = "DomainBlockedError";
|
|
369313
369356
|
}
|
|
369314
369357
|
};
|
|
@@ -389512,7 +389555,7 @@ async function enrollTrustedDevice() {
|
|
|
389512
389555
|
logForDebugging2("[trusted-device] CLAUDE_TRUSTED_DEVICE_TOKEN env var is set, skipping enrollment (env var takes precedence)");
|
|
389513
389556
|
return;
|
|
389514
389557
|
}
|
|
389515
|
-
init_auth();
|
|
389558
|
+
const { getClaudeAIOAuthTokens } = (init_auth(), __toCommonJS(exports_auth));
|
|
389516
389559
|
const accessToken = getClaudeAIOAuthTokens()?.accessToken;
|
|
389517
389560
|
if (!accessToken) {
|
|
389518
389561
|
logForDebugging2("[trusted-device] No OAuth token, skipping enrollment");
|
|
@@ -389526,7 +389569,7 @@ async function enrollTrustedDevice() {
|
|
|
389526
389569
|
const baseUrl = getOauthConfig().BASE_API_URL;
|
|
389527
389570
|
let response;
|
|
389528
389571
|
try {
|
|
389529
|
-
response = await axios_default.post(`${baseUrl}/api/auth/trusted_devices`, { display_name:
|
|
389572
|
+
response = await axios_default.post(`${baseUrl}/api/auth/trusted_devices`, { display_name: `${getBranding().productName} on ${hostname2()} · ${process.platform}` }, {
|
|
389530
389573
|
headers: {
|
|
389531
389574
|
Authorization: `Bearer ${accessToken}`,
|
|
389532
389575
|
"Content-Type": "application/json"
|
|
@@ -389578,6 +389621,7 @@ var init_trustedDevice = __esm(() => {
|
|
|
389578
389621
|
init_privacyLevel();
|
|
389579
389622
|
init_secureStorage();
|
|
389580
389623
|
init_slowOperations();
|
|
389624
|
+
init_branding();
|
|
389581
389625
|
readStoredToken = memoize_default(() => {
|
|
389582
389626
|
const envToken = process.env.CLAUDE_TRUSTED_DEVICE_TOKEN;
|
|
389583
389627
|
if (envToken) {
|
|
@@ -480080,7 +480124,7 @@ function buildPrimarySection() {
|
|
|
480080
480124
|
}, undefined, false, undefined, this);
|
|
480081
480125
|
return [{
|
|
480082
480126
|
label: "Version",
|
|
480083
|
-
value: "0.4.
|
|
480127
|
+
value: "0.4.27"
|
|
480084
480128
|
}, {
|
|
480085
480129
|
label: "Session name",
|
|
480086
480130
|
value: nameValue
|
|
@@ -506584,7 +506628,7 @@ async function validatePluginManifest(filePath) {
|
|
|
506584
506628
|
delete stripped[key];
|
|
506585
506629
|
warnings.push({
|
|
506586
506630
|
path: key,
|
|
506587
|
-
message: `Field '${key}' belongs in the marketplace entry (marketplace.json), ` + `not plugin.json. It's harmless here but unused —
|
|
506631
|
+
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.`
|
|
506588
506632
|
});
|
|
506589
506633
|
}
|
|
506590
506634
|
toValidate = stripped;
|
|
@@ -506599,7 +506643,7 @@ async function validatePluginManifest(filePath) {
|
|
|
506599
506643
|
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(manifest.name)) {
|
|
506600
506644
|
warnings.push({
|
|
506601
506645
|
path: "name",
|
|
506602
|
-
message: `Plugin name "${manifest.name}" is not kebab-case.
|
|
506646
|
+
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").`
|
|
506603
506647
|
});
|
|
506604
506648
|
}
|
|
506605
506649
|
if (!manifest.version) {
|
|
@@ -507035,6 +507079,7 @@ var init_validatePlugin = __esm(() => {
|
|
|
507035
507079
|
init_slowOperations();
|
|
507036
507080
|
init_schemas3();
|
|
507037
507081
|
init_fsOperations();
|
|
507082
|
+
init_branding();
|
|
507038
507083
|
MARKETPLACE_ONLY_MANIFEST_FIELDS = new Set([
|
|
507039
507084
|
"category",
|
|
507040
507085
|
"source",
|
|
@@ -528159,7 +528204,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
528159
528204
|
var call58 = async () => {
|
|
528160
528205
|
return {
|
|
528161
528206
|
type: "text",
|
|
528162
|
-
value: `${"99.0.0"} (built ${"2026-10-
|
|
528207
|
+
value: `${"99.0.0"} (built ${"2026-10-20T14:00:47.620Z"})`
|
|
528163
528208
|
};
|
|
528164
528209
|
}, version2, version_default;
|
|
528165
528210
|
var init_version = __esm(() => {
|
|
@@ -545838,7 +545883,7 @@ function WelcomeV2() {
|
|
|
545838
545883
|
dimColor: true,
|
|
545839
545884
|
children: [
|
|
545840
545885
|
"v",
|
|
545841
|
-
"0.4.
|
|
545886
|
+
"0.4.27",
|
|
545842
545887
|
" "
|
|
545843
545888
|
]
|
|
545844
545889
|
}, undefined, true, undefined, this)
|
|
@@ -546038,7 +546083,7 @@ function WelcomeV2() {
|
|
|
546038
546083
|
dimColor: true,
|
|
546039
546084
|
children: [
|
|
546040
546085
|
"v",
|
|
546041
|
-
"0.4.
|
|
546086
|
+
"0.4.27",
|
|
546042
546087
|
" "
|
|
546043
546088
|
]
|
|
546044
546089
|
}, undefined, true, undefined, this)
|
|
@@ -546264,7 +546309,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
546264
546309
|
dimColor: true,
|
|
546265
546310
|
children: [
|
|
546266
546311
|
"v",
|
|
546267
|
-
"0.4.
|
|
546312
|
+
"0.4.27",
|
|
546268
546313
|
" "
|
|
546269
546314
|
]
|
|
546270
546315
|
}, undefined, true, undefined, this);
|
|
@@ -546518,7 +546563,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
546518
546563
|
dimColor: true,
|
|
546519
546564
|
children: [
|
|
546520
546565
|
"v",
|
|
546521
|
-
"0.4.
|
|
546566
|
+
"0.4.27",
|
|
546522
546567
|
" "
|
|
546523
546568
|
]
|
|
546524
546569
|
}, undefined, true, undefined, this);
|
|
@@ -549999,9 +550044,8 @@ Remember that settings are in:
|
|
|
549999
550044
|
|
|
550000
550045
|
1. Review the user's issue description
|
|
550001
550046
|
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
|
|
550002
|
-
3.
|
|
550003
|
-
4.
|
|
550004
|
-
5. Suggest concrete fixes or next steps
|
|
550047
|
+
3. Explain what you found in plain language
|
|
550048
|
+
4. Suggest concrete fixes or next steps
|
|
550005
550049
|
`;
|
|
550006
550050
|
return [{ type: "text", text: prompt }];
|
|
550007
550051
|
}
|
|
@@ -550009,7 +550053,6 @@ Remember that settings are in:
|
|
|
550009
550053
|
}
|
|
550010
550054
|
var DEFAULT_DEBUG_LINES_READ = 20, TAIL_READ_BYTES;
|
|
550011
550055
|
var init_debug3 = __esm(() => {
|
|
550012
|
-
init_claudeCodeGuideAgent();
|
|
550013
550056
|
init_settings2();
|
|
550014
550057
|
init_debug();
|
|
550015
550058
|
init_errors2();
|
|
@@ -550162,7 +550205,7 @@ var init_schema2 = __esm(() => {
|
|
|
550162
550205
|
$schema: string2().optional().describe("JSON Schema URL for editor validation"),
|
|
550163
550206
|
$docs: string2().optional().describe("Documentation URL"),
|
|
550164
550207
|
bindings: array(KeybindingBlockSchema()).describe("Array of keybinding blocks by context")
|
|
550165
|
-
}).describe("
|
|
550208
|
+
}).describe("Keybindings configuration. Customize keyboard shortcuts by context."));
|
|
550166
550209
|
});
|
|
550167
550210
|
|
|
550168
550211
|
// src/cli/skills/bundled/keybindings.ts
|
|
@@ -567277,7 +567320,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
567277
567320
|
pendingHookMessages
|
|
567278
567321
|
}, renderAndRun);
|
|
567279
567322
|
}
|
|
567280
|
-
}).version("0.4.
|
|
567323
|
+
}).version("0.4.27 (OpenCow)", "-v, --version", "Output the version number");
|
|
567281
567324
|
program.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
567282
567325
|
program.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
567283
567326
|
if (canUserConfigureAdvisor()) {
|
|
@@ -567872,7 +567915,7 @@ if (false) {}
|
|
|
567872
567915
|
async function main2() {
|
|
567873
567916
|
const args = process.argv.slice(2);
|
|
567874
567917
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
567875
|
-
console.log(`${"0.4.
|
|
567918
|
+
console.log(`${"0.4.27"} (OpenCow)`);
|
|
567876
567919
|
return;
|
|
567877
567920
|
}
|
|
567878
567921
|
if (args.includes("--provider")) {
|
|
@@ -567972,4 +568015,4 @@ async function main2() {
|
|
|
567972
568015
|
}
|
|
567973
568016
|
main2();
|
|
567974
568017
|
|
|
567975
|
-
//# debugId=
|
|
568018
|
+
//# debugId=25745C572ABF064464756E2164756E21
|