@rayss-dev/openclaude 0.29.2-by-rayss → 0.30.2-by-rayss

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.
Files changed (5) hide show
  1. package/README.md +2 -2
  2. package/dist/acp.mjs +1328 -710
  3. package/dist/cli.mjs +157 -150
  4. package/dist/sdk.mjs +691 -259
  5. package/package.json +225 -225
package/dist/sdk.mjs CHANGED
@@ -7551,8 +7551,7 @@ var init_zai = __esm(() => {
7551
7551
  validation: {
7552
7552
  kind: "credential-env",
7553
7553
  routing: {
7554
- matchDefaultBaseUrl: true,
7555
- matchBaseUrlHosts: ["api.z.ai"]
7554
+ matchDefaultBaseUrl: true
7556
7555
  },
7557
7556
  credentialEnvVars: ["OPENAI_API_KEY"],
7558
7557
  missingCredentialMessage: "OPENAI_API_KEY is required for Z.AI GLM Coding Plan."
@@ -7560,6 +7559,22 @@ var init_zai = __esm(() => {
7560
7559
  catalog: {
7561
7560
  source: "static",
7562
7561
  models: [
7562
+ {
7563
+ id: "glm-5.3-flash",
7564
+ apiName: "glm-5.3-flash",
7565
+ label: "GLM-5.3-Flash",
7566
+ modelDescriptorId: "glm-5.3-flash",
7567
+ reasoning: {
7568
+ mode: "levels",
7569
+ levels: ["low", "high", "xhigh"],
7570
+ wireFormat: "zai_compatible"
7571
+ },
7572
+ transportOverrides: {
7573
+ openaiShim: {
7574
+ enableToolStreaming: true
7575
+ }
7576
+ }
7577
+ },
7563
7578
  {
7564
7579
  id: "glm-5.3",
7565
7580
  apiName: "glm-5.3",
@@ -9434,7 +9449,7 @@ var init_version = __esm(() => {
9434
9449
  import_semver = __toESM(require_semver2(), 1);
9435
9450
  fallbackBuildVersion = (() => {
9436
9451
  try {
9437
- return "0.29.2-by-rayss";
9452
+ return "0.30.2-by-rayss";
9438
9453
  } catch {
9439
9454
  return "0.0.0";
9440
9455
  }
@@ -9443,6 +9458,28 @@ var init_version = __esm(() => {
9443
9458
  });
9444
9459
 
9445
9460
  // src/integrations/aimlapi/config.ts
9461
+ function isManagedAttributionHeaderName(name) {
9462
+ return AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES.has(name.trim().toLowerCase());
9463
+ }
9464
+ function omitManagedAttributionHeaders(headers) {
9465
+ const resolved = {};
9466
+ for (const [name, value] of Object.entries(headers)) {
9467
+ if (isManagedAttributionHeaderName(name))
9468
+ continue;
9469
+ resolved[name] = value;
9470
+ }
9471
+ return resolved;
9472
+ }
9473
+ function collectManagedAttributionValues(headers) {
9474
+ const collected = new Map;
9475
+ for (const [name, value] of Object.entries(headers)) {
9476
+ const key = name.trim().toLowerCase();
9477
+ if (AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES.has(key)) {
9478
+ collected.set(key, value);
9479
+ }
9480
+ }
9481
+ return collected;
9482
+ }
9446
9483
  function resolvePartnerId() {
9447
9484
  return DEFAULT_PARTNER_ID;
9448
9485
  }
@@ -9475,12 +9512,27 @@ function isCanonicalAimlapiInferenceBaseUrl(value) {
9475
9512
  return canonical !== null && candidate !== null && candidate.origin === canonical.origin && candidate.pathname === canonical.pathname;
9476
9513
  }
9477
9514
  function resolveAimlapiAttributionHeaders(headers, baseUrl) {
9515
+ const rest = omitManagedAttributionHeaders(headers);
9478
9516
  if (!baseUrl || isCanonicalAimlapiInferenceBaseUrl(baseUrl)) {
9479
- return { ...withResolvedPartnerHeader(headers), [SOURCE_HEADER_NAME]: AIMLAPI_SOURCE };
9517
+ const collected = collectManagedAttributionValues(headers);
9518
+ const managed = {
9519
+ [PARTNER_HEADER_NAME]: resolvePartnerId(),
9520
+ [SOURCE_HEADER_NAME]: AIMLAPI_SOURCE
9521
+ };
9522
+ for (const [key, canonical] of Object.entries(MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES)) {
9523
+ if (key === PARTNER_HEADER_NAME.toLowerCase() || key === SOURCE_HEADER_NAME.toLowerCase()) {
9524
+ continue;
9525
+ }
9526
+ const value = collected.get(key);
9527
+ if (value !== undefined) {
9528
+ managed[canonical] = value;
9529
+ }
9530
+ }
9531
+ return { ...rest, ...managed };
9480
9532
  }
9481
- return Object.fromEntries(Object.entries(headers).filter(([name]) => !CATALOG_ATTRIBUTION_HEADER_NAMES.has(name.trim().toLowerCase())));
9533
+ return rest;
9482
9534
  }
9483
- var DEFAULT_ENDPOINTS, DEFAULT_PARTNER_ID = "part_62yQoGYDq4Yqnrj2R1iGrDNJ", PARTNER_HEADER_NAME = "X-AIMLAPI-Partner-ID", SOURCE_HEADER_NAME = "X-AIMLAPI-Source", AIMLAPI_SOURCE = "agent/openclaude", CATALOG_ATTRIBUTION_HEADER_NAMES;
9535
+ var DEFAULT_ENDPOINTS, DEFAULT_PARTNER_ID = "part_62yQoGYDq4Yqnrj2R1iGrDNJ", PARTNER_HEADER_NAME = "X-AIMLAPI-Partner-ID", SOURCE_HEADER_NAME = "X-AIMLAPI-Source", INTEGRATION_REPO_HEADER_NAME = "X-AIMLAPI-Integration-Repo", INTEGRATION_VERSION_HEADER_NAME = "X-AIMLAPI-Integration-Version", REFERER_HEADER_NAME = "HTTP-Referer", TITLE_HEADER_NAME = "X-Title", MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES, AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES, AIMLAPI_SOURCE = "agent/openclaude";
9484
9536
  var init_config = __esm(() => {
9485
9537
  DEFAULT_ENDPOINTS = {
9486
9538
  authBaseUrl: "https://auth.aimlapi.com",
@@ -9489,14 +9541,15 @@ var init_config = __esm(() => {
9489
9541
  inferenceBaseUrl: "https://api.aimlapi.com/v1",
9490
9542
  verificationBaseUrl: "https://aimlapi.com/app"
9491
9543
  };
9492
- CATALOG_ATTRIBUTION_HEADER_NAMES = new Set([
9493
- PARTNER_HEADER_NAME.toLowerCase(),
9494
- SOURCE_HEADER_NAME.toLowerCase(),
9495
- "x-aimlapi-integration-repo",
9496
- "x-aimlapi-integration-version",
9497
- "http-referer",
9498
- "x-title"
9499
- ]);
9544
+ MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES = {
9545
+ [PARTNER_HEADER_NAME.toLowerCase()]: PARTNER_HEADER_NAME,
9546
+ [SOURCE_HEADER_NAME.toLowerCase()]: SOURCE_HEADER_NAME,
9547
+ [INTEGRATION_REPO_HEADER_NAME.toLowerCase()]: INTEGRATION_REPO_HEADER_NAME,
9548
+ [INTEGRATION_VERSION_HEADER_NAME.toLowerCase()]: INTEGRATION_VERSION_HEADER_NAME,
9549
+ [REFERER_HEADER_NAME.toLowerCase()]: REFERER_HEADER_NAME,
9550
+ [TITLE_HEADER_NAME.toLowerCase()]: TITLE_HEADER_NAME
9551
+ };
9552
+ AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES = new Set(Object.keys(MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES));
9500
9553
  });
9501
9554
 
9502
9555
  // src/integrations/gateways/aimlapi.ts
@@ -12643,6 +12696,7 @@ var init_glm = __esm(() => {
12643
12696
  supportsPreciseTokenCount: false
12644
12697
  },
12645
12698
  modelIds: [
12699
+ "glm-5.3-flash",
12646
12700
  "glm-5.3",
12647
12701
  "glm-5.2",
12648
12702
  "GLM-5.1",
@@ -17659,6 +17713,21 @@ var init_glm2 = __esm(() => {
17659
17713
  supportsPreciseTokenCount: false
17660
17714
  };
17661
17715
  glm_default2 = [
17716
+ defineModel({
17717
+ id: "glm-5.3-flash",
17718
+ label: "GLM 5.3 Flash",
17719
+ brandId: "glm",
17720
+ vendorId: "zai",
17721
+ classification: ["chat", "reasoning", "vision", "coding"],
17722
+ defaultModel: "glm-5.3-flash",
17723
+ capabilities: {
17724
+ ...glmCapabilities,
17725
+ supportsVision: true
17726
+ },
17727
+ contextWindow: 1e6,
17728
+ maxOutputTokens: 131072,
17729
+ runtimeMetadataScope: "catalog"
17730
+ }),
17662
17731
  glmModel("glm-5.3", "GLM 5.3", 1e6, 131072, "catalog"),
17663
17732
  defineModel({
17664
17733
  id: "glm-5v-turbo",
@@ -31478,6 +31547,9 @@ function normalizeComparableBaseUrl(baseUrl) {
31478
31547
  return baseUrl.trim().replace(/\/+$/, "").toLowerCase() || null;
31479
31548
  }
31480
31549
  }
31550
+ function isCanonicalZaiCodingPlanBaseUrl(value) {
31551
+ return normalizeComparableBaseUrl(value) === normalizeComparableBaseUrl(ZAI_CODING_PLAN_BASE_URL);
31552
+ }
31481
31553
  function normalizeHost2(baseUrl) {
31482
31554
  if (!baseUrl?.trim()) {
31483
31555
  return null;
@@ -32063,6 +32135,9 @@ function profileRouteHonorsBaseUrlBoundary(routeId, baseUrl) {
32063
32135
  if (routeId === "llmtr") {
32064
32136
  return isCanonicalLlmtrInferenceBaseUrl(baseUrl);
32065
32137
  }
32138
+ if (routeId === "zai") {
32139
+ return !baseUrl || isCanonicalZaiCodingPlanBaseUrl(baseUrl);
32140
+ }
32066
32141
  return true;
32067
32142
  }
32068
32143
  function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
@@ -32081,20 +32156,22 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
32081
32156
  if (isEnvTruthy(processEnv.CLAUDE_CODE_USE_VERTEX)) {
32082
32157
  return "vertex";
32083
32158
  }
32084
- const knownAnthropicRoute = resolveRouteIdFromBaseUrl(processEnv.ANTHROPIC_BASE_URL);
32085
- if (!isEnvTruthy(processEnv.CLAUDE_CODE_USE_OPENAI) && hasNonEmptyEnvValue(processEnv.ANTHROPIC_BASE_URL) && hasNonEmptyEnvValue(processEnv.ANTHROPIC_MODEL) && (hasNonEmptyEnvValue(processEnv.ANTHROPIC_AUTH_TOKEN) || hasNonEmptyEnvValue(processEnv.ANTHROPIC_API_KEY)) && !isFirstPartyAnthropicBaseUrlForEnv(processEnv) && (hasNonEmptyEnvValue(processEnv.ANTHROPIC_AUTH_TOKEN) || knownAnthropicRoute === "custom-anthropic" || !knownAnthropicRoute)) {
32159
+ const anthropicBaseUrl = hasNonEmptyEnvValue(processEnv.ANTHROPIC_BASE_URL) ? processEnv.ANTHROPIC_BASE_URL : undefined;
32160
+ const knownAnthropicRoute = resolveRouteIdFromBaseUrl(anthropicBaseUrl);
32161
+ if (!isEnvTruthy(processEnv.CLAUDE_CODE_USE_OPENAI) && anthropicBaseUrl && hasNonEmptyEnvValue(processEnv.ANTHROPIC_MODEL) && (hasNonEmptyEnvValue(processEnv.ANTHROPIC_AUTH_TOKEN) || hasNonEmptyEnvValue(processEnv.ANTHROPIC_API_KEY)) && !isFirstPartyAnthropicBaseUrlForEnv(processEnv) && (hasNonEmptyEnvValue(processEnv.ANTHROPIC_AUTH_TOKEN) || knownAnthropicRoute === "custom-anthropic" || !knownAnthropicRoute)) {
32086
32162
  return "custom-anthropic";
32087
32163
  }
32088
32164
  const envOnlyRouteId = resolveEnvOnlyProviderRouteId(processEnv);
32089
32165
  if (envOnlyRouteId)
32090
32166
  return envOnlyRouteId;
32091
32167
  if (isEnvTruthy(processEnv.CLAUDE_CODE_USE_OPENAI)) {
32092
- const baseUrl = processEnv.OPENAI_BASE_URL ?? processEnv.OPENAI_API_BASE;
32168
+ const baseUrl = hasNonEmptyEnvValue(processEnv.OPENAI_BASE_URL) ? processEnv.OPENAI_BASE_URL : hasNonEmptyEnvValue(processEnv.OPENAI_API_BASE) ? processEnv.OPENAI_API_BASE : undefined;
32169
+ const hasExplicitBaseUrl = baseUrl !== undefined;
32093
32170
  const matchedRoute = resolveRouteIdFromBaseUrl(baseUrl);
32094
32171
  if (matchedRoute) {
32095
32172
  return matchedRoute;
32096
32173
  }
32097
- if (options?.activeProfileProvider) {
32174
+ if (!hasExplicitBaseUrl && options?.activeProfileProvider) {
32098
32175
  const route = resolveProfileRoute(options.activeProfileProvider);
32099
32176
  if (route.routeId !== "unknown-fallback" && route.routeId !== "openai" && route.routeId !== "custom" && profileRouteHonorsBaseUrlBoundary(route.routeId, options.activeProfileBaseUrl ?? baseUrl)) {
32100
32177
  return route.routeId;
@@ -32111,7 +32188,7 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
32111
32188
  }
32112
32189
  return "custom";
32113
32190
  }
32114
- if (options?.activeProfileProvider) {
32191
+ if (!anthropicBaseUrl && options?.activeProfileProvider) {
32115
32192
  const route = resolveProfileRoute(options.activeProfileProvider);
32116
32193
  if (route.routeId !== "unknown-fallback" && route.routeId !== "openai" && route.routeId !== "custom" && profileRouteHonorsBaseUrlBoundary(route.routeId, options.activeProfileBaseUrl)) {
32117
32194
  return route.routeId;
@@ -32126,7 +32203,7 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
32126
32203
  function getTransportKindForRoute(routeId) {
32127
32204
  return getRouteDescriptor(routeId)?.transportConfig.kind ?? null;
32128
32205
  }
32129
- var XIAOMI_MIMO_PRIMARY_HOST = "api.xiaomimimo.com", XIAOMI_MIMO_STALE_DOCS_HOST = "api.mimo-v2.com", XIAOMI_MIMO_TOKEN_PLAN_HOSTS, XIAOMI_MIMO_PRIMARY_BASE_URL, CONCENTRATE_CANONICAL_INFERENCE_BASE_URL = "https://api.concentrate.ai/v1", LLMTR_CANONICAL_INFERENCE_BASE_URL = "https://llmtr.com/v1", APISMART_CANONICAL_INFERENCE_BASE_URL = "https://gw.apismart.ai/v1";
32206
+ var XIAOMI_MIMO_PRIMARY_HOST = "api.xiaomimimo.com", XIAOMI_MIMO_STALE_DOCS_HOST = "api.mimo-v2.com", XIAOMI_MIMO_TOKEN_PLAN_HOSTS, XIAOMI_MIMO_PRIMARY_BASE_URL, ZAI_CODING_PLAN_BASE_URL = "https://api.z.ai/api/coding/paas/v4", CONCENTRATE_CANONICAL_INFERENCE_BASE_URL = "https://api.concentrate.ai/v1", LLMTR_CANONICAL_INFERENCE_BASE_URL = "https://llmtr.com/v1", APISMART_CANONICAL_INFERENCE_BASE_URL = "https://gw.apismart.ai/v1";
32130
32207
  var init_routeMetadata = __esm(() => {
32131
32208
  init_integrations();
32132
32209
  init_credentialPool();
@@ -64716,7 +64793,7 @@ var init_schemas3 = __esm(() => {
64716
64793
  }),
64717
64794
  exports_external.object({
64718
64795
  source: exports_external.literal("hostPattern"),
64719
- hostPattern: exports_external.string().describe("Regex pattern to match the host/domain extracted from any marketplace source type. " + 'For github sources, matches against "github.com". For git sources (SSH or HTTPS), ' + "extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all " + 'marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')
64796
+ hostPattern: exports_external.string().describe("Regex pattern to match the host/domain extracted from any marketplace source type. " + 'For github sources, matches against "github.com". For git sources (SSH or HTTPS), ' + "extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all " + 'marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$"). ' + "The pattern must match the ENTIRE host: it is anchored before use, so " + '"github\\.mycompany\\.com" cannot be satisfied by a lookalike host such as ' + '"github.mycompany.com.evil.example". Use an explicit wildcard (e.g. ' + '".*\\.mycompany\\.com") to allow subdomains.')
64720
64797
  }),
64721
64798
  exports_external.object({
64722
64799
  source: exports_external.literal("pathPattern"),
@@ -65100,7 +65177,7 @@ function isBashPrefixTool(toolName) {
65100
65177
  return TOOL_VALIDATION_CONFIG.bashPrefixTools.includes(toolName);
65101
65178
  }
65102
65179
  function getCustomValidation(toolName) {
65103
- return TOOL_VALIDATION_CONFIG.customValidation[toolName];
65180
+ return Object.hasOwn(TOOL_VALIDATION_CONFIG.customValidation, toolName) ? TOOL_VALIDATION_CONFIG.customValidation[toolName] : undefined;
65104
65181
  }
65105
65182
  var TOOL_VALIDATION_CONFIG;
65106
65183
  var init_toolValidationConfig = __esm(() => {
@@ -67553,9 +67630,13 @@ function getRouteDiscoveryHeaders(routeId, options) {
67553
67630
  ...transportConfig?.headers ?? {},
67554
67631
  ...transportConfig?.openaiShim?.headers ?? {}
67555
67632
  };
67556
- const headers = {
67557
- ...routeId === "aimlapi" ? resolveAimlapiAttributionHeaders(descriptorHeaders, getRouteBaseUrl(routeId, options)) : descriptorHeaders,
67558
- ...options?.headers ?? {}
67633
+ const callerHeaders = options?.headers ?? {};
67634
+ const headers = routeId === "aimlapi" ? resolveAimlapiAttributionHeaders({
67635
+ ...callerHeaders,
67636
+ ...descriptorHeaders
67637
+ }, getRouteBaseUrl(routeId, options)) : {
67638
+ ...descriptorHeaders,
67639
+ ...callerHeaders
67559
67640
  };
67560
67641
  return Object.keys(headers).length > 0 ? headers : undefined;
67561
67642
  }
@@ -68042,7 +68123,7 @@ function resolveModelRuntimeLimits(options) {
68042
68123
  if (options.baseUrl !== undefined) {
68043
68124
  runtimeEnv.OPENAI_BASE_URL = options.baseUrl;
68044
68125
  }
68045
- const routeId = resolveActiveRouteIdFromEnv(runtimeEnv, {
68126
+ const routeId = options.resolvedRouteId !== undefined ? options.resolvedRouteId : resolveActiveRouteIdFromEnv(runtimeEnv, {
68046
68127
  activeProfileProvider: options?.activeProfileProvider,
68047
68128
  activeProfileBaseUrl: options?.baseUrl
68048
68129
  });
@@ -68055,10 +68136,9 @@ function resolveModelRuntimeLimits(options) {
68055
68136
  const externalContextWindow = getOpenAIContextWindowMatches(modelApiName, runtimeEnv);
68056
68137
  const externalMaxOutputTokens = getOpenAIMaxOutputTokenMatches(modelApiName, runtimeEnv);
68057
68138
  const settings = getInitialSettings();
68058
- const resolvedWindow = settings.maxContextWindow !== undefined ? settings.maxContextWindow : externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? cachedCatalogEntry?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? modelDescriptor?.contextWindow;
68059
68139
  return {
68060
- contextWindow: resolvedWindow,
68061
- maxOutputTokens: externalMaxOutputTokens.exact ?? catalogEntry3?.maxOutputTokens ?? cachedCatalogEntry?.maxOutputTokens ?? externalMaxOutputTokens.prefix ?? externalMaxOutputTokens.settings ?? modelDescriptor?.maxOutputTokens
68140
+ contextWindow: settings.maxContextWindow !== undefined ? settings.maxContextWindow : externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? cachedCatalogEntry?.contextWindow ?? modelDescriptor?.contextWindow,
68141
+ maxOutputTokens: externalMaxOutputTokens.exact ?? catalogEntry3?.maxOutputTokens ?? externalMaxOutputTokens.prefix ?? externalMaxOutputTokens.settings ?? cachedCatalogEntry?.maxOutputTokens ?? modelDescriptor?.maxOutputTokens
68062
68142
  };
68063
68143
  }
68064
68144
  function usesAnthropicNativeMessageFormat(options) {
@@ -69098,17 +69178,17 @@ function isAttributionHeaderEnabled() {
69098
69178
  }
69099
69179
  return getFeatureValue_CACHED_MAY_BE_STALE("tengu_attribution_header", true);
69100
69180
  }
69101
- function getAttributionHeader(fingerprint) {
69102
- if (!isAttributionHeaderEnabled()) {
69181
+ function getAttributionHeader(fingerprint, policy) {
69182
+ if (!policy.generate) {
69103
69183
  return "";
69104
69184
  }
69105
- const version2 = `${"0.29.2-by-rayss"}.${fingerprint}`;
69185
+ const version2 = `${"0.30.2-by-rayss"}.${fingerprint}`;
69106
69186
  const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
69107
69187
  const cch = "";
69108
69188
  const workload = getWorkload();
69109
69189
  const workloadPair = workload ? ` cc_workload=${workload};` : "";
69110
69190
  const header = `x-anthropic-billing-header: cc_version=${version2}; cc_entrypoint=${entrypoint};${cch}${workloadPair}`;
69111
- logForDebugging(`attribution header ${header}`);
69191
+ logForDebugging(`attribution header generated: ${policy.reason}`);
69112
69192
  return header;
69113
69193
  }
69114
69194
  var DEFAULT_PREFIX, AGENT_SDK_CLAUDE_CODE_PRESET_PREFIX, AGENT_SDK_PREFIX, CLI_SYSPROMPT_PREFIX_VALUES, CLI_SYSPROMPT_PREFIXES;
@@ -98608,6 +98688,9 @@ function resolveProfileCapabilityRouteId(provider, baseUrl) {
98608
98688
  if (routeIdFromBaseUrl) {
98609
98689
  return routeIdFromBaseUrl;
98610
98690
  }
98691
+ if (providerRouteId === "zai" && baseUrl) {
98692
+ return "custom";
98693
+ }
98611
98694
  if ((providerRouteId === "cloudflare" || providerRouteId === "longcat" || providerRouteId === "concentrate" || providerRouteId === "llmtr") && baseUrl && !(providerRouteId === "cloudflare" ? isCloudflareBaseUrl(baseUrl) : providerRouteId === "longcat" ? isLongcatBaseUrl(baseUrl) : providerRouteId === "concentrate" ? isCanonicalConcentrateInferenceBaseUrl(baseUrl) : isCanonicalLlmtrInferenceBaseUrl(baseUrl))) {
98612
98695
  return "custom";
98613
98696
  }
@@ -99912,6 +99995,7 @@ __export(exports_auth, {
99912
99995
  isOverageProvisioningAllowed: () => isOverageProvisioningAllowed,
99913
99996
  isOtelHeadersHelperFromProjectOrLocalSettings: () => isOtelHeadersHelperFromProjectOrLocalSettings,
99914
99997
  isMaxSubscriber: () => isMaxSubscriber,
99998
+ isManagedOAuthContext: () => isManagedOAuthContext,
99915
99999
  isGcpAuthRefreshFromProjectSettings: () => isGcpAuthRefreshFromProjectSettings,
99916
100000
  isEnterpriseSubscriber: () => isEnterpriseSubscriber,
99917
100001
  isCustomApiKeyApproved: () => isCustomApiKeyApproved,
@@ -99953,7 +100037,7 @@ import { exec } from "child_process";
99953
100037
  import { mkdir as mkdir3, stat as stat5 } from "fs/promises";
99954
100038
  import { join as join32 } from "path";
99955
100039
  function isManagedOAuthContext() {
99956
- return isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) || process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop";
100040
+ return isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) || process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop" || !!process.env.ANTHROPIC_UNIX_SOCKET && !!process.env.CLAUDE_CODE_OAUTH_TOKEN;
99957
100041
  }
99958
100042
  function isAnthropicAuthEnabled() {
99959
100043
  if (isBareMode())
@@ -102666,7 +102750,7 @@ var init_metadata = __esm(() => {
102666
102750
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
102667
102751
  WHITESPACE_REGEX = /\s+/;
102668
102752
  getVersionBase = memoize_default(() => {
102669
- const match = "0.29.2-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
102753
+ const match = "0.30.2-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
102670
102754
  return match ? match[0] : undefined;
102671
102755
  });
102672
102756
  buildEnvContext = memoize_default(async () => {
@@ -102706,9 +102790,9 @@ var init_metadata = __esm(() => {
102706
102790
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
102707
102791
  isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
102708
102792
  isClaudeAiAuth: isClaudeAISubscriber(),
102709
- version: "0.29.2-by-rayss",
102793
+ version: "0.30.2-by-rayss",
102710
102794
  versionBase: getVersionBase(),
102711
- buildTime: "2026-08-28T02:14:46.317Z",
102795
+ buildTime: "2026-09-05T03:58:52.070Z",
102712
102796
  deploymentEnvironment: env2.detectDeploymentEnvironment(),
102713
102797
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
102714
102798
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -111431,7 +111515,7 @@ var init_effort = __esm(() => {
111431
111515
 
111432
111516
  // src/utils/userAgent.ts
111433
111517
  function getClaudeCodeUserAgent() {
111434
- return `claude-code/${"0.29.2-by-rayss"}`;
111518
+ return `claude-code/${"0.30.2-by-rayss"}`;
111435
111519
  }
111436
111520
 
111437
111521
  // src/utils/http.ts
@@ -111440,7 +111524,7 @@ function getUserAgent() {
111440
111524
  const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
111441
111525
  const workload = getWorkload();
111442
111526
  const workloadSuffix = workload ? `, workload/${workload}` : "";
111443
- return `claude-cli/${"0.29.2-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
111527
+ return `claude-cli/${"0.30.2-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
111444
111528
  }
111445
111529
  function getMCPUserAgent() {
111446
111530
  const parts = [];
@@ -111454,7 +111538,7 @@ function getMCPUserAgent() {
111454
111538
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
111455
111539
  }
111456
111540
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
111457
- return `claude-code/${"0.29.2-by-rayss"}${suffix}`;
111541
+ return `claude-code/${"0.30.2-by-rayss"}${suffix}`;
111458
111542
  }
111459
111543
  function getWebFetchUserAgent() {
111460
111544
  const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
@@ -111467,7 +111551,188 @@ var init_http2 = __esm(() => {
111467
111551
  init_workloadContext();
111468
111552
  });
111469
111553
 
111554
+ // src/utils/anthropicAttribution.ts
111555
+ function resolveAnthropicAttributionAuth({
111556
+ apiKey,
111557
+ authToken,
111558
+ isSubscriber
111559
+ }) {
111560
+ if (apiKey === "external" || authToken === "api_key")
111561
+ return "api_key";
111562
+ if (authToken === "oauth" && isSubscriber)
111563
+ return "oauth_subscription";
111564
+ if (apiKey === "managed")
111565
+ return "api_key";
111566
+ return "unknown";
111567
+ }
111568
+ function resolveAnthropicAttributionPolicy({
111569
+ route,
111570
+ auth,
111571
+ attributionEnabled
111572
+ }) {
111573
+ if (route === "unknown") {
111574
+ return { generate: false, retain: false, reason: "unknown_route" };
111575
+ }
111576
+ if (route !== "official_anthropic") {
111577
+ return { generate: false, retain: false, reason: "non_official_route" };
111578
+ }
111579
+ if (auth === "oauth_subscription") {
111580
+ return {
111581
+ generate: true,
111582
+ retain: true,
111583
+ reason: "official_oauth_required"
111584
+ };
111585
+ }
111586
+ if (auth === "api_key") {
111587
+ return attributionEnabled ? {
111588
+ generate: true,
111589
+ retain: true,
111590
+ reason: "official_api_key_enabled"
111591
+ } : {
111592
+ generate: false,
111593
+ retain: false,
111594
+ reason: "official_api_key_disabled"
111595
+ };
111596
+ }
111597
+ return attributionEnabled ? {
111598
+ generate: true,
111599
+ retain: true,
111600
+ reason: "official_auth_unknown_enabled"
111601
+ } : {
111602
+ generate: false,
111603
+ retain: false,
111604
+ reason: "official_auth_unknown_disabled"
111605
+ };
111606
+ }
111607
+ function isAnthropicBillingAttributionBlock(text) {
111608
+ return text?.startsWith(ANTHROPIC_BILLING_ATTRIBUTION_PREFIX) ?? false;
111609
+ }
111610
+ function getAttributionBlockText(block) {
111611
+ if (typeof block === "string")
111612
+ return block;
111613
+ return block.type === undefined || block.type === "text" ? block.text : undefined;
111614
+ }
111615
+ function applyAnthropicAttributionPolicy(blocks, policy) {
111616
+ let retainedAttribution = false;
111617
+ return blocks.filter((block) => {
111618
+ if (!isAnthropicBillingAttributionBlock(getAttributionBlockText(block))) {
111619
+ return true;
111620
+ }
111621
+ if (!policy.retain || retainedAttribution)
111622
+ return false;
111623
+ retainedAttribution = true;
111624
+ return true;
111625
+ });
111626
+ }
111627
+ function getAnthropicAttributionDiagnostic(policy) {
111628
+ switch (policy.reason) {
111629
+ case "unknown_route":
111630
+ return "[anthropic-attribution] disabled for an unresolved request route";
111631
+ case "official_auth_unknown_enabled":
111632
+ case "official_auth_unknown_disabled":
111633
+ return "[anthropic-attribution] preserved the configured setting for ambiguous official auth";
111634
+ default:
111635
+ return null;
111636
+ }
111637
+ }
111638
+ var ANTHROPIC_BILLING_ATTRIBUTION_PREFIX = "x-anthropic-billing-header";
111639
+
111470
111640
  // src/services/api/authRouting.ts
111641
+ function resolveAnthropicAttributionAuthTokenSource(authTokenSource, managedOAuthContext) {
111642
+ if (managedOAuthContext && (authTokenSource === "ANTHROPIC_AUTH_TOKEN" || authTokenSource === "apiKeyHelper")) {
111643
+ return "none";
111644
+ }
111645
+ if (authTokenSource === "ANTHROPIC_AUTH_TOKEN" || authTokenSource === "apiKeyHelper") {
111646
+ return "api_key";
111647
+ }
111648
+ if (authTokenSource === "CLAUDE_CODE_OAUTH_TOKEN" || authTokenSource === "CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR" || authTokenSource === "CCR_OAUTH_TOKEN_FILE" || authTokenSource === "claude.ai") {
111649
+ return "oauth";
111650
+ }
111651
+ return "none";
111652
+ }
111653
+ function isManagedOAuthEffective(authTokenSource, managedOAuthContext, bareMode) {
111654
+ return managedOAuthContext && !bareMode && resolveAnthropicAttributionAuthTokenSource(authTokenSource, false) === "oauth";
111655
+ }
111656
+ function resolveAnthropicAttributionAuthFromSources({
111657
+ apiKeySource,
111658
+ authTokenSource,
111659
+ bareMode,
111660
+ isSubscriber,
111661
+ managedOAuthContext
111662
+ }) {
111663
+ const managedOAuthIsEffective = isManagedOAuthEffective(authTokenSource, managedOAuthContext, bareMode);
111664
+ const apiKey = managedOAuthIsEffective ? "none" : apiKeySource === "ANTHROPIC_API_KEY" || apiKeySource === "apiKeyHelper" ? "external" : apiKeySource === "/login managed key" ? "managed" : "none";
111665
+ const authToken = resolveAnthropicAttributionAuthTokenSource(authTokenSource, managedOAuthIsEffective);
111666
+ return resolveAnthropicAttributionAuth({
111667
+ apiKey,
111668
+ authToken,
111669
+ isSubscriber
111670
+ });
111671
+ }
111672
+ function resolveCurrentAnthropicAttributionAuth() {
111673
+ let apiKeySource = "none";
111674
+ try {
111675
+ ({ source: apiKeySource } = getAnthropicApiKeyWithSource({
111676
+ skipRetrievingKeyFromApiKeyHelper: true
111677
+ }));
111678
+ } catch {}
111679
+ let authTokenSource = "none";
111680
+ try {
111681
+ ({ source: authTokenSource } = getAuthTokenSource());
111682
+ } catch {
111683
+ return "unknown";
111684
+ }
111685
+ const bareMode = isBareMode();
111686
+ const managedOAuthContext = isManagedOAuthContext();
111687
+ const managedOAuthIsEffective = isManagedOAuthEffective(authTokenSource, managedOAuthContext, bareMode);
111688
+ const hasOAuthToken = resolveAnthropicAttributionAuthTokenSource(authTokenSource, managedOAuthIsEffective) === "oauth";
111689
+ let isSubscriber = false;
111690
+ if (hasOAuthToken) {
111691
+ try {
111692
+ isSubscriber = managedOAuthIsEffective ? getSubscriptionType() !== "free" : isClaudeAISubscriber();
111693
+ } catch {
111694
+ return "unknown";
111695
+ }
111696
+ }
111697
+ return resolveAnthropicAttributionAuthFromSources({
111698
+ apiKeySource,
111699
+ authTokenSource,
111700
+ bareMode,
111701
+ isSubscriber,
111702
+ managedOAuthContext
111703
+ });
111704
+ }
111705
+ function resolveAnthropicAttributionRoute(providerOverride) {
111706
+ if (providerOverride)
111707
+ return "non_official";
111708
+ try {
111709
+ const routeId = resolveActiveRouteIdFromEnv(process.env);
111710
+ if (routeId === "anthropic" && getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl()) {
111711
+ return "official_anthropic";
111712
+ }
111713
+ if (routeId && getTransportKindForRoute(routeId) !== null) {
111714
+ return "non_official";
111715
+ }
111716
+ return "unknown";
111717
+ } catch {
111718
+ return "unknown";
111719
+ }
111720
+ }
111721
+ function resolveCurrentAnthropicAttributionPolicy({
111722
+ attributionEnabled,
111723
+ providerOverride
111724
+ }) {
111725
+ const route = resolveAnthropicAttributionRoute(providerOverride);
111726
+ const policy = resolveAnthropicAttributionPolicy({
111727
+ route,
111728
+ auth: route === "official_anthropic" ? resolveCurrentAnthropicAttributionAuth() : "unknown",
111729
+ attributionEnabled
111730
+ });
111731
+ const diagnostic = getAnthropicAttributionDiagnostic(policy);
111732
+ if (diagnostic)
111733
+ logForDebugging(diagnostic);
111734
+ return policy;
111735
+ }
111471
111736
  function shouldUseFirstPartyAnthropicAuthForProvider({
111472
111737
  providerOverride,
111473
111738
  apiProvider,
@@ -111485,6 +111750,10 @@ function shouldUseCustomAnthropicBearerAuth({
111485
111750
  }
111486
111751
  var init_authRouting = __esm(() => {
111487
111752
  init_providers();
111753
+ init_auth();
111754
+ init_routeMetadata();
111755
+ init_debug();
111756
+ init_envUtils();
111488
111757
  });
111489
111758
 
111490
111759
  // src/services/api/vertexClient.ts
@@ -133221,16 +133490,8 @@ async function callInner(file_path, fullFilePath, resolvedFilePath, ext, offset,
133221
133490
  });
133222
133491
  context2.nestedMemoryAttachmentTriggers?.add(fullFilePath);
133223
133492
  return {
133224
- data: {
133225
- type: "text",
133226
- file: {
133227
- filePath: file_path,
133228
- content: metadataText,
133229
- numLines: 1,
133230
- startLine: 1,
133231
- totalLines: 1
133232
- }
133233
- }
133493
+ data: await readImageWithTokenBudget(resolvedFilePath, maxTokens),
133494
+ newMessages: [createUserMessage({ content: metadataText, isMeta: true })]
133234
133495
  };
133235
133496
  }
133236
133497
  if (isPDFExtension(ext)) {
@@ -145655,7 +145916,7 @@ function doesSourceMatchHostPattern(source, pattern) {
145655
145916
  return false;
145656
145917
  }
145657
145918
  try {
145658
- const regex = new RegExp(pattern.hostPattern);
145919
+ const regex = new RegExp(`^(?:${pattern.hostPattern})$`);
145659
145920
  return regex.test(host);
145660
145921
  } catch {
145661
145922
  logError2(new Error(`Invalid hostPattern regex: ${pattern.hostPattern}`));
@@ -154930,7 +155191,7 @@ function computeFingerprint(messageText2, version2) {
154930
155191
  }
154931
155192
  function computeFingerprintFromMessages(messages) {
154932
155193
  const firstMessageText = extractFirstMessageText(messages);
154933
- return computeFingerprint(firstMessageText, "0.29.2-by-rayss");
155194
+ return computeFingerprint(firstMessageText, "0.30.2-by-rayss");
154934
155195
  }
154935
155196
  var FINGERPRINT_SALT = "59cf53e54c78";
154936
155197
  var init_fingerprint = () => {};
@@ -154972,9 +155233,12 @@ async function sideQuery(opts) {
154972
155233
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
154973
155234
  }
154974
155235
  const messageText2 = extractFirstUserMessageText(messages);
154975
- const fingerprint = computeFingerprint(messageText2, "0.29.2-by-rayss");
154976
- const attributionHeader = getAttributionHeader(fingerprint);
154977
- const systemBlocks = [
155236
+ const fingerprint = computeFingerprint(messageText2, publicBuildVersion);
155237
+ const attributionPolicy = resolveCurrentAnthropicAttributionPolicy({
155238
+ attributionEnabled: isAttributionHeaderEnabled()
155239
+ });
155240
+ const attributionHeader = getAttributionHeader(fingerprint, attributionPolicy);
155241
+ const systemBlocks = applyAnthropicAttributionPolicy([
154978
155242
  attributionHeader ? { type: "text", text: attributionHeader } : null,
154979
155243
  ...skipSystemPromptPrefix ? [] : [
154980
155244
  {
@@ -154986,7 +155250,7 @@ async function sideQuery(opts) {
154986
155250
  }
154987
155251
  ],
154988
155252
  ...Array.isArray(system) ? system : system ? [{ type: "text", text: system }] : []
154989
- ].filter((block) => block !== null);
155253
+ ].filter((block) => block !== null), attributionPolicy);
154990
155254
  let thinkingConfig;
154991
155255
  if (thinking === false) {
154992
155256
  thinkingConfig = { type: "disabled" };
@@ -155034,10 +155298,12 @@ var init_sideQuery = __esm(() => {
155034
155298
  init_betas();
155035
155299
  init_system();
155036
155300
  init_claude3();
155301
+ init_authRouting();
155037
155302
  init_client4();
155038
155303
  init_betas2();
155039
155304
  init_fingerprint();
155040
155305
  init_model();
155306
+ init_version();
155041
155307
  });
155042
155308
 
155043
155309
  // src/utils/claudeInChrome/mcpServer.ts
@@ -156292,7 +156558,7 @@ var init_client2 = __esm(() => {
156292
156558
  const client = new Client({
156293
156559
  name: "claude-code",
156294
156560
  title: "OpenClaude",
156295
- version: "0.29.2-by-rayss",
156561
+ version: "0.30.2-by-rayss",
156296
156562
  description: "OpenClaude — coding-agent CLI for any LLM provider",
156297
156563
  websiteUrl: PRODUCT_URL
156298
156564
  }, {
@@ -233258,7 +233524,7 @@ function getAnthropicEnvMetadata() {
233258
233524
  function getBuildAgeMinutes() {
233259
233525
  if (false)
233260
233526
  ;
233261
- const buildTime = new Date("2026-08-28T02:14:46.317Z").getTime();
233527
+ const buildTime = new Date("2026-09-05T03:58:52.070Z").getTime();
233262
233528
  if (isNaN(buildTime))
233263
233529
  return;
233264
233530
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -235427,6 +235693,83 @@ var init_LocalShellTask = __esm(() => {
235427
235693
  };
235428
235694
  });
235429
235695
 
235696
+ // src/tools/BashTool/commandRepair.ts
235697
+ import { writeFile as writeFile19 } from "fs/promises";
235698
+ import { join as join79 } from "path";
235699
+ function findInlineScripts(command) {
235700
+ const results = [];
235701
+ const nodePatterns = [
235702
+ /(^|\s|&&|\|\|)(node\s+(?:--input-type=\S+\s+)?-e)\s+('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,
235703
+ /(^|\s|&&|\|\|)(node\s+(?:--input-type=\S+\s+)?-e)\s+(\$'[^']+')/g
235704
+ ];
235705
+ const pythonPatterns = [
235706
+ /(^|\s|&&|\|\|)((?:python3?|pypy3?)\s+-c)\s+('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,
235707
+ /(^|\s|&&|\|\|)((?:python3?|pypy3?)\s+-c)\s+(\$'[^']+')/g
235708
+ ];
235709
+ for (const pattern of [...nodePatterns, ...pythonPatterns]) {
235710
+ let match;
235711
+ while ((match = pattern.exec(command)) !== null) {
235712
+ const lang = match[2].startsWith("node") ? "node" : "python";
235713
+ const raw = match[3];
235714
+ const code = raw.startsWith("'") && raw.endsWith("'") || raw.startsWith('"') && raw.endsWith('"') ? raw.slice(1, -1) : raw;
235715
+ results.push({
235716
+ full: match[0],
235717
+ prefix: match[2],
235718
+ lang,
235719
+ code,
235720
+ start: match.index,
235721
+ end: match.index + match[0].length
235722
+ });
235723
+ }
235724
+ }
235725
+ return results;
235726
+ }
235727
+ function needsRepair(code) {
235728
+ if (code.includes("!"))
235729
+ return true;
235730
+ if (code.includes("`"))
235731
+ return true;
235732
+ if (code.length > 300)
235733
+ return true;
235734
+ return false;
235735
+ }
235736
+ function getRunner(lang) {
235737
+ if (lang === "node") {
235738
+ return { ext: ".mjs", cmd: "node" };
235739
+ }
235740
+ return { ext: ".py", cmd: "python" };
235741
+ }
235742
+ async function repairCommand(command) {
235743
+ const scripts = findInlineScripts(command);
235744
+ if (scripts.length === 0)
235745
+ return command;
235746
+ const needsRepairAny = scripts.some((s) => needsRepair(s.code));
235747
+ if (!needsRepairAny)
235748
+ return command;
235749
+ let result = command;
235750
+ for (const script of [...scripts].reverse()) {
235751
+ if (!needsRepair(script.code))
235752
+ continue;
235753
+ const { ext, cmd } = getRunner(script.lang);
235754
+ const id = Math.random().toString(36).slice(2, 10);
235755
+ const tempDir = getClaudeTempDir();
235756
+ const tempFile = join79(tempDir, `_inline_${id}${ext}`);
235757
+ let cleanCode = script.code;
235758
+ if (script.lang === "node") {
235759
+ cleanCode = cleanCode.replace(/\\\$/g, "$").replace(/\\\`/g, "`").replace(/\\\\/g, "\\");
235760
+ }
235761
+ await writeFile19(tempFile, cleanCode, "utf8");
235762
+ const runCmd = `( trap 'rm -f "${tempFile}"' EXIT; ${cmd} "${tempFile}" )`;
235763
+ result = runCmd;
235764
+ logForDebugging(`[commandRepair] Rewrote inline ${script.lang} script (${script.code.length} chars) to temp file: ${tempFile}`);
235765
+ }
235766
+ return result;
235767
+ }
235768
+ var init_commandRepair = __esm(() => {
235769
+ init_filesystem();
235770
+ init_debug();
235771
+ });
235772
+
235430
235773
  // src/utils/claudeCodeHints.ts
235431
235774
  function extractClaudeCodeHints(output, command) {
235432
235775
  if (!output.includes("<claude-code-hint")) {
@@ -236151,8 +236494,8 @@ var init_types9 = __esm(() => {
236151
236494
 
236152
236495
  // src/services/teamMemorySync/index.ts
236153
236496
  import { createHash as createHash11 } from "crypto";
236154
- import { mkdir as mkdir22, readdir as readdir16, readFile as readFile21, stat as stat24, writeFile as writeFile19 } from "fs/promises";
236155
- import { join as join79, relative as relative14, sep as sep20 } from "path";
236497
+ import { mkdir as mkdir22, readdir as readdir16, readFile as readFile21, stat as stat24, writeFile as writeFile20 } from "fs/promises";
236498
+ import { join as join80, relative as relative14, sep as sep20 } from "path";
236156
236499
  function createSyncState() {
236157
236500
  return {
236158
236501
  lastKnownChecksum: null,
@@ -236468,7 +236811,7 @@ async function collectLocalTeamMemoryFiles(teamDir, deps) {
236468
236811
  throw e;
236469
236812
  }
236470
236813
  for (const entry of dirEntries) {
236471
- const fullPath = join79(dir, entry.name);
236814
+ const fullPath = join80(dir, entry.name);
236472
236815
  if (entry.isDirectory()) {
236473
236816
  await walkDir(fullPath);
236474
236817
  continue;
@@ -236882,7 +237225,7 @@ var init_teamMemorySync = __esm(() => {
236882
237225
  validateTeamMemKey,
236883
237226
  readFile: (path13) => readFile21(path13, "utf8"),
236884
237227
  mkdir: (path13, options2) => mkdir22(path13, options2),
236885
- writeFile: (path13, content) => writeFile19(path13, content, "utf8")
237228
+ writeFile: (path13, content) => writeFile20(path13, content, "utf8")
236886
237229
  };
236887
237230
  });
236888
237231
 
@@ -236899,7 +237242,7 @@ __export(exports_watcher, {
236899
237242
  });
236900
237243
  import { watch as watch2 } from "fs";
236901
237244
  import { mkdir as mkdir23, stat as stat25 } from "fs/promises";
236902
- import { join as join80 } from "path";
237245
+ import { join as join81 } from "path";
236903
237246
  function isPermanentFailure(r) {
236904
237247
  if (r.errorType === "no_oauth" || r.errorType === "no_repo")
236905
237248
  return true;
@@ -236997,7 +237340,7 @@ async function startFileWatcher(teamDir) {
236997
237340
  return;
236998
237341
  }
236999
237342
  if (pushSuppressedReason !== null) {
237000
- stat25(join80(teamDir, filename)).catch((err2) => {
237343
+ stat25(join81(teamDir, filename)).catch((err2) => {
237001
237344
  if (err2.code !== "ENOENT")
237002
237345
  return;
237003
237346
  if (pushSuppressedReason !== null) {
@@ -237514,7 +237857,14 @@ function getSimplePrompt() {
237514
237857
  sleepSubitems,
237515
237858
  ...embedded ? [
237516
237859
  "When using `find -regex` with alternation, put the longest alternative first. Example: use `'.*\\.\\(tsx\\|ts\\)'` not `'.*\\.\\(ts\\|tsx\\)'` — the second form silently skips `.tsx` files."
237517
- ] : []
237860
+ ] : [],
237861
+ "Inline scripts (node -e / python -c):",
237862
+ [
237863
+ "NEVER use `node -e` or `python -c` with inline code that contains the `!` character. Bash interprets `!` as history expansion BEFORE passing the string to the interpreter, causing syntax errors. Examples of breaking code: `!!`, `!==`, `!!value`.",
237864
+ "For short one-liners without `!`, inline is fine.",
237865
+ 'For complex or multi-line scripts, ALWAYS write the code to a temporary file first using the Write tool, then execute the file (e.g. `node "$TMPDIR/script.mjs"` or `python "$TMPDIR/script.py"`).',
237866
+ "If you must use inline with `!`, prefix with `set +H` to disable history expansion, or use the temp-file approach above."
237867
+ ]
237518
237868
  ];
237519
237869
  return [
237520
237870
  "Executes a given bash command and returns its output.",
@@ -238230,7 +238580,11 @@ async function* runShellCommand({
238230
238580
  });
238231
238581
  }
238232
238582
  const shouldAutoBackground = !isBackgroundTasksDisabled2 && isAutobackgroundingAllowed(command);
238233
- const shellCommand = await exec2(command, abortController.signal, "bash", {
238583
+ let finalCommand = command;
238584
+ try {
238585
+ finalCommand = await repairCommand(command);
238586
+ } catch {}
238587
+ const shellCommand = await exec2(finalCommand, abortController.signal, "bash", {
238234
238588
  timeout: timeoutMs,
238235
238589
  onProgress(lastLines, allLines, totalLines, totalBytes, isIncomplete) {
238236
238590
  lastProgressOutput = lastLines;
@@ -238429,6 +238783,7 @@ var init_BashTool = __esm(() => {
238429
238783
  init_LocalShellTask();
238430
238784
  init_ast();
238431
238785
  init_commands2();
238786
+ init_commandRepair();
238432
238787
  init_claudeCodeHints();
238433
238788
  init_codeIndexing();
238434
238789
  init_envUtils();
@@ -239086,12 +239441,12 @@ import {
239086
239441
  basename as basename23,
239087
239442
  dirname as dirname42,
239088
239443
  isAbsolute as isAbsolute23,
239089
- join as join81,
239444
+ join as join82,
239090
239445
  sep as pathSep,
239091
239446
  relative as relative15
239092
239447
  } from "path";
239093
239448
  function getProjectSkillsPaths(dir) {
239094
- return PROJECT_CONFIG_DIR_NAMES.map((configDirName) => join81(dir, configDirName, "skills"));
239449
+ return PROJECT_CONFIG_DIR_NAMES.map((configDirName) => join82(dir, configDirName, "skills"));
239095
239450
  }
239096
239451
  function prefersOpenClaudeConfigDir(path13) {
239097
239452
  return path13.split(pathSep).includes(".openclaude") ? 0 : 1;
@@ -239115,7 +239470,7 @@ function isPlainObject5(value) {
239115
239470
  }
239116
239471
  async function readSkillJsonMetadata(skillDirPath) {
239117
239472
  try {
239118
- const raw = await getFsImplementation().readFile(join81(skillDirPath, "skill.json"), {
239473
+ const raw = await getFsImplementation().readFile(join82(skillDirPath, "skill.json"), {
239119
239474
  encoding: "utf-8"
239120
239475
  });
239121
239476
  const parsed = JSON.parse(raw);
@@ -239288,7 +239643,7 @@ async function findSkillMarkdownFiles(basePath) {
239288
239643
  }
239289
239644
  const childDirs = [];
239290
239645
  for (const entry of entries2) {
239291
- const entryPath = join81(skillDirPath, entry.name);
239646
+ const entryPath = join82(skillDirPath, entry.name);
239292
239647
  if (isSkillFile2(entryPath)) {
239293
239648
  skillFiles.push(entryPath);
239294
239649
  continue;
@@ -239323,7 +239678,7 @@ async function findSkillMarkdownFiles(basePath) {
239323
239678
  }
239324
239679
  const topLevelDirs = [];
239325
239680
  for (const entry of entries) {
239326
- const entryPath = join81(basePath, entry.name);
239681
+ const entryPath = join82(basePath, entry.name);
239327
239682
  if (entry.isDirectory()) {
239328
239683
  topLevelDirs.push(entryPath);
239329
239684
  continue;
@@ -239619,8 +239974,8 @@ var init_loadSkillsDir = __esm(() => {
239619
239974
  init_types2();
239620
239975
  import_ignore2 = __toESM(require_ignore(), 1);
239621
239976
  getSkillDirCommands = memoize_default(async (cwd2) => {
239622
- const userSkillsDir = join81(getClaudeConfigHomeDir(), "skills");
239623
- const managedSkillsDir = join81(getManagedFilePath(), ".openclaude", "skills");
239977
+ const userSkillsDir = join82(getClaudeConfigHomeDir(), "skills");
239978
+ const managedSkillsDir = join82(getManagedFilePath(), ".openclaude", "skills");
239624
239979
  const projectSkillsDirs = getProjectDirsUpToHome("skills", cwd2).sort(compareSkillDirPrecedence);
239625
239980
  logForDebugging(`Loading skills from: managed=${managedSkillsDir}, user=${userSkillsDir}, project=[${projectSkillsDirs.join(", ")}]`);
239626
239981
  const additionalDirs = getAdditionalDirectoriesForClaudeMd();
@@ -240810,8 +241165,8 @@ var init_toolSearch = __esm(() => {
240810
241165
 
240811
241166
  // src/services/vcr.ts
240812
241167
  import { createHash as createHash12, randomUUID as randomUUID19 } from "crypto";
240813
- import { mkdir as mkdir24, readFile as readFile22, writeFile as writeFile20 } from "fs/promises";
240814
- import { dirname as dirname43, join as join82 } from "path";
241168
+ import { mkdir as mkdir24, readFile as readFile22, writeFile as writeFile21 } from "fs/promises";
241169
+ import { dirname as dirname43, join as join83 } from "path";
240815
241170
  function shouldUseVCR() {
240816
241171
  if (false) {}
240817
241172
  if (process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.FORCE_VCR)) {
@@ -240824,7 +241179,7 @@ async function withFixture(input, fixtureName, f) {
240824
241179
  return await f();
240825
241180
  }
240826
241181
  const hash = createHash12("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
240827
- const filename = join82(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
241182
+ const filename = join83(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
240828
241183
  try {
240829
241184
  const cached3 = jsonParse(await readFile22(filename, { encoding: "utf8" }));
240830
241185
  return cached3;
@@ -240839,7 +241194,7 @@ async function withFixture(input, fixtureName, f) {
240839
241194
  }
240840
241195
  const result = await f();
240841
241196
  await mkdir24(dirname43(filename), { recursive: true });
240842
- await writeFile20(filename, jsonStringify(result, null, 2), {
241197
+ await writeFile21(filename, jsonStringify(result, null, 2), {
240843
241198
  encoding: "utf8"
240844
241199
  });
240845
241200
  return result;
@@ -240858,7 +241213,7 @@ async function withVCR(messages, f) {
240858
241213
  return true;
240859
241214
  }));
240860
241215
  const dehydratedInput = mapMessages(messagesForAPI.map((_) => _.message.content), dehydrateValue);
240861
- const filename = join82(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) => createHash12("sha1").update(jsonStringify(_)).digest("hex").slice(0, 6)).join("-")}.json`);
241216
+ const filename = join83(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) => createHash12("sha1").update(jsonStringify(_)).digest("hex").slice(0, 6)).join("-")}.json`);
240862
241217
  try {
240863
241218
  const cached3 = jsonParse(await readFile22(filename, { encoding: "utf8" }));
240864
241219
  cached3.output.forEach(addCachedCostToTotalSessionCost);
@@ -240878,7 +241233,7 @@ ${jsonStringify(dehydratedInput, null, 2)}`);
240878
241233
  return results;
240879
241234
  }
240880
241235
  await mkdir24(dirname43(filename), { recursive: true });
240881
- await writeFile20(filename, jsonStringify({
241236
+ await writeFile21(filename, jsonStringify({
240882
241237
  input: dehydratedInput,
240883
241238
  output: results.map((message, index) => mapMessage(message, dehydrateValue, index))
240884
241239
  }, null, 2), { encoding: "utf8" });
@@ -242009,9 +242364,9 @@ var init_postCompactCleanup = __esm(() => {
242009
242364
 
242010
242365
  // src/services/SessionMemory/prompts.ts
242011
242366
  import { readFile as readFile23 } from "fs/promises";
242012
- import { join as join83 } from "path";
242367
+ import { join as join84 } from "path";
242013
242368
  async function loadSessionMemoryTemplate() {
242014
- const templatePath = join83(getClaudeConfigHomeDir(), "session-memory", "config", "template.md");
242369
+ const templatePath = join84(getClaudeConfigHomeDir(), "session-memory", "config", "template.md");
242015
242370
  try {
242016
242371
  return await readFile23(templatePath, { encoding: "utf-8" });
242017
242372
  } catch (e) {
@@ -242711,6 +243066,7 @@ var init_autoCompact = __esm(() => {
242711
243066
  var exports_compressToolHistory = {};
242712
243067
  __export(exports_compressToolHistory, {
242713
243068
  setToolHistoryCompressionEnabledOverrideForTest: () => setToolHistoryCompressionEnabledOverrideForTest,
243069
+ omitOldUserImages: () => omitOldUserImages,
242714
243070
  getTiers: () => getTiers,
242715
243071
  compressToolHistory: () => compressToolHistory
242716
243072
  });
@@ -242919,6 +243275,52 @@ function shouldCompressBlock(block2, toolUsesById) {
242919
243275
  return true;
242920
243276
  return isCompactableTool(toolUse.name);
242921
243277
  }
243278
+ function hasCompletedTurn(messages, fromIndex) {
243279
+ for (let i3 = fromIndex + 1;i3 < messages.length; i3++) {
243280
+ const content = getInner(messages[i3]).content;
243281
+ if (!Array.isArray(content))
243282
+ continue;
243283
+ const types = content.map((b) => b?.type);
243284
+ if (types.includes("tool_use"))
243285
+ continue;
243286
+ if ((getInner(messages[i3]).role ?? messages[i3].role) === "assistant") {
243287
+ return true;
243288
+ }
243289
+ }
243290
+ return false;
243291
+ }
243292
+ function omitOldUserImages(messages) {
243293
+ let changed = false;
243294
+ const out = messages.map((msg, i3) => {
243295
+ const inner = getInner(msg);
243296
+ if ((inner.role ?? msg.role) !== "user")
243297
+ return msg;
243298
+ const content = inner.content;
243299
+ if (!Array.isArray(content))
243300
+ return msg;
243301
+ if (!content.some((block2) => isInlineImagePayload(block2)))
243302
+ return msg;
243303
+ if (!hasCompletedTurn(messages, i3))
243304
+ return msg;
243305
+ let omitted = false;
243306
+ const newContent = content.map((block2) => {
243307
+ if (isInlineImagePayload(block2)) {
243308
+ omitted = true;
243309
+ return { type: "text", text: OMITTED_USER_IMAGE_MARKER };
243310
+ }
243311
+ return block2;
243312
+ });
243313
+ if (!omitted)
243314
+ return msg;
243315
+ changed = true;
243316
+ const newMessage = rewriteMessage(msg, newContent);
243317
+ if (msg.imagePermissionToolUseIds) {
243318
+ return { ...newMessage, imagePermissionToolUseIds: [] };
243319
+ }
243320
+ return newMessage;
243321
+ });
243322
+ return changed ? out : messages;
243323
+ }
242922
243324
  function compressToolHistory(messages, model, options2 = {}) {
242923
243325
  const compressionEnabled = toolHistoryCompressionEnabledOverrideForTest ?? getGlobalConfig().toolHistoryCompressionEnabled;
242924
243326
  if (!compressionEnabled)
@@ -242927,10 +243329,11 @@ function compressToolHistory(messages, model, options2 = {}) {
242927
243329
  const textBlockSeparator = options2.textBlockSeparator ?? `
242928
243330
 
242929
243331
  `;
242930
- const toolResults = indexToolResults(messages);
243332
+ const working = options2.omitOldUserImages ? omitOldUserImages(messages) : messages;
243333
+ const toolResults = indexToolResults(working);
242931
243334
  const total = toolResults.length;
242932
243335
  if (total <= tiers.recent)
242933
- return messages;
243336
+ return working;
242934
243337
  const positionsByMessage = new Map;
242935
243338
  for (let pos = 0;pos < toolResults.length; pos++) {
242936
243339
  const { messageIndex, blockIndex } = toolResults[pos];
@@ -242941,8 +243344,8 @@ function compressToolHistory(messages, model, options2 = {}) {
242941
243344
  }
242942
243345
  positions.set(blockIndex, pos);
242943
243346
  }
242944
- const toolUsesById = indexToolUses(messages);
242945
- return messages.map((msg, i3) => {
243347
+ const toolUsesById = indexToolUses(working);
243348
+ return working.map((msg, i3) => {
242946
243349
  const positions = positionsByMessage.get(i3);
242947
243350
  if (!positions)
242948
243351
  return msg;
@@ -242988,7 +243391,7 @@ function compressToolHistory(messages, model, options2 = {}) {
242988
243391
  return rewriteMessage(msg, newContent);
242989
243392
  });
242990
243393
  }
242991
- var MID_MAX_CHARS = 2000, STUB_ARGS_MAX_CHARS = 200, OMITTED_INLINE_IMAGE_MARKER = "[Inline image omitted from tool history]", toolHistoryCompressionEnabledOverrideForTest, STUB_MARKER_RE, TRUNCATION_MARKER_RE;
243394
+ var MID_MAX_CHARS = 2000, STUB_ARGS_MAX_CHARS = 200, OMITTED_INLINE_IMAGE_MARKER = "[Inline image omitted from tool history]", OMITTED_USER_IMAGE_MARKER = "[Image omitted from history]", toolHistoryCompressionEnabledOverrideForTest, STUB_MARKER_RE, TRUNCATION_MARKER_RE;
242992
243395
  var init_compressToolHistory = __esm(() => {
242993
243396
  init_autoCompact();
242994
243397
  init_microCompact();
@@ -243269,7 +243672,7 @@ function prepareOpenAIRequest({
243269
243672
  model: runtimeModel,
243270
243673
  baseUrl: request.baseUrl,
243271
243674
  processEnv: requestProcessEnv,
243272
- activeProfileProvider: runtimeShimContext.routeId ?? undefined
243675
+ resolvedRouteId: runtimeShimContext.routeId
243273
243676
  });
243274
243677
  const shimConfig = runtimeShimContext.openaiShimConfig;
243275
243678
  const effectiveTransport = shimConfig.endpointPath === "/responses" ? "responses" : shimConfig.endpointPath === "/messages" ? "anthropic_messages" : shimConfig.endpointPath?.startsWith("/models/gemini-") ? "gemini" : request.transport;
@@ -243279,7 +243682,8 @@ function prepareOpenAIRequest({
243279
243682
 
243280
243683
  ` : `
243281
243684
  `,
243282
- runtimeLimits
243685
+ runtimeLimits,
243686
+ omitOldUserImages: true
243283
243687
  }) : rawMessages;
243284
243688
  const useNativeOllamaChat = effectiveTransport === "chat_completions" && !shimConfig.endpointPath && isDirectLocalOllamaEndpoint(request.baseUrl) && isLikelyOllamaEndpoint(request.baseUrl);
243285
243689
  const openaiMessages = effectiveTransport === "chat_completions" ? convertMessages(compressedMessages, params.system, {
@@ -243393,9 +243797,11 @@ function prepareOpenAIRequest({
243393
243797
  let responsesInput;
243394
243798
  let responsesMessages;
243395
243799
  const getResponsesInput = () => {
243396
- responsesMessages ??= effectiveTransport === "chat_completions" ? fastPath.skipToolHistoryCompression || skipCompressionForPrefixCache ? rawMessages : compressToolHistory(rawMessages, request.resolvedModel, {
243800
+ responsesMessages ??= effectiveTransport === "chat_completions" ? fastPath.skipToolHistoryCompression || skipCompressionForPrefixCache ? rawMessages : compressToolHistory(rawMessages, runtimeModel, {
243397
243801
  textBlockSeparator: `
243398
- `
243802
+ `,
243803
+ omitOldUserImages: true,
243804
+ runtimeLimits
243399
243805
  }) : compressedMessages;
243400
243806
  responsesInput ??= convertAnthropicMessagesToResponsesInput(responsesMessages, effectiveTransport === "responses_compat");
243401
243807
  return responsesInput;
@@ -246171,61 +246577,50 @@ function convertSystemPrompt2(system) {
246171
246577
  }
246172
246578
  return String(system);
246173
246579
  }
246174
- function ensureTextPartForImageContent(parts) {
246175
- if (!parts.some((part) => part.type === "image_url"))
246176
- return parts;
246177
- if (parts.some((part) => part.type === "text" && part.text.trim().length > 0))
246178
- return parts;
246179
- return [{ type: "text", text: "Image attached." }, ...parts];
246180
- }
246181
246580
  function joinTextContentParts(parts) {
246182
246581
  return parts.map((part) => part.type === "text" ? part.text : "").join("");
246183
246582
  }
246184
- function convertToolResultContent(content, isError, options2) {
246185
- if (typeof content === "string")
246186
- return isError ? `Error: ${content}` : content;
246583
+ function extractToolResultWithImagePlaceholder(content, isError, options2) {
246584
+ if (typeof content === "string") {
246585
+ return { text: isError ? `Error: ${content}` : content, images: [] };
246586
+ }
246187
246587
  if (!Array.isArray(content)) {
246188
- const text = JSON.stringify(content ?? "");
246189
- return isError ? `Error: ${text}` : text;
246588
+ const text2 = JSON.stringify(content ?? "");
246589
+ return { text: isError ? `Error: ${text2}` : text2, images: [] };
246190
246590
  }
246191
- const parts = [];
246591
+ const textChunks = [];
246592
+ const images = [];
246192
246593
  for (const block2 of content) {
246193
246594
  if (block2?.type === "text" && typeof block2.text === "string") {
246194
- parts.push({ type: "text", text: block2.text });
246595
+ textChunks.push(block2.text);
246195
246596
  } else if (block2?.type === "tool_reference" && typeof block2.tool_name === "string") {
246196
- parts.push({ type: "text", text: `Tool "${block2.tool_name}" is now loaded and available to call.` });
246597
+ textChunks.push(`Tool "${block2.tool_name}" is now loaded and available to call.`);
246197
246598
  } else if (block2?.type === "image") {
246198
246599
  if (options2?.supportsImageInputs === false) {
246199
246600
  throw new Error("The active provider accepts text-only messages and does not support image inputs.");
246200
246601
  }
246602
+ textChunks.push("(see following user message for image)");
246201
246603
  const source = block2.source;
246202
- if (source?.type === "url" && source.url)
246203
- parts.push({ type: "image_url", image_url: { url: source.url } });
246204
- else if (source?.type === "base64" && source.media_type && source.data) {
246205
- parts.push({
246604
+ if (source?.type === "url" && source.url) {
246605
+ images.push({ type: "image_url", image_url: { url: source.url } });
246606
+ } else if (source?.type === "base64" && source.media_type && source.data) {
246607
+ images.push({
246206
246608
  type: "image_url",
246207
246609
  image_url: { url: `data:${source.media_type};base64,${source.data}` }
246208
246610
  });
246209
246611
  }
246210
246612
  } else if (typeof block2?.text === "string") {
246211
- parts.push({ type: "text", text: block2.text });
246613
+ textChunks.push(block2.text);
246212
246614
  }
246213
246615
  }
246214
- if (parts.length === 0)
246215
- return "";
246216
- if (parts.length === 1 && parts[0].type === "text")
246217
- return isError ? `Error: ${parts[0].text}` : parts[0].text;
246218
- if (parts.every((part) => part.type === "text")) {
246219
- const text = parts.map((part) => part.text).join(`
246616
+ let text = textChunks.join(`
246220
246617
 
246221
246618
  `);
246222
- return isError ? `Error: ${text}` : text;
246223
- }
246224
- if (isError && parts[0]?.type === "text")
246225
- parts[0] = { ...parts[0], text: `Error: ${parts[0].text}` };
246226
- else if (isError)
246227
- parts.unshift({ type: "text", text: "Error:" });
246228
- return ensureTextPartForImageContent(parts);
246619
+ if (isError)
246620
+ text = text ? `Error: ${text}` : "Error:";
246621
+ if (!text && images.length === 0)
246622
+ text = "";
246623
+ return { text, images };
246229
246624
  }
246230
246625
  function convertContentBlocks(content, options2) {
246231
246626
  if (typeof content === "string")
@@ -246274,7 +246669,7 @@ function convertContentBlocks(content, options2) {
246274
246669
  return parts.map((part) => part.text).join(`
246275
246670
 
246276
246671
  `);
246277
- return ensureTextPartForImageContent(parts);
246672
+ return parts;
246278
246673
  }
246279
246674
  function convertMessages(messages, system, options2 = {}) {
246280
246675
  const result = [];
@@ -246304,6 +246699,7 @@ function convertMessages(messages, system, options2 = {}) {
246304
246699
  continue;
246305
246700
  }
246306
246701
  let otherContent;
246702
+ const toolResultImages = [];
246307
246703
  for (const block2 of content) {
246308
246704
  if (block2?.type !== "tool_result") {
246309
246705
  otherContent ??= [];
@@ -246312,15 +246708,20 @@ function convertMessages(messages, system, options2 = {}) {
246312
246708
  }
246313
246709
  const id = block2.tool_use_id ?? "unknown";
246314
246710
  if (knownToolCallIds.has(id)) {
246711
+ const extracted = extractToolResultWithImagePlaceholder(block2.content, block2.is_error, options2);
246315
246712
  result.push({
246316
246713
  role: "tool",
246317
246714
  tool_call_id: id,
246318
- content: convertToolResultContent(block2.content, block2.is_error, options2)
246715
+ content: extracted.text
246319
246716
  });
246717
+ toolResultImages.push(...extracted.images);
246320
246718
  } else {
246321
246719
  options2.log?.(`Dropping orphan tool_result for ID: ${id} to prevent API error`);
246322
246720
  }
246323
246721
  }
246722
+ if (toolResultImages.length > 0) {
246723
+ result.push({ role: "user", content: toolResultImages });
246724
+ }
246324
246725
  if (otherContent?.length)
246325
246726
  result.push({ role: "user", content: convertContentBlocks(otherContent, options2) });
246326
246727
  continue;
@@ -253720,7 +254121,7 @@ var init_permissionSetup = __esm(() => {
253720
254121
  import { statSync as statSync6 } from "fs";
253721
254122
  import { lstat as lstat6, readdir as readdir17, readFile as readFile24, realpath as realpath9, stat as stat26 } from "fs/promises";
253722
254123
  import { homedir as homedir22 } from "os";
253723
- import { dirname as dirname44, join as join84, resolve as resolve30, sep as sep21 } from "path";
254124
+ import { dirname as dirname44, join as join85, resolve as resolve30, sep as sep21 } from "path";
253724
254125
  function getMaxMarkdownFileSizeBytes() {
253725
254126
  const raw = process.env.CLAUDE_CODE_MAX_MARKDOWN_FILE_SIZE_BYTES;
253726
254127
  if (!raw)
@@ -253828,7 +254229,7 @@ function getProjectDirsUpToHome(subdir, cwd2) {
253828
254229
  break;
253829
254230
  }
253830
254231
  for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
253831
- const configSubdir = join84(current, configDirName, subdir);
254232
+ const configSubdir = join85(current, configDirName, subdir);
253832
254233
  try {
253833
254234
  statSync6(configSubdir);
253834
254235
  dirs.push(configSubdir);
@@ -253876,7 +254277,7 @@ async function findMarkdownFilesNative(dir, signal) {
253876
254277
  if (signal.aborted) {
253877
254278
  break;
253878
254279
  }
253879
- const fullPath = join84(currentDir, entry.name);
254280
+ const fullPath = join85(currentDir, entry.name);
253880
254281
  try {
253881
254282
  if (entry.isSymbolicLink()) {
253882
254283
  try {
@@ -253985,17 +254386,17 @@ var init_markdownConfigLoader = __esm(() => {
253985
254386
  oversizedMarkdownSkips = new Map;
253986
254387
  loadMarkdownFilesForSubdir = memoize_default(async function(subdir, cwd2) {
253987
254388
  const searchStartTime = Date.now();
253988
- const userDir = join84(getClaudeConfigHomeDir(), subdir);
253989
- const managedDir = join84(getManagedFilePath(), ".openclaude", subdir);
254389
+ const userDir = join85(getClaudeConfigHomeDir(), subdir);
254390
+ const managedDir = join85(getManagedFilePath(), ".openclaude", subdir);
253990
254391
  const projectDirs = getProjectDirsUpToHome(subdir, cwd2);
253991
254392
  const gitRoot = findGitRoot(cwd2);
253992
254393
  const canonicalRoot = findCanonicalGitRoot(cwd2);
253993
254394
  if (gitRoot && canonicalRoot && canonicalRoot !== gitRoot) {
253994
- const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(join84(gitRoot, configDirName, subdir)));
254395
+ const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(join85(gitRoot, configDirName, subdir)));
253995
254396
  const worktreeHasSubdir = projectDirs.some((dir) => worktreeSubdirs.includes(normalizePathForComparison(dir)));
253996
254397
  if (!worktreeHasSubdir) {
253997
254398
  for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
253998
- const mainConfigSubdir = join84(canonicalRoot, configDirName, subdir);
254399
+ const mainConfigSubdir = join85(canonicalRoot, configDirName, subdir);
253999
254400
  if (!projectDirs.includes(mainConfigSubdir)) {
254000
254401
  projectDirs.push(mainConfigSubdir);
254001
254402
  }
@@ -255340,8 +255741,18 @@ function getUserMessageText(message) {
255340
255741
  }
255341
255742
  function textForResubmit(msg) {
255342
255743
  const content = getUserMessageText(msg);
255343
- if (content === null)
255744
+ if (content === null) {
255745
+ if (Array.isArray(msg.message.content)) {
255746
+ const imageCount = msg.message.content.filter((block2) => block2.type === "image").length;
255747
+ if (imageCount > 0) {
255748
+ return {
255749
+ text: Array.from({ length: imageCount }, (_, index) => `[Image #${msg.imagePasteIds?.[index] ?? index + 1}]`).join(" "),
255750
+ mode: "prompt"
255751
+ };
255752
+ }
255753
+ }
255344
255754
  return null;
255755
+ }
255345
255756
  const bash = extractTag(content, "bash-input");
255346
255757
  if (bash)
255347
255758
  return { text: bash, mode: "bash" };
@@ -255365,6 +255776,9 @@ function getContentText(content) {
255365
255776
  }
255366
255777
  return null;
255367
255778
  }
255779
+ function getUserMessagePreviewText(content) {
255780
+ return getContentText(content)?.trim() || "(no prompt)";
255781
+ }
255368
255782
  var STRIPPED_TAGS_RE;
255369
255783
  var init_content = __esm(() => {
255370
255784
  init_xml();
@@ -255941,6 +256355,7 @@ __export(exports_messages, {
255941
256355
  hasSuccessfulToolCall: () => hasSuccessfulToolCall,
255942
256356
  handleMessageFromStream: () => handleMessageFromStream,
255943
256357
  getUserMessageText: () => getUserMessageText,
256358
+ getUserMessagePreviewText: () => getUserMessagePreviewText,
255944
256359
  getToolUseIDs: () => getToolUseIDs,
255945
256360
  getToolUseID: () => getToolUseID,
255946
256361
  getToolResultIDs: () => getToolResultIDs,
@@ -258632,10 +259047,10 @@ __export(exports_replayIndex, {
258632
259047
  loadReplayIndex: () => loadReplayIndex,
258633
259048
  fileExists: () => fileExists
258634
259049
  });
258635
- import { chmod as chmod5, readFile as readFile25, writeFile as writeFile21, stat as stat27 } from "fs/promises";
258636
- import { join as join85, dirname as dirname46 } from "path";
259050
+ import { chmod as chmod5, readFile as readFile25, writeFile as writeFile22, stat as stat27 } from "fs/promises";
259051
+ import { join as join86, dirname as dirname46 } from "path";
258637
259052
  function getReplayIndexPath(sessionId, transcriptPath) {
258638
- return join85(dirname46(transcriptPath), `${sessionId}.replay.json`);
259053
+ return join86(dirname46(transcriptPath), `${sessionId}.replay.json`);
258639
259054
  }
258640
259055
  async function fileExists(path13) {
258641
259056
  try {
@@ -258707,7 +259122,7 @@ async function writeReplayIndex(sessionId, transcriptPath, index) {
258707
259122
  const { mkdir: mkdir25 } = await import("fs/promises");
258708
259123
  await mkdir25(dir, { recursive: true, mode: 448 });
258709
259124
  }
258710
- await writeFile21(replayPath, JSON.stringify(index, null, 2), {
259125
+ await writeFile22(replayPath, JSON.stringify(index, null, 2), {
258711
259126
  encoding: "utf-8",
258712
259127
  mode: 384
258713
259128
  });
@@ -258831,9 +259246,9 @@ import {
258831
259246
  readFile as readFile26,
258832
259247
  stat as stat28,
258833
259248
  unlink as unlink10,
258834
- writeFile as writeFile22
259249
+ writeFile as writeFile23
258835
259250
  } from "fs/promises";
258836
- import { basename as basename25, dirname as dirname47, join as join86 } from "path";
259251
+ import { basename as basename25, dirname as dirname47, join as join87 } from "path";
258837
259252
  function getBuiltInCommandNames() {
258838
259253
  if (builtInCommandNamesCache)
258839
259254
  return builtInCommandNamesCache;
@@ -259042,14 +259457,14 @@ function isEphemeralToolProgress(dataType) {
259042
259457
  }
259043
259458
  function getTranscriptPath() {
259044
259459
  const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
259045
- return join86(projectDir, `${getSessionId()}.jsonl`);
259460
+ return join87(projectDir, `${getSessionId()}.jsonl`);
259046
259461
  }
259047
259462
  function getTranscriptPathForSession(sessionId) {
259048
259463
  if (sessionId === getSessionId()) {
259049
259464
  return getTranscriptPath();
259050
259465
  }
259051
259466
  const projectDir = getProjectDir2(getOriginalCwd());
259052
- return join86(projectDir, `${sessionId}.jsonl`);
259467
+ return join87(projectDir, `${sessionId}.jsonl`);
259053
259468
  }
259054
259469
  function setAgentTranscriptSubdir(agentId, subdir) {
259055
259470
  agentTranscriptSubdirs.set(agentId, subdir);
@@ -259061,8 +259476,8 @@ function getAgentTranscriptPath(agentId) {
259061
259476
  const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
259062
259477
  const sessionId = getSessionId();
259063
259478
  const subdir = agentTranscriptSubdirs.get(agentId);
259064
- const base2 = subdir ? join86(projectDir, sessionId, "subagents", subdir) : join86(projectDir, sessionId, "subagents");
259065
- return join86(base2, `agent-${agentId}.jsonl`);
259479
+ const base2 = subdir ? join87(projectDir, sessionId, "subagents", subdir) : join87(projectDir, sessionId, "subagents");
259480
+ return join87(base2, `agent-${agentId}.jsonl`);
259066
259481
  }
259067
259482
  function getAgentMetadataPath(agentId) {
259068
259483
  return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
@@ -259085,15 +259500,15 @@ async function readAgentMetadata(agentId) {
259085
259500
  }
259086
259501
  function getRemoteAgentsDir() {
259087
259502
  const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
259088
- return join86(projectDir, getSessionId(), "remote-agents");
259503
+ return join87(projectDir, getSessionId(), "remote-agents");
259089
259504
  }
259090
259505
  function getRemoteAgentMetadataPath(taskId) {
259091
- return join86(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
259506
+ return join87(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
259092
259507
  }
259093
259508
  async function writeRemoteAgentMetadata(taskId, metadata) {
259094
259509
  const path13 = getRemoteAgentMetadataPath(taskId);
259095
259510
  await mkdir25(dirname47(path13), { recursive: true });
259096
- await writeFile22(path13, JSON.stringify(metadata));
259511
+ await writeFile23(path13, JSON.stringify(metadata));
259097
259512
  }
259098
259513
  async function readRemoteAgentMetadata(taskId) {
259099
259514
  const path13 = getRemoteAgentMetadataPath(taskId);
@@ -259131,7 +259546,7 @@ async function listRemoteAgentMetadata() {
259131
259546
  if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
259132
259547
  continue;
259133
259548
  try {
259134
- const raw = await readFile26(join86(dir, entry.name), "utf-8");
259549
+ const raw = await readFile26(join87(dir, entry.name), "utf-8");
259135
259550
  results.push(JSON.parse(raw));
259136
259551
  } catch (e) {
259137
259552
  logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
@@ -259141,7 +259556,7 @@ async function listRemoteAgentMetadata() {
259141
259556
  }
259142
259557
  function sessionIdExists(sessionId) {
259143
259558
  const projectDir = getProjectDir2(getOriginalCwd());
259144
- const sessionFile = join86(projectDir, `${sessionId}.jsonl`);
259559
+ const sessionFile = join87(projectDir, `${sessionId}.jsonl`);
259145
259560
  const fs2 = getFsImplementation();
259146
259561
  try {
259147
259562
  fs2.statSync(sessionFile);
@@ -259177,7 +259592,7 @@ function getProject() {
259177
259592
  if (!shouldSkipSessionPersistence()) {
259178
259593
  const { writeReplayIndex: writeReplayIndex2 } = await Promise.resolve().then(() => (init_replayIndex(), exports_replayIndex));
259179
259594
  for (const { sessionId, builder, projectDir } of replayBuilders) {
259180
- const transcriptPath = projectDir ? join86(projectDir, `${sessionId}.jsonl`) : getTranscriptPathForSession(sessionId);
259595
+ const transcriptPath = projectDir ? join87(projectDir, `${sessionId}.jsonl`) : getTranscriptPathForSession(sessionId);
259181
259596
  const index = builder.build(sessionId);
259182
259597
  await writeReplayIndex2(sessionId, transcriptPath, index);
259183
259598
  }
@@ -261593,7 +262008,7 @@ async function loadTranscriptFile(filePath, opts) {
261593
262008
  };
261594
262009
  }
261595
262010
  async function loadSessionFile(sessionId) {
261596
- const sessionFile = join86(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
262011
+ const sessionFile = join87(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
261597
262012
  return loadTranscriptFile(sessionFile);
261598
262013
  }
261599
262014
  function clearSessionMessagesCache() {
@@ -261665,7 +262080,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
261665
262080
  } catch {
261666
262081
  return [];
261667
262082
  }
261668
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join86(projectsDir, dirent.name));
262083
+ const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join87(projectsDir, dirent.name));
261669
262084
  const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
261670
262085
  const allLogs = logsPerProject.flat();
261671
262086
  const deduped = new Map;
@@ -261690,7 +262105,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
261690
262105
  } catch {
261691
262106
  return { logs: [], allStatLogs: [], nextIndex: 0 };
261692
262107
  }
261693
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join86(projectsDir, dirent.name));
262108
+ const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join87(projectsDir, dirent.name));
261694
262109
  const rawLogs = [];
261695
262110
  for (const projectDir of projectDirs) {
261696
262111
  rawLogs.push(...await getSessionFilesLite(projectDir, limit));
@@ -261751,7 +262166,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
261751
262166
  for (const { path: wtPath, prefix } of indexed) {
261752
262167
  if (dirName === prefix || dirName.startsWith(prefix + "-")) {
261753
262168
  seenDirs.add(dirName);
261754
- allLogs.push(...await getSessionFilesLite(join86(projectsDir, dirent.name), undefined, wtPath));
262169
+ allLogs.push(...await getSessionFilesLite(join87(projectsDir, dirent.name), undefined, wtPath));
261755
262170
  break;
261756
262171
  }
261757
262172
  }
@@ -261820,7 +262235,7 @@ async function loadSubagentTranscripts(agentIds) {
261820
262235
  return transcripts;
261821
262236
  }
261822
262237
  async function loadAllSubagentTranscriptsFromDisk() {
261823
- const subagentsDir = join86(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
262238
+ const subagentsDir = join87(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
261824
262239
  let entries;
261825
262240
  try {
261826
262241
  entries = await readdir18(subagentsDir, { withFileTypes: true });
@@ -261948,7 +262363,7 @@ async function getSessionFilesWithMtime(projectDir) {
261948
262363
  const sessionId = validateUuid2(basename25(dirent.name, ".jsonl"));
261949
262364
  if (!sessionId)
261950
262365
  continue;
261951
- candidates.push({ sessionId, filePath: join86(projectDir, dirent.name) });
262366
+ candidates.push({ sessionId, filePath: join87(projectDir, dirent.name) });
261952
262367
  }
261953
262368
  await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
261954
262369
  try {
@@ -262109,7 +262524,7 @@ async function readLiteMetadata(filePath, fileSize, buf, sessionId) {
262109
262524
  const projectPath = extractJsonStringField(head, "cwd");
262110
262525
  const teamName = extractJsonStringField(head, "teamName");
262111
262526
  const agentSetting = extractJsonStringField(head, "agentSetting");
262112
- const firstPrompt = extractLastJsonStringField(tail, "lastPrompt") || extractFirstPromptFromChunk(head) || extractJsonStringFieldPrefix(head, "content", 200) || extractJsonStringFieldPrefix(head, "text", 200) || "";
262527
+ const firstPrompt = extractFirstPromptFromChunk(head) || extractLastJsonStringField(tail, "lastPrompt") || extractJsonStringFieldPrefix(head, "content", 200) || extractJsonStringFieldPrefix(head, "text", 200) || "";
262113
262528
  const customTitle = extractLastJsonStringField(tail, "customTitle") ?? extractLastJsonStringField(head, "customTitle") ?? extractLastJsonStringField(tail, "aiTitle") ?? extractLastJsonStringField(head, "aiTitle");
262114
262529
  const summary = extractLastJsonStringField(tail, "summary");
262115
262530
  const tagLine = tail.split(`
@@ -262376,7 +262791,7 @@ var init_sessionStorage = __esm(() => {
262376
262791
  init_slowOperations();
262377
262792
  init_transcriptFileLock();
262378
262793
  init_uuid();
262379
- VERSION3 = typeof MACRO !== "undefined" ? "0.29.2-by-rayss" : "unknown";
262794
+ VERSION3 = typeof MACRO !== "undefined" ? "0.30.2-by-rayss" : "unknown";
262380
262795
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
262381
262796
  TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
262382
262797
  transcriptRewriteHooksForTesting = {};
@@ -262391,7 +262806,7 @@ var init_sessionStorage = __esm(() => {
262391
262806
  MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
262392
262807
  agentTranscriptSubdirs = new Map;
262393
262808
  getProjectDir2 = memoize_default((projectDir) => {
262394
- return join86(getProjectsDir(), sanitizePath(projectDir));
262809
+ return join87(getProjectsDir(), sanitizePath(projectDir));
262395
262810
  });
262396
262811
  PERSISTED_OUTPUT_TAG2 = Buffer.from("<persisted-output>");
262397
262812
  TOOL_USE_RESULT_KEY = Buffer.from('"toolUseResult":');
@@ -262754,41 +263169,41 @@ var init_memdir = __esm(() => {
262754
263169
  });
262755
263170
 
262756
263171
  // src/tools/AgentTool/agentMemory.ts
262757
- import { join as join87, normalize as normalize12, sep as sep22 } from "path";
263172
+ import { join as join88, normalize as normalize12, sep as sep22 } from "path";
262758
263173
  function sanitizeAgentTypeForPath(agentType) {
262759
263174
  return agentType.replace(/:/g, "-");
262760
263175
  }
262761
263176
  function getLocalAgentMemoryDir(dirName) {
262762
263177
  if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
262763
- return join87(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep22;
263178
+ return join88(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep22;
262764
263179
  }
262765
- return join87(getCwd(), ".openclaude", "agent-memory-local", dirName) + sep22;
263180
+ return join88(getCwd(), ".openclaude", "agent-memory-local", dirName) + sep22;
262766
263181
  }
262767
263182
  function getAgentMemoryDir(agentType, scope) {
262768
263183
  const dirName = sanitizeAgentTypeForPath(agentType);
262769
263184
  switch (scope) {
262770
263185
  case "project":
262771
- return join87(getCwd(), ".openclaude", "agent-memory", dirName) + sep22;
263186
+ return join88(getCwd(), ".openclaude", "agent-memory", dirName) + sep22;
262772
263187
  case "local":
262773
263188
  return getLocalAgentMemoryDir(dirName);
262774
263189
  case "user":
262775
- return join87(getMemoryBaseDir(), "agent-memory", dirName) + sep22;
263190
+ return join88(getMemoryBaseDir(), "agent-memory", dirName) + sep22;
262776
263191
  }
262777
263192
  }
262778
263193
  function isAgentMemoryPath(absolutePath) {
262779
263194
  const normalizedPath = normalize12(absolutePath);
262780
263195
  const memoryBase = getMemoryBaseDir();
262781
- if (normalizedPath.startsWith(join87(memoryBase, "agent-memory") + sep22)) {
263196
+ if (normalizedPath.startsWith(join88(memoryBase, "agent-memory") + sep22)) {
262782
263197
  return true;
262783
263198
  }
262784
- if (normalizedPath.startsWith(join87(getCwd(), ".openclaude", "agent-memory") + sep22)) {
263199
+ if (normalizedPath.startsWith(join88(getCwd(), ".openclaude", "agent-memory") + sep22)) {
262785
263200
  return true;
262786
263201
  }
262787
263202
  if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
262788
- if (normalizedPath.includes(sep22 + "agent-memory-local" + sep22) && normalizedPath.startsWith(join87(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects") + sep22)) {
263203
+ if (normalizedPath.includes(sep22 + "agent-memory-local" + sep22) && normalizedPath.startsWith(join88(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects") + sep22)) {
262789
263204
  return true;
262790
263205
  }
262791
- } else if (normalizedPath.startsWith(join87(getCwd(), ".openclaude", "agent-memory-local") + sep22)) {
263206
+ } else if (normalizedPath.startsWith(join88(getCwd(), ".openclaude", "agent-memory-local") + sep22)) {
262792
263207
  return true;
262793
263208
  }
262794
263209
  return false;
@@ -262863,7 +263278,7 @@ __export(exports_filesystem, {
262863
263278
  });
262864
263279
  import { randomBytes as randomBytes10 } from "crypto";
262865
263280
  import { homedir as homedir23, tmpdir as tmpdir6 } from "os";
262866
- import { join as join88, normalize as normalize13, posix as posix6, sep as sep23 } from "path";
263281
+ import { join as join89, normalize as normalize13, posix as posix6, sep as sep23 } from "path";
262867
263282
  function normalizeCaseForComparison(path13) {
262868
263283
  return path13.toLowerCase();
262869
263284
  }
@@ -262872,11 +263287,11 @@ function getClaudeSkillScope(filePath) {
262872
263287
  const absolutePathLower = normalizeCaseForComparison(absolutePath);
262873
263288
  const bases = [
262874
263289
  {
262875
- dir: expandPath(join88(getOriginalCwd(), ".openclaude", "skills")),
263290
+ dir: expandPath(join89(getOriginalCwd(), ".openclaude", "skills")),
262876
263291
  prefix: "/.openclaude/skills/"
262877
263292
  },
262878
263293
  {
262879
- dir: expandPath(join88(homedir23(), ".openclaude", "skills")),
263294
+ dir: expandPath(join89(homedir23(), ".openclaude", "skills")),
262880
263295
  prefix: "~/.openclaude/skills/"
262881
263296
  }
262882
263297
  ];
@@ -262931,13 +263346,13 @@ function isClaudeConfigFilePath(filePath) {
262931
263346
  if (isClaudeSettingsPath(filePath)) {
262932
263347
  return true;
262933
263348
  }
262934
- const commandsDir = join88(getOriginalCwd(), ".openclaude", "commands");
262935
- const agentsDir = join88(getOriginalCwd(), ".openclaude", "agents");
262936
- const skillsDir = join88(getOriginalCwd(), ".openclaude", "skills");
263349
+ const commandsDir = join89(getOriginalCwd(), ".openclaude", "commands");
263350
+ const agentsDir = join89(getOriginalCwd(), ".openclaude", "agents");
263351
+ const skillsDir = join89(getOriginalCwd(), ".openclaude", "skills");
262937
263352
  return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
262938
263353
  }
262939
263354
  function isPlanFilePath(plansDir, planSlug, absolutePath) {
262940
- const expectedPrefix = join88(plansDir, planSlug);
263355
+ const expectedPrefix = join89(plansDir, planSlug);
262941
263356
  const normalizedPath = normalize13(absolutePath);
262942
263357
  if (!normalizedPath.endsWith(".md")) {
262943
263358
  return false;
@@ -262945,7 +263360,7 @@ function isPlanFilePath(plansDir, planSlug, absolutePath) {
262945
263360
  if (normalizedPath === expectedPrefix + ".md") {
262946
263361
  return true;
262947
263362
  }
262948
- const agentPrefix = join88(plansDir, AGENT_PLANS_SUBDIR, `${planSlug}-agent-`);
263363
+ const agentPrefix = join89(plansDir, AGENT_PLANS_SUBDIR, `${planSlug}-agent-`);
262949
263364
  if (!normalizedPath.startsWith(agentPrefix)) {
262950
263365
  return false;
262951
263366
  }
@@ -262960,10 +263375,10 @@ function isSessionPlanFile(absolutePath) {
262960
263375
  return isResolvedPathWithinPlansDir(absolutePath, plansDir);
262961
263376
  }
262962
263377
  function getSessionMemoryDir() {
262963
- return join88(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep23;
263378
+ return join89(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep23;
262964
263379
  }
262965
263380
  function getSessionMemoryPath() {
262966
- return join88(getSessionMemoryDir(), "summary.md");
263381
+ return join89(getSessionMemoryDir(), "summary.md");
262967
263382
  }
262968
263383
  function isSessionMemoryPath(absolutePath) {
262969
263384
  const normalizedPath = normalize13(absolutePath);
@@ -262986,15 +263401,15 @@ function getClaudeTempDirName() {
262986
263401
  }
262987
263402
  function ensureUsableTempDir(fs2, dirPath) {
262988
263403
  fs2.mkdirSync(dirPath, { mode: 448 });
262989
- const probeDir = join88(dirPath, `.write-probe-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
263404
+ const probeDir = join89(dirPath, `.write-probe-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
262990
263405
  fs2.mkdirSync(probeDir, { mode: 448 });
262991
263406
  fs2.rmdirSync(probeDir);
262992
263407
  }
262993
263408
  function getProjectTempDir() {
262994
- return join88(getClaudeTempDir(), sanitizePath(getOriginalCwd())) + sep23;
263409
+ return join89(getClaudeTempDir(), sanitizePath(getOriginalCwd())) + sep23;
262995
263410
  }
262996
263411
  function getScratchpadDir() {
262997
- return join88(getProjectTempDir(), getSessionId(), "scratchpad");
263412
+ return join89(getProjectTempDir(), getSessionId(), "scratchpad");
262998
263413
  }
262999
263414
  async function ensureScratchpadDir() {
263000
263415
  if (!isScratchpadEnabled()) {
@@ -263045,7 +263460,7 @@ function getActiveSessionPlanFilePath(agentId) {
263045
263460
  return getPlanFilePath2(agentId);
263046
263461
  }
263047
263462
  function isOpenClaudeCommitMessagePath(absolutePath) {
263048
- const expectedPath = join88(getOriginalCwd(), ".git", "OPENCLAUDE_COMMIT_MSG");
263463
+ const expectedPath = join89(getOriginalCwd(), ".git", "OPENCLAUDE_COMMIT_MSG");
263049
263464
  const expectedForms = getPathsForPermissionCheck(expectedPath);
263050
263465
  const targetForms = getPathsForPermissionCheck(absolutePath);
263051
263466
  return targetForms.length > 0 && targetForms.every((target) => expectedForms.some((expected) => pathsEqualForPermission(target, expected)));
@@ -263621,7 +264036,7 @@ function checkEditableInternalPath(absolutePath, input, toolPermissionContext) {
263621
264036
  }
263622
264037
  };
263623
264038
  }
263624
- if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join88(getOriginalCwd(), ".openclaude", "launch.json"))) {
264039
+ if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join89(getOriginalCwd(), ".openclaude", "launch.json"))) {
263625
264040
  return {
263626
264041
  behavior: "allow",
263627
264042
  updatedInput: input,
@@ -263728,7 +264143,7 @@ function checkReadableInternalPath(absolutePath, input) {
263728
264143
  }
263729
264144
  };
263730
264145
  }
263731
- const tasksDir = join88(getClaudeConfigHomeDir(), "tasks") + sep23;
264146
+ const tasksDir = join89(getClaudeConfigHomeDir(), "tasks") + sep23;
263732
264147
  if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
263733
264148
  return {
263734
264149
  behavior: "allow",
@@ -263739,7 +264154,7 @@ function checkReadableInternalPath(absolutePath, input) {
263739
264154
  }
263740
264155
  };
263741
264156
  }
263742
- const teamsReadDir = join88(getClaudeConfigHomeDir(), "teams") + sep23;
264157
+ const teamsReadDir = join89(getClaudeConfigHomeDir(), "teams") + sep23;
263743
264158
  if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
263744
264159
  return {
263745
264160
  behavior: "allow",
@@ -263817,14 +264232,14 @@ var init_filesystem = __esm(() => {
263817
264232
  try {
263818
264233
  resolvedBaseTmpDir = fs2.realpathSync(baseTmpDir);
263819
264234
  } catch {}
263820
- const fullPath = join88(resolvedBaseTmpDir, getClaudeTempDirName()) + sep23;
264235
+ const fullPath = join89(resolvedBaseTmpDir, getClaudeTempDirName()) + sep23;
263821
264236
  try {
263822
264237
  ensureUsableTempDir(fs2, fullPath);
263823
264238
  } catch (e) {
263824
264239
  if (isFsInaccessible(e)) {
263825
264240
  const fallbackDirs = [
263826
- join88(tmpdir6(), "claude-code", getClaudeTempDirName()) + sep23,
263827
- join88(getClaudeConfigHomeDir(), "tmp", getClaudeTempDirName()) + sep23
264241
+ join89(tmpdir6(), "claude-code", getClaudeTempDirName()) + sep23,
264242
+ join89(getClaudeConfigHomeDir(), "tmp", getClaudeTempDirName()) + sep23
263828
264243
  ];
263829
264244
  for (const fallbackDir of fallbackDirs) {
263830
264245
  try {
@@ -263843,7 +264258,7 @@ var init_filesystem = __esm(() => {
263843
264258
  });
263844
264259
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
263845
264260
  const nonce = randomBytes10(16).toString("hex");
263846
- return join88(getClaudeTempDir(), "bundled-skills", "0.29.2-by-rayss", nonce);
264261
+ return join89(getClaudeTempDir(), "bundled-skills", "0.30.2-by-rayss", nonce);
263847
264262
  });
263848
264263
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
263849
264264
  });
@@ -263857,10 +264272,10 @@ import {
263857
264272
  symlink as symlink3,
263858
264273
  unlink as unlink11
263859
264274
  } from "fs/promises";
263860
- import { join as join89 } from "path";
264275
+ import { join as join90 } from "path";
263861
264276
  function getTaskOutputDir() {
263862
264277
  if (_taskOutputDir === undefined) {
263863
- _taskOutputDir = join89(getProjectTempDir(), getSessionId(), "tasks");
264278
+ _taskOutputDir = join90(getProjectTempDir(), getSessionId(), "tasks");
263864
264279
  }
263865
264280
  return _taskOutputDir;
263866
264281
  }
@@ -263868,7 +264283,7 @@ async function ensureOutputDir() {
263868
264283
  await mkdir26(getTaskOutputDir(), { recursive: true });
263869
264284
  }
263870
264285
  function getTaskOutputPath(taskId) {
263871
- return join89(getTaskOutputDir(), `${taskId}.output`);
264286
+ return join90(getTaskOutputDir(), `${taskId}.output`);
263872
264287
  }
263873
264288
  function track(p) {
263874
264289
  _pendingOps.add(p);
@@ -265163,7 +265578,7 @@ __export(exports_hookChains, {
265163
265578
  });
265164
265579
  import { createHash as createHash14 } from "crypto";
265165
265580
  import { statSync as statSync7 } from "fs";
265166
- import { join as join90, resolve as resolve32 } from "path";
265581
+ import { join as join91, resolve as resolve32 } from "path";
265167
265582
  function asAnalyticsString(value) {
265168
265583
  return value;
265169
265584
  }
@@ -265192,7 +265607,7 @@ function getConfigPath(pathOverride) {
265192
265607
  if (configuredPath) {
265193
265608
  return resolve32(getSafeOriginalCwd(), configuredPath);
265194
265609
  }
265195
- return join90(getSafeOriginalCwd(), DEFAULT_HOOK_CHAINS_RELATIVE_PATH);
265610
+ return join91(getSafeOriginalCwd(), DEFAULT_HOOK_CHAINS_RELATIVE_PATH);
265196
265611
  }
265197
265612
  function getSafeOriginalCwd() {
265198
265613
  try {
@@ -266121,7 +266536,7 @@ var init_hookChains = __esm(() => {
266121
266536
  init_teammate();
266122
266537
  init_teammateMailbox();
266123
266538
  init_v4();
266124
- DEFAULT_HOOK_CHAINS_RELATIVE_PATH = join90(".openclaude", "hook-chains.json");
266539
+ DEFAULT_HOOK_CHAINS_RELATIVE_PATH = join91(".openclaude", "hook-chains.json");
266125
266540
  MAX_GUARD_WINDOW_MS = 24 * 60 * 60 * 1000;
266126
266541
  CONFIG_CACHE_MAX_AGE_MS = 5 * 60 * 1000;
266127
266542
  HookChainOutcomeSchema = exports_external.enum(["success", "failed", "timeout", "unknown"]);
@@ -269230,7 +269645,7 @@ import {
269230
269645
  symlink as symlink4,
269231
269646
  utimes as utimes2
269232
269647
  } from "fs/promises";
269233
- import { basename as basename27, dirname as dirname49, join as join91 } from "path";
269648
+ import { basename as basename27, dirname as dirname49, join as join92 } from "path";
269234
269649
  function validateWorktreeSlug(slug) {
269235
269650
  if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
269236
269651
  throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
@@ -269253,8 +269668,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
269253
269668
  logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
269254
269669
  continue;
269255
269670
  }
269256
- const sourcePath = join91(repoRootPath, dir);
269257
- const destPath = join91(worktreePath, dir);
269671
+ const sourcePath = join92(repoRootPath, dir);
269672
+ const destPath = join92(worktreePath, dir);
269258
269673
  try {
269259
269674
  await symlink4(sourcePath, destPath, "dir");
269260
269675
  logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
@@ -269288,7 +269703,7 @@ async function withGitWorktreeMutationLock(repoRoot, fn) {
269288
269703
  }
269289
269704
  }
269290
269705
  function worktreesDir(repoRoot) {
269291
- return join91(repoRoot, ".openclaude", "worktrees");
269706
+ return join92(repoRoot, ".openclaude", "worktrees");
269292
269707
  }
269293
269708
  function flattenSlug(slug) {
269294
269709
  return slug.replaceAll("/", "+");
@@ -269302,7 +269717,7 @@ function buildRevParseFailureMessage(baseBranch, stderr, exitCode) {
269302
269717
  return `Failed to resolve base branch "${baseBranch}": ${detail}${hint}`;
269303
269718
  }
269304
269719
  function worktreePathFor(repoRoot, slug) {
269305
- return join91(worktreesDir(repoRoot), flattenSlug(slug));
269720
+ return join92(worktreesDir(repoRoot), flattenSlug(slug));
269306
269721
  }
269307
269722
  async function autoConfigureLongPathsForWorktrees(repoRoot) {
269308
269723
  if (_testDeps.getPlatform() !== "windows") {
@@ -269419,7 +269834,7 @@ async function getOrCreateWorktree(repoRoot, slug, options2) {
269419
269834
  async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
269420
269835
  let includeContent;
269421
269836
  try {
269422
- includeContent = await readFile27(join91(repoRoot, ".worktreeinclude"), "utf-8");
269837
+ includeContent = await readFile27(join92(repoRoot, ".worktreeinclude"), "utf-8");
269423
269838
  } catch {
269424
269839
  return [];
269425
269840
  }
@@ -269474,8 +269889,8 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
269474
269889
  }
269475
269890
  const copied = [];
269476
269891
  for (const relativePath2 of files) {
269477
- const srcPath = join91(repoRoot, relativePath2);
269478
- const destPath = join91(worktreePath, relativePath2);
269892
+ const srcPath = join92(repoRoot, relativePath2);
269893
+ const destPath = join92(worktreePath, relativePath2);
269479
269894
  try {
269480
269895
  await mkdir27(dirname49(destPath), { recursive: true });
269481
269896
  await copyFile6(srcPath, destPath);
@@ -269491,9 +269906,9 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
269491
269906
  }
269492
269907
  async function performPostCreationSetup(repoRoot, worktreePath) {
269493
269908
  const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
269494
- const sourceSettingsLocal = join91(repoRoot, localSettingsRelativePath);
269909
+ const sourceSettingsLocal = join92(repoRoot, localSettingsRelativePath);
269495
269910
  try {
269496
- const destSettingsLocal = join91(worktreePath, localSettingsRelativePath);
269911
+ const destSettingsLocal = join92(worktreePath, localSettingsRelativePath);
269497
269912
  await mkdirRecursive(dirname49(destSettingsLocal));
269498
269913
  await copyFile6(sourceSettingsLocal, destSettingsLocal);
269499
269914
  logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
@@ -269503,8 +269918,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
269503
269918
  logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
269504
269919
  }
269505
269920
  }
269506
- const huskyPath = join91(repoRoot, ".husky");
269507
- const gitHooksPath = join91(repoRoot, ".git", "hooks");
269921
+ const huskyPath = join92(repoRoot, ".husky");
269922
+ const gitHooksPath = join92(repoRoot, ".git", "hooks");
269508
269923
  let hooksPath = null;
269509
269924
  for (const candidatePath of [huskyPath, gitHooksPath]) {
269510
269925
  try {
@@ -270350,8 +270765,11 @@ function logStripOnce(stripped) {
270350
270765
  loggedStrip = true;
270351
270766
  logForDebugging(`[betas] Stripped from tool schemas: [${stripped.join(", ")}] (CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1)`);
270352
270767
  }
270768
+ function getSystemPromptTelemetryBlock(systemPrompt) {
270769
+ return splitSysPromptPrefix(systemPrompt).find((block2) => !isAnthropicBillingAttributionBlock(block2.text));
270770
+ }
270353
270771
  function logAPIPrefix(systemPrompt) {
270354
- const [firstSyspromptBlock] = splitSysPromptPrefix(systemPrompt);
270772
+ const firstSyspromptBlock = getSystemPromptTelemetryBlock(systemPrompt);
270355
270773
  const firstSystemPrompt = firstSyspromptBlock?.text;
270356
270774
  logEvent("tengu_sysprompt_block", {
270357
270775
  snippet: firstSystemPrompt?.slice(0, 20),
@@ -270373,7 +270791,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
270373
270791
  continue;
270374
270792
  if (prompt === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
270375
270793
  continue;
270376
- if (prompt.startsWith("x-anthropic-billing-header")) {
270794
+ if (isAnthropicBillingAttributionBlock(prompt)) {
270377
270795
  attributionHeader2 = prompt;
270378
270796
  } else if (CLI_SYSPROMPT_PREFIXES.has(prompt)) {
270379
270797
  systemPromptPrefix2 = prompt;
@@ -270407,7 +270825,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
270407
270825
  const block2 = systemPrompt[i3];
270408
270826
  if (!block2 || block2 === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
270409
270827
  continue;
270410
- if (block2.startsWith("x-anthropic-billing-header")) {
270828
+ if (isAnthropicBillingAttributionBlock(block2)) {
270411
270829
  attributionHeader2 = block2;
270412
270830
  } else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
270413
270831
  systemPromptPrefix2 = block2;
@@ -270450,7 +270868,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
270450
270868
  for (const block2 of systemPrompt) {
270451
270869
  if (!block2)
270452
270870
  continue;
270453
- if (block2.startsWith("x-anthropic-billing-header")) {
270871
+ if (isAnthropicBillingAttributionBlock(block2)) {
270454
270872
  attributionHeader = block2;
270455
270873
  } else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
270456
270874
  systemPromptPrefix = block2;
@@ -271321,8 +271739,8 @@ ${deferredToolList}
271321
271739
  }
271322
271740
  const hasChromeTools = filteredTools.some((t) => isToolFromMcpServer(t.name, CLAUDE_IN_CHROME_MCP_SERVER_NAME));
271323
271741
  const injectChromeHere = useToolSearch && hasChromeTools && !isMcpInstructionsDeltaEnabled();
271742
+ const attributionEnabled = isAttributionHeaderEnabled();
271324
271743
  systemPrompt = asSystemPrompt([
271325
- getAttributionHeader(fingerprint),
271326
271744
  getCLISyspromptPrefix({
271327
271745
  isNonInteractive: options2.isNonInteractiveSession,
271328
271746
  hasAppendSystemPrompt: options2.hasAppendSystemPrompt
@@ -271331,12 +271749,6 @@ ${deferredToolList}
271331
271749
  ...advisorModel ? [ADVISOR_TOOL_INSTRUCTIONS] : [],
271332
271750
  ...injectChromeHere ? [CHROME_TOOL_SEARCH_INSTRUCTIONS] : []
271333
271751
  ].filter(Boolean));
271334
- logAPIPrefix(systemPrompt);
271335
- const enablePromptCaching = options2.enablePromptCaching ?? getPromptCachingEnabled(options2.model);
271336
- const system = buildSystemPromptBlocks(systemPrompt, enablePromptCaching, {
271337
- skipGlobalCacheForSystemPrompt: needsToolBasedCacheMarker,
271338
- querySource: options2.querySource
271339
- });
271340
271752
  const useBetas = betas.length > 0;
271341
271753
  const extraToolSchemas = [...options2.extraToolSchemas ?? []];
271342
271754
  if (advisorModel) {
@@ -271377,24 +271789,6 @@ ${deferredToolList}
271377
271789
  }
271378
271790
  const sonnet1mExpLatched = getSonnet1mExpTreatmentEnabled(options2.model);
271379
271791
  const effort = resolveAppliedEffort(options2.model, options2.effortValue);
271380
- if (true) {
271381
- const toolsForCacheDetection = allTools.filter((t) => !(("defer_loading" in t) && t.defer_loading));
271382
- recordPromptState({
271383
- system,
271384
- toolSchemas: toolsForCacheDetection,
271385
- querySource: options2.querySource,
271386
- model: options2.model,
271387
- agentId: options2.agentId,
271388
- fastMode: fastModeHeaderLatched,
271389
- globalCacheStrategy,
271390
- betas,
271391
- autoModeActive: afkHeaderLatched,
271392
- isUsingOverage: currentLimits.isUsingOverage ?? false,
271393
- cachedMCEnabled: cacheEditingHeaderLatched,
271394
- effortValue: effort,
271395
- extraBodyParams: getExtraBodyParams()
271396
- });
271397
- }
271398
271792
  const startIncludingRetries = Date.now();
271399
271793
  let start = Date.now();
271400
271794
  let attemptNumber = 0;
@@ -271428,6 +271822,8 @@ ${deferredToolList}
271428
271822
  const consumedCacheEdits = cachedMCEnabled ? consumePendingCacheEdits() : null;
271429
271823
  const consumedPinnedEdits = cachedMCEnabled ? getPinnedCacheEdits() : [];
271430
271824
  let lastRequestBetas;
271825
+ let apiPrefixLogged = false;
271826
+ let promptStateRecorded = false;
271431
271827
  const paramsFromContext = (retryContext) => {
271432
271828
  const betasParams = [...betas];
271433
271829
  if (!betasParams.includes(CONTEXT_1M_BETA_HEADER) && sonnet1mExpLatched) {
@@ -271474,7 +271870,42 @@ ${deferredToolList}
271474
271870
  isRedactThinkingActive: betasParams.includes(REDACT_THINKING_BETA_HEADER),
271475
271871
  clearAllThinking: thinkingClearLatched
271476
271872
  });
271477
- const enablePromptCaching2 = options2.enablePromptCaching ?? getPromptCachingEnabled(retryContext.model);
271873
+ const enablePromptCaching = options2.enablePromptCaching ?? getPromptCachingEnabled(retryContext.model);
271874
+ const attributionPolicy = resolveCurrentAnthropicAttributionPolicy({
271875
+ attributionEnabled,
271876
+ providerOverride: options2.providerOverride
271877
+ });
271878
+ const requestSystemPrompt = asSystemPrompt(applyAnthropicAttributionPolicy([
271879
+ getAttributionHeader(fingerprint, attributionPolicy),
271880
+ ...systemPrompt
271881
+ ].filter(Boolean), attributionPolicy));
271882
+ const system = buildSystemPromptBlocks(requestSystemPrompt, enablePromptCaching, {
271883
+ skipGlobalCacheForSystemPrompt: needsToolBasedCacheMarker,
271884
+ querySource: options2.querySource
271885
+ });
271886
+ if (!apiPrefixLogged) {
271887
+ apiPrefixLogged = true;
271888
+ logAPIPrefix(requestSystemPrompt);
271889
+ }
271890
+ if (!promptStateRecorded) {
271891
+ promptStateRecorded = true;
271892
+ const toolsForCacheDetection = allTools.filter((t) => !(("defer_loading" in t) && t.defer_loading));
271893
+ recordPromptState({
271894
+ system,
271895
+ toolSchemas: toolsForCacheDetection,
271896
+ querySource: options2.querySource,
271897
+ model: options2.model,
271898
+ agentId: options2.agentId,
271899
+ fastMode: fastModeHeaderLatched,
271900
+ globalCacheStrategy,
271901
+ betas,
271902
+ autoModeActive: afkHeaderLatched,
271903
+ isUsingOverage: currentLimits.isUsingOverage ?? false,
271904
+ cachedMCEnabled: cacheEditingHeaderLatched,
271905
+ effortValue: effort,
271906
+ extraBodyParams: getExtraBodyParams()
271907
+ });
271908
+ }
271478
271909
  let speed;
271479
271910
  const isFastModeForRetry = isFastModeEnabled() && isFastModeAvailable() && !isFastModeCooldown() && isFastModeSupportedByModel(options2.model) && !!retryContext.fastMode;
271480
271911
  if (isFastModeForRetry) {
@@ -271498,7 +271929,7 @@ ${deferredToolList}
271498
271929
  return {
271499
271930
  model: normalizeModelStringForAPI(providerRequestModel),
271500
271931
  system,
271501
- messages: addCacheBreakpoints(messagesForAPI, enablePromptCaching2, options2.querySource, useCachedMC, consumedCacheEdits, consumedPinnedEdits, options2.skipCacheWrite),
271932
+ messages: addCacheBreakpoints(messagesForAPI, enablePromptCaching, options2.querySource, useCachedMC, consumedCacheEdits, consumedPinnedEdits, options2.skipCacheWrite),
271502
271933
  tools: allTools,
271503
271934
  tool_choice: options2.toolChoice,
271504
271935
  ...useBetas && { betas: betasParams },
@@ -272728,6 +273159,7 @@ var init_claude3 = __esm(() => {
272728
273159
  init_manager();
272729
273160
  init_utils4();
272730
273161
  init_vcr();
273162
+ init_authRouting();
272731
273163
  init_client4();
272732
273164
  init_errors4();
272733
273165
  init_logging();
@@ -272831,9 +273263,9 @@ function assertFunction(value, field) {
272831
273263
 
272832
273264
  // src/utils/imageStore.ts
272833
273265
  import { mkdir as mkdir28, open as open10 } from "fs/promises";
272834
- import { join as join92 } from "path";
273266
+ import { join as join93 } from "path";
272835
273267
  function getImageStoreDir() {
272836
- return join92(getClaudeConfigHomeDir(), IMAGE_STORE_DIR, getSessionId());
273268
+ return join93(getClaudeConfigHomeDir(), IMAGE_STORE_DIR, getSessionId());
272837
273269
  }
272838
273270
  async function ensureImageStoreDir() {
272839
273271
  const dir = getImageStoreDir();
@@ -272841,7 +273273,7 @@ async function ensureImageStoreDir() {
272841
273273
  }
272842
273274
  function getImagePath(imageId, mediaType) {
272843
273275
  const extension2 = mediaType.split("/")[1] || "png";
272844
- return join92(getImageStoreDir(), `${imageId}.${extension2}`);
273276
+ return join93(getImageStoreDir(), `${imageId}.${extension2}`);
272845
273277
  }
272846
273278
  async function storeImage(content) {
272847
273279
  if (content.type !== "image") {
@@ -278365,7 +278797,7 @@ function buildSystemInitMessage(inputs) {
278365
278797
  slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
278366
278798
  apiKeySource: getAnthropicApiKeyWithSource().source,
278367
278799
  betas: getSdkBetas(),
278368
- claude_code_version: "0.29.2-by-rayss",
278800
+ claude_code_version: "0.30.2-by-rayss",
278369
278801
  output_style: outputStyle,
278370
278802
  agents: inputs.agents.map((agent) => agent.agentType),
278371
278803
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -280571,9 +281003,9 @@ __export(exports_upstreamproxy, {
280571
281003
  getUpstreamProxyEnv: () => getUpstreamProxyEnv,
280572
281004
  SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
280573
281005
  });
280574
- import { mkdir as mkdir29, readFile as readFile28, unlink as unlink13, writeFile as writeFile23 } from "fs/promises";
281006
+ import { mkdir as mkdir29, readFile as readFile28, unlink as unlink13, writeFile as writeFile24 } from "fs/promises";
280575
281007
  import { homedir as homedir25 } from "os";
280576
- import { join as join93 } from "path";
281008
+ import { join as join94 } from "path";
280577
281009
  async function initUpstreamProxy(opts) {
280578
281010
  if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
280579
281011
  return state2;
@@ -280594,7 +281026,7 @@ async function initUpstreamProxy(opts) {
280594
281026
  }
280595
281027
  setNonDumpable();
280596
281028
  const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
280597
- const caBundlePath = opts?.caBundlePath ?? join93(homedir25(), ".ccr", "ca-bundle.crt");
281029
+ const caBundlePath = opts?.caBundlePath ?? join94(homedir25(), ".ccr", "ca-bundle.crt");
280598
281030
  const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
280599
281031
  if (!caOk)
280600
281032
  return state2;
@@ -280712,8 +281144,8 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
280712
281144
  return false;
280713
281145
  }
280714
281146
  const systemCa = await readFile28(systemCaPath, "utf8").catch(() => "");
280715
- await mkdir29(join93(outPath, ".."), { recursive: true });
280716
- await writeFile23(outPath, systemCa + `
281147
+ await mkdir29(join94(outPath, ".."), { recursive: true });
281148
+ await writeFile24(outPath, systemCa + `
280717
281149
  ` + ccrCa, "utf8");
280718
281150
  return true;
280719
281151
  } catch (err2) {
@@ -280766,25 +281198,25 @@ var init_InvalidConfigDialog = __esm(() => {
280766
281198
 
280767
281199
  // src/entrypoints/init.ts
280768
281200
  import { existsSync as existsSync8, mkdirSync as mkdirSync6, copyFileSync as copyFileSync2 } from "fs";
280769
- import { join as join94, dirname as dirname50 } from "path";
281201
+ import { join as join95, dirname as dirname50 } from "path";
280770
281202
  import { fileURLToPath as fileURLToPath4 } from "url";
280771
281203
  function copyDefaultConfigFiles() {
280772
281204
  try {
280773
281205
  const { homedir: homedir26 } = __require("os");
280774
- const configDir = join94(homedir26(), ".openclaude");
281206
+ const configDir = join95(homedir26(), ".openclaude");
280775
281207
  if (!existsSync8(configDir)) {
280776
281208
  mkdirSync6(configDir, { recursive: true });
280777
281209
  }
280778
281210
  const __filename2 = fileURLToPath4(import.meta.url);
280779
- const packageDir = join94(dirname50(__filename2), "..");
280780
- const defaultsDir = join94(packageDir, "config", "defaults");
280781
- const claudeMdPath = join94(configDir, "CLAUDE.md");
280782
- const defaultClaudeMd = join94(defaultsDir, "CLAUDE.md");
281211
+ const packageDir = join95(dirname50(__filename2), "..");
281212
+ const defaultsDir = join95(packageDir, "config", "defaults");
281213
+ const claudeMdPath = join95(configDir, "CLAUDE.md");
281214
+ const defaultClaudeMd = join95(defaultsDir, "CLAUDE.md");
280783
281215
  if (!existsSync8(claudeMdPath) && existsSync8(defaultClaudeMd)) {
280784
281216
  copyFileSync2(defaultClaudeMd, claudeMdPath);
280785
281217
  }
280786
- const settingsPath = join94(configDir, "settings.json");
280787
- const defaultSettings = join94(defaultsDir, "settings.json");
281218
+ const settingsPath = join95(configDir, "settings.json");
281219
+ const defaultSettings = join95(defaultsDir, "settings.json");
280788
281220
  if (!existsSync8(settingsPath) && existsSync8(defaultSettings)) {
280789
281221
  copyFileSync2(defaultSettings, settingsPath);
280790
281222
  }
@@ -281021,8 +281453,8 @@ var init_shared2 = __esm(() => {
281021
281453
 
281022
281454
  // src/entrypoints/sdk/sessions.ts
281023
281455
  import { randomUUID as randomUUID34 } from "crypto";
281024
- import { appendFile as appendFile3, mkdir as mkdir30, unlink as unlink14, writeFile as writeFile24 } from "fs/promises";
281025
- import { dirname as dirname51, join as join95 } from "path";
281456
+ import { appendFile as appendFile3, mkdir as mkdir30, unlink as unlink14, writeFile as writeFile25 } from "fs/promises";
281457
+ import { dirname as dirname51, join as join96 } from "path";
281026
281458
  function toSDKSessionInfo(info) {
281027
281459
  return {
281028
281460
  sessionId: info.sessionId,
@@ -281188,7 +281620,7 @@ async function forkSession(sessionId, options2) {
281188
281620
  }
281189
281621
  const forkSessionId = randomUUID34();
281190
281622
  const targetDir = dirname51(resolved.filePath);
281191
- const forkPath = join95(targetDir, `${forkSessionId}.jsonl`);
281623
+ const forkPath = join96(targetDir, `${forkSessionId}.jsonl`);
281192
281624
  const uuidMap = new Map;
281193
281625
  const mainEntries = [];
281194
281626
  const metadataEntries = [];
@@ -281241,7 +281673,7 @@ async function forkSession(sessionId, options2) {
281241
281673
  };
281242
281674
  lines.push(JSON.stringify(forkedEntry));
281243
281675
  }
281244
- await writeFile24(forkPath, lines.join(`
281676
+ await writeFile25(forkPath, lines.join(`
281245
281677
  `) + `
281246
281678
  `, {
281247
281679
  encoding: "utf8",
@@ -282960,4 +283392,4 @@ export {
282960
283392
  AbortError
282961
283393
  };
282962
283394
 
282963
- //# debugId=8256BAC37AFFD8C864756E2164756E21
283395
+ //# debugId=7D221E548F40893364756E2164756E21