@rayss-dev/openclaude 0.31.1-by-rayss → 0.33.1-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 +9 -0
  2. package/dist/acp.mjs +8064 -7312
  3. package/dist/cli.mjs +179 -171
  4. package/dist/sdk.mjs +2041 -386
  5. package/package.json +1 -1
package/dist/sdk.mjs CHANGED
@@ -10131,7 +10131,7 @@ var init_version = __esm(() => {
10131
10131
  import_semver = __toESM(require_semver2(), 1);
10132
10132
  fallbackBuildVersion = (() => {
10133
10133
  try {
10134
- return "0.31.1-by-rayss";
10134
+ return "0.33.1-by-rayss";
10135
10135
  } catch {
10136
10136
  return "0.0.0";
10137
10137
  }
@@ -69154,6 +69154,10 @@ function inferRemoteModelOpenAIShimConfig(modelApiName, catalogEntry3) {
69154
69154
  removeBodyFields: ["store"]
69155
69155
  };
69156
69156
  }
69157
+ const hasAnthropicModel = segments.some((s) => /^(?:[a-z]{2,4}\.)?(?:claude|anthropic)|^(?:sonnet|opus|haiku)-\d/.test(s));
69158
+ if (hasAnthropicModel) {
69159
+ return { removeBodyFields: ["store"] };
69160
+ }
69157
69161
  const hasGlm = segments.some((s) => /^glm-\d/.test(s));
69158
69162
  const isFireworks = segments.some((s) => s === "fireworks");
69159
69163
  if (hasGlm && !isFireworks && !catalogEntry3) {
@@ -70361,7 +70365,7 @@ function getAttributionHeader(fingerprint, policy) {
70361
70365
  if (!policy.generate) {
70362
70366
  return "";
70363
70367
  }
70364
- const version2 = `${"0.31.1-by-rayss"}.${fingerprint}`;
70368
+ const version2 = `${"0.33.1-by-rayss"}.${fingerprint}`;
70365
70369
  const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
70366
70370
  const cch = "";
70367
70371
  const workload = getWorkload();
@@ -103997,7 +104001,7 @@ var init_metadata = __esm(() => {
103997
104001
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
103998
104002
  WHITESPACE_REGEX = /\s+/;
103999
104003
  getVersionBase = memoize_default(() => {
104000
- const match = "0.31.1-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
104004
+ const match = "0.33.1-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
104001
104005
  return match ? match[0] : undefined;
104002
104006
  });
104003
104007
  buildEnvContext = memoize_default(async () => {
@@ -104037,9 +104041,9 @@ var init_metadata = __esm(() => {
104037
104041
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
104038
104042
  isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
104039
104043
  isClaudeAiAuth: isClaudeAISubscriber(),
104040
- version: "0.31.1-by-rayss",
104044
+ version: "0.33.1-by-rayss",
104041
104045
  versionBase: getVersionBase(),
104042
- buildTime: "2026-10-02T04:00:23.815Z",
104046
+ buildTime: "2026-10-17T12:42:18.156Z",
104043
104047
  deploymentEnvironment: env2.detectDeploymentEnvironment(),
104044
104048
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
104045
104049
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -111629,16 +111633,6 @@ function normalizeReasoningLevels(levels) {
111629
111633
  const normalized = (levels ?? DEFAULT_REASONING_LEVELS).filter(isSupportedEffortLevel);
111630
111634
  return normalized.length > 0 ? normalized : [...DEFAULT_REASONING_LEVELS];
111631
111635
  }
111632
- function normalizeMetadataReasoningLevels(wireFormat, levels) {
111633
- const normalized = normalizeReasoningLevels(levels);
111634
- if (wireFormat === "deepseek_compatible") {
111635
- return normalized.filter((level) => DEEPSEEK_METADATA_COMPAT_LEVELS.includes(level));
111636
- }
111637
- if (wireFormat === "zai_compatible") {
111638
- return normalized.filter((level) => ZAI_METADATA_COMPAT_LEVELS.includes(level));
111639
- }
111640
- return normalized;
111641
- }
111642
111636
  function normalizeReasoningDefaultLevel(level, levels) {
111643
111637
  if (!level || !isSupportedEffortLevel(level)) {
111644
111638
  return;
@@ -111678,14 +111672,6 @@ function normalizeReasoningThinkingType(value) {
111678
111672
  }
111679
111673
  return;
111680
111674
  }
111681
- function normalizeDeepSeekReasoningEffort(effort) {
111682
- return effort === "xhigh" || effort === "max" ? "max" : "high";
111683
- }
111684
- function normalizeZaiReasoningEffort(effort, supportsLowEffort = false) {
111685
- if (supportsLowEffort && effort === "low")
111686
- return "low";
111687
- return effort === "xhigh" || effort === "max" ? "max" : "high";
111688
- }
111689
111675
  function resolveCompatibilityWireFormat(model, thinkingRequestFormat, routeIdOverride, useRuntimeFallback = true, processEnv = process.env) {
111690
111676
  if (thinkingRequestFormat === "deepseek-compatible") {
111691
111677
  return "deepseek_compatible";
@@ -111793,7 +111779,7 @@ function resolveMetadataReasoningControl(model, context) {
111793
111779
  };
111794
111780
  }
111795
111781
  const wireFormat = reasoning.wireFormat;
111796
- const levels = reasoning.mode === "levels" ? normalizeMetadataReasoningLevels(wireFormat, reasoning.levels) : [];
111782
+ const levels = reasoning.mode === "levels" ? normalizeReasoningLevels(reasoning.levels) : [];
111797
111783
  const controllable = Boolean(capabilities?.supportsReasoning !== false && metadataWireFormatSupportsEffort(wireFormat) && reasoning.mode === "levels" && levels.length > 0);
111798
111784
  return {
111799
111785
  supportsReasoning: capabilities?.supportsReasoning ?? true,
@@ -111949,7 +111935,7 @@ function resolveOpenAIShimReasoningRequestPlan(options) {
111949
111935
  if (wireFormat === "deepseek_compatible") {
111950
111936
  const thinkingType = requestedThinkingType ?? defaultThinkingType;
111951
111937
  const shouldEnableThinking = thinkingType !== "disabled" && (thinkingType === "enabled" || options.requestedEffort !== undefined);
111952
- const reasoningEffort = shouldEnableThinking && options.requestedEffort ? normalizeDeepSeekReasoningEffort(options.requestedEffort) : undefined;
111938
+ const reasoningEffort = shouldEnableThinking && options.requestedEffort ? options.requestedEffort : undefined;
111953
111939
  return {
111954
111940
  thinkingType: shouldEnableThinking ? "enabled" : requestedThinkingType === "disabled" ? "disabled" : undefined,
111955
111941
  reasoningEffort,
@@ -111961,7 +111947,7 @@ function resolveOpenAIShimReasoningRequestPlan(options) {
111961
111947
  const thinkingType = requestedThinkingType ?? defaultThinkingType;
111962
111948
  if (thinkingType === "disabled") {
111963
111949
  const supportsLowEffort = metadataWireFormat === "zai_compatible" && options.reasoningControl?.levels.includes("low") === true && options.reasoningControl.disableFormat !== "thinking_type_disabled";
111964
- const translatedEffort = supportsLowEffort && options.requestedEffort ? normalizeZaiReasoningEffort(options.requestedEffort, true) : "low";
111950
+ const translatedEffort = supportsLowEffort && options.requestedEffort ? options.requestedEffort : "low";
111965
111951
  return {
111966
111952
  thinkingType: supportsLowEffort ? "enabled" : "disabled",
111967
111953
  reasoningEffort: supportsLowEffort ? translatedEffort : undefined,
@@ -111971,7 +111957,7 @@ function resolveOpenAIShimReasoningRequestPlan(options) {
111971
111957
  }
111972
111958
  const shouldEnableThinking = thinkingType === "enabled" || options.requestedEffort !== undefined;
111973
111959
  const metadataZaiSupportsReasoningEffort = metadataWireFormat === "zai_compatible" && (options.reasoningControl?.levels.length ?? 0) > 0;
111974
- const reasoningEffort = options.requestedEffort && (metadataZaiSupportsReasoningEffort || metadataWireFormat !== "zai_compatible" && supportsZaiReasoningEffort(options.model)) ? normalizeZaiReasoningEffort(options.requestedEffort, options.reasoningControl?.levels.includes("low") === true) : undefined;
111960
+ const reasoningEffort = options.requestedEffort && (metadataZaiSupportsReasoningEffort || metadataWireFormat !== "zai_compatible" && supportsZaiReasoningEffort(options.model)) ? options.requestedEffort : undefined;
111975
111961
  return {
111976
111962
  thinkingType: shouldEnableThinking ? "enabled" : undefined,
111977
111963
  reasoningEffort,
@@ -112177,7 +112163,7 @@ function getLegacyDefaultEffortForModel(model, context) {
112177
112163
  }
112178
112164
  return;
112179
112165
  }
112180
- var EFFORT_LEVELS, DEFAULT_REASONING_LEVELS, OPENAI_SHIM_COMPAT_LEVELS, DEEPSEEK_METADATA_COMPAT_LEVELS, ZAI_METADATA_COMPAT_LEVELS, GLOBAL_EFFORT_LEVELS, OPUS_DEFAULT_EFFORT_CONFIG_DEFAULT;
112166
+ var EFFORT_LEVELS, DEFAULT_REASONING_LEVELS, OPENAI_SHIM_COMPAT_LEVELS, GLOBAL_EFFORT_LEVELS, OPUS_DEFAULT_EFFORT_CONFIG_DEFAULT;
112181
112167
  var init_effort = __esm(() => {
112182
112168
  init_thinking();
112183
112169
  init_settings2();
@@ -112201,8 +112187,6 @@ var init_effort = __esm(() => {
112201
112187
  ];
112202
112188
  DEFAULT_REASONING_LEVELS = ["low", "medium", "high"];
112203
112189
  OPENAI_SHIM_COMPAT_LEVELS = ["low", "medium", "high", "xhigh"];
112204
- DEEPSEEK_METADATA_COMPAT_LEVELS = ["high", "xhigh"];
112205
- ZAI_METADATA_COMPAT_LEVELS = ["low", "medium", "high", "xhigh"];
112206
112190
  GLOBAL_EFFORT_LEVELS = ["low", "medium", "high", "xhigh", "max", "ultracode"];
112207
112191
  OPUS_DEFAULT_EFFORT_CONFIG_DEFAULT = {
112208
112192
  enabled: true,
@@ -112213,11 +112197,11 @@ var init_effort = __esm(() => {
112213
112197
 
112214
112198
  // src/utils/userAgent.ts
112215
112199
  function getClaudeCodeUserAgent() {
112216
- return `claude-code/${"0.31.1-by-rayss"}`;
112200
+ return `claude-code/${"0.33.1-by-rayss"}`;
112217
112201
  }
112218
112202
  function getOpenClaudeUserAgent() {
112219
112203
  try {
112220
- return `openclaude/${"0.31.1-by-rayss"}`;
112204
+ return `openclaude/${"0.33.1-by-rayss"}`;
112221
112205
  } catch {
112222
112206
  return "openclaude/0.0.0";
112223
112207
  }
@@ -112229,7 +112213,7 @@ function getUserAgent() {
112229
112213
  const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
112230
112214
  const workload = getWorkload();
112231
112215
  const workloadSuffix = workload ? `, workload/${workload}` : "";
112232
- return `claude-cli/${"0.31.1-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
112216
+ return `claude-cli/${"0.33.1-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
112233
112217
  }
112234
112218
  function getMCPUserAgent() {
112235
112219
  const parts = [];
@@ -112243,7 +112227,7 @@ function getMCPUserAgent() {
112243
112227
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
112244
112228
  }
112245
112229
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
112246
- return `claude-code/${"0.31.1-by-rayss"}${suffix}`;
112230
+ return `claude-code/${"0.33.1-by-rayss"}${suffix}`;
112247
112231
  }
112248
112232
  function getWebFetchUserAgent() {
112249
112233
  const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
@@ -125264,287 +125248,293 @@ var init_session = __esm(() => {
125264
125248
  session_default = noop63;
125265
125249
  });
125266
125250
 
125251
+ // sdk-missing-stub:./commands/sessions/index.js
125252
+ var noop64 = () => null, sessions_default;
125253
+ var init_sessions = __esm(() => {
125254
+ sessions_default = noop64;
125255
+ });
125256
+
125267
125257
  // sdk-missing-stub:./commands/set-context-window/index.js
125268
- var noop64 = () => null, set_context_window_default;
125258
+ var noop65 = () => null, set_context_window_default;
125269
125259
  var init_set_context_window = __esm(() => {
125270
- set_context_window_default = noop64;
125260
+ set_context_window_default = noop65;
125271
125261
  });
125272
125262
 
125273
125263
  // sdk-missing-stub:./commands/share/index.js
125274
- var noop65 = () => null, share_default;
125264
+ var noop66 = () => null, share_default;
125275
125265
  var init_share = __esm(() => {
125276
- share_default = noop65;
125266
+ share_default = noop66;
125277
125267
  });
125278
125268
 
125279
125269
  // sdk-missing-stub:./commands/skills/index.js
125280
- var noop66 = () => null, skills_default;
125270
+ var noop67 = () => null, skills_default;
125281
125271
  var init_skills = __esm(() => {
125282
- skills_default = noop66;
125272
+ skills_default = noop67;
125283
125273
  });
125284
125274
 
125285
125275
  // sdk-missing-stub:./commands/status/index.js
125286
- var noop67 = () => null, status_default;
125276
+ var noop68 = () => null, status_default;
125287
125277
  var init_status = __esm(() => {
125288
- status_default = noop67;
125278
+ status_default = noop68;
125289
125279
  });
125290
125280
 
125291
125281
  // sdk-missing-stub:./commands/tasks/index.js
125292
- var noop68 = () => null, tasks_default;
125282
+ var noop69 = () => null, tasks_default;
125293
125283
  var init_tasks = __esm(() => {
125294
- tasks_default = noop68;
125284
+ tasks_default = noop69;
125295
125285
  });
125296
125286
 
125297
125287
  // sdk-missing-stub:./commands/teleport/index.js
125298
- var noop69 = () => null, teleport_default;
125288
+ var noop70 = () => null, teleport_default;
125299
125289
  var init_teleport = __esm(() => {
125300
- teleport_default = noop69;
125290
+ teleport_default = noop70;
125301
125291
  });
125302
125292
 
125303
125293
  // sdk-missing-stub:./commands/security-review.js
125304
- var noop70 = () => null, security_review_default;
125294
+ var noop71 = () => null, security_review_default;
125305
125295
  var init_security_review = __esm(() => {
125306
- security_review_default = noop70;
125296
+ security_review_default = noop71;
125307
125297
  });
125308
125298
 
125309
125299
  // sdk-missing-stub:./commands/bughunter/index.js
125310
- var noop71 = () => null, bughunter_default;
125300
+ var noop72 = () => null, bughunter_default;
125311
125301
  var init_bughunter = __esm(() => {
125312
- bughunter_default = noop71;
125302
+ bughunter_default = noop72;
125313
125303
  });
125314
125304
 
125315
125305
  // sdk-missing-stub:./commands/bughunter-security/index.js
125316
- var noop72 = () => null, bughunter_security_default;
125306
+ var noop73 = () => null, bughunter_security_default;
125317
125307
  var init_bughunter_security = __esm(() => {
125318
- bughunter_security_default = noop72;
125308
+ bughunter_security_default = noop73;
125319
125309
  });
125320
125310
 
125321
125311
  // sdk-missing-stub:./commands/bughunter-perf/index.js
125322
- var noop73 = () => null, bughunter_perf_default;
125312
+ var noop74 = () => null, bughunter_perf_default;
125323
125313
  var init_bughunter_perf = __esm(() => {
125324
- bughunter_perf_default = noop73;
125314
+ bughunter_perf_default = noop74;
125325
125315
  });
125326
125316
 
125327
125317
  // sdk-missing-stub:./commands/terminalSetup/index.js
125328
- var noop74 = () => null, terminalSetup_default;
125318
+ var noop75 = () => null, terminalSetup_default;
125329
125319
  var init_terminalSetup = __esm(() => {
125330
- terminalSetup_default = noop74;
125320
+ terminalSetup_default = noop75;
125331
125321
  });
125332
125322
 
125333
125323
  // sdk-missing-stub:./commands/usage/index.js
125334
- var noop75 = () => null, usage_default;
125324
+ var noop76 = () => null, usage_default;
125335
125325
  var init_usage = __esm(() => {
125336
- usage_default = noop75;
125326
+ usage_default = noop76;
125337
125327
  });
125338
125328
 
125339
125329
  // sdk-missing-stub:./commands/theme/index.js
125340
- var noop76 = () => null, theme_default;
125330
+ var noop77 = () => null, theme_default;
125341
125331
  var init_theme = __esm(() => {
125342
- theme_default = noop76;
125332
+ theme_default = noop77;
125343
125333
  });
125344
125334
 
125345
125335
  // sdk-missing-stub:./commands/logo/index.js
125346
- var noop77 = () => null, logo_default;
125336
+ var noop78 = () => null, logo_default;
125347
125337
  var init_logo = __esm(() => {
125348
- logo_default = noop77;
125338
+ logo_default = noop78;
125349
125339
  });
125350
125340
 
125351
125341
  // sdk-missing-stub:./commands/vim/index.js
125352
- var noop78 = () => null, vim_default;
125342
+ var noop79 = () => null, vim_default;
125353
125343
  var init_vim = __esm(() => {
125354
- vim_default = noop78;
125344
+ vim_default = noop79;
125355
125345
  });
125356
125346
 
125357
125347
  // sdk-missing-stub:./commands/thinkback/index.js
125358
- var noop79 = () => null, thinkback_default;
125348
+ var noop80 = () => null, thinkback_default;
125359
125349
  var init_thinkback = __esm(() => {
125360
- thinkback_default = noop79;
125350
+ thinkback_default = noop80;
125361
125351
  });
125362
125352
 
125363
125353
  // sdk-missing-stub:./commands/thinkback-play/index.js
125364
- var noop80 = () => null, thinkback_play_default;
125354
+ var noop81 = () => null, thinkback_play_default;
125365
125355
  var init_thinkback_play = __esm(() => {
125366
- thinkback_play_default = noop80;
125356
+ thinkback_play_default = noop81;
125367
125357
  });
125368
125358
 
125369
125359
  // sdk-missing-stub:./commands/permissions/index.js
125370
- var noop81 = () => null, permissions_default;
125360
+ var noop82 = () => null, permissions_default;
125371
125361
  var init_permissions2 = __esm(() => {
125372
- permissions_default = noop81;
125362
+ permissions_default = noop82;
125373
125363
  });
125374
125364
 
125375
125365
  // sdk-missing-stub:./commands/plan/index.js
125376
- var noop82 = () => null, plan_default;
125366
+ var noop83 = () => null, plan_default;
125377
125367
  var init_plan = __esm(() => {
125378
- plan_default = noop82;
125368
+ plan_default = noop83;
125379
125369
  });
125380
125370
 
125381
125371
  // sdk-missing-stub:./commands/fast/index.js
125382
- var noop83 = () => null, fast_default;
125372
+ var noop84 = () => null, fast_default;
125383
125373
  var init_fast = __esm(() => {
125384
- fast_default = noop83;
125374
+ fast_default = noop84;
125385
125375
  });
125386
125376
 
125387
125377
  // sdk-missing-stub:./commands/passes/index.js
125388
- var noop84 = () => null, passes_default;
125378
+ var noop85 = () => null, passes_default;
125389
125379
  var init_passes = __esm(() => {
125390
- passes_default = noop84;
125380
+ passes_default = noop85;
125391
125381
  });
125392
125382
 
125393
125383
  // sdk-missing-stub:./commands/privacy-settings/index.js
125394
- var noop85 = () => null, privacy_settings_default;
125384
+ var noop86 = () => null, privacy_settings_default;
125395
125385
  var init_privacy_settings = __esm(() => {
125396
- privacy_settings_default = noop85;
125386
+ privacy_settings_default = noop86;
125397
125387
  });
125398
125388
 
125399
125389
  // sdk-missing-stub:./commands/provider/index.js
125400
- var noop86 = () => null, provider_default;
125390
+ var noop87 = () => null, provider_default;
125401
125391
  var init_provider = __esm(() => {
125402
- provider_default = noop86;
125392
+ provider_default = noop87;
125403
125393
  });
125404
125394
 
125405
125395
  // sdk-missing-stub:./commands/hooks/index.js
125406
- var noop87 = () => null, hooks_default;
125396
+ var noop88 = () => null, hooks_default;
125407
125397
  var init_hooks2 = __esm(() => {
125408
- hooks_default = noop87;
125398
+ hooks_default = noop88;
125409
125399
  });
125410
125400
 
125411
125401
  // sdk-missing-stub:./commands/files/index.js
125412
- var noop88 = () => null, files_default;
125402
+ var noop89 = () => null, files_default;
125413
125403
  var init_files2 = __esm(() => {
125414
- files_default = noop88;
125404
+ files_default = noop89;
125415
125405
  });
125416
125406
 
125417
125407
  // sdk-missing-stub:./commands/branch/index.js
125418
- var noop89 = () => null, branch_default;
125408
+ var noop90 = () => null, branch_default;
125419
125409
  var init_branch = __esm(() => {
125420
- branch_default = noop89;
125410
+ branch_default = noop90;
125421
125411
  });
125422
125412
 
125423
125413
  // sdk-missing-stub:./commands/agents/index.js
125424
- var noop90 = () => null, agents_default;
125414
+ var noop91 = () => null, agents_default;
125425
125415
  var init_agents = __esm(() => {
125426
- agents_default = noop90;
125416
+ agents_default = noop91;
125427
125417
  });
125428
125418
 
125429
125419
  // sdk-missing-stub:./commands/auto-fix.js
125430
- var noop91 = () => null, auto_fix_default;
125420
+ var noop92 = () => null, auto_fix_default;
125431
125421
  var init_auto_fix = __esm(() => {
125432
- auto_fix_default = noop91;
125422
+ auto_fix_default = noop92;
125433
125423
  });
125434
125424
 
125435
125425
  // sdk-missing-stub:./commands/plugin/index.js
125436
- var noop92 = () => null, plugin_default;
125426
+ var noop93 = () => null, plugin_default;
125437
125427
  var init_plugin = __esm(() => {
125438
- plugin_default = noop92;
125428
+ plugin_default = noop93;
125439
125429
  });
125440
125430
 
125441
125431
  // sdk-missing-stub:./commands/reload-plugins/index.js
125442
- var noop93 = () => null, reload_plugins_default;
125432
+ var noop94 = () => null, reload_plugins_default;
125443
125433
  var init_reload_plugins = __esm(() => {
125444
- reload_plugins_default = noop93;
125434
+ reload_plugins_default = noop94;
125445
125435
  });
125446
125436
 
125447
125437
  // sdk-missing-stub:./commands/rewind/index.js
125448
- var noop94 = () => null, rewind_default;
125438
+ var noop95 = () => null, rewind_default;
125449
125439
  var init_rewind = __esm(() => {
125450
- rewind_default = noop94;
125440
+ rewind_default = noop95;
125451
125441
  });
125452
125442
 
125453
125443
  // sdk-missing-stub:./commands/heapdump/index.js
125454
- var noop95 = () => null, heapdump_default;
125444
+ var noop96 = () => null, heapdump_default;
125455
125445
  var init_heapdump = __esm(() => {
125456
- heapdump_default = noop95;
125446
+ heapdump_default = noop96;
125457
125447
  });
125458
125448
 
125459
125449
  // sdk-missing-stub:./commands/mock-limits/index.js
125460
- var noop96 = () => null, mock_limits_default;
125450
+ var noop97 = () => null, mock_limits_default;
125461
125451
  var init_mock_limits = __esm(() => {
125462
- mock_limits_default = noop96;
125452
+ mock_limits_default = noop97;
125463
125453
  });
125464
125454
 
125465
125455
  // sdk-missing-stub:./commands/bridge-kick.js
125466
- var noop97 = () => null, bridge_kick_default;
125456
+ var noop98 = () => null, bridge_kick_default;
125467
125457
  var init_bridge_kick = __esm(() => {
125468
- bridge_kick_default = noop97;
125458
+ bridge_kick_default = noop98;
125469
125459
  });
125470
125460
 
125471
125461
  // sdk-missing-stub:./commands/version.js
125472
- var noop98 = () => null, version_default;
125462
+ var noop99 = () => null, version_default;
125473
125463
  var init_version2 = __esm(() => {
125474
- version_default = noop98;
125464
+ version_default = noop99;
125475
125465
  });
125476
125466
 
125477
125467
  // sdk-missing-stub:./commands/update/index.js
125478
- var noop99 = () => null, update_default;
125468
+ var noop100 = () => null, update_default;
125479
125469
  var init_update = __esm(() => {
125480
- update_default = noop99;
125470
+ update_default = noop100;
125481
125471
  });
125482
125472
 
125483
125473
  // sdk-missing-stub:./commands/wiki/index.js
125484
- var noop100 = () => null, wiki_default;
125474
+ var noop101 = () => null, wiki_default;
125485
125475
  var init_wiki = __esm(() => {
125486
- wiki_default = noop100;
125476
+ wiki_default = noop101;
125487
125477
  });
125488
125478
 
125489
125479
  // sdk-missing-stub:./commands/summary/index.js
125490
- var noop101 = () => null, summary_default;
125480
+ var noop102 = () => null, summary_default;
125491
125481
  var init_summary = __esm(() => {
125492
- summary_default = noop101;
125482
+ summary_default = noop102;
125493
125483
  });
125494
125484
 
125495
125485
  // sdk-missing-stub:./commands/reset-limits/index.js
125496
- var noop102 = () => null, resetLimits, resetLimitsNonInteractive;
125486
+ var noop103 = () => null, resetLimits, resetLimitsNonInteractive;
125497
125487
  var init_reset_limits = __esm(() => {
125498
- resetLimits = noop102;
125499
- resetLimitsNonInteractive = noop102;
125488
+ resetLimits = noop103;
125489
+ resetLimitsNonInteractive = noop103;
125500
125490
  });
125501
125491
 
125502
125492
  // sdk-missing-stub:./commands/ant-trace/index.js
125503
- var noop103 = () => null, ant_trace_default;
125493
+ var noop104 = () => null, ant_trace_default;
125504
125494
  var init_ant_trace = __esm(() => {
125505
- ant_trace_default = noop103;
125495
+ ant_trace_default = noop104;
125506
125496
  });
125507
125497
 
125508
125498
  // sdk-missing-stub:./commands/perf-issue/index.js
125509
- var noop104 = () => null, perf_issue_default;
125499
+ var noop105 = () => null, perf_issue_default;
125510
125500
  var init_perf_issue = __esm(() => {
125511
- perf_issue_default = noop104;
125501
+ perf_issue_default = noop105;
125512
125502
  });
125513
125503
 
125514
125504
  // sdk-missing-stub:./commands/sandbox-toggle/index.js
125515
- var noop105 = () => null, sandbox_toggle_default;
125505
+ var noop106 = () => null, sandbox_toggle_default;
125516
125506
  var init_sandbox_toggle = __esm(() => {
125517
- sandbox_toggle_default = noop105;
125507
+ sandbox_toggle_default = noop106;
125518
125508
  });
125519
125509
 
125520
125510
  // sdk-missing-stub:./commands/chrome/index.js
125521
- var noop106 = () => null, chrome_default;
125511
+ var noop107 = () => null, chrome_default;
125522
125512
  var init_chrome = __esm(() => {
125523
- chrome_default = noop106;
125513
+ chrome_default = noop107;
125524
125514
  });
125525
125515
 
125526
125516
  // sdk-missing-stub:./commands/stickers/index.js
125527
- var noop107 = () => null, stickers_default;
125517
+ var noop108 = () => null, stickers_default;
125528
125518
  var init_stickers = __esm(() => {
125529
- stickers_default = noop107;
125519
+ stickers_default = noop108;
125530
125520
  });
125531
125521
 
125532
125522
  // sdk-missing-stub:./commands/advisor.js
125533
- var noop108 = () => null, advisor_default;
125523
+ var noop109 = () => null, advisor_default;
125534
125524
  var init_advisor = __esm(() => {
125535
- advisor_default = noop108;
125525
+ advisor_default = noop109;
125536
125526
  });
125537
125527
 
125538
125528
  // sdk-missing-stub:./commands/ads.js
125539
- var noop109 = () => null, ads_default;
125529
+ var noop110 = () => null, ads_default;
125540
125530
  var init_ads = __esm(() => {
125541
- ads_default = noop109;
125531
+ ads_default = noop110;
125542
125532
  });
125543
125533
 
125544
125534
  // sdk-missing-stub:./commands/smartroute/index.js
125545
- var noop110 = () => null, smartroute_default;
125535
+ var noop111 = () => null, smartroute_default;
125546
125536
  var init_smartroute = __esm(() => {
125547
- smartroute_default = noop110;
125537
+ smartroute_default = noop111;
125548
125538
  });
125549
125539
 
125550
125540
  // node_modules/shell-quote/quote.js
@@ -126659,8 +126649,10 @@ function validateRetryAttemptsEnvVar(envVarName, value) {
126659
126649
  if (!value) {
126660
126650
  return DEFAULT_MAX_RETRIES;
126661
126651
  }
126662
- const parsed = parseInt(value, 10);
126663
- if (isNaN(parsed) || parsed < 0) {
126652
+ const normalized = value.trim();
126653
+ const isDecimalInteger = /^\d+$/.test(normalized);
126654
+ const parsed = isDecimalInteger ? Number(normalized) : Number.NaN;
126655
+ if (!Number.isFinite(parsed)) {
126664
126656
  logForDebugging(`${envVarName} Invalid value "${value}" (using default: ${DEFAULT_MAX_RETRIES})`);
126665
126657
  return DEFAULT_MAX_RETRIES;
126666
126658
  }
@@ -128146,10 +128138,10 @@ var init__arrayIncludesWith = __esm(() => {
128146
128138
  });
128147
128139
 
128148
128140
  // node_modules/lodash-es/noop.js
128149
- function noop111() {}
128141
+ function noop112() {}
128150
128142
  var noop_default;
128151
128143
  var init_noop = __esm(() => {
128152
- noop_default = noop111;
128144
+ noop_default = noop112;
128153
128145
  });
128154
128146
 
128155
128147
  // node_modules/lodash-es/_createSet.js
@@ -130507,15 +130499,15 @@ var init_fileChangedWatcher = __esm(() => {
130507
130499
  });
130508
130500
 
130509
130501
  // sdk-missing-stub:@anthropic-ai/sandbox-runtime
130510
- var noop112 = () => null, SandboxManager, SandboxRuntimeConfigSchema, SandboxViolationStore = null;
130502
+ var noop113 = () => null, SandboxManager, SandboxRuntimeConfigSchema, SandboxViolationStore = null;
130511
130503
  var init_sandbox_runtime = __esm(() => {
130512
130504
  SandboxManager = class {
130513
130505
  static isSupportedPlatform = () => false;
130514
- static create = noop112;
130506
+ static create = noop113;
130515
130507
  static Version = "";
130516
130508
  static annotateStderrWithSandboxFailures = (_command, stderr) => stderr;
130517
130509
  };
130518
- SandboxRuntimeConfigSchema = { parse: noop112 };
130510
+ SandboxRuntimeConfigSchema = { parse: noop113 };
130519
130511
  });
130520
130512
 
130521
130513
  // node_modules/lodash-es/lodash.js
@@ -134588,28 +134580,68 @@ var init_limits = __esm(() => {
134588
134580
  });
134589
134581
  });
134590
134582
 
134583
+ // src/tools/FileReadTool/readDedup.ts
134584
+ function isFullRead(state2) {
134585
+ return (state2.offset === 1 || state2.offset === 0) && state2.limit === undefined;
134586
+ }
134587
+ function countLines(content) {
134588
+ if (content === "")
134589
+ return 0;
134590
+ const lines = content.split(`
134591
+ `).length;
134592
+ return content.endsWith(`
134593
+ `) ? lines - 1 : lines;
134594
+ }
134595
+ function isCoveredByFullRead(state2, offset, limit) {
134596
+ if (!isFullRead(state2))
134597
+ return false;
134598
+ if (limit !== undefined && limit <= 0)
134599
+ return false;
134600
+ const startLine = offset === 0 ? 1 : offset;
134601
+ return startLine >= 1 && startLine <= countLines(state2.content);
134602
+ }
134603
+ async function checkReadDedup(state2, offset, limit, deps) {
134604
+ if (!state2 || state2.isPartialView || state2.offset === undefined) {
134605
+ return { kind: "miss" };
134606
+ }
134607
+ const exactRange = state2.offset === offset && state2.limit === limit;
134608
+ if (!exactRange && !isCoveredByFullRead(state2, offset, limit)) {
134609
+ return { kind: "miss" };
134610
+ }
134611
+ try {
134612
+ const mtimeMs = await deps.getModificationTime();
134613
+ if (mtimeMs === state2.timestamp)
134614
+ return { kind: "unchanged" };
134615
+ const current = await deps.readRange(state2.offset, state2.limit);
134616
+ if (current.content === state2.content) {
134617
+ return { kind: "touched", timestamp: Math.floor(current.mtimeMs) };
134618
+ }
134619
+ } catch {}
134620
+ return { kind: "miss" };
134621
+ }
134622
+
134591
134623
  // sdk-missing-stub:./UI.js
134592
- var noop113 = () => null, renderToolResultMessage, renderGroupedAgentToolUse, renderToolUseErrorMessage, renderToolUseMessage, renderToolUseProgressMessage, renderToolUseRejectedMessage, renderToolUseTag, userFacingName, userFacingNameBackgroundColor, BackgroundHint, renderToolUseQueuedMessage, getToolUseSummary, isResultTruncated, renderCreateResultMessage, renderCreateToolUseMessage, renderDeleteResultMessage, renderDeleteToolUseMessage, renderListResultMessage, renderListToolUseMessage;
134624
+ var noop114 = () => null, renderToolResultMessage, renderGroupedAgentToolUse, renderToolUseErrorMessage, renderToolUseMessage, renderToolUseProgressMessage, renderToolUseRejectedMessage, renderToolUseTag, userFacingName, userFacingNameBackgroundColor, BackgroundHint, renderToolUseQueuedMessage, getToolUseSummary, isResultTruncated, renderCreateResultMessage, renderCreateToolUseMessage, renderDeleteResultMessage, renderDeleteToolUseMessage, renderListResultMessage, renderListToolUseMessage;
134593
134625
  var init_UI = __esm(() => {
134594
- renderToolResultMessage = noop113;
134595
- renderGroupedAgentToolUse = noop113;
134596
- renderToolUseErrorMessage = noop113;
134597
- renderToolUseMessage = noop113;
134598
- renderToolUseProgressMessage = noop113;
134599
- renderToolUseRejectedMessage = noop113;
134600
- renderToolUseTag = noop113;
134601
- userFacingName = noop113;
134602
- userFacingNameBackgroundColor = noop113;
134603
- BackgroundHint = noop113;
134604
- renderToolUseQueuedMessage = noop113;
134605
- getToolUseSummary = noop113;
134606
- isResultTruncated = noop113;
134607
- renderCreateResultMessage = noop113;
134608
- renderCreateToolUseMessage = noop113;
134609
- renderDeleteResultMessage = noop113;
134610
- renderDeleteToolUseMessage = noop113;
134611
- renderListResultMessage = noop113;
134612
- renderListToolUseMessage = noop113;
134626
+ renderToolResultMessage = noop114;
134627
+ renderGroupedAgentToolUse = noop114;
134628
+ renderToolUseErrorMessage = noop114;
134629
+ renderToolUseMessage = noop114;
134630
+ renderToolUseProgressMessage = noop114;
134631
+ renderToolUseRejectedMessage = noop114;
134632
+ renderToolUseTag = noop114;
134633
+ userFacingName = noop114;
134634
+ userFacingNameBackgroundColor = noop114;
134635
+ BackgroundHint = noop114;
134636
+ renderToolUseQueuedMessage = noop114;
134637
+ getToolUseSummary = noop114;
134638
+ isResultTruncated = noop114;
134639
+ renderCreateResultMessage = noop114;
134640
+ renderCreateToolUseMessage = noop114;
134641
+ renderDeleteResultMessage = noop114;
134642
+ renderDeleteToolUseMessage = noop114;
134643
+ renderListResultMessage = noop114;
134644
+ renderListToolUseMessage = noop114;
134613
134645
  });
134614
134646
 
134615
134647
  // src/tools/FileReadTool/FileReadTool.ts
@@ -135258,25 +135290,27 @@ var init_FileReadTool = __esm(() => {
135258
135290
  const fullFilePath = expandPath(file_path);
135259
135291
  const dedupKillswitch = getFeatureValue_CACHED_MAY_BE_STALE("tengu_read_dedup_killswitch", false);
135260
135292
  const existingState = dedupKillswitch ? undefined : readFileState.get(fullFilePath);
135261
- if (existingState && !existingState.isPartialView && existingState.offset !== undefined) {
135262
- const rangeMatch = existingState.offset === offset && existingState.limit === limit;
135263
- if (rangeMatch) {
135264
- try {
135265
- const mtimeMs = await getFileModificationTimeAsync(fullFilePath);
135266
- if (mtimeMs === existingState.timestamp) {
135267
- const analyticsExt = getFileExtensionForAnalytics(fullFilePath);
135268
- logEvent("tengu_file_read_dedup", {
135269
- ...analyticsExt !== undefined && { ext: analyticsExt }
135270
- });
135271
- return {
135272
- data: {
135273
- type: "file_unchanged",
135274
- file: { filePath: file_path }
135275
- }
135276
- };
135277
- }
135278
- } catch {}
135293
+ const dedup = await checkReadDedup(existingState, offset, limit, {
135294
+ getModificationTime: () => getFileModificationTimeAsync(fullFilePath),
135295
+ readRange: (rangeOffset, rangeLimit) => readFileInRange(fullFilePath, rangeOffset === 0 ? 0 : rangeOffset - 1, rangeLimit, rangeLimit === undefined ? maxSizeBytes : undefined, context2.abortController.signal)
135296
+ });
135297
+ if (dedup.kind !== "miss" && existingState) {
135298
+ if (dedup.kind === "touched") {
135299
+ readFileState.set(fullFilePath, {
135300
+ ...existingState,
135301
+ timestamp: dedup.timestamp
135302
+ });
135279
135303
  }
135304
+ const analyticsExt = getFileExtensionForAnalytics(fullFilePath);
135305
+ logEvent("tengu_file_read_dedup", {
135306
+ ...analyticsExt !== undefined && { ext: analyticsExt }
135307
+ });
135308
+ return {
135309
+ data: {
135310
+ type: "file_unchanged",
135311
+ file: { filePath: file_path }
135312
+ }
135313
+ };
135280
135314
  }
135281
135315
  const cwd2 = getCwd();
135282
135316
  if (!isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) {
@@ -144795,6 +144829,7 @@ var init_en2 = __esm(() => {
144795
144829
  "commands.rename.description": "Rename the current conversation",
144796
144830
  "commands.request-size.description": "Show estimated request context load and top contributors",
144797
144831
  "commands.resume.description": "Resume a previous conversation",
144832
+ "commands.sessions.description": "List saved conversations to resume or delete them",
144798
144833
  "commands.review.description": "Review a pull request",
144799
144834
  "commands.rewind.description": "Restore the code and/or conversation to a previous point",
144800
144835
  "commands.security-review.description": "Complete a security review of the pending changes on the current branch",
@@ -144870,6 +144905,7 @@ var init_vi2 = __esm(() => {
144870
144905
  "commands.rename.description": "Đổi tên cuộc hội thoại hiện tại",
144871
144906
  "commands.request-size.description": "Hiện tải ngữ cảnh ước tính và các thành phần chính",
144872
144907
  "commands.resume.description": "Tiếp tục cuộc hội thoại trước",
144908
+ "commands.sessions.description": "Liệt kê các cuộc hội thoại đã lưu để tiếp tục hoặc xóa",
144873
144909
  "commands.review.description": "Đánh giá pull request",
144874
144910
  "commands.rewind.description": "Khôi phục mã và/hoặc cuộc hội thoại về điểm trước",
144875
144911
  "commands.security-review.description": "Hoàn thành đánh giá bảo mật cho các thay đổi đang chờ trên nhánh hiện tại",
@@ -144948,6 +144984,7 @@ var init_commandDescriptions = __esm(() => {
144948
144984
  rename: "commands.rename.description",
144949
144985
  "request-size": "commands.request-size.description",
144950
144986
  resume: "commands.resume.description",
144987
+ sessions: "commands.sessions.description",
144951
144988
  review: "commands.review.description",
144952
144989
  rewind: "commands.rewind.description",
144953
144990
  "security-review": "commands.security-review.description",
@@ -153972,9 +154009,9 @@ __export(exports_toolRendering, {
153972
154009
  default: () => toolRendering_default,
153973
154010
  __stub: () => __stub2
153974
154011
  });
153975
- var noop114 = () => null, toolRendering_default, __stub2 = true;
154012
+ var noop115 = () => null, toolRendering_default, __stub2 = true;
153976
154013
  var init_toolRendering = __esm(() => {
153977
- toolRendering_default = noop114;
154014
+ toolRendering_default = noop115;
153978
154015
  });
153979
154016
 
153980
154017
  // node_modules/ws/lib/constants.js
@@ -156897,14 +156934,14 @@ __export(exports_claude_for_chrome_mcp, {
156897
156934
  ClaudeForChromeContext: () => ClaudeForChromeContext,
156898
156935
  BROWSER_TOOLS: () => BROWSER_TOOLS
156899
156936
  });
156900
- var noop115 = () => null, claude_for_chrome_mcp_default, __stub3 = true, BROWSER_TOOLS, ClaudeForChromeContext, createClaudeForChromeMcpServer, Logger, PermissionMode;
156937
+ var noop116 = () => null, claude_for_chrome_mcp_default, __stub3 = true, BROWSER_TOOLS, ClaudeForChromeContext, createClaudeForChromeMcpServer, Logger, PermissionMode;
156901
156938
  var init_claude_for_chrome_mcp = __esm(() => {
156902
- claude_for_chrome_mcp_default = noop115;
156903
- BROWSER_TOOLS = noop115;
156904
- ClaudeForChromeContext = noop115;
156905
- createClaudeForChromeMcpServer = noop115;
156906
- Logger = noop115;
156907
- PermissionMode = noop115;
156939
+ claude_for_chrome_mcp_default = noop116;
156940
+ BROWSER_TOOLS = noop116;
156941
+ ClaudeForChromeContext = noop116;
156942
+ createClaudeForChromeMcpServer = noop116;
156943
+ Logger = noop116;
156944
+ PermissionMode = noop116;
156908
156945
  });
156909
156946
 
156910
156947
  // src/services/analytics/sink.ts
@@ -156938,7 +156975,7 @@ function computeFingerprint(messageText2, version2) {
156938
156975
  }
156939
156976
  function computeFingerprintFromMessages(messages) {
156940
156977
  const firstMessageText = extractFirstMessageText(messages);
156941
- return computeFingerprint(firstMessageText, "0.31.1-by-rayss");
156978
+ return computeFingerprint(firstMessageText, "0.33.1-by-rayss");
156942
156979
  }
156943
156980
  var FINGERPRINT_SALT = "59cf53e54c78";
156944
156981
  var init_fingerprint = () => {};
@@ -157400,6 +157437,57 @@ async function createNodeWsClient(url3, options) {
157400
157437
  function getConnectionTimeoutMs() {
157401
157438
  return parseInt(process.env.MCP_TIMEOUT || "", 10) || 30000;
157402
157439
  }
157440
+ function wrapResponseBodyWithCleanup2(response, cleanup, signal) {
157441
+ if (!response.body) {
157442
+ cleanup();
157443
+ return response;
157444
+ }
157445
+ const reader = response.body.getReader();
157446
+ let isCleanedUp = false;
157447
+ const finish = () => {
157448
+ if (isCleanedUp)
157449
+ return;
157450
+ isCleanedUp = true;
157451
+ signal?.removeEventListener("abort", cancelReader);
157452
+ cleanup();
157453
+ };
157454
+ const cancelReader = () => {
157455
+ reader.cancel(signal?.reason).catch(() => {});
157456
+ finish();
157457
+ };
157458
+ signal?.addEventListener("abort", cancelReader, { once: true });
157459
+ if (signal?.aborted) {
157460
+ cancelReader();
157461
+ }
157462
+ const body = new ReadableStream({
157463
+ async pull(controller) {
157464
+ try {
157465
+ const { done, value } = await reader.read();
157466
+ if (done) {
157467
+ controller.close();
157468
+ finish();
157469
+ } else {
157470
+ controller.enqueue(value);
157471
+ }
157472
+ } catch (error40) {
157473
+ controller.error(error40);
157474
+ finish();
157475
+ }
157476
+ },
157477
+ async cancel(reason) {
157478
+ try {
157479
+ await reader.cancel(reason);
157480
+ } finally {
157481
+ finish();
157482
+ }
157483
+ }
157484
+ });
157485
+ return new Response(body, {
157486
+ status: response.status,
157487
+ statusText: response.statusText,
157488
+ headers: response.headers
157489
+ });
157490
+ }
157403
157491
  function wrapFetchWithTimeout(baseFetch) {
157404
157492
  return async (url3, init) => {
157405
157493
  const method = (init?.method ?? "GET").toUpperCase();
@@ -157429,14 +157517,64 @@ function wrapFetchWithTimeout(baseFetch) {
157429
157517
  headers,
157430
157518
  signal: controller.signal
157431
157519
  });
157432
- cleanup();
157433
- return response;
157520
+ clearTimeout(timer);
157521
+ return wrapResponseBodyWithCleanup2(response, cleanup, controller.signal);
157434
157522
  } catch (error40) {
157435
157523
  cleanup();
157436
157524
  throw error40;
157437
157525
  }
157438
157526
  };
157439
157527
  }
157528
+ function wrapFetchWithRequestCancellation(baseFetch, activeRequests) {
157529
+ return async (url3, init) => {
157530
+ let requestId;
157531
+ if ((init?.method ?? "GET").toUpperCase() === "POST" && typeof init?.body === "string") {
157532
+ try {
157533
+ const request = JSON.parse(init.body);
157534
+ if (request !== null && typeof request === "object" && "id" in request && (typeof request.id === "string" || typeof request.id === "number")) {
157535
+ requestId = request.id;
157536
+ }
157537
+ } catch {}
157538
+ }
157539
+ if (requestId === undefined) {
157540
+ return baseFetch(url3, init);
157541
+ }
157542
+ const requestController = createAbortController();
157543
+ activeRequests.set(requestId, requestController);
157544
+ const { signal, cleanup } = createCombinedAbortSignal(init?.signal ?? undefined, {
157545
+ signalB: requestController.signal,
157546
+ trace: {
157547
+ subsystem: "mcp_http_request",
157548
+ controllerRole: "mcp_http_request"
157549
+ }
157550
+ });
157551
+ const finish = () => {
157552
+ cleanup();
157553
+ if (activeRequests.get(requestId) === requestController) {
157554
+ activeRequests.delete(requestId);
157555
+ }
157556
+ };
157557
+ try {
157558
+ const response = await baseFetch(url3, { ...init, signal });
157559
+ return wrapResponseBodyWithCleanup2(response, finish, signal);
157560
+ } catch (error40) {
157561
+ finish();
157562
+ throw error40;
157563
+ }
157564
+ };
157565
+ }
157566
+ function attachMcpRequestCancellationHandler(transport, activeRequests) {
157567
+ const send = transport.send.bind(transport);
157568
+ transport.send = async (message, options) => {
157569
+ if ("method" in message && message.method === "notifications/cancelled" && "params" in message && message.params !== undefined && typeof message.params === "object" && "requestId" in message.params) {
157570
+ const requestId = message.params.requestId;
157571
+ if (typeof requestId === "string" || typeof requestId === "number") {
157572
+ activeRequests.get(requestId)?.abort(new DOMException("MCP request cancelled.", "AbortError"));
157573
+ }
157574
+ }
157575
+ return send(message, options);
157576
+ };
157577
+ }
157440
157578
  function buildMcpSseEventSourceHeaders(initHeaders) {
157441
157579
  const headers = new Headers(initHeaders);
157442
157580
  if (!headers.has("User-Agent")) {
@@ -157742,7 +157880,7 @@ async function callMCPToolWithUrlElicitationRetry({
157742
157880
  const MAX_URL_ELICITATION_RETRIES = 3;
157743
157881
  for (let attempt = 0;; attempt++) {
157744
157882
  if (signal.aborted) {
157745
- throw new Error("Tool call aborted during URL elicitation");
157883
+ throw new AbortError("Tool call aborted during URL elicitation");
157746
157884
  }
157747
157885
  try {
157748
157886
  return await callToolFn({
@@ -157867,11 +158005,20 @@ async function callMCPTool({
157867
158005
  logMCPDebug(name2, `Tool '${tool3}' still running (${duration4} elapsed)`);
157868
158006
  }, 30000, toolStartTime, name, tool2);
157869
158007
  const timeoutMs = getMcpToolTimeoutMs();
158008
+ const timeoutController = createAbortController();
158009
+ const {
158010
+ signal: requestSignal,
158011
+ cleanup: cleanupRequestSignal
158012
+ } = createCombinedAbortSignal(signal, {
158013
+ signalB: timeoutController.signal,
158014
+ trace: { subsystem: "mcp_tool_call", controllerRole: "mcp_tool_call" }
158015
+ });
157870
158016
  let timeoutId;
157871
158017
  const timeoutPromise = new Promise((_, reject) => {
157872
- timeoutId = setTimeout((reject2, name2, tool3, timeoutMs2) => {
157873
- reject2(new TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS(`MCP server "${name2}" tool "${tool3}" timed out after ${Math.floor(timeoutMs2 / 1000)}s`, "MCP tool timeout"));
157874
- }, timeoutMs, reject, name, tool2, timeoutMs);
158018
+ timeoutId = setTimeout(() => {
158019
+ timeoutController.abort(new DOMException("The operation timed out.", "TimeoutError"));
158020
+ reject(new TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS(`MCP server "${name}" tool "${tool2}" timed out after ${Math.floor(timeoutMs / 1000)}s`, "MCP tool timeout"));
158021
+ }, timeoutMs);
157875
158022
  });
157876
158023
  const result = await Promise.race([
157877
158024
  client.callTool({
@@ -157879,7 +158026,7 @@ async function callMCPTool({
157879
158026
  arguments: args,
157880
158027
  _meta: meta
157881
158028
  }, CallToolResultSchema, {
157882
- signal,
158029
+ signal: requestSignal,
157883
158030
  timeout: timeoutMs,
157884
158031
  onprogress: onProgress ? (sdkProgress) => {
157885
158032
  onProgress({
@@ -157898,6 +158045,7 @@ async function callMCPTool({
157898
158045
  if (timeoutId) {
157899
158046
  clearTimeout(timeoutId);
157900
158047
  }
158048
+ cleanupRequestSignal();
157901
158049
  });
157902
158050
  if ("isError" in result && result.isError) {
157903
158051
  let errorDetails = "Unknown error";
@@ -158011,6 +158159,7 @@ var init_client2 = __esm(() => {
158011
158159
  init_McpAuthTool();
158012
158160
  init_ReadMcpResourceTool();
158013
158161
  init_abortController();
158162
+ init_combinedAbortSignal();
158014
158163
  init_errors();
158015
158164
  init_auth();
158016
158165
  init_cleanupRegistry();
@@ -158215,13 +158364,14 @@ var init_client2 = __esm(() => {
158215
158364
  const allowUnauthorizedRefresh = !hasExplicitAuthorization;
158216
158365
  const proxyOptions = getProxyFetchOptions();
158217
158366
  logMCPDebug(name, `Proxy options: ${proxyOptions.dispatcher ? "custom dispatcher" : "default"}`);
158367
+ const activeHttpRequests = new Map;
158218
158368
  const transportOptions = {
158219
158369
  authProvider,
158220
- fetch: wrapFetchWithTimeout(wrapFetchWithStepUpDetection(createFetchWithInit(), authProvider, {
158370
+ fetch: wrapFetchWithRequestCancellation(wrapFetchWithTimeout(wrapFetchWithStepUpDetection(createFetchWithInit(), authProvider, {
158221
158371
  allowUnauthorizedRefresh,
158222
158372
  resourceUrl: serverRef.url,
158223
158373
  providerOwnsAuthorization: allowUnauthorizedRefresh
158224
- })),
158374
+ })), activeHttpRequests),
158225
158375
  requestInit: {
158226
158376
  ...proxyOptions,
158227
158377
  headers: {
@@ -158241,6 +158391,7 @@ var init_client2 = __esm(() => {
158241
158391
  timeoutMs: MCP_REQUEST_TIMEOUT_MS
158242
158392
  })}`);
158243
158393
  transport = new StreamableHTTPClientTransport(new URL(serverRef.url), transportOptions);
158394
+ attachMcpRequestCancellationHandler(transport, activeHttpRequests);
158244
158395
  logMCPDebug(name, `HTTP transport created successfully`);
158245
158396
  } else if (serverRef.type === "sdk") {
158246
158397
  throw new Error("SDK servers should be handled in print.ts");
@@ -158255,8 +158406,9 @@ var init_client2 = __esm(() => {
158255
158406
  logMCPDebug(name, `Using claude.ai proxy at ${proxyUrl}`);
158256
158407
  const fetchWithAuth = createClaudeAiProxyFetch(globalThis.fetch);
158257
158408
  const proxyOptions = getProxyFetchOptions();
158409
+ const activeProxyRequests = new Map;
158258
158410
  const transportOptions = {
158259
- fetch: wrapFetchWithTimeout(fetchWithAuth),
158411
+ fetch: wrapFetchWithRequestCancellation(wrapFetchWithTimeout(fetchWithAuth), activeProxyRequests),
158260
158412
  requestInit: {
158261
158413
  ...proxyOptions,
158262
158414
  headers: {
@@ -158266,6 +158418,7 @@ var init_client2 = __esm(() => {
158266
158418
  }
158267
158419
  };
158268
158420
  transport = new StreamableHTTPClientTransport(new URL(proxyUrl), transportOptions);
158421
+ attachMcpRequestCancellationHandler(transport, activeProxyRequests);
158269
158422
  logMCPDebug(name, `claude.ai proxy transport created successfully`);
158270
158423
  } else if ((serverRef.type === "stdio" || !serverRef.type) && isClaudeInChromeMCPServer(name)) {
158271
158424
  const { createChromeContext: createChromeContext2 } = await Promise.resolve().then(() => (init_mcpServer(), exports_mcpServer));
@@ -158305,7 +158458,7 @@ var init_client2 = __esm(() => {
158305
158458
  const client = new Client({
158306
158459
  name: "claude-code",
158307
158460
  title: "OpenClaude",
158308
- version: "0.31.1-by-rayss",
158461
+ version: "0.33.1-by-rayss",
158309
158462
  description: "OpenClaude — coding-agent CLI for any LLM provider",
158310
158463
  websiteUrl: PRODUCT_URL
158311
158464
  }, {
@@ -164037,9 +164190,9 @@ var init_claudemd = __esm(() => {
164037
164190
  });
164038
164191
 
164039
164192
  // sdk-missing-stub:../state/selectors.js
164040
- var noop116 = () => null, getViewedTeammateTask;
164193
+ var noop117 = () => null, getViewedTeammateTask;
164041
164194
  var init_selectors = __esm(() => {
164042
- getViewedTeammateTask = noop116;
164195
+ getViewedTeammateTask = noop117;
164043
164196
  });
164044
164197
 
164045
164198
  // src/services/diagnosticTracking.ts
@@ -165352,9 +165505,9 @@ __export(exports_repoMap, {
165352
165505
  default: () => repoMap_default,
165353
165506
  __stub: () => __stub4
165354
165507
  });
165355
- var noop117 = () => null, repoMap_default, __stub4 = true;
165508
+ var noop118 = () => null, repoMap_default, __stub4 = true;
165356
165509
  var init_repoMap = __esm(() => {
165357
- repoMap_default = noop117;
165510
+ repoMap_default = noop118;
165358
165511
  });
165359
165512
 
165360
165513
  // src/utils/nativeInstaller/pidLock.ts
@@ -167969,22 +168122,22 @@ function canDescendantShowPermissionPrompts({
167969
168122
  }
167970
168123
 
167971
168124
  // sdk-missing-stub:react-compiler-runtime
167972
- var noop118 = () => null, c6;
168125
+ var noop119 = () => null, c6;
167973
168126
  var init_react_compiler_runtime = __esm(() => {
167974
- c6 = noop118;
168127
+ c6 = noop119;
167975
168128
  });
167976
168129
 
167977
168130
  // sdk-missing-stub:src/components/ConfigurableShortcutHint.js
167978
- var noop119 = () => null, ConfigurableShortcutHint;
168131
+ var noop120 = () => null, ConfigurableShortcutHint;
167979
168132
  var init_ConfigurableShortcutHint = __esm(() => {
167980
- ConfigurableShortcutHint = noop119;
168133
+ ConfigurableShortcutHint = noop120;
167981
168134
  });
167982
168135
 
167983
168136
  // sdk-missing-stub:src/components/CtrlOToExpand.js
167984
- var noop120 = () => null, CtrlOToExpand, SubAgentProvider;
168137
+ var noop121 = () => null, CtrlOToExpand, SubAgentProvider;
167985
168138
  var init_CtrlOToExpand2 = __esm(() => {
167986
- CtrlOToExpand = noop120;
167987
- SubAgentProvider = noop120;
168139
+ CtrlOToExpand = noop121;
168140
+ SubAgentProvider = noop121;
167988
168141
  });
167989
168142
 
167990
168143
  // sdk-missing-stub:src/components/design-system/Byline.js
@@ -167997,43 +168150,43 @@ var init_KeyboardShortcutHint = () => {};
167997
168150
  var init_AgentProgressLine = () => {};
167998
168151
 
167999
168152
  // sdk-missing-stub:../../components/FallbackToolUseErrorMessage.js
168000
- var noop121 = () => null, FallbackToolUseErrorMessage;
168153
+ var noop122 = () => null, FallbackToolUseErrorMessage;
168001
168154
  var init_FallbackToolUseErrorMessage = __esm(() => {
168002
- FallbackToolUseErrorMessage = noop121;
168155
+ FallbackToolUseErrorMessage = noop122;
168003
168156
  });
168004
168157
 
168005
168158
  // sdk-missing-stub:../../components/FallbackToolUseRejectedMessage.js
168006
- var noop122 = () => null, FallbackToolUseRejectedMessage;
168159
+ var noop123 = () => null, FallbackToolUseRejectedMessage;
168007
168160
  var init_FallbackToolUseRejectedMessage = __esm(() => {
168008
- FallbackToolUseRejectedMessage = noop122;
168161
+ FallbackToolUseRejectedMessage = noop123;
168009
168162
  });
168010
168163
 
168011
168164
  // sdk-missing-stub:../../components/Markdown.js
168012
- var noop123 = () => null, Markdown;
168165
+ var noop124 = () => null, Markdown;
168013
168166
  var init_Markdown = __esm(() => {
168014
- Markdown = noop123;
168167
+ Markdown = noop124;
168015
168168
  });
168016
168169
 
168017
168170
  // sdk-missing-stub:../../components/Message.js
168018
- var noop124 = () => null, Message;
168171
+ var noop125 = () => null, Message;
168019
168172
  var init_Message = __esm(() => {
168020
- Message = noop124;
168173
+ Message = noop125;
168021
168174
  });
168022
168175
 
168023
168176
  // sdk-missing-stub:../../components/MessageResponse.js
168024
- var noop125 = () => null, MessageResponse;
168177
+ var noop126 = () => null, MessageResponse;
168025
168178
  var init_MessageResponse = __esm(() => {
168026
- MessageResponse = noop125;
168179
+ MessageResponse = noop126;
168027
168180
  });
168028
168181
 
168029
168182
  // sdk-missing-stub:../../components/ToolUseLoader.js
168030
168183
  var init_ToolUseLoader = () => {};
168031
168184
 
168032
168185
  // sdk-missing-stub:../../ink.js
168033
- var noop126 = () => null, Box, Text;
168186
+ var noop127 = () => null, Box, Text;
168034
168187
  var init_ink = __esm(() => {
168035
- Box = noop126;
168036
- Text = noop126;
168188
+ Box = noop127;
168189
+ Text = noop127;
168037
168190
  });
168038
168191
 
168039
168192
  // sdk-jsx-stub:react/jsx-dev-runtime
@@ -168431,6 +168584,1283 @@ function parseSlashCommand(input) {
168431
168584
  };
168432
168585
  }
168433
168586
 
168587
+ // node_modules/fuse.js/dist/fuse.mjs
168588
+ function isArray3(value) {
168589
+ return !Array.isArray ? getTag2(value) === "[object Array]" : Array.isArray(value);
168590
+ }
168591
+ function baseToString2(value) {
168592
+ if (typeof value == "string") {
168593
+ return value;
168594
+ }
168595
+ let result = value + "";
168596
+ return result == "0" && 1 / value == -INFINITY4 ? "-0" : result;
168597
+ }
168598
+ function toString5(value) {
168599
+ return value == null ? "" : baseToString2(value);
168600
+ }
168601
+ function isString2(value) {
168602
+ return typeof value === "string";
168603
+ }
168604
+ function isNumber2(value) {
168605
+ return typeof value === "number";
168606
+ }
168607
+ function isBoolean2(value) {
168608
+ return value === true || value === false || isObjectLike2(value) && getTag2(value) == "[object Boolean]";
168609
+ }
168610
+ function isObject5(value) {
168611
+ return typeof value === "object";
168612
+ }
168613
+ function isObjectLike2(value) {
168614
+ return isObject5(value) && value !== null;
168615
+ }
168616
+ function isDefined(value) {
168617
+ return value !== undefined && value !== null;
168618
+ }
168619
+ function isBlank(value) {
168620
+ return !value.trim().length;
168621
+ }
168622
+ function getTag2(value) {
168623
+ return value == null ? value === undefined ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
168624
+ }
168625
+
168626
+ class KeyStore {
168627
+ constructor(keys2) {
168628
+ this._keys = [];
168629
+ this._keyMap = {};
168630
+ let totalWeight = 0;
168631
+ keys2.forEach((key) => {
168632
+ let obj = createKey(key);
168633
+ this._keys.push(obj);
168634
+ this._keyMap[obj.id] = obj;
168635
+ totalWeight += obj.weight;
168636
+ });
168637
+ this._keys.forEach((key) => {
168638
+ key.weight /= totalWeight;
168639
+ });
168640
+ }
168641
+ get(keyId) {
168642
+ return this._keyMap[keyId];
168643
+ }
168644
+ keys() {
168645
+ return this._keys;
168646
+ }
168647
+ toJSON() {
168648
+ return JSON.stringify(this._keys);
168649
+ }
168650
+ }
168651
+ function createKey(key) {
168652
+ let path11 = null;
168653
+ let id = null;
168654
+ let src = null;
168655
+ let weight = 1;
168656
+ let getFn = null;
168657
+ if (isString2(key) || isArray3(key)) {
168658
+ src = key;
168659
+ path11 = createKeyPath(key);
168660
+ id = createKeyId(key);
168661
+ } else {
168662
+ if (!hasOwn.call(key, "name")) {
168663
+ throw new Error(MISSING_KEY_PROPERTY("name"));
168664
+ }
168665
+ const name = key.name;
168666
+ src = name;
168667
+ if (hasOwn.call(key, "weight")) {
168668
+ weight = key.weight;
168669
+ if (weight <= 0) {
168670
+ throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
168671
+ }
168672
+ }
168673
+ path11 = createKeyPath(name);
168674
+ id = createKeyId(name);
168675
+ getFn = key.getFn;
168676
+ }
168677
+ return { path: path11, id, weight, src, getFn };
168678
+ }
168679
+ function createKeyPath(key) {
168680
+ return isArray3(key) ? key : key.split(".");
168681
+ }
168682
+ function createKeyId(key) {
168683
+ return isArray3(key) ? key.join(".") : key;
168684
+ }
168685
+ function get2(obj, path11) {
168686
+ let list2 = [];
168687
+ let arr = false;
168688
+ const deepGet = (obj2, path12, index) => {
168689
+ if (!isDefined(obj2)) {
168690
+ return;
168691
+ }
168692
+ if (!path12[index]) {
168693
+ list2.push(obj2);
168694
+ } else {
168695
+ let key = path12[index];
168696
+ const value = obj2[key];
168697
+ if (!isDefined(value)) {
168698
+ return;
168699
+ }
168700
+ if (index === path12.length - 1 && (isString2(value) || isNumber2(value) || isBoolean2(value))) {
168701
+ list2.push(toString5(value));
168702
+ } else if (isArray3(value)) {
168703
+ arr = true;
168704
+ for (let i3 = 0, len = value.length;i3 < len; i3 += 1) {
168705
+ deepGet(value[i3], path12, index + 1);
168706
+ }
168707
+ } else if (path12.length) {
168708
+ deepGet(value, path12, index + 1);
168709
+ }
168710
+ }
168711
+ };
168712
+ deepGet(obj, isString2(path11) ? path11.split(".") : path11, 0);
168713
+ return arr ? list2 : list2[0];
168714
+ }
168715
+ function norm(weight = 1, mantissa = 3) {
168716
+ const cache = new Map;
168717
+ const m = Math.pow(10, mantissa);
168718
+ return {
168719
+ get(value) {
168720
+ const numTokens = value.match(SPACE).length;
168721
+ if (cache.has(numTokens)) {
168722
+ return cache.get(numTokens);
168723
+ }
168724
+ const norm2 = 1 / Math.pow(numTokens, 0.5 * weight);
168725
+ const n2 = parseFloat(Math.round(norm2 * m) / m);
168726
+ cache.set(numTokens, n2);
168727
+ return n2;
168728
+ },
168729
+ clear() {
168730
+ cache.clear();
168731
+ }
168732
+ };
168733
+ }
168734
+
168735
+ class FuseIndex {
168736
+ constructor({
168737
+ getFn = Config.getFn,
168738
+ fieldNormWeight = Config.fieldNormWeight
168739
+ } = {}) {
168740
+ this.norm = norm(fieldNormWeight, 3);
168741
+ this.getFn = getFn;
168742
+ this.isCreated = false;
168743
+ this.setIndexRecords();
168744
+ }
168745
+ setSources(docs = []) {
168746
+ this.docs = docs;
168747
+ }
168748
+ setIndexRecords(records = []) {
168749
+ this.records = records;
168750
+ }
168751
+ setKeys(keys2 = []) {
168752
+ this.keys = keys2;
168753
+ this._keysMap = {};
168754
+ keys2.forEach((key, idx) => {
168755
+ this._keysMap[key.id] = idx;
168756
+ });
168757
+ }
168758
+ create() {
168759
+ if (this.isCreated || !this.docs.length) {
168760
+ return;
168761
+ }
168762
+ this.isCreated = true;
168763
+ if (isString2(this.docs[0])) {
168764
+ this.docs.forEach((doc2, docIndex) => {
168765
+ this._addString(doc2, docIndex);
168766
+ });
168767
+ } else {
168768
+ this.docs.forEach((doc2, docIndex) => {
168769
+ this._addObject(doc2, docIndex);
168770
+ });
168771
+ }
168772
+ this.norm.clear();
168773
+ }
168774
+ add(doc2) {
168775
+ const idx = this.size();
168776
+ if (isString2(doc2)) {
168777
+ this._addString(doc2, idx);
168778
+ } else {
168779
+ this._addObject(doc2, idx);
168780
+ }
168781
+ }
168782
+ removeAt(idx) {
168783
+ this.records.splice(idx, 1);
168784
+ for (let i3 = idx, len = this.size();i3 < len; i3 += 1) {
168785
+ this.records[i3].i -= 1;
168786
+ }
168787
+ }
168788
+ getValueForItemAtKeyId(item, keyId) {
168789
+ return item[this._keysMap[keyId]];
168790
+ }
168791
+ size() {
168792
+ return this.records.length;
168793
+ }
168794
+ _addString(doc2, docIndex) {
168795
+ if (!isDefined(doc2) || isBlank(doc2)) {
168796
+ return;
168797
+ }
168798
+ let record2 = {
168799
+ v: doc2,
168800
+ i: docIndex,
168801
+ n: this.norm.get(doc2)
168802
+ };
168803
+ this.records.push(record2);
168804
+ }
168805
+ _addObject(doc2, docIndex) {
168806
+ let record2 = { i: docIndex, $: {} };
168807
+ this.keys.forEach((key, keyIndex) => {
168808
+ let value = key.getFn ? key.getFn(doc2) : this.getFn(doc2, key.path);
168809
+ if (!isDefined(value)) {
168810
+ return;
168811
+ }
168812
+ if (isArray3(value)) {
168813
+ let subRecords = [];
168814
+ const stack = [{ nestedArrIndex: -1, value }];
168815
+ while (stack.length) {
168816
+ const { nestedArrIndex, value: value2 } = stack.pop();
168817
+ if (!isDefined(value2)) {
168818
+ continue;
168819
+ }
168820
+ if (isString2(value2) && !isBlank(value2)) {
168821
+ let subRecord = {
168822
+ v: value2,
168823
+ i: nestedArrIndex,
168824
+ n: this.norm.get(value2)
168825
+ };
168826
+ subRecords.push(subRecord);
168827
+ } else if (isArray3(value2)) {
168828
+ value2.forEach((item, k) => {
168829
+ stack.push({
168830
+ nestedArrIndex: k,
168831
+ value: item
168832
+ });
168833
+ });
168834
+ }
168835
+ }
168836
+ record2.$[keyIndex] = subRecords;
168837
+ } else if (isString2(value) && !isBlank(value)) {
168838
+ let subRecord = {
168839
+ v: value,
168840
+ n: this.norm.get(value)
168841
+ };
168842
+ record2.$[keyIndex] = subRecord;
168843
+ }
168844
+ });
168845
+ this.records.push(record2);
168846
+ }
168847
+ toJSON() {
168848
+ return {
168849
+ keys: this.keys,
168850
+ records: this.records
168851
+ };
168852
+ }
168853
+ }
168854
+ function createIndex(keys2, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
168855
+ const myIndex = new FuseIndex({ getFn, fieldNormWeight });
168856
+ myIndex.setKeys(keys2.map(createKey));
168857
+ myIndex.setSources(docs);
168858
+ myIndex.create();
168859
+ return myIndex;
168860
+ }
168861
+ function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
168862
+ const { keys: keys2, records } = data;
168863
+ const myIndex = new FuseIndex({ getFn, fieldNormWeight });
168864
+ myIndex.setKeys(keys2);
168865
+ myIndex.setIndexRecords(records);
168866
+ return myIndex;
168867
+ }
168868
+ function computeScore$1(pattern, {
168869
+ errors: errors3 = 0,
168870
+ currentLocation = 0,
168871
+ expectedLocation = 0,
168872
+ distance = Config.distance,
168873
+ ignoreLocation = Config.ignoreLocation
168874
+ } = {}) {
168875
+ const accuracy = errors3 / pattern.length;
168876
+ if (ignoreLocation) {
168877
+ return accuracy;
168878
+ }
168879
+ const proximity = Math.abs(expectedLocation - currentLocation);
168880
+ if (!distance) {
168881
+ return proximity ? 1 : accuracy;
168882
+ }
168883
+ return accuracy + proximity / distance;
168884
+ }
168885
+ function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) {
168886
+ let indices = [];
168887
+ let start = -1;
168888
+ let end = -1;
168889
+ let i3 = 0;
168890
+ for (let len = matchmask.length;i3 < len; i3 += 1) {
168891
+ let match = matchmask[i3];
168892
+ if (match && start === -1) {
168893
+ start = i3;
168894
+ } else if (!match && start !== -1) {
168895
+ end = i3 - 1;
168896
+ if (end - start + 1 >= minMatchCharLength) {
168897
+ indices.push([start, end]);
168898
+ }
168899
+ start = -1;
168900
+ }
168901
+ }
168902
+ if (matchmask[i3 - 1] && i3 - start >= minMatchCharLength) {
168903
+ indices.push([start, i3 - 1]);
168904
+ }
168905
+ return indices;
168906
+ }
168907
+ function search(text, pattern, patternAlphabet, {
168908
+ location = Config.location,
168909
+ distance = Config.distance,
168910
+ threshold = Config.threshold,
168911
+ findAllMatches = Config.findAllMatches,
168912
+ minMatchCharLength = Config.minMatchCharLength,
168913
+ includeMatches = Config.includeMatches,
168914
+ ignoreLocation = Config.ignoreLocation
168915
+ } = {}) {
168916
+ if (pattern.length > MAX_BITS) {
168917
+ throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));
168918
+ }
168919
+ const patternLen = pattern.length;
168920
+ const textLen = text.length;
168921
+ const expectedLocation = Math.max(0, Math.min(location, textLen));
168922
+ let currentThreshold = threshold;
168923
+ let bestLocation = expectedLocation;
168924
+ const computeMatches = minMatchCharLength > 1 || includeMatches;
168925
+ const matchMask = computeMatches ? Array(textLen) : [];
168926
+ let index;
168927
+ while ((index = text.indexOf(pattern, bestLocation)) > -1) {
168928
+ let score = computeScore$1(pattern, {
168929
+ currentLocation: index,
168930
+ expectedLocation,
168931
+ distance,
168932
+ ignoreLocation
168933
+ });
168934
+ currentThreshold = Math.min(score, currentThreshold);
168935
+ bestLocation = index + patternLen;
168936
+ if (computeMatches) {
168937
+ let i3 = 0;
168938
+ while (i3 < patternLen) {
168939
+ matchMask[index + i3] = 1;
168940
+ i3 += 1;
168941
+ }
168942
+ }
168943
+ }
168944
+ bestLocation = -1;
168945
+ let lastBitArr = [];
168946
+ let finalScore = 1;
168947
+ let binMax = patternLen + textLen;
168948
+ const mask = 1 << patternLen - 1;
168949
+ for (let i3 = 0;i3 < patternLen; i3 += 1) {
168950
+ let binMin = 0;
168951
+ let binMid = binMax;
168952
+ while (binMin < binMid) {
168953
+ const score2 = computeScore$1(pattern, {
168954
+ errors: i3,
168955
+ currentLocation: expectedLocation + binMid,
168956
+ expectedLocation,
168957
+ distance,
168958
+ ignoreLocation
168959
+ });
168960
+ if (score2 <= currentThreshold) {
168961
+ binMin = binMid;
168962
+ } else {
168963
+ binMax = binMid;
168964
+ }
168965
+ binMid = Math.floor((binMax - binMin) / 2 + binMin);
168966
+ }
168967
+ binMax = binMid;
168968
+ let start = Math.max(1, expectedLocation - binMid + 1);
168969
+ let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;
168970
+ let bitArr = Array(finish + 2);
168971
+ bitArr[finish + 1] = (1 << i3) - 1;
168972
+ for (let j = finish;j >= start; j -= 1) {
168973
+ let currentLocation = j - 1;
168974
+ let charMatch = patternAlphabet[text.charAt(currentLocation)];
168975
+ if (computeMatches) {
168976
+ matchMask[currentLocation] = +!!charMatch;
168977
+ }
168978
+ bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;
168979
+ if (i3) {
168980
+ bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
168981
+ }
168982
+ if (bitArr[j] & mask) {
168983
+ finalScore = computeScore$1(pattern, {
168984
+ errors: i3,
168985
+ currentLocation,
168986
+ expectedLocation,
168987
+ distance,
168988
+ ignoreLocation
168989
+ });
168990
+ if (finalScore <= currentThreshold) {
168991
+ currentThreshold = finalScore;
168992
+ bestLocation = currentLocation;
168993
+ if (bestLocation <= expectedLocation) {
168994
+ break;
168995
+ }
168996
+ start = Math.max(1, 2 * expectedLocation - bestLocation);
168997
+ }
168998
+ }
168999
+ }
169000
+ const score = computeScore$1(pattern, {
169001
+ errors: i3 + 1,
169002
+ currentLocation: expectedLocation,
169003
+ expectedLocation,
169004
+ distance,
169005
+ ignoreLocation
169006
+ });
169007
+ if (score > currentThreshold) {
169008
+ break;
169009
+ }
169010
+ lastBitArr = bitArr;
169011
+ }
169012
+ const result = {
169013
+ isMatch: bestLocation >= 0,
169014
+ score: Math.max(0.001, finalScore)
169015
+ };
169016
+ if (computeMatches) {
169017
+ const indices = convertMaskToIndices(matchMask, minMatchCharLength);
169018
+ if (!indices.length) {
169019
+ result.isMatch = false;
169020
+ } else if (includeMatches) {
169021
+ result.indices = indices;
169022
+ }
169023
+ }
169024
+ return result;
169025
+ }
169026
+ function createPatternAlphabet(pattern) {
169027
+ let mask = {};
169028
+ for (let i3 = 0, len = pattern.length;i3 < len; i3 += 1) {
169029
+ const char = pattern.charAt(i3);
169030
+ mask[char] = (mask[char] || 0) | 1 << len - i3 - 1;
169031
+ }
169032
+ return mask;
169033
+ }
169034
+
169035
+ class BitapSearch {
169036
+ constructor(pattern, {
169037
+ location = Config.location,
169038
+ threshold = Config.threshold,
169039
+ distance = Config.distance,
169040
+ includeMatches = Config.includeMatches,
169041
+ findAllMatches = Config.findAllMatches,
169042
+ minMatchCharLength = Config.minMatchCharLength,
169043
+ isCaseSensitive = Config.isCaseSensitive,
169044
+ ignoreDiacritics = Config.ignoreDiacritics,
169045
+ ignoreLocation = Config.ignoreLocation
169046
+ } = {}) {
169047
+ this.options = {
169048
+ location,
169049
+ threshold,
169050
+ distance,
169051
+ includeMatches,
169052
+ findAllMatches,
169053
+ minMatchCharLength,
169054
+ isCaseSensitive,
169055
+ ignoreDiacritics,
169056
+ ignoreLocation
169057
+ };
169058
+ pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
169059
+ pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
169060
+ this.pattern = pattern;
169061
+ this.chunks = [];
169062
+ if (!this.pattern.length) {
169063
+ return;
169064
+ }
169065
+ const addChunk = (pattern2, startIndex) => {
169066
+ this.chunks.push({
169067
+ pattern: pattern2,
169068
+ alphabet: createPatternAlphabet(pattern2),
169069
+ startIndex
169070
+ });
169071
+ };
169072
+ const len = this.pattern.length;
169073
+ if (len > MAX_BITS) {
169074
+ let i3 = 0;
169075
+ const remainder = len % MAX_BITS;
169076
+ const end = len - remainder;
169077
+ while (i3 < end) {
169078
+ addChunk(this.pattern.substr(i3, MAX_BITS), i3);
169079
+ i3 += MAX_BITS;
169080
+ }
169081
+ if (remainder) {
169082
+ const startIndex = len - MAX_BITS;
169083
+ addChunk(this.pattern.substr(startIndex), startIndex);
169084
+ }
169085
+ } else {
169086
+ addChunk(this.pattern, 0);
169087
+ }
169088
+ }
169089
+ searchIn(text) {
169090
+ const { isCaseSensitive, ignoreDiacritics, includeMatches } = this.options;
169091
+ text = isCaseSensitive ? text : text.toLowerCase();
169092
+ text = ignoreDiacritics ? stripDiacritics(text) : text;
169093
+ if (this.pattern === text) {
169094
+ let result2 = {
169095
+ isMatch: true,
169096
+ score: 0
169097
+ };
169098
+ if (includeMatches) {
169099
+ result2.indices = [[0, text.length - 1]];
169100
+ }
169101
+ return result2;
169102
+ }
169103
+ const {
169104
+ location,
169105
+ distance,
169106
+ threshold,
169107
+ findAllMatches,
169108
+ minMatchCharLength,
169109
+ ignoreLocation
169110
+ } = this.options;
169111
+ let allIndices = [];
169112
+ let totalScore = 0;
169113
+ let hasMatches = false;
169114
+ this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
169115
+ const { isMatch, score, indices } = search(text, pattern, alphabet, {
169116
+ location: location + startIndex,
169117
+ distance,
169118
+ threshold,
169119
+ findAllMatches,
169120
+ minMatchCharLength,
169121
+ includeMatches,
169122
+ ignoreLocation
169123
+ });
169124
+ if (isMatch) {
169125
+ hasMatches = true;
169126
+ }
169127
+ totalScore += score;
169128
+ if (isMatch && indices) {
169129
+ allIndices = [...allIndices, ...indices];
169130
+ }
169131
+ });
169132
+ let result = {
169133
+ isMatch: hasMatches,
169134
+ score: hasMatches ? totalScore / this.chunks.length : 1
169135
+ };
169136
+ if (hasMatches && includeMatches) {
169137
+ result.indices = allIndices;
169138
+ }
169139
+ return result;
169140
+ }
169141
+ }
169142
+
169143
+ class BaseMatch {
169144
+ constructor(pattern) {
169145
+ this.pattern = pattern;
169146
+ }
169147
+ static isMultiMatch(pattern) {
169148
+ return getMatch(pattern, this.multiRegex);
169149
+ }
169150
+ static isSingleMatch(pattern) {
169151
+ return getMatch(pattern, this.singleRegex);
169152
+ }
169153
+ search() {}
169154
+ }
169155
+ function getMatch(pattern, exp) {
169156
+ const matches = pattern.match(exp);
169157
+ return matches ? matches[1] : null;
169158
+ }
169159
+ function parseQuery(pattern, options2 = {}) {
169160
+ return pattern.split(OR_TOKEN).map((item) => {
169161
+ let query2 = item.trim().split(SPACE_RE).filter((item2) => item2 && !!item2.trim());
169162
+ let results = [];
169163
+ for (let i3 = 0, len = query2.length;i3 < len; i3 += 1) {
169164
+ const queryItem = query2[i3];
169165
+ let found = false;
169166
+ let idx = -1;
169167
+ while (!found && ++idx < searchersLen) {
169168
+ const searcher = searchers[idx];
169169
+ let token = searcher.isMultiMatch(queryItem);
169170
+ if (token) {
169171
+ results.push(new searcher(token, options2));
169172
+ found = true;
169173
+ }
169174
+ }
169175
+ if (found) {
169176
+ continue;
169177
+ }
169178
+ idx = -1;
169179
+ while (++idx < searchersLen) {
169180
+ const searcher = searchers[idx];
169181
+ let token = searcher.isSingleMatch(queryItem);
169182
+ if (token) {
169183
+ results.push(new searcher(token, options2));
169184
+ break;
169185
+ }
169186
+ }
169187
+ }
169188
+ return results;
169189
+ });
169190
+ }
169191
+
169192
+ class ExtendedSearch {
169193
+ constructor(pattern, {
169194
+ isCaseSensitive = Config.isCaseSensitive,
169195
+ ignoreDiacritics = Config.ignoreDiacritics,
169196
+ includeMatches = Config.includeMatches,
169197
+ minMatchCharLength = Config.minMatchCharLength,
169198
+ ignoreLocation = Config.ignoreLocation,
169199
+ findAllMatches = Config.findAllMatches,
169200
+ location = Config.location,
169201
+ threshold = Config.threshold,
169202
+ distance = Config.distance
169203
+ } = {}) {
169204
+ this.query = null;
169205
+ this.options = {
169206
+ isCaseSensitive,
169207
+ ignoreDiacritics,
169208
+ includeMatches,
169209
+ minMatchCharLength,
169210
+ findAllMatches,
169211
+ ignoreLocation,
169212
+ location,
169213
+ threshold,
169214
+ distance
169215
+ };
169216
+ pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
169217
+ pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
169218
+ this.pattern = pattern;
169219
+ this.query = parseQuery(this.pattern, this.options);
169220
+ }
169221
+ static condition(_, options2) {
169222
+ return options2.useExtendedSearch;
169223
+ }
169224
+ searchIn(text) {
169225
+ const query2 = this.query;
169226
+ if (!query2) {
169227
+ return {
169228
+ isMatch: false,
169229
+ score: 1
169230
+ };
169231
+ }
169232
+ const { includeMatches, isCaseSensitive, ignoreDiacritics } = this.options;
169233
+ text = isCaseSensitive ? text : text.toLowerCase();
169234
+ text = ignoreDiacritics ? stripDiacritics(text) : text;
169235
+ let numMatches = 0;
169236
+ let allIndices = [];
169237
+ let totalScore = 0;
169238
+ for (let i3 = 0, qLen = query2.length;i3 < qLen; i3 += 1) {
169239
+ const searchers2 = query2[i3];
169240
+ allIndices.length = 0;
169241
+ numMatches = 0;
169242
+ for (let j = 0, pLen = searchers2.length;j < pLen; j += 1) {
169243
+ const searcher = searchers2[j];
169244
+ const { isMatch, indices, score } = searcher.search(text);
169245
+ if (isMatch) {
169246
+ numMatches += 1;
169247
+ totalScore += score;
169248
+ if (includeMatches) {
169249
+ const type = searcher.constructor.type;
169250
+ if (MultiMatchSet.has(type)) {
169251
+ allIndices = [...allIndices, ...indices];
169252
+ } else {
169253
+ allIndices.push(indices);
169254
+ }
169255
+ }
169256
+ } else {
169257
+ totalScore = 0;
169258
+ numMatches = 0;
169259
+ allIndices.length = 0;
169260
+ break;
169261
+ }
169262
+ }
169263
+ if (numMatches) {
169264
+ let result = {
169265
+ isMatch: true,
169266
+ score: totalScore / numMatches
169267
+ };
169268
+ if (includeMatches) {
169269
+ result.indices = allIndices;
169270
+ }
169271
+ return result;
169272
+ }
169273
+ }
169274
+ return {
169275
+ isMatch: false,
169276
+ score: 1
169277
+ };
169278
+ }
169279
+ }
169280
+ function register(...args) {
169281
+ registeredSearchers.push(...args);
169282
+ }
169283
+ function createSearcher(pattern, options2) {
169284
+ for (let i3 = 0, len = registeredSearchers.length;i3 < len; i3 += 1) {
169285
+ let searcherClass = registeredSearchers[i3];
169286
+ if (searcherClass.condition(pattern, options2)) {
169287
+ return new searcherClass(pattern, options2);
169288
+ }
169289
+ }
169290
+ return new BitapSearch(pattern, options2);
169291
+ }
169292
+ function parse9(query2, options2, { auto = true } = {}) {
169293
+ const next = (query3) => {
169294
+ let keys2 = Object.keys(query3);
169295
+ const isQueryPath = isPath(query3);
169296
+ if (!isQueryPath && keys2.length > 1 && !isExpression(query3)) {
169297
+ return next(convertToExplicit(query3));
169298
+ }
169299
+ if (isLeaf(query3)) {
169300
+ const key = isQueryPath ? query3[KeyType.PATH] : keys2[0];
169301
+ const pattern = isQueryPath ? query3[KeyType.PATTERN] : query3[key];
169302
+ if (!isString2(pattern)) {
169303
+ throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
169304
+ }
169305
+ const obj = {
169306
+ keyId: createKeyId(key),
169307
+ pattern
169308
+ };
169309
+ if (auto) {
169310
+ obj.searcher = createSearcher(pattern, options2);
169311
+ }
169312
+ return obj;
169313
+ }
169314
+ let node = {
169315
+ children: [],
169316
+ operator: keys2[0]
169317
+ };
169318
+ keys2.forEach((key) => {
169319
+ const value = query3[key];
169320
+ if (isArray3(value)) {
169321
+ value.forEach((item) => {
169322
+ node.children.push(next(item));
169323
+ });
169324
+ }
169325
+ });
169326
+ return node;
169327
+ };
169328
+ if (!isExpression(query2)) {
169329
+ query2 = convertToExplicit(query2);
169330
+ }
169331
+ return next(query2);
169332
+ }
169333
+ function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
169334
+ results.forEach((result) => {
169335
+ let totalScore = 1;
169336
+ result.matches.forEach(({ key, norm: norm2, score }) => {
169337
+ const weight = key ? key.weight : null;
169338
+ totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm2));
169339
+ });
169340
+ result.score = totalScore;
169341
+ });
169342
+ }
169343
+ function transformMatches(result, data) {
169344
+ const matches = result.matches;
169345
+ data.matches = [];
169346
+ if (!isDefined(matches)) {
169347
+ return;
169348
+ }
169349
+ matches.forEach((match) => {
169350
+ if (!isDefined(match.indices) || !match.indices.length) {
169351
+ return;
169352
+ }
169353
+ const { indices, value } = match;
169354
+ let obj = {
169355
+ indices,
169356
+ value
169357
+ };
169358
+ if (match.key) {
169359
+ obj.key = match.key.src;
169360
+ }
169361
+ if (match.idx > -1) {
169362
+ obj.refIndex = match.idx;
169363
+ }
169364
+ data.matches.push(obj);
169365
+ });
169366
+ }
169367
+ function transformScore(result, data) {
169368
+ data.score = result.score;
169369
+ }
169370
+ function format4(results, docs, {
169371
+ includeMatches = Config.includeMatches,
169372
+ includeScore = Config.includeScore
169373
+ } = {}) {
169374
+ const transformers = [];
169375
+ if (includeMatches)
169376
+ transformers.push(transformMatches);
169377
+ if (includeScore)
169378
+ transformers.push(transformScore);
169379
+ return results.map((result) => {
169380
+ const { idx } = result;
169381
+ const data = {
169382
+ item: docs[idx],
169383
+ refIndex: idx
169384
+ };
169385
+ if (transformers.length) {
169386
+ transformers.forEach((transformer) => {
169387
+ transformer(result, data);
169388
+ });
169389
+ }
169390
+ return data;
169391
+ });
169392
+ }
169393
+
169394
+ class Fuse {
169395
+ constructor(docs, options2 = {}, index) {
169396
+ this.options = { ...Config, ...options2 };
169397
+ if (this.options.useExtendedSearch && false) {}
169398
+ this._keyStore = new KeyStore(this.options.keys);
169399
+ this.setCollection(docs, index);
169400
+ }
169401
+ setCollection(docs, index) {
169402
+ this._docs = docs;
169403
+ if (index && !(index instanceof FuseIndex)) {
169404
+ throw new Error(INCORRECT_INDEX_TYPE);
169405
+ }
169406
+ this._myIndex = index || createIndex(this.options.keys, this._docs, {
169407
+ getFn: this.options.getFn,
169408
+ fieldNormWeight: this.options.fieldNormWeight
169409
+ });
169410
+ }
169411
+ add(doc2) {
169412
+ if (!isDefined(doc2)) {
169413
+ return;
169414
+ }
169415
+ this._docs.push(doc2);
169416
+ this._myIndex.add(doc2);
169417
+ }
169418
+ remove(predicate = () => false) {
169419
+ const results = [];
169420
+ for (let i3 = 0, len = this._docs.length;i3 < len; i3 += 1) {
169421
+ const doc2 = this._docs[i3];
169422
+ if (predicate(doc2, i3)) {
169423
+ this.removeAt(i3);
169424
+ i3 -= 1;
169425
+ len -= 1;
169426
+ results.push(doc2);
169427
+ }
169428
+ }
169429
+ return results;
169430
+ }
169431
+ removeAt(idx) {
169432
+ this._docs.splice(idx, 1);
169433
+ this._myIndex.removeAt(idx);
169434
+ }
169435
+ getIndex() {
169436
+ return this._myIndex;
169437
+ }
169438
+ search(query2, { limit = -1 } = {}) {
169439
+ const {
169440
+ includeMatches,
169441
+ includeScore,
169442
+ shouldSort,
169443
+ sortFn,
169444
+ ignoreFieldNorm
169445
+ } = this.options;
169446
+ let results = isString2(query2) ? isString2(this._docs[0]) ? this._searchStringList(query2) : this._searchObjectList(query2) : this._searchLogical(query2);
169447
+ computeScore(results, { ignoreFieldNorm });
169448
+ if (shouldSort) {
169449
+ results.sort(sortFn);
169450
+ }
169451
+ if (isNumber2(limit) && limit > -1) {
169452
+ results = results.slice(0, limit);
169453
+ }
169454
+ return format4(results, this._docs, {
169455
+ includeMatches,
169456
+ includeScore
169457
+ });
169458
+ }
169459
+ _searchStringList(query2) {
169460
+ const searcher = createSearcher(query2, this.options);
169461
+ const { records } = this._myIndex;
169462
+ const results = [];
169463
+ records.forEach(({ v: text, i: idx, n: norm2 }) => {
169464
+ if (!isDefined(text)) {
169465
+ return;
169466
+ }
169467
+ const { isMatch, score, indices } = searcher.searchIn(text);
169468
+ if (isMatch) {
169469
+ results.push({
169470
+ item: text,
169471
+ idx,
169472
+ matches: [{ score, value: text, norm: norm2, indices }]
169473
+ });
169474
+ }
169475
+ });
169476
+ return results;
169477
+ }
169478
+ _searchLogical(query2) {
169479
+ const expression = parse9(query2, this.options);
169480
+ const evaluate = (node, item, idx) => {
169481
+ if (!node.children) {
169482
+ const { keyId, searcher } = node;
169483
+ const matches = this._findMatches({
169484
+ key: this._keyStore.get(keyId),
169485
+ value: this._myIndex.getValueForItemAtKeyId(item, keyId),
169486
+ searcher
169487
+ });
169488
+ if (matches && matches.length) {
169489
+ return [
169490
+ {
169491
+ idx,
169492
+ item,
169493
+ matches
169494
+ }
169495
+ ];
169496
+ }
169497
+ return [];
169498
+ }
169499
+ const res = [];
169500
+ for (let i3 = 0, len = node.children.length;i3 < len; i3 += 1) {
169501
+ const child = node.children[i3];
169502
+ const result = evaluate(child, item, idx);
169503
+ if (result.length) {
169504
+ res.push(...result);
169505
+ } else if (node.operator === LogicalOperator.AND) {
169506
+ return [];
169507
+ }
169508
+ }
169509
+ return res;
169510
+ };
169511
+ const records = this._myIndex.records;
169512
+ const resultMap = {};
169513
+ const results = [];
169514
+ records.forEach(({ $: item, i: idx }) => {
169515
+ if (isDefined(item)) {
169516
+ let expResults = evaluate(expression, item, idx);
169517
+ if (expResults.length) {
169518
+ if (!resultMap[idx]) {
169519
+ resultMap[idx] = { idx, item, matches: [] };
169520
+ results.push(resultMap[idx]);
169521
+ }
169522
+ expResults.forEach(({ matches }) => {
169523
+ resultMap[idx].matches.push(...matches);
169524
+ });
169525
+ }
169526
+ }
169527
+ });
169528
+ return results;
169529
+ }
169530
+ _searchObjectList(query2) {
169531
+ const searcher = createSearcher(query2, this.options);
169532
+ const { keys: keys2, records } = this._myIndex;
169533
+ const results = [];
169534
+ records.forEach(({ $: item, i: idx }) => {
169535
+ if (!isDefined(item)) {
169536
+ return;
169537
+ }
169538
+ let matches = [];
169539
+ keys2.forEach((key, keyIndex) => {
169540
+ matches.push(...this._findMatches({
169541
+ key,
169542
+ value: item[keyIndex],
169543
+ searcher
169544
+ }));
169545
+ });
169546
+ if (matches.length) {
169547
+ results.push({
169548
+ idx,
169549
+ item,
169550
+ matches
169551
+ });
169552
+ }
169553
+ });
169554
+ return results;
169555
+ }
169556
+ _findMatches({ key, value, searcher }) {
169557
+ if (!isDefined(value)) {
169558
+ return [];
169559
+ }
169560
+ let matches = [];
169561
+ if (isArray3(value)) {
169562
+ value.forEach(({ v: text, i: idx, n: norm2 }) => {
169563
+ if (!isDefined(text)) {
169564
+ return;
169565
+ }
169566
+ const { isMatch, score, indices } = searcher.searchIn(text);
169567
+ if (isMatch) {
169568
+ matches.push({
169569
+ score,
169570
+ key,
169571
+ value: text,
169572
+ idx,
169573
+ norm: norm2,
169574
+ indices
169575
+ });
169576
+ }
169577
+ });
169578
+ } else {
169579
+ const { v: text, n: norm2 } = value;
169580
+ const { isMatch, score, indices } = searcher.searchIn(text);
169581
+ if (isMatch) {
169582
+ matches.push({ score, key, value: text, norm: norm2, indices });
169583
+ }
169584
+ }
169585
+ return matches;
169586
+ }
169587
+ }
169588
+ var INFINITY4, INCORRECT_INDEX_TYPE = "Incorrect 'index' type", LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) => `Invalid value for key ${key}`, PATTERN_LENGTH_TOO_LARGE = (max2) => `Pattern length exceeds max of ${max2}.`, MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`, INVALID_KEY_WEIGHT_VALUE = (key) => `Property 'weight' in key '${key}' must be a positive integer`, hasOwn, MatchOptions, BasicOptions, FuzzyOptions, AdvancedOptions, Config, SPACE, MAX_BITS = 32, stripDiacritics, ExactMatch, InverseExactMatch, PrefixExactMatch, InversePrefixExactMatch, SuffixExactMatch, InverseSuffixExactMatch, FuzzyMatch, IncludeMatch, searchers, searchersLen, SPACE_RE, OR_TOKEN = "|", MultiMatchSet, registeredSearchers, LogicalOperator, KeyType, isExpression = (query2) => !!(query2[LogicalOperator.AND] || query2[LogicalOperator.OR]), isPath = (query2) => !!query2[KeyType.PATH], isLeaf = (query2) => !isArray3(query2) && isObject5(query2) && !isExpression(query2), convertToExplicit = (query2) => ({
169589
+ [LogicalOperator.AND]: Object.keys(query2).map((key) => ({
169590
+ [key]: query2[key]
169591
+ }))
169592
+ });
169593
+ var init_fuse = __esm(() => {
169594
+ INFINITY4 = 1 / 0;
169595
+ hasOwn = Object.prototype.hasOwnProperty;
169596
+ MatchOptions = {
169597
+ includeMatches: false,
169598
+ findAllMatches: false,
169599
+ minMatchCharLength: 1
169600
+ };
169601
+ BasicOptions = {
169602
+ isCaseSensitive: false,
169603
+ ignoreDiacritics: false,
169604
+ includeScore: false,
169605
+ keys: [],
169606
+ shouldSort: true,
169607
+ sortFn: (a2, b) => a2.score === b.score ? a2.idx < b.idx ? -1 : 1 : a2.score < b.score ? -1 : 1
169608
+ };
169609
+ FuzzyOptions = {
169610
+ location: 0,
169611
+ threshold: 0.6,
169612
+ distance: 100
169613
+ };
169614
+ AdvancedOptions = {
169615
+ useExtendedSearch: false,
169616
+ getFn: get2,
169617
+ ignoreLocation: false,
169618
+ ignoreFieldNorm: false,
169619
+ fieldNormWeight: 1
169620
+ };
169621
+ Config = {
169622
+ ...BasicOptions,
169623
+ ...MatchOptions,
169624
+ ...FuzzyOptions,
169625
+ ...AdvancedOptions
169626
+ };
169627
+ SPACE = /[^ ]+/g;
169628
+ stripDiacritics = String.prototype.normalize ? (str) => str.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "") : (str) => str;
169629
+ ExactMatch = class ExactMatch extends BaseMatch {
169630
+ constructor(pattern) {
169631
+ super(pattern);
169632
+ }
169633
+ static get type() {
169634
+ return "exact";
169635
+ }
169636
+ static get multiRegex() {
169637
+ return /^="(.*)"$/;
169638
+ }
169639
+ static get singleRegex() {
169640
+ return /^=(.*)$/;
169641
+ }
169642
+ search(text) {
169643
+ const isMatch = text === this.pattern;
169644
+ return {
169645
+ isMatch,
169646
+ score: isMatch ? 0 : 1,
169647
+ indices: [0, this.pattern.length - 1]
169648
+ };
169649
+ }
169650
+ };
169651
+ InverseExactMatch = class InverseExactMatch extends BaseMatch {
169652
+ constructor(pattern) {
169653
+ super(pattern);
169654
+ }
169655
+ static get type() {
169656
+ return "inverse-exact";
169657
+ }
169658
+ static get multiRegex() {
169659
+ return /^!"(.*)"$/;
169660
+ }
169661
+ static get singleRegex() {
169662
+ return /^!(.*)$/;
169663
+ }
169664
+ search(text) {
169665
+ const index = text.indexOf(this.pattern);
169666
+ const isMatch = index === -1;
169667
+ return {
169668
+ isMatch,
169669
+ score: isMatch ? 0 : 1,
169670
+ indices: [0, text.length - 1]
169671
+ };
169672
+ }
169673
+ };
169674
+ PrefixExactMatch = class PrefixExactMatch extends BaseMatch {
169675
+ constructor(pattern) {
169676
+ super(pattern);
169677
+ }
169678
+ static get type() {
169679
+ return "prefix-exact";
169680
+ }
169681
+ static get multiRegex() {
169682
+ return /^\^"(.*)"$/;
169683
+ }
169684
+ static get singleRegex() {
169685
+ return /^\^(.*)$/;
169686
+ }
169687
+ search(text) {
169688
+ const isMatch = text.startsWith(this.pattern);
169689
+ return {
169690
+ isMatch,
169691
+ score: isMatch ? 0 : 1,
169692
+ indices: [0, this.pattern.length - 1]
169693
+ };
169694
+ }
169695
+ };
169696
+ InversePrefixExactMatch = class InversePrefixExactMatch extends BaseMatch {
169697
+ constructor(pattern) {
169698
+ super(pattern);
169699
+ }
169700
+ static get type() {
169701
+ return "inverse-prefix-exact";
169702
+ }
169703
+ static get multiRegex() {
169704
+ return /^!\^"(.*)"$/;
169705
+ }
169706
+ static get singleRegex() {
169707
+ return /^!\^(.*)$/;
169708
+ }
169709
+ search(text) {
169710
+ const isMatch = !text.startsWith(this.pattern);
169711
+ return {
169712
+ isMatch,
169713
+ score: isMatch ? 0 : 1,
169714
+ indices: [0, text.length - 1]
169715
+ };
169716
+ }
169717
+ };
169718
+ SuffixExactMatch = class SuffixExactMatch extends BaseMatch {
169719
+ constructor(pattern) {
169720
+ super(pattern);
169721
+ }
169722
+ static get type() {
169723
+ return "suffix-exact";
169724
+ }
169725
+ static get multiRegex() {
169726
+ return /^"(.*)"\$$/;
169727
+ }
169728
+ static get singleRegex() {
169729
+ return /^(.*)\$$/;
169730
+ }
169731
+ search(text) {
169732
+ const isMatch = text.endsWith(this.pattern);
169733
+ return {
169734
+ isMatch,
169735
+ score: isMatch ? 0 : 1,
169736
+ indices: [text.length - this.pattern.length, text.length - 1]
169737
+ };
169738
+ }
169739
+ };
169740
+ InverseSuffixExactMatch = class InverseSuffixExactMatch extends BaseMatch {
169741
+ constructor(pattern) {
169742
+ super(pattern);
169743
+ }
169744
+ static get type() {
169745
+ return "inverse-suffix-exact";
169746
+ }
169747
+ static get multiRegex() {
169748
+ return /^!"(.*)"\$$/;
169749
+ }
169750
+ static get singleRegex() {
169751
+ return /^!(.*)\$$/;
169752
+ }
169753
+ search(text) {
169754
+ const isMatch = !text.endsWith(this.pattern);
169755
+ return {
169756
+ isMatch,
169757
+ score: isMatch ? 0 : 1,
169758
+ indices: [0, text.length - 1]
169759
+ };
169760
+ }
169761
+ };
169762
+ FuzzyMatch = class FuzzyMatch extends BaseMatch {
169763
+ constructor(pattern, {
169764
+ location = Config.location,
169765
+ threshold = Config.threshold,
169766
+ distance = Config.distance,
169767
+ includeMatches = Config.includeMatches,
169768
+ findAllMatches = Config.findAllMatches,
169769
+ minMatchCharLength = Config.minMatchCharLength,
169770
+ isCaseSensitive = Config.isCaseSensitive,
169771
+ ignoreDiacritics = Config.ignoreDiacritics,
169772
+ ignoreLocation = Config.ignoreLocation
169773
+ } = {}) {
169774
+ super(pattern);
169775
+ this._bitapSearch = new BitapSearch(pattern, {
169776
+ location,
169777
+ threshold,
169778
+ distance,
169779
+ includeMatches,
169780
+ findAllMatches,
169781
+ minMatchCharLength,
169782
+ isCaseSensitive,
169783
+ ignoreDiacritics,
169784
+ ignoreLocation
169785
+ });
169786
+ }
169787
+ static get type() {
169788
+ return "fuzzy";
169789
+ }
169790
+ static get multiRegex() {
169791
+ return /^"(.*)"$/;
169792
+ }
169793
+ static get singleRegex() {
169794
+ return /^(.*)$/;
169795
+ }
169796
+ search(text) {
169797
+ return this._bitapSearch.searchIn(text);
169798
+ }
169799
+ };
169800
+ IncludeMatch = class IncludeMatch extends BaseMatch {
169801
+ constructor(pattern) {
169802
+ super(pattern);
169803
+ }
169804
+ static get type() {
169805
+ return "include";
169806
+ }
169807
+ static get multiRegex() {
169808
+ return /^'"(.*)"$/;
169809
+ }
169810
+ static get singleRegex() {
169811
+ return /^'(.*)$/;
169812
+ }
169813
+ search(text) {
169814
+ let location = 0;
169815
+ let index;
169816
+ const indices = [];
169817
+ const patternLen = this.pattern.length;
169818
+ while ((index = text.indexOf(this.pattern, location)) > -1) {
169819
+ location = index + patternLen;
169820
+ indices.push([index, location - 1]);
169821
+ }
169822
+ const isMatch = !!indices.length;
169823
+ return {
169824
+ isMatch,
169825
+ score: isMatch ? 0 : 1,
169826
+ indices
169827
+ };
169828
+ }
169829
+ };
169830
+ searchers = [
169831
+ ExactMatch,
169832
+ IncludeMatch,
169833
+ PrefixExactMatch,
169834
+ InversePrefixExactMatch,
169835
+ InverseSuffixExactMatch,
169836
+ SuffixExactMatch,
169837
+ InverseExactMatch,
169838
+ FuzzyMatch
169839
+ ];
169840
+ searchersLen = searchers.length;
169841
+ SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;
169842
+ MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);
169843
+ registeredSearchers = [];
169844
+ LogicalOperator = {
169845
+ AND: "$and",
169846
+ OR: "$or"
169847
+ };
169848
+ KeyType = {
169849
+ PATH: "$path",
169850
+ PATTERN: "$val"
169851
+ };
169852
+ Fuse.version = "7.1.0";
169853
+ Fuse.createIndex = createIndex;
169854
+ Fuse.parseIndex = parseIndex;
169855
+ Fuse.config = Config;
169856
+ {
169857
+ Fuse.parseQuery = parse9;
169858
+ }
169859
+ {
169860
+ register(ExtendedSearch);
169861
+ }
169862
+ });
169863
+
168434
169864
  // src/utils/suggestions/skillUsageTracking.ts
168435
169865
  function recordSkillUsage(skillName) {
168436
169866
  const now = Date.now();
@@ -168459,6 +169889,86 @@ var init_skillUsageTracking = __esm(() => {
168459
169889
  lastWriteBySkill = new Map;
168460
169890
  });
168461
169891
 
169892
+ // src/utils/suggestions/commandSuggestions.ts
169893
+ function warnBrokenCommand(label, err2) {
169894
+ if (warnedBrokenCommands.has(label)) {
169895
+ return;
169896
+ }
169897
+ warnedBrokenCommands.add(label);
169898
+ logForDebugging(`command suggestion: skipped metadata for "${label}" — getter threw: ${err2 instanceof Error ? err2.message : String(err2)}`, { level: "warn" });
169899
+ }
169900
+ function safeIsHidden(command) {
169901
+ try {
169902
+ return Boolean(command.isHidden);
169903
+ } catch (err2) {
169904
+ warnBrokenCommand(safeCommandName(command) ?? "unknown", err2);
169905
+ return false;
169906
+ }
169907
+ }
169908
+ function safeCommandName(command) {
169909
+ try {
169910
+ return getCommandName(command);
169911
+ } catch {
169912
+ return null;
169913
+ }
169914
+ }
169915
+ function safeCommandAliases(command, commandName) {
169916
+ try {
169917
+ return command.aliases;
169918
+ } catch (err2) {
169919
+ warnBrokenCommand(commandName, err2);
169920
+ return;
169921
+ }
169922
+ }
169923
+ function findClosestSkillNames(commandName, commands, limit = 3) {
169924
+ const query2 = commandName.toLowerCase().trim();
169925
+ if (!query2) {
169926
+ return [];
169927
+ }
169928
+ const candidates = [];
169929
+ for (const command of commands) {
169930
+ const name = safeCommandName(command);
169931
+ if (name === null || safeIsHidden(command)) {
169932
+ continue;
169933
+ }
169934
+ candidates.push({
169935
+ name,
169936
+ aliasKey: safeCommandAliases(command, name)?.map((alias) => alias.toLowerCase()) ?? []
169937
+ });
169938
+ }
169939
+ const fuse = new Fuse(candidates, {
169940
+ includeScore: true,
169941
+ threshold: 0.45,
169942
+ location: 0,
169943
+ distance: 100,
169944
+ keys: [
169945
+ { name: "name", weight: 3 },
169946
+ { name: "aliasKey", weight: 2 }
169947
+ ]
169948
+ });
169949
+ const seen = new Set;
169950
+ const result = [];
169951
+ for (const { item } of fuse.search(query2)) {
169952
+ if (seen.has(item.name)) {
169953
+ continue;
169954
+ }
169955
+ seen.add(item.name);
169956
+ result.push(item.name);
169957
+ if (result.length >= limit) {
169958
+ break;
169959
+ }
169960
+ }
169961
+ return result;
169962
+ }
169963
+ var warnedBrokenCommands;
169964
+ var init_commandSuggestions = __esm(() => {
169965
+ init_fuse();
169966
+ init_commands();
169967
+ init_debug();
169968
+ init_skillUsageTracking();
169969
+ warnedBrokenCommands = new Set;
169970
+ });
169971
+
168462
169972
  // src/utils/telemetry/events.ts
168463
169973
  async function logOTelEvent(_eventName, _metadata = {}) {}
168464
169974
  function redactIfDisabled(_content) {
@@ -168636,7 +170146,8 @@ async function processSlashCommand(inputString, precedingInputBlocks, imageConte
168636
170146
  logEvent("tengu_input_slash_invalid", {
168637
170147
  input: commandName
168638
170148
  });
168639
- const unknownMessage = `Unknown skill: ${commandName}`;
170149
+ const closest = findClosestSkillNames(commandName, context2.options.commands);
170150
+ const unknownMessage = `Unknown skill: ${commandName}` + (closest.length > 0 ? `. Did you mean: ${closest.map((name) => `/${name}`).join(", ")}?` : "");
168640
170151
  return {
168641
170152
  messages: [
168642
170153
  createSyntheticUserCaveatMessage(),
@@ -169133,6 +170644,7 @@ var init_processSlashCommand = __esm(() => {
169133
170644
  init_permissions3();
169134
170645
  init_pluginIdentifier();
169135
170646
  init_pluginOnlyPolicy();
170647
+ init_commandSuggestions();
169136
170648
  init_skillUsageTracking();
169137
170649
  init_pluginTelemetry();
169138
170650
  init_tokens();
@@ -170118,6 +171630,7 @@ var init_SkillTool = __esm(() => {
170118
171630
  init_frontmatterParser();
170119
171631
  init_messages();
170120
171632
  init_model();
171633
+ init_commandSuggestions();
170121
171634
  init_skillUsageTracking();
170122
171635
  init_uuid();
170123
171636
  init_runAgent();
@@ -170201,9 +171714,10 @@ var init_SkillTool = __esm(() => {
170201
171714
  const commands = await getAllCommands(context2);
170202
171715
  const foundCommand = findCommand(normalizedCommandName, commands);
170203
171716
  if (!foundCommand) {
171717
+ const closest = findClosestSkillNames(normalizedCommandName, commands);
170204
171718
  return {
170205
171719
  result: false,
170206
- message: `Unknown skill: ${normalizedCommandName}`,
171720
+ message: `Unknown skill: ${normalizedCommandName}` + (closest.length > 0 ? `. Did you mean: ${closest.map((name) => `/${name}`).join(", ")}?` : ""),
170207
171721
  errorCode: 2
170208
171722
  };
170209
171723
  }
@@ -172269,8 +173783,8 @@ var init_FileEditTool = __esm(() => {
172269
173783
  if (readTimestamp) {
172270
173784
  const lastWriteTime = getFileModificationTime(fullFilePath);
172271
173785
  if (lastWriteTime > readTimestamp.timestamp) {
172272
- const isFullRead = readTimestamp.offset === undefined && readTimestamp.limit === undefined;
172273
- if (isFullRead && fileContent === readTimestamp.content) {} else {
173786
+ const isFullRead2 = readTimestamp.offset === undefined && readTimestamp.limit === undefined;
173787
+ if (isFullRead2 && fileContent === readTimestamp.content) {} else {
172274
173788
  return {
172275
173789
  result: false,
172276
173790
  behavior: "ask",
@@ -172372,8 +173886,8 @@ String: ${old_string}`,
172372
173886
  const lastWriteTime = getFileModificationTime(absoluteFilePath);
172373
173887
  const lastRead = readFileState.get(absoluteFilePath);
172374
173888
  if (!lastRead || lastWriteTime > lastRead.timestamp) {
172375
- const isFullRead = lastRead && lastRead.offset === undefined && lastRead.limit === undefined;
172376
- const contentUnchanged = isFullRead && originalFileContents === lastRead.content;
173889
+ const isFullRead2 = lastRead && lastRead.offset === undefined && lastRead.limit === undefined;
173890
+ const contentUnchanged = isFullRead2 && originalFileContents === lastRead.content;
172377
173891
  if (!contentUnchanged) {
172378
173892
  throw new Error(FILE_UNEXPECTEDLY_MODIFIED_ERROR);
172379
173893
  }
@@ -172928,8 +174442,8 @@ var init_FileWriteTool = __esm(() => {
172928
174442
  const lastWriteTime = getFileModificationTime(fullFilePath);
172929
174443
  const lastRead = readFileState.get(fullFilePath);
172930
174444
  if (!lastRead || lastWriteTime > lastRead.timestamp) {
172931
- const isFullRead = lastRead && lastRead.offset === undefined && lastRead.limit === undefined;
172932
- if (!isFullRead || meta.content !== lastRead.content) {
174445
+ const isFullRead2 = lastRead && lastRead.offset === undefined && lastRead.limit === undefined;
174446
+ if (!isFullRead2 || meta.content !== lastRead.content) {
172933
174447
  throw new Error(FILE_UNEXPECTEDLY_MODIFIED_ERROR);
172934
174448
  }
172935
174449
  }
@@ -178193,7 +179707,7 @@ var require_TreeWalker = __commonJS((exports, module) => {
178193
179707
  return null;
178194
179708
  }
178195
179709
  } },
178196
- toString: { value: function toString5() {
179710
+ toString: { value: function toString6() {
178197
179711
  return "[object TreeWalker]";
178198
179712
  } }
178199
179713
  });
@@ -178334,7 +179848,7 @@ var require_NodeIterator = __commonJS((exports, module) => {
178334
179848
  return traverse(this, false);
178335
179849
  } },
178336
179850
  detach: { value: function detach() {} },
178337
- toString: { value: function toString5() {
179851
+ toString: { value: function toString6() {
178338
179852
  return "[object NodeIterator]";
178339
179853
  } }
178340
179854
  });
@@ -178539,7 +180053,7 @@ var require_events2 = __commonJS((exports, module) => {
178539
180053
  var require_style_parser = __commonJS((exports) => {
178540
180054
  Object.defineProperty(exports, "__esModule", { value: true });
178541
180055
  exports.hyphenate = exports.parse = undefined;
178542
- function parse9(value) {
180056
+ function parse10(value) {
178543
180057
  const styles4 = [];
178544
180058
  let i3 = 0;
178545
180059
  let parenDepth = 0;
@@ -178593,7 +180107,7 @@ var require_style_parser = __commonJS((exports) => {
178593
180107
  }
178594
180108
  return styles4;
178595
180109
  }
178596
- exports.parse = parse9;
180110
+ exports.parse = parse10;
178597
180111
  function hyphenate(value) {
178598
180112
  return value.replace(/[a-z][A-Z]/g, (v) => {
178599
180113
  return v.charAt(0) + "-" + v.charAt(1);
@@ -178604,7 +180118,7 @@ var require_style_parser = __commonJS((exports) => {
178604
180118
 
178605
180119
  // node_modules/@mixmark-io/domino/lib/CSSStyleDeclaration.js
178606
180120
  var require_CSSStyleDeclaration = __commonJS((exports, module) => {
178607
- var { parse: parse9 } = require_style_parser();
180121
+ var { parse: parse10 } = require_style_parser();
178608
180122
  module.exports = function(elt) {
178609
180123
  const style = new CSSStyleDeclaration(elt);
178610
180124
  const handler = {
@@ -178640,7 +180154,7 @@ var require_CSSStyleDeclaration = __commonJS((exports, module) => {
178640
180154
  if (!value) {
178641
180155
  return result;
178642
180156
  }
178643
- const styleValues = parse9(value);
180157
+ const styleValues = parse10(value);
178644
180158
  if (styleValues.length < 2) {
178645
180159
  return result;
178646
180160
  }
@@ -190305,11 +191819,11 @@ var require_turndown_cjs = __commonJS((exports, module) => {
190305
191819
  function Node(node, options2) {
190306
191820
  node.isBlock = isBlock(node);
190307
191821
  node.isCode = node.nodeName === "CODE" || node.parentNode.isCode;
190308
- node.isBlank = isBlank(node);
191822
+ node.isBlank = isBlank2(node);
190309
191823
  node.flankingWhitespace = flankingWhitespace(node, options2);
190310
191824
  return node;
190311
191825
  }
190312
- function isBlank(node) {
191826
+ function isBlank2(node) {
190313
191827
  return !isVoid(node) && !isMeaningfulWhenBlank(node) && /^\s*$/i.test(node.textContent) && !hasVoid(node) && !hasMeaningfulWhenBlank(node);
190314
191828
  }
190315
191829
  function flankingWhitespace(node, options2) {
@@ -192796,9 +194310,9 @@ var init_BriefTool = __esm(() => {
192796
194310
  });
192797
194311
 
192798
194312
  // sdk-missing-stub:../../keybindings/useShortcutDisplay.js
192799
- var noop127 = () => null, useShortcutDisplay;
194313
+ var noop128 = () => null, useShortcutDisplay;
192800
194314
  var init_useShortcutDisplay = __esm(() => {
192801
- useShortcutDisplay = noop127;
194315
+ useShortcutDisplay = noop128;
192802
194316
  });
192803
194317
 
192804
194318
  // src/utils/task/outputFormatting.ts
@@ -192826,10 +194340,10 @@ var init_outputFormatting = __esm(() => {
192826
194340
  });
192827
194341
 
192828
194342
  // sdk-missing-stub:../AgentTool/UI.js
192829
- var noop128 = () => null, AgentPromptDisplay2, AgentResponseDisplay;
194343
+ var noop129 = () => null, AgentPromptDisplay2, AgentResponseDisplay;
192830
194344
  var init_UI3 = __esm(() => {
192831
- AgentPromptDisplay2 = noop128;
192832
- AgentResponseDisplay = noop128;
194345
+ AgentPromptDisplay2 = noop129;
194346
+ AgentResponseDisplay = noop129;
192833
194347
  });
192834
194348
 
192835
194349
  // src/utils/sandbox/sandbox-ui-utils.ts
@@ -192838,27 +194352,27 @@ function removeSandboxViolationTags(text) {
192838
194352
  }
192839
194353
 
192840
194354
  // sdk-missing-stub:../../components/design-system/FullWidthRow.js
192841
- var noop129 = () => null, FullWidthRow_default;
194355
+ var noop130 = () => null, FullWidthRow_default;
192842
194356
  var init_FullWidthRow = __esm(() => {
192843
- FullWidthRow_default = noop129;
194357
+ FullWidthRow_default = noop130;
192844
194358
  });
192845
194359
 
192846
194360
  // sdk-missing-stub:../../components/design-system/KeyboardShortcutHint.js
192847
- var noop130 = () => null, KeyboardShortcutHint2;
194361
+ var noop131 = () => null, KeyboardShortcutHint2;
192848
194362
  var init_KeyboardShortcutHint2 = __esm(() => {
192849
- KeyboardShortcutHint2 = noop130;
194363
+ KeyboardShortcutHint2 = noop131;
192850
194364
  });
192851
194365
 
192852
194366
  // sdk-missing-stub:../../components/shell/OutputLine.js
192853
- var noop131 = () => null, OutputLine;
194367
+ var noop132 = () => null, OutputLine;
192854
194368
  var init_OutputLine = __esm(() => {
192855
- OutputLine = noop131;
194369
+ OutputLine = noop132;
192856
194370
  });
192857
194371
 
192858
194372
  // sdk-missing-stub:../../components/shell/ShellTimeDisplay.js
192859
- var noop132 = () => null, ShellTimeDisplay;
194373
+ var noop133 = () => null, ShellTimeDisplay;
192860
194374
  var init_ShellTimeDisplay = __esm(() => {
192861
- ShellTimeDisplay = noop132;
194375
+ ShellTimeDisplay = noop133;
192862
194376
  });
192863
194377
 
192864
194378
  // src/tools/BashTool/BashToolResultMessage.tsx
@@ -194675,15 +196189,15 @@ var require_commonjs = __commonJS((exports) => {
194675
196189
 
194676
196190
  // node_modules/needle/lib/querystring.js
194677
196191
  var require_querystring = __commonJS((exports) => {
194678
- var toString5 = Object.prototype.toString;
196192
+ var toString6 = Object.prototype.toString;
194679
196193
  function stringify(obj, prefix) {
194680
196194
  if (prefix && (obj === null || typeof obj == "undefined")) {
194681
196195
  return prefix + "=";
194682
- } else if (toString5.call(obj) == "[object Array]") {
196196
+ } else if (toString6.call(obj) == "[object Array]") {
194683
196197
  return stringifyArray(obj, prefix);
194684
- } else if (toString5.call(obj) == "[object Object]") {
196198
+ } else if (toString6.call(obj) == "[object Object]") {
194685
196199
  return stringifyObject(obj, prefix);
194686
- } else if (toString5.call(obj) == "[object Date]") {
196200
+ } else if (toString6.call(obj) == "[object Date]") {
194687
196201
  return obj.toISOString();
194688
196202
  } else if (prefix) {
194689
196203
  return prefix + "=" + encodeURIComponent(String(obj));
@@ -201164,7 +202678,7 @@ var require_search = __commonJS((exports) => {
201164
202678
  var NEWS_REGEX = /;DDG\.duckbar\.load\('news', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('videos/;
201165
202679
  var VIDEOS_REGEX = /;DDG\.duckbar\.load\('videos', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.loadModule\('related_searches/;
201166
202680
  var RELATED_SEARCHES_REGEX = /DDG\.duckbar\.loadModule\('related_searches', ({"ads":.+"vqd":{".+":"\d-\d+-\d+"}})\);DDG\.duckbar\.load\('products/;
201167
- async function search(query3, options2, needleOptions) {
202681
+ async function search2(query3, options2, needleOptions) {
201168
202682
  if (!query3)
201169
202683
  throw new Error("Query cannot be empty!");
201170
202684
  if (!options2)
@@ -201225,21 +202739,21 @@ var require_search = __commonJS((exports) => {
201225
202739
  vqd,
201226
202740
  results: []
201227
202741
  };
201228
- for (const search2 of searchResults) {
201229
- if ("n" in search2)
202742
+ for (const search3 of searchResults) {
202743
+ if ("n" in search3)
201230
202744
  continue;
201231
202745
  let bang;
201232
- if (search2.b) {
201233
- const [prefix, title, domain2] = search2.b.split("\t");
202746
+ if (search3.b) {
202747
+ const [prefix, title, domain2] = search3.b.split("\t");
201234
202748
  bang = { prefix, title, domain: domain2 };
201235
202749
  }
201236
202750
  results.results.push({
201237
- title: search2.t,
201238
- description: (0, html_entities_1.decode)(search2.a),
201239
- rawDescription: search2.a,
201240
- hostname: search2.i,
201241
- icon: `https://external-content.duckduckgo.com/ip3/${search2.i}.ico`,
201242
- url: search2.u,
202751
+ title: search3.t,
202752
+ description: (0, html_entities_1.decode)(search3.a),
202753
+ rawDescription: search3.a,
202754
+ hostname: search3.i,
202755
+ icon: `https://external-content.duckduckgo.com/ip3/${search3.i}.ico`,
202756
+ url: search3.u,
201243
202757
  bang
201244
202758
  });
201245
202759
  }
@@ -201296,7 +202810,7 @@ var require_search = __commonJS((exports) => {
201296
202810
  }
201297
202811
  return results;
201298
202812
  }
201299
- exports.search = search;
202813
+ exports.search = search2;
201300
202814
  function sanityCheck(options2) {
201301
202815
  options2 = Object.assign({}, defaultOptions2, options2);
201302
202816
  if (!(options2.safeSearch in util_1.SafeSearchType))
@@ -201836,10 +203350,10 @@ var init_duckduckgo = __esm(() => {
201836
203350
  },
201837
203351
  async search(input, signal) {
201838
203352
  const start = performance.now();
201839
- let search;
203353
+ let search2;
201840
203354
  let SafeSearchType;
201841
203355
  try {
201842
- ({ search, SafeSearchType } = await Promise.resolve().then(() => __toESM(require_lib5(), 1)));
203356
+ ({ search: search2, SafeSearchType } = await Promise.resolve().then(() => __toESM(require_lib5(), 1)));
201843
203357
  } catch {
201844
203358
  throw new Error("duck-duck-scrape package not installed. Run: npm install duck-duck-scrape");
201845
203359
  }
@@ -201850,7 +203364,7 @@ var init_duckduckgo = __esm(() => {
201850
203364
  if (signal?.aborted)
201851
203365
  throw new DOMException("Aborted", "AbortError");
201852
203366
  try {
201853
- const response = await withWebSearchTimeout((combinedSignal) => search(input.query, { safeSearch: SafeSearchType.STRICT }, { signal: combinedSignal }), signal, { providerName: "DuckDuckGo" });
203367
+ const response = await withWebSearchTimeout((combinedSignal) => search2(input.query, { safeSearch: SafeSearchType.STRICT }, { signal: combinedSignal }), signal, { providerName: "DuckDuckGo" });
201854
203368
  const hits = applyDomainFilters(response.results.map((r) => ({
201855
203369
  title: r.title || r.url,
201856
203370
  url: r.url,
@@ -205783,9 +207297,9 @@ ${filenames.join(`
205783
207297
  });
205784
207298
 
205785
207299
  // sdk-missing-stub:../../context/repoMap/index.js
205786
- var noop133 = () => null, buildRepoMap;
207300
+ var noop134 = () => null, buildRepoMap;
205787
207301
  var init_repoMap2 = __esm(() => {
205788
- buildRepoMap = noop133;
207302
+ buildRepoMap = noop134;
205789
207303
  });
205790
207304
 
205791
207305
  // src/tools/RepoMapTool/prompt.ts
@@ -205940,9 +207454,9 @@ ${output.rendered}`
205940
207454
  });
205941
207455
 
205942
207456
  // sdk-missing-stub:src/components/MessageResponse.js
205943
- var noop134 = () => null, MessageResponse2;
207457
+ var noop135 = () => null, MessageResponse2;
205944
207458
  var init_MessageResponse2 = __esm(() => {
205945
- MessageResponse2 = noop134;
207459
+ MessageResponse2 = noop135;
205946
207460
  });
205947
207461
 
205948
207462
  // src/tools/AskUserQuestionTool/AskUserQuestionTool.tsx
@@ -206096,11 +207610,11 @@ var init_AskUserQuestionTool = __esm(() => {
206096
207610
  return DESCRIPTION2;
206097
207611
  },
206098
207612
  async prompt() {
206099
- const format4 = getQuestionPreviewFormat();
206100
- if (format4 === undefined) {
207613
+ const format5 = getQuestionPreviewFormat();
207614
+ if (format5 === undefined) {
206101
207615
  return ASK_USER_QUESTION_TOOL_PROMPT;
206102
207616
  }
206103
- return ASK_USER_QUESTION_TOOL_PROMPT + PREVIEW_FEATURE_PROMPT[format4];
207617
+ return ASK_USER_QUESTION_TOOL_PROMPT + PREVIEW_FEATURE_PROMPT[format5];
206104
207618
  },
206105
207619
  get inputSchema() {
206106
207620
  return inputSchema25();
@@ -218214,9 +219728,11 @@ function getMaxActiveMessagesHardCap(env4 = process.env) {
218214
219728
  const parsed = parseMaxActiveMessagesLimit(trimmed);
218215
219729
  return parsed > 0 ? parsed : DEFAULT_MAX_ACTIVE_MESSAGES_HARD_CAP;
218216
219730
  }
218217
- function resolveMaxActiveMessagesLimit(configSetting, envSetting) {
218218
- const configuredLimit = configSetting !== undefined && configSetting !== "off" ? parseMaxActiveMessagesLimit(configSetting) : parseMaxActiveMessagesLimit(envSetting);
218219
- const hardCap = getMaxActiveMessagesHardCap();
219731
+ function resolveMaxActiveMessagesLimit(configSetting, envSetting, hardCap = getMaxActiveMessagesHardCap()) {
219732
+ if (configSetting === "off") {
219733
+ return parseMaxActiveMessagesLimit(envSetting);
219734
+ }
219735
+ const configuredLimit = configSetting !== undefined ? parseMaxActiveMessagesLimit(configSetting) : parseMaxActiveMessagesLimit(envSetting);
218220
219736
  if (configuredLimit > 0 && hardCap > 0) {
218221
219737
  return Math.min(configuredLimit, hardCap);
218222
219738
  }
@@ -222835,7 +224351,7 @@ function getPrompt12() {
222835
224351
  ## When to Use This Tool
222836
224352
 
222837
224353
  - When the user asks what another active session is actually working on
222838
- - To see the most recent user prompts and assistant replies of a peer, beyond the metadata returned by HallPeers
224354
+ - To follow a peer's live progress: which files it is editing, what commands it runs, and their results
222839
224355
  - Before coordinating on shared files, to understand the peer's current intent
222840
224356
 
222841
224357
  ## Privacy
@@ -222845,13 +224361,19 @@ This reads the peer's transcript JSONL from this machine's OpenClaude config hom
222845
224361
  ## Input
222846
224362
 
222847
224363
  - **session_id** (optional): a peer session id from HallPeers. When omitted, reads every peer in this workspace.
222848
- - **limit** (optional): how many recent messages per peer to return (1-30, default 8).
224364
+ - **limit** (optional): how many recent activity events per peer to return (1-100, default 50).
222849
224365
 
222850
224366
  ## Output
222851
224367
 
222852
- For each peer: the session id, agent name, whether its transcript was found, and a list of recent messages with role and text.`;
224368
+ For each peer: the session id, agent name, whether its transcript was found, and a list of recent events in order. Each event has a role:
224369
+
224370
+ - **user** / **assistant**: conversation text.
224371
+ - **tool_use** (shown as \`[→] ToolName: key-argument\`): a tool the peer invoked, e.g. \`[→] Bash: bun test ./src/hall/\`.
224372
+ - **tool_result** (shown as \`[←] ToolName: result-summary\`): that tool's outcome.
224373
+
224374
+ Because tool calls and results are included, this reflects the peer's live progress within a long turn, not just its opening messages.`;
222853
224375
  }
222854
- var DESCRIPTION20 = "Read a peer session's recent conversation from its local transcript (Agent Hall)";
224376
+ var DESCRIPTION20 = "Read a peer session's recent activity (messages, tool calls, results) from its local transcript (Agent Hall)";
222855
224377
 
222856
224378
  // src/tools/HallPeerActivityTool/transcript.ts
222857
224379
  import { open as open9, readdir as readdir14, stat as stat22 } from "fs/promises";
@@ -222907,30 +224429,57 @@ function textOfContent2(content) {
222907
224429
  return parts.join(`
222908
224430
  `);
222909
224431
  }
222910
- function isToolResultOnly(content) {
222911
- if (!Array.isArray(content) || content.length === 0)
222912
- return false;
222913
- return content.every((b) => b !== null && typeof b === "object" && b.type === "tool_result");
222914
- }
222915
- async function readPeerMessages(sessionId, limit) {
222916
- const path13 = await findTranscriptPath(sessionId);
222917
- if (!path13)
222918
- return { found: false, messages: [] };
222919
- const tail = await readTail(path13, TAIL_BYTES);
222920
- const lines = tail.split(`
222921
- `);
222922
- const messages = [];
222923
- for (const rawLine of lines) {
224432
+ function summarizeToolInput2(input) {
224433
+ if (!input || typeof input !== "object")
224434
+ return "";
224435
+ const i3 = input;
224436
+ const candidate = i3.command ?? i3.file_path ?? i3.path ?? i3.pattern ?? i3.query ?? i3.url ?? i3.description;
224437
+ if (typeof candidate === "string")
224438
+ return clip(candidate, MAX_TOOL_CHARS);
224439
+ if (Array.isArray(i3.file_paths))
224440
+ return clip(i3.file_paths.join(", "), MAX_TOOL_CHARS);
224441
+ return clip(JSON.stringify(i3), MAX_TOOL_CHARS);
224442
+ }
224443
+ function summarizeToolResult(content) {
224444
+ const text = textOfContent2(content);
224445
+ return text ? clip(text, MAX_TOOL_CHARS) : "";
224446
+ }
224447
+ function parseRecords(tail) {
224448
+ const records = [];
224449
+ for (const rawLine of tail.split(`
224450
+ `)) {
222924
224451
  const line = rawLine.trim();
222925
224452
  if (!line)
222926
224453
  continue;
222927
- let rec;
222928
224454
  try {
222929
- rec = JSON.parse(line);
222930
- } catch {
224455
+ const rec = JSON.parse(line);
224456
+ records.push({ type: String(rec.type ?? ""), rec });
224457
+ } catch {}
224458
+ }
224459
+ return records;
224460
+ }
224461
+ function collectToolNames(records) {
224462
+ const names = new Map;
224463
+ for (const { type, rec } of records) {
224464
+ if (type !== "assistant")
222931
224465
  continue;
224466
+ const message = rec.message;
224467
+ if (!message || !Array.isArray(message.content))
224468
+ continue;
224469
+ for (const block2 of message.content) {
224470
+ if (!block2 || typeof block2 !== "object")
224471
+ continue;
224472
+ const b = block2;
224473
+ if (b.type === "tool_use" && typeof b.id === "string") {
224474
+ names.set(b.id, typeof b.name === "string" ? b.name : "tool");
224475
+ }
222932
224476
  }
222933
- const type = rec.type;
224477
+ }
224478
+ return names;
224479
+ }
224480
+ function buildMessages(records, toolNames) {
224481
+ const messages = [];
224482
+ for (const { type, rec } of records) {
222934
224483
  if (type !== "user" && type !== "assistant")
222935
224484
  continue;
222936
224485
  if (rec.isMeta === true)
@@ -222939,16 +224488,51 @@ async function readPeerMessages(sessionId, limit) {
222939
224488
  if (!message)
222940
224489
  continue;
222941
224490
  const content = message.content;
222942
- if (type === "user" && isToolResultOnly(content))
224491
+ if (Array.isArray(content)) {
224492
+ for (const block2 of content) {
224493
+ if (!block2 || typeof block2 !== "object")
224494
+ continue;
224495
+ const b = block2;
224496
+ if (b.type === "text" && typeof b.text === "string") {
224497
+ const body2 = clip(b.text);
224498
+ if (body2)
224499
+ messages.push({ role: type, text: body2 });
224500
+ } else if (type === "assistant" && b.type === "tool_use") {
224501
+ const name = typeof b.name === "string" ? b.name : "tool";
224502
+ const arg = summarizeToolInput2(b.input);
224503
+ messages.push({
224504
+ role: "tool_use",
224505
+ text: arg ? `${name}: ${arg}` : name
224506
+ });
224507
+ } else if (type === "user" && b.type === "tool_result") {
224508
+ const summary = summarizeToolResult(b.content);
224509
+ if (!summary)
224510
+ continue;
224511
+ const id = typeof b.tool_use_id === "string" ? b.tool_use_id : "";
224512
+ const name = toolNames.get(id) ?? "tool";
224513
+ messages.push({ role: "tool_result", text: `${name}: ${summary}` });
224514
+ }
224515
+ }
222943
224516
  continue;
224517
+ }
222944
224518
  const body = textOfContent2(content);
222945
- if (!body.trim())
222946
- continue;
222947
- messages.push({ role: type, text: clip(body) });
224519
+ if (body.trim()) {
224520
+ messages.push({ role: type, text: clip(body) });
224521
+ }
222948
224522
  }
224523
+ return messages;
224524
+ }
224525
+ async function readPeerMessages(sessionId, limit) {
224526
+ const path13 = await findTranscriptPath(sessionId);
224527
+ if (!path13)
224528
+ return { found: false, messages: [] };
224529
+ const tail = await readTail(path13, TAIL_BYTES);
224530
+ const records = parseRecords(tail);
224531
+ const toolNames = collectToolNames(records);
224532
+ const messages = buildMessages(records, toolNames);
222949
224533
  return { found: true, messages: messages.slice(-limit) };
222950
224534
  }
222951
- var TAIL_BYTES, MAX_MSG_CHARS = 400;
224535
+ var TAIL_BYTES, MAX_MSG_CHARS = 400, MAX_TOOL_CHARS = 160;
222952
224536
  var init_transcript = __esm(() => {
222953
224537
  init_envUtils();
222954
224538
  TAIL_BYTES = 512 * 1024;
@@ -222967,7 +224551,7 @@ var init_HallPeerActivityTool = __esm(() => {
222967
224551
  init_transcript();
222968
224552
  inputSchema45 = lazySchema(() => exports_external.strictObject({
222969
224553
  session_id: exports_external.string().optional().describe("Target a specific peer session id; omit to read all workspace peers"),
222970
- limit: exports_external.number().int().min(1).max(30).optional().describe("Recent messages per peer (default 8, max 30)")
224554
+ limit: exports_external.number().int().min(1).max(100).optional().describe("Recent activity events per peer (default 50, max 100)")
222971
224555
  }));
222972
224556
  outputSchema35 = lazySchema(() => exports_external.object({
222973
224557
  connected: exports_external.boolean(),
@@ -223018,7 +224602,7 @@ var init_HallPeerActivityTool = __esm(() => {
223018
224602
  if (!client2 || !client2.isConnected) {
223019
224603
  return { data: { connected: false, peers: [] } };
223020
224604
  }
223021
- const limit = input.limit ?? 8;
224605
+ const limit = input.limit ?? 50;
223022
224606
  let targets;
223023
224607
  if (input.session_id) {
223024
224608
  targets = [{ session_id: input.session_id, agent_name: input.session_id }];
@@ -223067,7 +224651,13 @@ Transcript not found on this machine.`;
223067
224651
  return `${header}
223068
224652
  No recent messages.`;
223069
224653
  }
223070
- const lines = peer.messages.map((m) => `[${m.role}] ${m.text}`);
224654
+ const lines = peer.messages.map((m) => {
224655
+ if (m.role === "tool_use")
224656
+ return ` [→] ${m.text}`;
224657
+ if (m.role === "tool_result")
224658
+ return ` [←] ${m.text}`;
224659
+ return `[${m.role}] ${m.text}`;
224660
+ });
223071
224661
  return `${header}
223072
224662
  ${lines.join(`
223073
224663
  `)}`;
@@ -223316,9 +224906,9 @@ __export(exports_PowerShellTool, {
223316
224906
  default: () => PowerShellTool_default,
223317
224907
  __stub: () => __stub5
223318
224908
  });
223319
- var noop135 = () => null, PowerShellTool_default, __stub5 = true;
224909
+ var noop136 = () => null, PowerShellTool_default, __stub5 = true;
223320
224910
  var init_PowerShellTool = __esm(() => {
223321
- PowerShellTool_default = noop135;
224911
+ PowerShellTool_default = noop136;
223322
224912
  });
223323
224913
 
223324
224914
  // src/tools.ts
@@ -223557,9 +225147,9 @@ var init_copilotOptimization = __esm(() => {
223557
225147
  });
223558
225148
 
223559
225149
  // sdk-missing-stub:../BashTool/UI.js
223560
- var noop136 = () => null, BackgroundHint2;
225150
+ var noop137 = () => null, BackgroundHint2;
223561
225151
  var init_UI4 = __esm(() => {
223562
- BackgroundHint2 = noop136;
225152
+ BackgroundHint2 = noop137;
223563
225153
  });
223564
225154
 
223565
225155
  // src/utils/swarm/teammateModel.ts
@@ -223577,9 +225167,9 @@ __export(exports_It2SetupPrompt, {
223577
225167
  default: () => It2SetupPrompt_default,
223578
225168
  __stub: () => __stub6
223579
225169
  });
223580
- var noop137 = () => null, It2SetupPrompt_default, __stub6 = true;
225170
+ var noop138 = () => null, It2SetupPrompt_default, __stub6 = true;
223581
225171
  var init_It2SetupPrompt = __esm(() => {
223582
- It2SetupPrompt_default = noop137;
225172
+ It2SetupPrompt_default = noop138;
223583
225173
  });
223584
225174
 
223585
225175
  // src/tools/shared/spawnMultiAgent.ts
@@ -226840,7 +228430,7 @@ var init_prefetch = __esm(() => {
226840
228430
 
226841
228431
  // src/utils/attachments.ts
226842
228432
  import { readdir as readdir16, stat as stat23 } from "fs/promises";
226843
- import nodePath2, { dirname as dirname40, parse as parse9, relative as relative12, resolve as resolve28 } from "path";
228433
+ import nodePath2, { dirname as dirname40, parse as parse10, relative as relative12, resolve as resolve28 } from "path";
226844
228434
  import { randomUUID as randomUUID16 } from "crypto";
226845
228435
  function shouldIncludeSkillListingAttachment(querySource) {
226846
228436
  return !(typeof querySource === "string" && SKILL_LISTING_SUPPRESSED_QUERY_SOURCES.has(querySource));
@@ -227322,7 +228912,7 @@ function getDirectoriesToProcess(targetPath, originalCwd) {
227322
228912
  const targetDir = dirname40(resolve28(targetPath));
227323
228913
  const nestedDirs = [];
227324
228914
  let currentDir = targetDir;
227325
- while (currentDir !== originalCwd && currentDir !== parse9(currentDir).root) {
228915
+ while (currentDir !== originalCwd && currentDir !== parse10(currentDir).root) {
227326
228916
  if (isPathUnder(currentDir, originalCwd)) {
227327
228917
  nestedDirs.push(currentDir);
227328
228918
  }
@@ -227331,7 +228921,7 @@ function getDirectoriesToProcess(targetPath, originalCwd) {
227331
228921
  nestedDirs.reverse();
227332
228922
  const cwdLevelDirs = [];
227333
228923
  currentDir = originalCwd;
227334
- while (currentDir !== parse9(currentDir).root) {
228924
+ while (currentDir !== parse10(currentDir).root) {
227335
228925
  cwdLevelDirs.push(currentDir);
227336
228926
  currentDir = dirname40(currentDir);
227337
228927
  }
@@ -228001,7 +229591,7 @@ async function* getAttachmentMessages(input, toolUseContext, ideSelection, queue
228001
229591
  }
228002
229592
  }
228003
229593
  async function tryGetPDFReference(filename) {
228004
- const ext = parse9(filename).ext.toLowerCase();
229594
+ const ext = parse10(filename).ext.toLowerCase();
228005
229595
  if (!isPDFExtension(ext)) {
228006
229596
  return null;
228007
229597
  }
@@ -228035,7 +229625,7 @@ async function generateFileAttachment(filename, toolUseContext, successEventName
228035
229625
  return null;
228036
229626
  }
228037
229627
  if (mode === "at-mention" && !isFileWithinReadSizeLimit(filename, getDefaultFileReadingLimits().maxSizeBytes)) {
228038
- const ext = parse9(filename).ext.toLowerCase();
229628
+ const ext = parse10(filename).ext.toLowerCase();
228039
229629
  if (!isPDFExtension(ext)) {
228040
229630
  try {
228041
229631
  const stats = await getFsImplementation().stat(filename);
@@ -233681,9 +235271,9 @@ var init_providerFallback = __esm(() => {
233681
235271
  });
233682
235272
 
233683
235273
  // sdk-missing-stub:../keybindings/shortcutFormat.js
233684
- var noop138 = () => null, getShortcutDisplay;
235274
+ var noop139 = () => null, getShortcutDisplay;
233685
235275
  var init_shortcutFormat = __esm(() => {
233686
- getShortcutDisplay = noop138;
235276
+ getShortcutDisplay = noop139;
233687
235277
  });
233688
235278
 
233689
235279
  // src/services/autoDream/config.ts
@@ -236855,7 +238445,7 @@ function getAnthropicEnvMetadata() {
236855
238445
  function getBuildAgeMinutes() {
236856
238446
  if (false)
236857
238447
  ;
236858
- const buildTime = new Date("2026-10-02T04:00:23.815Z").getTime();
238448
+ const buildTime = new Date("2026-10-17T12:42:18.156Z").getTime();
236859
238449
  if (isNaN(buildTime))
236860
238450
  return;
236861
238451
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -239261,9 +240851,9 @@ var init_hintRecommendation = __esm(() => {
239261
240851
  });
239262
240852
 
239263
240853
  // sdk-missing-stub:../FileEditTool/UI.js
239264
- var noop139 = () => null, userFacingName2;
240854
+ var noop140 = () => null, userFacingName2;
239265
240855
  var init_UI5 = __esm(() => {
239266
- userFacingName2 = noop139;
240856
+ userFacingName2 = noop140;
239267
240857
  });
239268
240858
 
239269
240859
  // src/tools/BashTool/commandSemantics.ts
@@ -242646,9 +244236,9 @@ __export(exports_PowerShellTool2, {
242646
244236
  default: () => PowerShellTool_default2,
242647
244237
  __stub: () => __stub7
242648
244238
  });
242649
- var noop140 = () => null, PowerShellTool_default2, __stub7 = true;
244239
+ var noop141 = () => null, PowerShellTool_default2, __stub7 = true;
242650
244240
  var init_PowerShellTool2 = __esm(() => {
242651
- PowerShellTool_default2 = noop140;
244241
+ PowerShellTool_default2 = noop141;
242652
244242
  });
242653
244243
 
242654
244244
  // src/utils/promptShellExecution.ts
@@ -243415,94 +245005,94 @@ var init_bundledSkills = __esm(() => {
243415
245005
  });
243416
245006
 
243417
245007
  // sdk-missing-stub:./commands/env/index.js
243418
- var noop141 = () => null, env_default;
245008
+ var noop142 = () => null, env_default;
243419
245009
  var init_env2 = __esm(() => {
243420
- env_default = noop141;
245010
+ env_default = noop142;
243421
245011
  });
243422
245012
 
243423
245013
  // sdk-missing-stub:./commands/exit/index.js
243424
- var noop142 = () => null, exit_default;
245014
+ var noop143 = () => null, exit_default;
243425
245015
  var init_exit = __esm(() => {
243426
- exit_default = noop142;
245016
+ exit_default = noop143;
243427
245017
  });
243428
245018
 
243429
245019
  // sdk-missing-stub:./commands/export/index.js
243430
- var noop143 = () => null, export_default;
245020
+ var noop144 = () => null, export_default;
243431
245021
  var init_export = __esm(() => {
243432
- export_default = noop143;
245022
+ export_default = noop144;
243433
245023
  });
243434
245024
 
243435
245025
  // sdk-missing-stub:./commands/model/index.js
243436
- var noop144 = () => null, model_default;
245026
+ var noop145 = () => null, model_default;
243437
245027
  var init_model2 = __esm(() => {
243438
- model_default = noop144;
245028
+ model_default = noop145;
243439
245029
  });
243440
245030
 
243441
245031
  // sdk-missing-stub:./commands/tag/index.js
243442
- var noop145 = () => null, tag_default;
245032
+ var noop146 = () => null, tag_default;
243443
245033
  var init_tag = __esm(() => {
243444
- tag_default = noop145;
245034
+ tag_default = noop146;
243445
245035
  });
243446
245036
 
243447
245037
  // sdk-missing-stub:./commands/output-style/index.js
243448
- var noop146 = () => null, output_style_default;
245038
+ var noop147 = () => null, output_style_default;
243449
245039
  var init_output_style = __esm(() => {
243450
- output_style_default = noop146;
245040
+ output_style_default = noop147;
243451
245041
  });
243452
245042
 
243453
245043
  // sdk-missing-stub:./commands/remote-env/index.js
243454
- var noop147 = () => null, remote_env_default;
245044
+ var noop148 = () => null, remote_env_default;
243455
245045
  var init_remote_env = __esm(() => {
243456
- remote_env_default = noop147;
245046
+ remote_env_default = noop148;
243457
245047
  });
243458
245048
 
243459
245049
  // sdk-missing-stub:./commands/upgrade/index.js
243460
- var noop148 = () => null, upgrade_default;
245050
+ var noop149 = () => null, upgrade_default;
243461
245051
  var init_upgrade = __esm(() => {
243462
- upgrade_default = noop148;
245052
+ upgrade_default = noop149;
243463
245053
  });
243464
245054
 
243465
245055
  // sdk-missing-stub:./commands/extra-usage/index.js
243466
- var noop149 = () => null, extraUsage, extraUsageNonInteractive;
245056
+ var noop150 = () => null, extraUsage, extraUsageNonInteractive;
243467
245057
  var init_extra_usage = __esm(() => {
243468
- extraUsage = noop149;
243469
- extraUsageNonInteractive = noop149;
245058
+ extraUsage = noop150;
245059
+ extraUsageNonInteractive = noop150;
243470
245060
  });
243471
245061
 
243472
245062
  // sdk-missing-stub:./commands/rate-limit-options/index.js
243473
- var noop150 = () => null, rate_limit_options_default;
245063
+ var noop151 = () => null, rate_limit_options_default;
243474
245064
  var init_rate_limit_options = __esm(() => {
243475
- rate_limit_options_default = noop150;
245065
+ rate_limit_options_default = noop151;
243476
245066
  });
243477
245067
 
243478
245068
  // sdk-missing-stub:./commands/statusline.js
243479
- var noop151 = () => null, statusline_default;
245069
+ var noop152 = () => null, statusline_default;
243480
245070
  var init_statusline = __esm(() => {
243481
- statusline_default = noop151;
245071
+ statusline_default = noop152;
243482
245072
  });
243483
245073
 
243484
245074
  // sdk-missing-stub:./commands/effort/index.js
243485
- var noop152 = () => null, effort_default;
245075
+ var noop153 = () => null, effort_default;
243486
245076
  var init_effort2 = __esm(() => {
243487
- effort_default = noop152;
245077
+ effort_default = noop153;
243488
245078
  });
243489
245079
 
243490
245080
  // sdk-missing-stub:./commands/stats/index.js
243491
- var noop153 = () => null, stats_default;
245081
+ var noop154 = () => null, stats_default;
243492
245082
  var init_stats = __esm(() => {
243493
- stats_default = noop153;
245083
+ stats_default = noop154;
243494
245084
  });
243495
245085
 
243496
245086
  // sdk-missing-stub:./commands/oauth-refresh/index.js
243497
- var noop154 = () => null, oauth_refresh_default;
245087
+ var noop155 = () => null, oauth_refresh_default;
243498
245088
  var init_oauth_refresh = __esm(() => {
243499
- oauth_refresh_default = noop154;
245089
+ oauth_refresh_default = noop155;
243500
245090
  });
243501
245091
 
243502
245092
  // sdk-missing-stub:./commands/debug-tool-call/index.js
243503
- var noop155 = () => null, debug_tool_call_default;
245093
+ var noop156 = () => null, debug_tool_call_default;
243504
245094
  var init_debug_tool_call = __esm(() => {
243505
- debug_tool_call_default = noop155;
245095
+ debug_tool_call_default = noop156;
243506
245096
  });
243507
245097
 
243508
245098
  // src/types/command.ts
@@ -243525,9 +245115,9 @@ __export(exports_agents_platform, {
243525
245115
  default: () => agents_platform_default,
243526
245116
  __stub: () => __stub8
243527
245117
  });
243528
- var noop156 = () => null, agents_platform_default, __stub8 = true;
245118
+ var noop157 = () => null, agents_platform_default, __stub8 = true;
243529
245119
  var init_agents_platform = __esm(() => {
243530
- agents_platform_default = noop156;
245120
+ agents_platform_default = noop157;
243531
245121
  });
243532
245122
 
243533
245123
  // sdk-missing-stub:./commands/hall/index.js
@@ -243536,9 +245126,9 @@ __export(exports_hall, {
243536
245126
  default: () => hall_default,
243537
245127
  __stub: () => __stub9
243538
245128
  });
243539
- var noop157 = () => null, hall_default, __stub9 = true;
245129
+ var noop158 = () => null, hall_default, __stub9 = true;
243540
245130
  var init_hall = __esm(() => {
243541
- hall_default = noop157;
245131
+ hall_default = noop158;
243542
245132
  });
243543
245133
 
243544
245134
  // sdk-missing-stub:./commands/buddy/index.js
@@ -243547,9 +245137,9 @@ __export(exports_buddy, {
243547
245137
  default: () => buddy_default,
243548
245138
  __stub: () => __stub10
243549
245139
  });
243550
- var noop158 = () => null, buddy_default, __stub10 = true;
245140
+ var noop159 = () => null, buddy_default, __stub10 = true;
243551
245141
  var init_buddy = __esm(() => {
243552
- buddy_default = noop158;
245142
+ buddy_default = noop159;
243553
245143
  });
243554
245144
 
243555
245145
  // sdk-missing-stub:./commands/insights.js
@@ -243558,9 +245148,9 @@ __export(exports_insights, {
243558
245148
  default: () => insights_default,
243559
245149
  __stub: () => __stub11
243560
245150
  });
243561
- var noop159 = () => null, insights_default, __stub11 = true;
245151
+ var noop160 = () => null, insights_default, __stub11 = true;
243562
245152
  var init_insights = __esm(() => {
243563
- insights_default = noop159;
245153
+ insights_default = noop160;
243564
245154
  });
243565
245155
 
243566
245156
  // src/commands.ts
@@ -243800,6 +245390,7 @@ var init_commands = __esm(() => {
243800
245390
  init_resume();
243801
245391
  init_review();
243802
245392
  init_session();
245393
+ init_sessions();
243803
245394
  init_set_context_window();
243804
245395
  init_share();
243805
245396
  init_skills();
@@ -243984,6 +245575,7 @@ var init_commands = __esm(() => {
243984
245575
  requestSizeNonInteractive,
243985
245576
  resume_default,
243986
245577
  session_default,
245578
+ sessions_default,
243987
245579
  set_context_window_default,
243988
245580
  skills_default,
243989
245581
  stats_default,
@@ -245358,6 +246950,7 @@ function messageTokenCountFromLastAPIResponse(messages) {
245358
246950
  return 0;
245359
246951
  }
245360
246952
  function getCurrentUsage(messages) {
246953
+ messages = getMessagesAfterCompactBoundary(messages);
245361
246954
  for (let i3 = messages.length - 1;i3 >= 0; i3--) {
245362
246955
  const message = messages[i3];
245363
246956
  const usage = message ? getTokenUsage(message) : undefined;
@@ -246137,8 +247730,11 @@ __export(exports_autoCompact, {
246137
247730
  function getEffectiveContextWindowSize(model, runtimeLimits) {
246138
247731
  const reservedTokensForSummary = Math.min(runtimeLimits?.maxOutputTokens ?? getMaxOutputTokensForModel(model), MAX_OUTPUT_TOKENS_FOR_SUMMARY);
246139
247732
  let contextWindow = getContextWindowForModel(model, getSdkBetas(), runtimeLimits);
247733
+ const internalContextWindowOverride = process.env.USER_TYPE === "ant" ? parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS ?? "", 10) : NaN;
247734
+ const internalOverrideTakesPrecedence = Number.isFinite(internalContextWindowOverride) && internalContextWindowOverride > 0;
247735
+ const hasSessionOverride = getSessionContextWindowOverride(model) !== undefined && !internalOverrideTakesPrecedence;
246140
247736
  const autoCompactWindow = process.env.CLAUDE_CODE_AUTO_COMPACT_WINDOW;
246141
- if (autoCompactWindow) {
247737
+ if (autoCompactWindow && !hasSessionOverride) {
246142
247738
  const parsed = parseInt(autoCompactWindow, 10);
246143
247739
  if (!isNaN(parsed) && parsed > 0) {
246144
247740
  contextWindow = Math.min(contextWindow, parsed);
@@ -248420,7 +250016,7 @@ async function* openaiStreamToAnthropic(response, model, signal, isOllama, reque
248420
250016
  }
248421
250017
  }
248422
250018
  }
248423
- if (!hasEmittedFinalUsage && chunkUsage && (chunk.choices?.length ?? 0) === 0 && lastStopReason !== null) {
250019
+ if (!hasEmittedFinalUsage && chunkUsage && lastStopReason !== null) {
248424
250020
  throwIfStreamAborted2(signal);
248425
250021
  yield {
248426
250022
  type: "message_delta",
@@ -256200,10 +257796,10 @@ var init_dangerousModePromptRuntime = __esm(() => {
256200
257796
  });
256201
257797
 
256202
257798
  // sdk-missing-stub:../../commands/add-dir/validation.js
256203
- var noop160 = () => null, addDirHelpMessage, validateDirectoryForWorkspace;
257799
+ var noop161 = () => null, addDirHelpMessage, validateDirectoryForWorkspace;
256204
257800
  var init_validation3 = __esm(() => {
256205
- addDirHelpMessage = noop160;
256206
- validateDirectoryForWorkspace = noop160;
257801
+ addDirHelpMessage = noop161;
257802
+ validateDirectoryForWorkspace = noop161;
256207
257803
  });
256208
257804
 
256209
257805
  // src/utils/permissions/dangerousPatterns.ts
@@ -261968,6 +263564,7 @@ __export(exports_sessionStorage, {
261968
263564
  saveAgentSetting: () => saveAgentSetting,
261969
263565
  saveAgentName: () => saveAgentName,
261970
263566
  saveAgentColor: () => saveAgentColor,
263567
+ restoreSessionWrites: () => restoreSessionWrites,
261971
263568
  restoreSessionMetadata: () => restoreSessionMetadata,
261972
263569
  resetTranscriptRewriteHooksForTesting: () => resetTranscriptRewriteHooksForTesting,
261973
263570
  resetSessionFilePointer: () => resetSessionFilePointer,
@@ -262027,6 +263624,7 @@ __export(exports_sessionStorage, {
262027
263624
  getCurrentSessionAgentColor: () => getCurrentSessionAgentColor,
262028
263625
  getAgentTranscriptPath: () => getAgentTranscriptPath,
262029
263626
  getAgentTranscript: () => getAgentTranscript,
263627
+ forgetDeletedSession: () => forgetDeletedSession,
262030
263628
  flushSessionStorage: () => flushSessionStorage,
262031
263629
  findUnresolvedToolUse: () => findUnresolvedToolUse,
262032
263630
  fetchLogs: () => fetchLogs,
@@ -262056,7 +263654,7 @@ import {
262056
263654
  unlink as unlink10,
262057
263655
  writeFile as writeFile23
262058
263656
  } from "fs/promises";
262059
- import { basename as basename26, dirname as dirname47, join as join92 } from "path";
263657
+ import { basename as basename26, dirname as dirname47, join as join92, resolve as resolvePath2 } from "path";
262060
263658
  function getBuiltInCommandNames() {
262061
263659
  if (builtInCommandNamesCache)
262062
263660
  return builtInCommandNamesCache;
@@ -262257,6 +263855,16 @@ function isTranscriptMessage(entry) {
262257
263855
  function isChainParticipant(m) {
262258
263856
  return m.type !== "progress";
262259
263857
  }
263858
+ function startsConversation(message) {
263859
+ if (message.type === "assistant") {
263860
+ return message.message.model !== SYNTHETIC_MODEL;
263861
+ }
263862
+ if (message.type !== "user" || message.isMeta)
263863
+ return false;
263864
+ const content = message.message.content;
263865
+ const blocks = typeof content === "string" ? [{ type: "text", text: content }] : content;
263866
+ return blocks.some((block2) => block2.type !== "text" || !LOCAL_COMMAND_TAGS.some((tag2) => block2.text.trimStart().startsWith(`<${tag2}>`)));
263867
+ }
262260
263868
  function isLegacyProgressEntry(entry) {
262261
263869
  return typeof entry === "object" && entry !== null && "type" in entry && entry.type === "progress" && "uuid" in entry && typeof entry.uuid === "string";
262262
263870
  }
@@ -262448,6 +264056,7 @@ class Project {
262448
264056
  currentSessionBranch;
262449
264057
  sessionFile = null;
262450
264058
  pendingEntries = [];
264059
+ pendingEntriesSessionId = null;
262451
264060
  remoteIngressUrl = null;
262452
264061
  internalEventWriter = null;
262453
264062
  internalEventReader = null;
@@ -262549,6 +264158,8 @@ class Project {
262549
264158
  this.scheduleDrain();
262550
264159
  }
262551
264160
  async appendDirectlyToFile(filePath, data) {
264161
+ if (this.isDeletedSessionFile(filePath))
264162
+ return;
262552
264163
  transcriptRewriteHooksForTesting.beforeFileAppend?.(filePath);
262553
264164
  await mkdir25(dirname47(filePath), { recursive: true, mode: 448 });
262554
264165
  await withTranscriptFileLock(filePath, async (signal) => {
@@ -262600,6 +264211,8 @@ class Project {
262600
264211
  const earlierDirectAppends = this.pendingDirectAppends.get(filePath);
262601
264212
  if (earlierDirectAppends)
262602
264213
  await Promise.all(earlierDirectAppends);
264214
+ if (this.isDeletedSessionFile(filePath))
264215
+ return;
262603
264216
  await withTranscriptFileLock(filePath, (signal) => rewrite(signal));
262604
264217
  transcriptRewriteHooksForTesting.beforeBarrierRelease?.(filePath);
262605
264218
  }
@@ -262715,6 +264328,13 @@ class Project {
262715
264328
  resetSessionFile() {
262716
264329
  this.sessionFile = null;
262717
264330
  this.pendingEntries = [];
264331
+ this.pendingEntriesSessionId = null;
264332
+ }
264333
+ dropForeignPendingEntries(sessionId) {
264334
+ if (this.pendingEntriesSessionId !== null && this.pendingEntriesSessionId !== sessionId) {
264335
+ this.pendingEntries = [];
264336
+ this.pendingEntriesSessionId = null;
264337
+ }
262718
264338
  }
262719
264339
  reAppendSessionMetadata(skipTitleRefresh = false) {
262720
264340
  if (!this.sessionFile)
@@ -262901,11 +264521,13 @@ class Project {
262901
264521
  async materializeSessionFile() {
262902
264522
  if (this.shouldSkipPersistence())
262903
264523
  return;
264524
+ this.dropForeignPendingEntries(getSessionId());
262904
264525
  this.ensureCurrentSessionFile();
262905
264526
  this.reAppendSessionMetadata();
262906
264527
  if (this.pendingEntries.length > 0) {
262907
264528
  const buffered = this.pendingEntries;
262908
264529
  this.pendingEntries = [];
264530
+ this.pendingEntriesSessionId = null;
262909
264531
  for (const entry of buffered) {
262910
264532
  await this.appendEntry(entry);
262911
264533
  }
@@ -262914,7 +264536,7 @@ class Project {
262914
264536
  async insertMessageChain(messages, isSidechain = false, agentId, startingParentUuid, teamInfo) {
262915
264537
  return this.trackWrite(async () => {
262916
264538
  let parentUuid = startingParentUuid ?? null;
262917
- if (this.sessionFile === null && messages.some((m) => m.type === "user" || m.type === "assistant")) {
264539
+ if (this.sessionFile === null && messages.some(startsConversation)) {
262918
264540
  await this.materializeSessionFile();
262919
264541
  }
262920
264542
  let gitBranch;
@@ -263040,6 +264662,8 @@ class Project {
263040
264662
  let sessionFile;
263041
264663
  if (isCurrentSession) {
263042
264664
  if (this.sessionFile === null) {
264665
+ this.dropForeignPendingEntries(currentSessionId);
264666
+ this.pendingEntriesSessionId = currentSessionId;
263043
264667
  this.pendingEntries.push(entry);
263044
264668
  return;
263045
264669
  }
@@ -263125,6 +264749,23 @@ class Project {
263125
264749
  return this.sessionFile;
263126
264750
  }
263127
264751
  existingSessionFiles = new Map;
264752
+ deletedSessionFiles = new Set;
264753
+ isDeletedSessionFile(filePath) {
264754
+ return this.deletedSessionFiles.size > 0 && this.deletedSessionFiles.has(resolvePath2(filePath));
264755
+ }
264756
+ async forgetDeletedSession(sessionId, transcriptPath) {
264757
+ this.deletedSessionFiles.add(resolvePath2(transcriptPath));
264758
+ this.existingSessionFiles.delete(sessionId);
264759
+ if (this.sessionFile && this.isDeletedSessionFile(this.sessionFile)) {
264760
+ this.resetSessionFile();
264761
+ }
264762
+ await this.flush();
264763
+ const inFlight = [...this.pendingDirectAppends].filter(([path13]) => this.isDeletedSessionFile(path13)).flatMap(([, appends]) => [...appends]);
264764
+ await Promise.allSettled(inFlight);
264765
+ }
264766
+ restoreSessionWrites(transcriptPath) {
264767
+ this.deletedSessionFiles.delete(resolvePath2(transcriptPath));
264768
+ }
263128
264769
  async getExistingSessionFile(sessionId) {
263129
264770
  const cached3 = this.existingSessionFiles.get(sessionId);
263130
264771
  if (cached3)
@@ -263239,6 +264880,12 @@ async function recordSpeculationAccept(entry) {
263239
264880
  async function recordGoalState(goal, sessionId = getSessionId()) {
263240
264881
  await getProject().insertGoalState(goal, sessionId);
263241
264882
  }
264883
+ async function forgetDeletedSession(sessionId, transcriptPath) {
264884
+ await getProject().forgetDeletedSession(sessionId, transcriptPath);
264885
+ }
264886
+ function restoreSessionWrites(transcriptPath) {
264887
+ getProject().restoreSessionWrites(transcriptPath);
264888
+ }
263242
264889
  async function resetSessionFilePointer() {
263243
264890
  getProject().resetSessionFile();
263244
264891
  }
@@ -264098,6 +265745,8 @@ async function fetchLogs(limit) {
264098
265745
  }
264099
265746
  function appendEntryToFile(fullPath, entry) {
264100
265747
  const fs2 = getFsImplementation();
265748
+ if (project?.isDeletedSessionFile(fullPath))
265749
+ return;
264101
265750
  const line = jsonStringify(entry) + `
264102
265751
  `;
264103
265752
  if (project?._deferSynchronousAppend(fullPath, line))
@@ -265765,7 +267414,7 @@ async function enrichLogs(allLogs, startIndex, count4, options2) {
265765
267414
  }
265766
267415
  return { logs: result, nextIndex: i3 };
265767
267416
  }
265768
- var VERSION3, builtInCommandNamesCache, MAX_TOMBSTONE_REWRITE_BYTES, TRANSCRIPT_COPY_CHUNK_BYTES, transcriptRewriteHooksForTesting, SKIP_FIRST_PROMPT_PATTERN2, EPHEMERAL_PROGRESS_TYPES, MAX_TRANSCRIPT_READ_BYTES, agentTranscriptSubdirs, getProjectDir2, project = null, cleanupRegistered2 = false, REMOTE_FLUSH_INTERVAL_MS = 10, PERSISTED_OUTPUT_TAG2, TOOL_USE_RESULT_KEY, SEARCH_HEAD_BYTES, SEARCH_TAIL_BYTES, SEARCH_MID_WINDOW_BYTES, SEARCH_MAX_MID_WINDOWS = 12, SEARCH_MAX_TOTAL_READ_BYTES, SEARCH_MAX_CHAR_COUNT = 80000, METADATA_TYPE_MARKERS, METADATA_MARKER_BUFS, METADATA_PREFIX_BOUND = 25, getSessionMessages2, INITIAL_ENRICH_COUNT = 50, SESSION_BRANCH_ENTRY_PREFIX = '{"type":"session-branch"', SESSION_BRANCH_ENTRY_PREFIX_SPACED = '{"type": "session-branch"';
267417
+ var VERSION3, builtInCommandNamesCache, MAX_TOMBSTONE_REWRITE_BYTES, TRANSCRIPT_COPY_CHUNK_BYTES, transcriptRewriteHooksForTesting, SKIP_FIRST_PROMPT_PATTERN2, LOCAL_COMMAND_TAGS, EPHEMERAL_PROGRESS_TYPES, MAX_TRANSCRIPT_READ_BYTES, agentTranscriptSubdirs, getProjectDir2, project = null, cleanupRegistered2 = false, REMOTE_FLUSH_INTERVAL_MS = 10, PERSISTED_OUTPUT_TAG2, TOOL_USE_RESULT_KEY, SEARCH_HEAD_BYTES, SEARCH_TAIL_BYTES, SEARCH_MID_WINDOW_BYTES, SEARCH_MAX_MID_WINDOWS = 12, SEARCH_MAX_TOTAL_READ_BYTES, SEARCH_MAX_CHAR_COUNT = 80000, METADATA_TYPE_MARKERS, METADATA_MARKER_BUFS, METADATA_PREFIX_BOUND = 25, getSessionMessages2, INITIAL_ENRICH_COUNT = 50, SESSION_BRANCH_ENTRY_PREFIX = '{"type":"session-branch"', SESSION_BRANCH_ENTRY_PREFIX_SPACED = '{"type": "session-branch"';
265769
267418
  var init_sessionStorage = __esm(() => {
265770
267419
  init_memoize();
265771
267420
  init_state();
@@ -265795,11 +267444,17 @@ var init_sessionStorage = __esm(() => {
265795
267444
  init_slowOperations();
265796
267445
  init_transcriptFileLock();
265797
267446
  init_uuid();
265798
- VERSION3 = typeof MACRO !== "undefined" ? "0.31.1-by-rayss" : "unknown";
267447
+ VERSION3 = typeof MACRO !== "undefined" ? "0.33.1-by-rayss" : "unknown";
265799
267448
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
265800
267449
  TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
265801
267450
  transcriptRewriteHooksForTesting = {};
265802
267451
  SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
267452
+ LOCAL_COMMAND_TAGS = [
267453
+ COMMAND_NAME_TAG,
267454
+ LOCAL_COMMAND_STDOUT_TAG,
267455
+ LOCAL_COMMAND_STDERR_TAG,
267456
+ LOCAL_COMMAND_CAVEAT_TAG
267457
+ ];
265803
267458
  EPHEMERAL_PROGRESS_TYPES = new Set([
265804
267459
  "bash_progress",
265805
267460
  "powershell_progress",
@@ -267266,7 +268921,7 @@ var init_filesystem = __esm(() => {
267266
268921
  });
267267
268922
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
267268
268923
  const nonce = randomBytes10(16).toString("hex");
267269
- return join94(getClaudeTempDir(), "bundled-skills", "0.31.1-by-rayss", nonce);
268924
+ return join94(getClaudeTempDir(), "bundled-skills", "0.33.1-by-rayss", nonce);
267270
268925
  });
267271
268926
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
267272
268927
  });
@@ -268020,7 +269675,7 @@ function getWindowsBashHookCommand(command) {
268020
269675
  }
268021
269676
  if (/^\s*\(\s*\)/.test(rest.trimStart().slice(word.length)))
268022
269677
  return command;
268023
- return /\.sh["']?$/.test(word) ? `${command.slice(0, offset)}bash ${rest}` : command;
269678
+ return /\.sh["']?$/i.test(word) ? `${command.slice(0, offset)}bash ${rest}` : command;
268024
269679
  }
268025
269680
  }
268026
269681
 
@@ -276441,9 +278096,9 @@ var init_processTextPrompt = __esm(() => {
276441
278096
  });
276442
278097
 
276443
278098
  // sdk-missing-stub:src/components/BashModeProgress.js
276444
- var noop161 = () => null, BashModeProgress;
278099
+ var noop162 = () => null, BashModeProgress;
276445
278100
  var init_BashModeProgress = __esm(() => {
276446
- BashModeProgress = noop161;
278101
+ BashModeProgress = noop162;
276447
278102
  });
276448
278103
 
276449
278104
  // src/utils/shell/resolveDefaultShell.ts
@@ -281805,7 +283460,7 @@ function buildSystemInitMessage(inputs) {
281805
283460
  slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
281806
283461
  apiKeySource: getAnthropicApiKeyWithSource().source,
281807
283462
  betas: getSdkBetas(),
281808
- claude_code_version: "0.31.1-by-rayss",
283463
+ claude_code_version: "0.33.1-by-rayss",
281809
283464
  output_style: outputStyle,
281810
283465
  agents: inputs.agents.map((agent) => agent.agentType),
281811
283466
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -284232,9 +285887,9 @@ __export(exports_InvalidConfigDialog, {
284232
285887
  default: () => InvalidConfigDialog_default,
284233
285888
  __stub: () => __stub12
284234
285889
  });
284235
- var noop162 = () => null, InvalidConfigDialog_default, __stub12 = true;
285890
+ var noop163 = () => null, InvalidConfigDialog_default, __stub12 = true;
284236
285891
  var init_InvalidConfigDialog = __esm(() => {
284237
- InvalidConfigDialog_default = noop162;
285892
+ InvalidConfigDialog_default = noop163;
284238
285893
  });
284239
285894
 
284240
285895
  // src/entrypoints/init.ts
@@ -284397,8 +286052,8 @@ function safelyAccess(fn) {
284397
286052
  }
284398
286053
  }
284399
286054
  function checkCriticalImportsForStubs(criticalImports) {
284400
- for (const { name, get: get2 } of criticalImports) {
284401
- const mod = get2();
286055
+ for (const { name, get: get3 } of criticalImports) {
286056
+ const mod = get3();
284402
286057
  if (mod && "__stub" in mod && mod.__stub === true) {
284403
286058
  throw new Error(`SDK init error: "${name}" resolved to a build stub at runtime. ` + `This means a TUI/CLI dependency leaked into the SDK bundle. ` + `Report this at https://github.com/rayss868/openclaude/issues`);
284404
286059
  }
@@ -284729,7 +286384,7 @@ async function forkSession(sessionId, options2) {
284729
286384
  }
284730
286385
  return { sessionId: forkSessionId };
284731
286386
  }
284732
- var init_sessions = __esm(() => {
286387
+ var init_sessions2 = __esm(() => {
284733
286388
  init_listSessionsImpl();
284734
286389
  init_sessionStoragePortable();
284735
286390
  init_json();
@@ -285420,7 +287075,7 @@ var init_query2 = __esm(() => {
285420
287075
  init_fileHistory();
285421
287076
  init_shared2();
285422
287077
  init_permissions4();
285423
- init_sessions();
287078
+ init_sessions2();
285424
287079
  init_agentDefinitions();
285425
287080
  QueryImpl = class QueryImpl {
285426
287081
  _engine = null;
@@ -286394,7 +288049,7 @@ var init_sdk2 = __esm(() => {
286394
288049
  init_QueryEngine();
286395
288050
  init_tools2();
286396
288051
  init_init2();
286397
- init_sessions();
288052
+ init_sessions2();
286398
288053
  init_query2();
286399
288054
  init_v2();
286400
288055
  init_errors();
@@ -286429,4 +288084,4 @@ export {
286429
288084
  AbortError
286430
288085
  };
286431
288086
 
286432
- //# debugId=6B16E16B88A8DB3B64756E2164756E21
288087
+ //# debugId=D013021EC2F70EA264756E2164756E21