@cnwenf/occ 2.1.331 → 2.1.333

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 (2) hide show
  1. package/dist/cli.js +667 -167
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- globalThis.MACRO={"VERSION":"2.1.331","BINARY_NAME":"occ","BUILD_TIME":"2026-09-12T07:54:49.967Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
2
+ globalThis.MACRO={"VERSION":"2.1.333","BINARY_NAME":"occ","BUILD_TIME":"2026-09-12T22:14:51.247Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
3
3
  // @bun
4
4
  var __create = Object.create;
5
5
  var __getProtoOf = Object.getPrototypeOf;
@@ -167193,11 +167193,32 @@ function inputToString(input) {
167193
167193
  return input;
167194
167194
  }
167195
167195
  }
167196
+ function isPartialTerminalResponse(buffer) {
167197
+ if (MOUSE_PREFIX_RE.test(buffer))
167198
+ return buffer.length <= MOUSE_PREFIX_MAX;
167199
+ if (OSC_DCS_PARTIAL_RE.test(buffer)) {
167200
+ return buffer.length <= OSC_DCS_PARTIAL_MAX;
167201
+ }
167202
+ return buffer.length <= CSI_PARTIAL_MAX && CSI_PARTIAL_RE.test(buffer);
167203
+ }
167196
167204
  function parseMultipleKeypresses(prevState, input = "") {
167197
167205
  const isFlush = input === null;
167198
167206
  const inputString = isFlush ? "" : inputToString(input);
167199
167207
  const tokenizer = prevState._tokenizer ?? createTokenizer({ x10Mouse: true });
167200
- const tokens = isFlush ? tokenizer.flush() : tokenizer.feed(inputString);
167208
+ let tokens;
167209
+ if (isFlush && prevState.mode !== "IN_PASTE") {
167210
+ const buffered = tokenizer.buffer();
167211
+ if (isPartialTerminalResponse(buffered)) {
167212
+ tokens = [];
167213
+ } else if (MOUSE_PREFIX_RE.test(buffered)) {
167214
+ tokenizer.reset();
167215
+ tokens = [];
167216
+ } else {
167217
+ tokens = tokenizer.flush();
167218
+ }
167219
+ } else {
167220
+ tokens = isFlush ? tokenizer.flush() : tokenizer.feed(inputString);
167221
+ }
167201
167222
  const keys2 = [];
167202
167223
  let inPaste = prevState.mode === "IN_PASTE";
167203
167224
  let pasteBuffer = prevState.pasteBuffer;
@@ -167487,7 +167508,7 @@ function createNavKey(s4, name3, ctrl) {
167487
167508
  isPasted: false
167488
167509
  };
167489
167510
  }
167490
- var META_KEY_CODE_RE, FN_KEY_RE, CSI_U_RE, MODIFY_OTHER_KEYS_RE, DECRPM_RE, DA1_RE, DA2_RE, KITTY_FLAGS_RE, CURSOR_POSITION_RE, OSC_RESPONSE_RE, XTVERSION_RE, SGR_MOUSE_RE, INITIAL_STATE, keyName, nonAlphanumericKeys, isShiftKey = (code) => {
167511
+ var META_KEY_CODE_RE, FN_KEY_RE, CSI_U_RE, MODIFY_OTHER_KEYS_RE, DECRPM_RE, DA1_RE, DA2_RE, KITTY_FLAGS_RE, CURSOR_POSITION_RE, OSC_RESPONSE_RE, XTVERSION_RE, SGR_MOUSE_RE, INITIAL_STATE, MOUSE_PREFIX_RE, MOUSE_PREFIX_MAX = 32, OSC_DCS_PARTIAL_RE, OSC_DCS_PARTIAL_MAX = 256, CSI_PARTIAL_RE, CSI_PARTIAL_MAX = 64, keyName, nonAlphanumericKeys, isShiftKey = (code) => {
167491
167512
  return [
167492
167513
  "[a",
167493
167514
  "[b",
@@ -167537,6 +167558,9 @@ var init_parse_keypress = __esm(() => {
167537
167558
  incomplete: "",
167538
167559
  pasteBuffer: ""
167539
167560
  };
167561
+ MOUSE_PREFIX_RE = /^\x1b\[<[\d;]*$/;
167562
+ OSC_DCS_PARTIAL_RE = /^\x1b(?:\][0-9]|P[0-9>|$+=!]|_G)[^\x07]*$/s;
167563
+ CSI_PARTIAL_RE = /^\x1b\[(?:[0-9:;]+|[<=>?][0-9:;]*[ -/]*)$/;
167540
167564
  keyName = {
167541
167565
  OP: "f1",
167542
167566
  OQ: "f2",
@@ -184538,6 +184562,14 @@ class Ink {
184538
184562
  get isAltScreenActive() {
184539
184563
  return this.altScreenActive;
184540
184564
  }
184565
+ get nativeCursorSeq() {
184566
+ if (this.accessibilityMode || this.isScreenReaderEnabled)
184567
+ return "";
184568
+ return this.nativeCursorVisible ? SHOW_CURSOR : HIDE_CURSOR;
184569
+ }
184570
+ get hasUnmounted() {
184571
+ return this.isUnmounted;
184572
+ }
184541
184573
  reassertTerminalModes = (includeAltScreen = false) => {
184542
184574
  if (!this.options.stdout.isTTY)
184543
184575
  return;
@@ -260734,7 +260766,8 @@ var init_FileReadTool = __esm(() => {
260734
260766
  return {
260735
260767
  result: false,
260736
260768
  message: "File is in a directory that is denied by your permission settings.",
260737
- errorCode: 1
260769
+ errorCode: 1,
260770
+ deniedByPermissionRule: true
260738
260771
  };
260739
260772
  }
260740
260773
  const isUncPath = fullFilePath.startsWith("\\\\") || fullFilePath.startsWith("//");
@@ -372510,8 +372543,20 @@ function createLSPClient(serverName, onCrash) {
372510
372543
  isStopping = true;
372511
372544
  try {
372512
372545
  if (connection3) {
372513
- await connection3.sendRequest("shutdown", {});
372514
- await connection3.sendNotification("exit", {});
372546
+ let shutdownRequestError;
372547
+ try {
372548
+ await connection3.sendRequest("shutdown", {});
372549
+ } catch (error52) {
372550
+ shutdownRequestError = error52;
372551
+ }
372552
+ try {
372553
+ await connection3.sendNotification("exit", {});
372554
+ } catch (error52) {
372555
+ throw shutdownRequestError ?? error52;
372556
+ }
372557
+ if (shutdownRequestError !== undefined) {
372558
+ throw shutdownRequestError;
372559
+ }
372515
372560
  }
372516
372561
  } catch (error52) {
372517
372562
  const err2 = error52;
@@ -374648,14 +374693,16 @@ var init_FileWriteTool = __esm(() => {
374648
374693
  return {
374649
374694
  result: false,
374650
374695
  message: "File is in a directory that is denied by your permission settings.",
374651
- errorCode: 1
374696
+ errorCode: 1,
374697
+ deniedByPermissionRule: true
374652
374698
  };
374653
374699
  }
374654
374700
  if (isCoveredByReadDenyRule(fullFilePath, toolPermissionContext)) {
374655
374701
  return {
374656
374702
  result: false,
374657
374703
  message: READ_DENY_WRITE_MESSAGE,
374658
- errorCode: 13
374704
+ errorCode: 13,
374705
+ deniedByPermissionRule: true
374659
374706
  };
374660
374707
  }
374661
374708
  if (fullFilePath.startsWith("\\\\") || fullFilePath.startsWith("//")) {
@@ -380709,6 +380756,19 @@ var init_sedValidation = __esm(() => {
380709
380756
  // src/tools/BashTool/pathValidation.ts
380710
380757
  import { homedir as homedir22 } from "os";
380711
380758
  import { isAbsolute as isAbsolute21, resolve as resolve30 } from "path";
380759
+ function filterTeeDevicePaths(paths2) {
380760
+ return paths2.filter((p4) => !TEE_DEVICE_PATHS.has(p4));
380761
+ }
380762
+ function canonicalizePathCommandName(cmd) {
380763
+ if (!cmd) {
380764
+ return cmd;
380765
+ }
380766
+ const base2 = cmd.replace(/^.*[\\/]/, "");
380767
+ if (CANONICAL_PATH_COMMAND_BASENAMES.has(base2)) {
380768
+ return base2;
380769
+ }
380770
+ return base2.toLowerCase().replace(/\.exe$/, "") === "tee" ? "tee" : cmd;
380771
+ }
380712
380772
  function checkDangerousRemovalPaths(command4, args, cwd2) {
380713
380773
  const extractor = PATH_EXTRACTORS[command4];
380714
380774
  const paths2 = extractor(args);
@@ -380900,7 +380960,8 @@ function validateSinglePathCommand(cmd, cwd2, toolPermissionContext, compoundCom
380900
380960
  message: "Empty command - no paths to validate"
380901
380961
  };
380902
380962
  }
380903
- const [baseCmd, ...args] = extractedArgs;
380963
+ const [rawBaseCmd, ...args] = extractedArgs;
380964
+ const baseCmd = canonicalizePathCommandName(rawBaseCmd);
380904
380965
  if (!baseCmd || !SUPPORTED_PATH_COMMANDS.includes(baseCmd)) {
380905
380966
  return {
380906
380967
  behavior: "passthrough",
@@ -380919,7 +380980,8 @@ function validateSinglePathCommandArgv(cmd, cwd2, toolPermissionContext, compoun
380919
380980
  message: "Empty command - no paths to validate"
380920
380981
  };
380921
380982
  }
380922
- const [baseCmd, ...args] = argv;
380983
+ const [rawBaseCmd, ...args] = argv;
380984
+ const baseCmd = canonicalizePathCommandName(rawBaseCmd);
380923
380985
  if (!baseCmd || !SUPPORTED_PATH_COMMANDS.includes(baseCmd)) {
380924
380986
  return {
380925
380987
  behavior: "passthrough",
@@ -381146,7 +381208,7 @@ function stripWrappersFromArgv(argv) {
381146
381208
  }
381147
381209
  }
381148
381210
  }
381149
- var PATH_EXTRACTORS, SUPPORTED_PATH_COMMANDS, ACTION_VERBS, COMMAND_OPERATION_TYPE, COMMAND_VALIDATOR, TIMEOUT_FLAG_VALUE_RE;
381211
+ var TEE_DEVICE_PATHS, CANONICAL_PATH_COMMAND_BASENAMES, PATH_EXTRACTORS, SUPPORTED_PATH_COMMANDS, ACTION_VERBS, COMMAND_OPERATION_TYPE, COMMAND_VALIDATOR, TIMEOUT_FLAG_VALUE_RE;
381150
381212
  var init_pathValidation2 = __esm(() => {
381151
381213
  init_commands4();
381152
381214
  init_shellQuote();
@@ -381156,6 +381218,13 @@ var init_pathValidation2 = __esm(() => {
381156
381218
  init_pathValidation();
381157
381219
  init_bashPermissions();
381158
381220
  init_sedValidation();
381221
+ TEE_DEVICE_PATHS = new Set([
381222
+ "/dev/null",
381223
+ "/dev/stdout",
381224
+ "/dev/stderr",
381225
+ "/dev/tty"
381226
+ ]);
381227
+ CANONICAL_PATH_COMMAND_BASENAMES = new Set(["rm", "rmdir", "tee"]);
381159
381228
  PATH_EXTRACTORS = {
381160
381229
  cd: (args) => args.length === 0 ? [homedir22()] : [args.join(" ")],
381161
381230
  ls: (args) => {
@@ -381238,6 +381307,7 @@ var init_pathValidation2 = __esm(() => {
381238
381307
  sha256sum: filterOutFlags,
381239
381308
  sha1sum: filterOutFlags,
381240
381309
  md5sum: filterOutFlags,
381310
+ tee: (args) => filterTeeDevicePaths(filterOutFlags(args)),
381241
381311
  tr: (args) => {
381242
381312
  const hasDelete = args.some((a5) => a5 === "-d" || a5 === "--delete" || a5.startsWith("-") && a5.includes("d"));
381243
381313
  const nonFlags = filterOutFlags(args);
@@ -381428,7 +381498,8 @@ var init_pathValidation2 = __esm(() => {
381428
381498
  jq: "process JSON from files in",
381429
381499
  sha256sum: "compute SHA-256 checksums for files in",
381430
381500
  sha1sum: "compute SHA-1 checksums for files in",
381431
- md5sum: "compute MD5 checksums for files in"
381501
+ md5sum: "compute MD5 checksums for files in",
381502
+ tee: "write to files in"
381432
381503
  };
381433
381504
  COMMAND_OPERATION_TYPE = {
381434
381505
  cd: "read",
@@ -381466,7 +381537,8 @@ var init_pathValidation2 = __esm(() => {
381466
381537
  jq: "read",
381467
381538
  sha256sum: "read",
381468
381539
  sha1sum: "read",
381469
- md5sum: "read"
381540
+ md5sum: "read",
381541
+ tee: "write"
381470
381542
  };
381471
381543
  COMMAND_VALIDATOR = {
381472
381544
  mv: (args) => !args.some((arg) => arg?.startsWith("-")),
@@ -381666,7 +381738,7 @@ function extractWritePathsFromSubcommand(subcommand) {
381666
381738
  const tokens = parseResult.tokens.filter((t4) => typeof t4 === "string");
381667
381739
  if (tokens.length === 0)
381668
381740
  return [];
381669
- const baseCmd = tokens[0];
381741
+ const baseCmd = canonicalizePathCommandName(tokens[0]?.replace(/[\\'"]/g, ""));
381670
381742
  if (!baseCmd)
381671
381743
  return [];
381672
381744
  if (!(baseCmd in COMMAND_OPERATION_TYPE)) {
@@ -451320,7 +451392,8 @@ var init_FileEditTool = __esm(() => {
451320
451392
  result: false,
451321
451393
  behavior: "ask",
451322
451394
  message: "File is in a directory that is denied by your permission settings.",
451323
- errorCode: 2
451395
+ errorCode: 2,
451396
+ deniedByPermissionRule: true
451324
451397
  };
451325
451398
  }
451326
451399
  if (isCoveredByReadDenyRule(fullFilePath, appState.toolPermissionContext)) {
@@ -451328,7 +451401,8 @@ var init_FileEditTool = __esm(() => {
451328
451401
  result: false,
451329
451402
  behavior: "ask",
451330
451403
  message: READ_DENY_EDIT_MESSAGE,
451331
- errorCode: 13
451404
+ errorCode: 13,
451405
+ deniedByPermissionRule: true
451332
451406
  };
451333
451407
  }
451334
451408
  if (fullFilePath.startsWith("\\\\") || fullFilePath.startsWith("//")) {
@@ -476321,7 +476395,8 @@ function deserializeMessagesWithInterruptDetection(serializedMessages) {
476321
476395
  const filteredToolUses = filterUnresolvedToolUses(migratedMessages);
476322
476396
  const filteredThinking = filterOrphanedThinkingOnlyMessages(filteredToolUses);
476323
476397
  const filteredMessages = filterWhitespaceOnlyAssistantMessages(filteredThinking);
476324
- const internalState = detectTurnInterruption(filteredMessages);
476398
+ const droppedUnresolvedToolUses = filteredToolUses.length !== migratedMessages.length;
476399
+ const internalState = applyResumeStalenessGates(detectTurnInterruption(filteredMessages), droppedUnresolvedToolUses ? migratedMessages : filteredMessages);
476325
476400
  let turnInterruptionState;
476326
476401
  if (internalState.kind === "interrupted_turn") {
476327
476402
  const [continuationMessage] = normalizeMessages([
@@ -476382,6 +476457,87 @@ function detectTurnInterruption(messages) {
476382
476457
  }
476383
476458
  return { kind: "none" };
476384
476459
  }
476460
+ function getResumeMaxAgeEnvMs() {
476461
+ const raw = process.env[RESUME_MAX_AGE_ENV];
476462
+ if (!raw)
476463
+ return;
476464
+ const n5 = Number(raw);
476465
+ if (n5 === 0)
476466
+ return 0;
476467
+ return Number.isFinite(n5) && n5 > 0 ? n5 : RESUME_INVALID_ENV_MAX_AGE_MS;
476468
+ }
476469
+ function getResumeMaxAge() {
476470
+ const fromEnv5 = getResumeMaxAgeEnvMs();
476471
+ if (fromEnv5)
476472
+ return { maxAgeMs: fromEnv5, source: "env" };
476473
+ return { maxAgeMs: RESUME_DEFAULT_MAX_AGE_MS, source: "default" };
476474
+ }
476475
+ function messageTimestampMs(m5) {
476476
+ return Date.parse(typeof m5.timestamp === "string" ? m5.timestamp : "");
476477
+ }
476478
+ function isResumeTailStaleByEnv(messages) {
476479
+ const maxAge = getResumeMaxAgeEnvMs();
476480
+ if (!maxAge)
476481
+ return false;
476482
+ for (let i6 = messages.length - 1;i6 >= 0; i6--) {
476483
+ const m5 = messages[i6];
476484
+ if (m5.type === "system" || m5.type === "progress")
476485
+ continue;
476486
+ const t4 = messageTimestampMs(m5);
476487
+ if (Number.isFinite(t4))
476488
+ return Date.now() - t4 >= maxAge;
476489
+ }
476490
+ return true;
476491
+ }
476492
+ function isResumeRowStale(m5, maxAgeMs) {
476493
+ const t4 = messageTimestampMs(m5);
476494
+ return !Number.isFinite(t4) || Math.abs(Date.now() - t4) >= maxAgeMs;
476495
+ }
476496
+ function newerResumeRow(a5, b5) {
476497
+ if (a5 === undefined || b5 === undefined)
476498
+ return a5 ?? b5;
476499
+ const ra = messageTimestampMs(a5);
476500
+ const rb = messageTimestampMs(b5);
476501
+ if (!Number.isFinite(ra))
476502
+ return a5;
476503
+ if (!Number.isFinite(rb))
476504
+ return b5;
476505
+ return rb > ra ? b5 : a5;
476506
+ }
476507
+ function findSkippedTailApiErrorRow(messages) {
476508
+ const lastRelevantIdx = messages.findLastIndex((m5) => m5.type !== "system" && m5.type !== "progress" && !(m5.type === "assistant" && m5.isApiErrorMessage));
476509
+ let newest;
476510
+ for (let i6 = lastRelevantIdx + 1;i6 < messages.length; i6++) {
476511
+ const m5 = messages[i6];
476512
+ if (m5.type === "assistant" && m5.isApiErrorMessage) {
476513
+ newest = newerResumeRow(newest, m5);
476514
+ }
476515
+ }
476516
+ return newest;
476517
+ }
476518
+ function applyResumeStalenessGates(state3, walkMessages) {
476519
+ if (state3.kind === "none")
476520
+ return state3;
476521
+ if (isResumeTailStaleByEnv(walkMessages)) {
476522
+ if (process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN) {
476523
+ logForDebugging(`[conversationRecovery] tengu_resume_stale_turn_suppressed (kind: ${state3.kind})`);
476524
+ }
476525
+ return { kind: "none" };
476526
+ }
476527
+ const apiErrorRow = findSkippedTailApiErrorRow(walkMessages);
476528
+ if (apiErrorRow !== undefined) {
476529
+ const bound = getResumeMaxAge();
476530
+ if (isResumeRowStale(apiErrorRow, bound.maxAgeMs)) {
476531
+ if (process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN) {
476532
+ const t4 = messageTimestampMs(apiErrorRow);
476533
+ const ageMin = Number.isFinite(t4) ? Math.floor((Date.now() - t4) / 60000) : undefined;
476534
+ logForDebugging(`[conversationRecovery] tengu_resume_stale_turn_suppressed (kind: ${state3.kind}, tail: api_error` + (ageMin !== undefined ? `, age_min: ${ageMin}` : "") + `, bound_source: ${bound.source}, bound_min: ${Math.floor(bound.maxAgeMs / 60000)})`);
476535
+ }
476536
+ return { kind: "none" };
476537
+ }
476538
+ }
476539
+ return state3;
476540
+ }
476385
476541
  function isTerminalToolResult(result, messages, resultIdx) {
476386
476542
  const content = result.message.content;
476387
476543
  if (!Array.isArray(content))
@@ -476559,7 +476715,7 @@ async function loadConversationForResume(source, sourceJsonlFile) {
476559
476715
  throw error52;
476560
476716
  }
476561
476717
  }
476562
- var BRIEF_TOOL_NAME4, LEGACY_BRIEF_TOOL_NAME2, SEND_USER_FILE_TOOL_NAME3, LOCAL_COMMAND_TAG_KINDS;
476718
+ var BRIEF_TOOL_NAME4, LEGACY_BRIEF_TOOL_NAME2, SEND_USER_FILE_TOOL_NAME3, RESUME_MAX_AGE_ENV = "CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS", RESUME_DEFAULT_MAX_AGE_MS = 21600000, RESUME_INVALID_ENV_MAX_AGE_MS = 3600000, LOCAL_COMMAND_TAG_KINDS;
476563
476719
  var init_conversationRecovery = __esm(() => {
476564
476720
  init_featureFlags();
476565
476721
  init_cwd2();
@@ -476570,6 +476726,7 @@ var init_conversationRecovery = __esm(() => {
476570
476726
  init_attachments2();
476571
476727
  init_fileHistory();
476572
476728
  init_log3();
476729
+ init_debug();
476573
476730
  init_messages3();
476574
476731
  init_plans();
476575
476732
  init_sessionStart();
@@ -480911,6 +481068,16 @@ async function getAllCommands(context6) {
480911
481068
  const localCommands = await getCommands(getProjectRoot());
480912
481069
  return dropShadowedSkills(uniqBy_default([...localCommands, ...mcpSkills], "name"));
480913
481070
  }
481071
+ function buildUnknownSkillMessage(name3, commands7) {
481072
+ const match = findPluginSkillFullNameMatch(name3, commands7);
481073
+ if (match.kind === "unique" && isSkillNameSafeToDisplay(match.command.name)) {
481074
+ return `Unknown skill: ${name3}. Did you mean ${match.command.name}? Invoke it by that full name.`;
481075
+ }
481076
+ if (match.kind === "ambiguous" && match.candidates.every((c9) => isSkillNameSafeToDisplay(c9.name))) {
481077
+ return `Unknown skill: ${name3}. Several skills match that name: ${match.candidates.map((c9) => c9.name).join(", ")} \u2014 invoke one by its full name.`;
481078
+ }
481079
+ return `Unknown skill: ${name3}`;
481080
+ }
480914
481081
  async function executeForkedSkill(command4, commandName, args, context6, canUseTool, parentMessage, onProgress) {
480915
481082
  const startTime2 = Date.now();
480916
481083
  const agentId = createAgentId();
@@ -481225,9 +481392,15 @@ var init_SkillTool = __esm(() => {
481225
481392
  const commands7 = await getAllCommands(context6);
481226
481393
  const foundCommand = findCommand(normalizedCommandName, commands7);
481227
481394
  if (!foundCommand) {
481395
+ const match = findPluginSkillFullNameMatch(normalizedCommandName, commands7);
481396
+ if (match.kind !== "none") {
481397
+ logEvent2("tengu_skill_tool_suffix_match", {
481398
+ candidate_count: match.kind === "ambiguous" ? match.candidates.length : 1
481399
+ });
481400
+ }
481228
481401
  return {
481229
481402
  result: false,
481230
- message: `Unknown skill: ${normalizedCommandName}`,
481403
+ message: buildUnknownSkillMessage(normalizedCommandName, commands7),
481231
481404
  errorCode: 2
481232
481405
  };
481233
481406
  }
@@ -561679,18 +561852,18 @@ function parseFolderPath(folderPath) {
561679
561852
  }
561680
561853
  return { platform: platform5, buildId };
561681
561854
  }
561682
- var import_debug178, debugCache;
561855
+ var import_debug179, debugCache;
561683
561856
  var init_Cache = __esm(() => {
561684
561857
  init_browser_data();
561685
561858
  init_detectPlatform();
561686
- import_debug178 = __toESM(require_src(), 1);
561687
- debugCache = import_debug178.default("puppeteer:browsers:cache");
561859
+ import_debug179 = __toESM(require_src(), 1);
561860
+ debugCache = import_debug179.default("puppeteer:browsers:cache");
561688
561861
  });
561689
561862
 
561690
561863
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/debug.js
561691
- var import_debug179;
561864
+ var import_debug180;
561692
561865
  var init_debug3 = __esm(() => {
561693
- import_debug179 = __toESM(require_src(), 1);
561866
+ import_debug180 = __toESM(require_src(), 1);
561694
561867
  });
561695
561868
 
561696
561869
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/launch.js
@@ -562009,7 +562182,7 @@ var init_launch = __esm(() => {
562009
562182
  init_Cache();
562010
562183
  init_debug3();
562011
562184
  init_detectPlatform();
562012
- debugLaunch = import_debug179.default("puppeteer:browsers:launcher");
562185
+ debugLaunch = import_debug180.default("puppeteer:browsers:launcher");
562013
562186
  CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/;
562014
562187
  WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/;
562015
562188
  processListeners = new Map;
@@ -567093,10 +567266,10 @@ async function installDMG(dmgPath, folderPath) {
567093
567266
  spawnSync4("hdiutil", ["detach", mountPath, "-quiet"]);
567094
567267
  }
567095
567268
  }
567096
- var import_debug181, debugFileUtil, internalConstantsForTesting;
567269
+ var import_debug182, debugFileUtil, internalConstantsForTesting;
567097
567270
  var init_fileUtil = __esm(() => {
567098
- import_debug181 = __toESM(require_src(), 1);
567099
- debugFileUtil = import_debug181.default("puppeteer:browsers:fileUtil");
567271
+ import_debug182 = __toESM(require_src(), 1);
567272
+ debugFileUtil = import_debug182.default("puppeteer:browsers:fileUtil");
567100
567273
  internalConstantsForTesting = {
567101
567274
  xz: "xz",
567102
567275
  bzip2: "bzip2"
@@ -567389,7 +567562,7 @@ var init_install = __esm(() => {
567389
567562
  init_fileUtil();
567390
567563
  init_httpUtil();
567391
567564
  import_progress = __toESM(require_node_progress(), 1);
567392
- debugInstall = import_debug179.default("puppeteer:browsers:install");
567565
+ debugInstall = import_debug180.default("puppeteer:browsers:install");
567393
567566
  times = new Map;
567394
567567
  });
567395
567568
 
@@ -573664,7 +573837,7 @@ import fs23 from "fs";
573664
573837
  import os16 from "os";
573665
573838
  import { dirname as dirname45 } from "path";
573666
573839
  import { PassThrough as PassThrough4 } from "stream";
573667
- var import_debug183, __runInitializers23 = function(thisArg, initializers, value) {
573840
+ var import_debug184, __runInitializers23 = function(thisArg, initializers, value) {
573668
573841
  var useValue = arguments.length > 2;
573669
573842
  for (var i6 = 0;i6 < initializers.length; i6++) {
573670
573843
  value = useValue ? initializers[i6].call(thisArg, value) : initializers[i6].call(thisArg);
@@ -573724,8 +573897,8 @@ var init_ScreenRecorder = __esm(() => {
573724
573897
  init_util6();
573725
573898
  init_decorators();
573726
573899
  init_disposable();
573727
- import_debug183 = __toESM(require_src(), 1);
573728
- debugFfmpeg = import_debug183.default("puppeteer:ffmpeg");
573900
+ import_debug184 = __toESM(require_src(), 1);
573901
+ debugFfmpeg = import_debug184.default("puppeteer:ffmpeg");
573729
573902
  ScreenRecorder = (() => {
573730
573903
  let _classSuper = PassThrough4;
573731
573904
  let _instanceExtraInitializers = [];
@@ -581396,12 +581569,13 @@ async function fetchAndCacheGatewayModels() {
581396
581569
  }
581397
581570
  const baseUrl = process.env.ANTHROPIC_BASE_URL.replace(/\/+$/, "");
581398
581571
  const url3 = `${baseUrl}/v1/models?limit=1000`;
581572
+ const timeoutMs = Number(process.env[DISCOVERY_TIMEOUT_ENV] ?? DEFAULT_DISCOVERY_TIMEOUT_MS);
581399
581573
  try {
581400
581574
  const response3 = await fetch(url3, {
581401
581575
  method: "GET",
581402
581576
  headers: buildHeaders5(),
581403
581577
  redirect: "error",
581404
- signal: AbortSignal.timeout(5000)
581578
+ signal: AbortSignal.timeout(timeoutMs)
581405
581579
  });
581406
581580
  if (!response3.ok) {
581407
581581
  logForDebugging(`[Bootstrap] Gateway /v1/models fetch failed: HTTP ${response3.status}`);
@@ -581425,7 +581599,7 @@ async function fetchAndCacheGatewayModels() {
581425
581599
  logForDebugging(`[Bootstrap] Gateway /v1/models fetch failed: ${error52 instanceof Error ? error52.message : "unknown"}`);
581426
581600
  }
581427
581601
  }
581428
- var GatewayModelSchema, GatewayModelsResponseSchema, GatewayCacheSchema;
581602
+ var GatewayModelSchema, GatewayModelsResponseSchema, GatewayCacheSchema, DEFAULT_DISCOVERY_TIMEOUT_MS = 3000, DISCOVERY_TIMEOUT_ENV = "CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS";
581429
581603
  var init_gatewayModelDiscovery = __esm(() => {
581430
581604
  init_v4();
581431
581605
  init_auth6();
@@ -586577,6 +586751,37 @@ var init_prefixStagger = __esm(() => {
586577
586751
  });
586578
586752
 
586579
586753
  // src/tools/WorkflowTool/primitives.ts
586754
+ import { availableParallelism } from "os";
586755
+ function parseConcurrencyEnv(raw) {
586756
+ if (raw === undefined) {
586757
+ return;
586758
+ }
586759
+ if (!/^[+-]?\d+$/.test(raw.trim())) {
586760
+ return;
586761
+ }
586762
+ const n5 = Number(raw.trim());
586763
+ if (!Number.isFinite(n5)) {
586764
+ return;
586765
+ }
586766
+ if (n5 < 1) {
586767
+ return;
586768
+ }
586769
+ if (n5 > 256) {
586770
+ return;
586771
+ }
586772
+ return n5;
586773
+ }
586774
+ function getDefaultWorkflowConcurrency() {
586775
+ return Math.min(16, Math.max(2, availableParallelism() - 2));
586776
+ }
586777
+ function resolveWorkflowConcurrency() {
586778
+ const fromEnv5 = parseConcurrencyEnv(process.env[WORKFLOW_CONCURRENCY_ENV]);
586779
+ const gate = fromEnv5 ?? getDefaultWorkflowConcurrency();
586780
+ if (fromEnv5 !== undefined) {
586781
+ logForDebugging(`workflow: concurrent agent gate = ${gate} (CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS)`);
586782
+ }
586783
+ return gate;
586784
+ }
586580
586785
  function workflowAgentTelemetryAttributes(runId, workflowName) {
586581
586786
  return {
586582
586787
  "workflow.run_id": runId,
@@ -586708,7 +586913,7 @@ function extractToolUseStats(messages) {
586708
586913
  return { toolUseCount, recentActivities: capped, lastActivity };
586709
586914
  }
586710
586915
  function createPrimitives(ctx) {
586711
- const concurrency = ctx.tokenBudget && ctx.tokenBudget > 0 ? Math.max(1, Math.floor(ctx.tokenBudget / 1e5)) : WORKFLOW_DEFAULT_CONCURRENCY;
586916
+ const concurrency = resolveWorkflowConcurrency();
586712
586917
  const agent = async (prompt, opts = {}) => {
586713
586918
  if (!prompt || typeof prompt !== "string") {
586714
586919
  throw new Error("agent() requires a non-empty string prompt");
@@ -587112,7 +587317,7 @@ function buildPrimitivesObject(ctx) {
587112
587317
  resolveWorkflow: p4.resolveWorkflow
587113
587318
  };
587114
587319
  }
587115
- var WORKFLOW_AGENT_LIFETIME_CAP = 1000, WORKFLOW_PARALLEL_MAX_ITEMS = 4096, WORKFLOW_DEFAULT_CONCURRENCY = 10;
587320
+ var WORKFLOW_AGENT_LIFETIME_CAP = 1000, WORKFLOW_PARALLEL_MAX_ITEMS = 4096, WORKFLOW_CONCURRENCY_ENV = "CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS";
587116
587321
  var init_primitives = __esm(() => {
587117
587322
  init_runAgent();
587118
587323
  init_generalPurposeAgent();
@@ -595775,6 +595980,11 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input2, toolUseConte
595775
595980
  },
595776
595981
  ...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl)
595777
595982
  });
595983
+ if (isValidCall.deniedByPermissionRule) {
595984
+ const observableInput = { ...parsedInput.data };
595985
+ tool.backfillObservableInput?.(observableInput);
595986
+ toolUseContext.onPermissionDenial?.(tool, toolUseID, observableInput);
595987
+ }
595778
595988
  return [
595779
595989
  {
595780
595990
  message: createUserMessage({
@@ -601471,7 +601681,7 @@ async function generateSuggestion(abortController, promptId, cacheSafeParams) {
601471
601681
  const contentArr = Array.isArray(msg.message.content) ? msg.message.content : [];
601472
601682
  const textBlock = contentArr.find((b6) => b6.type === "text");
601473
601683
  if (textBlock?.type === "text" && typeof textBlock.text === "string") {
601474
- const suggestion = textBlock.text.trim();
601684
+ const suggestion = stripSuggestionMeta(textBlock.text);
601475
601685
  if (suggestion) {
601476
601686
  return { suggestion, generationRequestId };
601477
601687
  }
@@ -601479,22 +601689,60 @@ async function generateSuggestion(abortController, promptId, cacheSafeParams) {
601479
601689
  }
601480
601690
  return { suggestion: null, generationRequestId };
601481
601691
  }
601692
+ function stripSuggestionMeta(text2) {
601693
+ return text2.trim().replace(/^<(suggestion|response|output|answer|result)>([\s\S]*)<\/\1>$/i, (match, tag, inner) => inner.includes(`</${tag.toLowerCase()}>`) || inner.includes(`</${tag.toUpperCase()}>`) ? match : inner).replace(/^\s*(suggested\s+(response|reply|input|prompt)|suggestion|response|reply|answer|output|result|\u63D0\u6848|\u56DE\u7B54|\u8FD4\u4FE1|\u5FDC\u7B54|\u51FA\u529B|\u7D50\u679C|\u5EFA\u8BAE|\u56DE\u590D|\u7B54\u6848|\u8F93\u51FA|\u7ED3\u679C|\uC81C\uC548|\uB2F5\uBCC0|\uC751\uB2F5|\uCD9C\uB825|\uACB0\uACFC)\s*[:\uFF1A]\s*/i, "").trim();
601694
+ }
601695
+ function classifyScripts(text2) {
601696
+ let han = 0;
601697
+ let phonetic = 0;
601698
+ let hangul = 0;
601699
+ let other = 0;
601700
+ for (const char of text2) {
601701
+ if (HAN_SCRIPT_RE.test(char))
601702
+ han++;
601703
+ else if (PHONETIC_SCRIPT_RE.test(char))
601704
+ phonetic++;
601705
+ else if (HANGUL_SCRIPT_RE.test(char))
601706
+ hangul++;
601707
+ else if (LETTER_NUMBER_RE.test(char))
601708
+ other++;
601709
+ }
601710
+ return { han, phonetic, hangul, other };
601711
+ }
601712
+ function countCjkCharacters(text2) {
601713
+ const { han, phonetic, hangul } = classifyScripts(text2);
601714
+ return han + phonetic + hangul;
601715
+ }
601716
+ function countSuggestionWords(text2) {
601717
+ const trimmed = text2.trim();
601718
+ if (trimmed === "")
601719
+ return 0;
601720
+ let total = 0;
601721
+ for (const token of trimmed.split(/\s+/)) {
601722
+ const { han, phonetic, hangul, other } = classifyScripts(token);
601723
+ total += han === 0 && phonetic === 0 ? 1 : (other + hangul > 0 ? 1 : 0) + han / 2 + phonetic / 4;
601724
+ }
601725
+ return Math.ceil(total);
601726
+ }
601482
601727
  function shouldFilterSuggestion(suggestion, promptId, source2) {
601483
601728
  if (!suggestion) {
601484
601729
  logSuggestionSuppressed("empty", undefined, promptId, source2);
601485
601730
  return true;
601486
601731
  }
601487
601732
  const lower = suggestion.toLowerCase();
601488
- const wordCount = suggestion.trim().split(/\s+/).length;
601733
+ const wordCount = countSuggestionWords(suggestion);
601489
601734
  const filters = [
601490
- ["done", () => lower === "done"],
601735
+ [
601736
+ "done",
601737
+ () => lower === "done" || /^\P{L}*(\u5B8C\u4E86(\u3057\u307E\u3057\u305F)?|\u5B8C\u6210\u4E86?|\uC644\uB8CC\uB428?)\P{L}*$/u.test(suggestion)
601738
+ ],
601491
601739
  [
601492
601740
  "meta_text",
601493
- () => lower === "nothing found" || lower === "nothing found." || lower.startsWith("nothing to suggest") || lower.startsWith("no suggestion") || /\bsilence is\b|\bstay(s|ing)? silent\b/.test(lower) || /^\W*silence\W*$/.test(lower)
601741
+ () => lower === "nothing found" || lower === "nothing found." || lower.startsWith("nothing to suggest") || lower.startsWith("no suggestion") || /\bsilence is\b|\bstay(s|ing)? silent\b/.test(lower) || /^\W*silence\W*$/.test(lower) || /^\P{L}*(\u6C88\u9ED9|\u6C89\u9ED8|\u9759\u9ED8|\uCE68\uBB35|\u63D0\u6848(\u306A\u3057|\u306F\u3042\u308A\u307E\u305B\u3093)|\u7279\u306B(\u306A\u3057|\u3042\u308A\u307E\u305B\u3093)|[\u65E0\u6CA1\u6C92]\u6709?\u5EFA[\u8BAE\u8B70]|(\uC81C\uC548|\uD574\uB2F9)\s*\uC5C6\uC74C)\P{L}*$/u.test(suggestion)
601494
601742
  ],
601495
601743
  [
601496
601744
  "meta_wrapped",
601497
- () => /^\(.*\)$|^\[.*\]$/.test(suggestion)
601745
+ () => /^(\(.*\)|\[.*\]|\uFF08.*\uFF09|\uFF3B.*\uFF3D|\u3010.*\u3011|\u3014.*\u3015)$/.test(suggestion)
601498
601746
  ],
601499
601747
  [
601500
601748
  "error_message",
@@ -601508,6 +601756,9 @@ function shouldFilterSuggestion(suggestion, promptId, source2) {
601508
601756
  return false;
601509
601757
  if (suggestion.startsWith("/"))
601510
601758
  return false;
601759
+ const cjkCount = countCjkCharacters(suggestion);
601760
+ if (cjkCount > 0)
601761
+ return cjkCount < 2;
601511
601762
  const ALLOWED_SINGLE_WORDS = new Set([
601512
601763
  "yes",
601513
601764
  "yeah",
@@ -601532,15 +601783,18 @@ function shouldFilterSuggestion(suggestion, promptId, source2) {
601532
601783
  ],
601533
601784
  ["too_many_words", () => wordCount > 12],
601534
601785
  ["too_long", () => suggestion.length >= 100],
601535
- ["multiple_sentences", () => /[.!?]\s+[A-Z]/.test(suggestion)],
601786
+ [
601787
+ "multiple_sentences",
601788
+ () => /[.!?]\s+[A-Z]|[\u3002\uFF01\uFF1F]\s*[\p{L}\p{N}]/u.test(suggestion)
601789
+ ],
601536
601790
  ["has_formatting", () => /[\n*]|\*\*/.test(suggestion)],
601537
601791
  [
601538
601792
  "evaluative",
601539
- () => /thanks|thank you|looks good|sounds good|that works|that worked|that's all|nice|great|perfect|makes sense|awesome|excellent/.test(lower)
601793
+ () => /thanks|thank you|looks good|sounds good|that works|that worked|that's all|nice|great|perfect|makes sense|awesome|excellent/.test(lower) || /^\P{L}*(\u3042\u308A\u304C\u3068\u3046(\u3054\u3056\u3044\u307E\u3059|\u3054\u3056\u3044\u307E\u3057\u305F)?|\u52A9\u304B\u308A\u307E\u3057\u305F|[\u8C22\u8B1D][\u8C22\u8B1D][\u4F60\u60A8]?|\u611F\u8C22[\u4F60\u60A8]?|\u611F\u8B1D\u3057\u307E\u3059|\uAC10\uC0AC\uD569\uB2C8\uB2E4|\uACE0\uB9C8\uC6CC\uC694?)(\P{L}|\u7684|$)/u.test(suggestion) || /(\u826F\u3055\u305D\u3046|\u3088\u3055\u305D\u3046|\u3044\u3044\u3067\u3059\u306D|\u770B\u8D77\u6765\u4E0D\u9519|\u592A\u597D\u4E86|\u5B8C\u74A7|\u5B8C\u7F8E|\uC88B\uB124\uC694)(\u3067\u3059|\u3067\u3059\u306D|\u3060\u306D)?\P{L}*$/u.test(suggestion)
601540
601794
  ],
601541
601795
  [
601542
601796
  "claude_voice",
601543
- () => /^(let me|i'll|i've|i'm|i can|i would|i think|i notice|here's|here is|here are|that's|this is|this will|you can|you should|you could|sure,|of course|certainly)/i.test(suggestion)
601797
+ () => /^(let me|i'll|i've|i'm|i can|i would|i think|i notice|here's|here is|here are|that's|this is|this will|you can|you should|you could|sure,|of course|certainly|\u8BA9\u6211(?!\u4EEC)|\u6211\u6765|\u6211\u4F1A|\u6211\u5C06)/i.test(suggestion)
601544
601798
  ]
601545
601799
  ];
601546
601800
  for (const [reason, check3] of filters) {
@@ -601616,7 +601870,7 @@ Stay silent if the next step isn't obvious from what the user said.
601616
601870
 
601617
601871
  Format: 2-12 words, match the user's style. Or nothing.
601618
601872
 
601619
- Reply with ONLY the suggestion, no quotes or explanation.`, SUGGESTION_PROMPTS;
601873
+ Reply with ONLY the suggestion, no quotes or explanation.`, SUGGESTION_PROMPTS, HAN_SCRIPT_RE, PHONETIC_SCRIPT_RE, HANGUL_SCRIPT_RE, LETTER_NUMBER_RE;
601620
601874
  var init_promptSuggestion = __esm(() => {
601621
601875
  init_state();
601622
601876
  init_agentSwarmsEnabled();
@@ -601635,6 +601889,10 @@ var init_promptSuggestion = __esm(() => {
601635
601889
  user_intent: SUGGESTION_PROMPT,
601636
601890
  stated_intent: SUGGESTION_PROMPT
601637
601891
  };
601892
+ HAN_SCRIPT_RE = /\p{Script=Han}/u;
601893
+ PHONETIC_SCRIPT_RE = /[\p{Script=Hiragana}\p{Script=Katakana}\u30FC\uFF70\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;
601894
+ HANGUL_SCRIPT_RE = /\p{Script=Hangul}/u;
601895
+ LETTER_NUMBER_RE = /[\p{L}\p{N}]/u;
601638
601896
  });
601639
601897
 
601640
601898
  // src/state/AppStateStore.ts
@@ -606982,6 +607240,8 @@ function runPostCompactCleanup(querySource) {
606982
607240
  if (isMainThreadCompact) {
606983
607241
  getUserContext.cache.clear?.();
606984
607242
  resetGetMemoryFilesCache("compact");
607243
+ getSystemContext.cache.clear?.();
607244
+ getGitStatus.cache.clear?.();
606985
607245
  }
606986
607246
  clearSystemPromptSections();
606987
607247
  clearClassifierApprovals();
@@ -610772,9 +611032,11 @@ var init_loadPluginCommands = __esm(() => {
610772
611032
 
610773
611033
  // src/utils/plugins/zipCache.ts
610774
611034
  import { randomBytes as randomBytes10 } from "crypto";
611035
+ import { constants as fsConstants8 } from "fs";
610775
611036
  import {
610776
611037
  chmod as chmod8,
610777
611038
  lstat as lstat9,
611039
+ open as open13,
610778
611040
  readdir as readdir24,
610779
611041
  readFile as readFile44,
610780
611042
  rename as rename4,
@@ -610932,22 +611194,91 @@ async function collectFilesForZip(baseDir, relativePath, files2, visited) {
610932
611194
  }
610933
611195
  }
610934
611196
  }
610935
- async function extractZipToDirectory(zipPath, targetDir) {
610936
- const zipBuf = await getFsImplementation().readFileBytes(zipPath);
610937
- const files2 = await unzipFile(zipBuf);
610938
- const modes = parseZipModes(zipBuf);
610939
- await getFsImplementation().mkdir(targetDir);
611197
+ function errnoCode(error52) {
611198
+ return typeof error52 === "object" && error52 !== null && "code" in error52 ? String(error52.code) : undefined;
611199
+ }
611200
+ function isInPlaceFallbackError(error52) {
611201
+ const code = errnoCode(error52);
611202
+ return code !== undefined && IN_PLACE_FALLBACK_ERRNOS.has(code);
611203
+ }
611204
+ function errorText(error52) {
611205
+ return error52 instanceof Error ? error52.message : String(error52);
611206
+ }
611207
+ async function isExistingDirectory(path35) {
611208
+ try {
611209
+ return (await stat36(path35)).isDirectory();
611210
+ } catch {
611211
+ return false;
611212
+ }
611213
+ }
611214
+ async function removeExtractionTree(path35) {
611215
+ await rm8(path35, { recursive: true, force: true }).catch((error52) => {
611216
+ logForDebugging(`Failed to remove the extraction tree ${path35}: ${errorText(error52)}`, { level: "warn" });
611217
+ });
611218
+ }
611219
+ async function hardenExtractedFileMode(filePath, diskMode) {
611220
+ if ((diskMode & GROUP_OTHER_WRITE_BITS) === 0)
611221
+ return;
611222
+ let handle2;
611223
+ try {
611224
+ handle2 = await open13(filePath, fsConstants8.O_RDONLY | fsConstants8.O_NOFOLLOW | fsConstants8.O_NONBLOCK);
611225
+ const fdStat = await handle2.stat();
611226
+ if (!fdStat.isFile() || fdStat.nlink !== 1)
611227
+ return;
611228
+ if ((fdStat.mode & GROUP_OTHER_WRITE_BITS) !== 0) {
611229
+ await handle2.chmod(fdStat.mode & EXTRACTED_MODE_MASK);
611230
+ }
611231
+ } catch {} finally {
611232
+ await handle2?.close().catch(() => {});
611233
+ }
611234
+ }
611235
+ async function extractZipEntriesToDir(files2, modes, destDir) {
611236
+ await getFsImplementation().mkdir(destDir);
610940
611237
  for (const [relPath, data] of Object.entries(files2)) {
610941
611238
  if (relPath.endsWith("/")) {
610942
- await getFsImplementation().mkdir(join119(targetDir, relPath));
611239
+ await getFsImplementation().mkdir(join119(destDir, relPath));
610943
611240
  continue;
610944
611241
  }
610945
- const fullPath = join119(targetDir, relPath);
611242
+ const fullPath = join119(destDir, relPath);
610946
611243
  await getFsImplementation().mkdir(dirname52(fullPath));
610947
611244
  await writeFile36(fullPath, data);
610948
611245
  const mode = modes[relPath];
610949
- if (mode && mode & 73) {
610950
- await chmod8(fullPath, mode & 511).catch(() => {});
611246
+ if (mode && mode & EXEC_MODE_BITS) {
611247
+ await chmod8(fullPath, mode & EXTRACTED_MODE_MASK).catch(() => {});
611248
+ }
611249
+ const diskStat = await lstat9(fullPath).catch(() => {
611250
+ return;
611251
+ });
611252
+ if (diskStat)
611253
+ await hardenExtractedFileMode(fullPath, diskStat.mode);
611254
+ }
611255
+ }
611256
+ async function extractZipToDirectory(zipPath, targetDir) {
611257
+ const zipBuf = await getFsImplementation().readFileBytes(zipPath);
611258
+ const files2 = await unzipFile(zipBuf);
611259
+ const modes = parseZipModes(zipBuf);
611260
+ const swapHex = randomBytes10(4).toString("hex");
611261
+ const stagingDir = `${targetDir}.staging-${swapHex}`;
611262
+ const previousDir = `${targetDir}.previous-${swapHex}`;
611263
+ await extractZipEntriesToDir(files2, modes, stagingDir);
611264
+ let movedAside = false;
611265
+ try {
611266
+ if (await isExistingDirectory(targetDir)) {
611267
+ await rename4(targetDir, previousDir);
611268
+ movedAside = true;
611269
+ }
611270
+ await rename4(stagingDir, targetDir);
611271
+ if (movedAside)
611272
+ await removeExtractionTree(previousDir);
611273
+ } catch (error52) {
611274
+ if (movedAside)
611275
+ await rename4(previousDir, targetDir).catch(() => {});
611276
+ await removeExtractionTree(stagingDir);
611277
+ if (isInPlaceFallbackError(error52)) {
611278
+ logForDebugging(`Plugin extraction directory ${targetDir} or its staged copy is held open; extracting the archive in place, so files dropped from it are not cleared this time`, { level: "warn" });
611279
+ await extractZipEntriesToDir(files2, modes, targetDir);
611280
+ } else {
611281
+ throw error52;
610951
611282
  }
610952
611283
  }
610953
611284
  logForDebugging(`Extracted ZIP to ${targetDir}: ${Object.keys(files2).length} entries`);
@@ -610964,13 +611295,14 @@ function getMarketplaceJsonRelativePath(marketplaceName) {
610964
611295
  function isMarketplaceSourceSupportedByZipCache(source2) {
610965
611296
  return ["github", "git", "url", "settings"].includes(source2.source);
610966
611297
  }
610967
- var sessionPluginCachePath = null, sessionPluginCachePromise = null;
611298
+ var sessionPluginCachePath = null, sessionPluginCachePromise = null, EXTRACTED_MODE_MASK = 493, EXEC_MODE_BITS = 73, GROUP_OTHER_WRITE_BITS = 18, IN_PLACE_FALLBACK_ERRNOS;
610968
611299
  var init_zipCache = __esm(() => {
610969
611300
  init_debug();
610970
611301
  init_zip();
610971
611302
  init_envUtils();
610972
611303
  init_fsOperations();
610973
611304
  init_pathValidation();
611305
+ IN_PLACE_FALLBACK_ERRNOS = new Set(["EBUSY", "EPERM", "ENOTEMPTY", "EEXIST"]);
610974
611306
  });
610975
611307
 
610976
611308
  // src/utils/plugins/cacheUtils.ts
@@ -616557,11 +616889,11 @@ function normalizeMessagesForAPI(messages, tools = []) {
616557
616889
  if (!isSyntheticApiErrorMessage(msg)) {
616558
616890
  continue;
616559
616891
  }
616560
- const errorText = Array.isArray(msg.message.content) && msg.message.content[0]?.type === "text" ? msg.message.content[0].text : undefined;
616561
- if (!errorText) {
616892
+ const errorText2 = Array.isArray(msg.message.content) && msg.message.content[0]?.type === "text" ? msg.message.content[0].text : undefined;
616893
+ if (!errorText2) {
616562
616894
  continue;
616563
616895
  }
616564
- const blockTypesToStrip = errorToBlockTypes[errorText];
616896
+ const blockTypesToStrip = errorToBlockTypes[errorText2];
616565
616897
  if (!blockTypesToStrip) {
616566
616898
  continue;
616567
616899
  }
@@ -621718,11 +622050,11 @@ var init_dist11 = __esm(() => {
621718
622050
  return;
621719
622051
  }
621720
622052
  const decoder = new TextDecoder, reader = body.getReader();
621721
- let open13 = true;
622053
+ let open14 = true;
621722
622054
  do {
621723
622055
  const { done, value } = await reader.read();
621724
- value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (open13 = false, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));
621725
- } while (open13);
622056
+ value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (open14 = false, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));
622057
+ } while (open14);
621726
622058
  }), __privateAdd(this, _onFetchError, (err2) => {
621727
622059
  __privateSet(this, _controller, undefined), !(err2.name === "AbortError" || err2.type === "aborted") && __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this, flattenError2(err2));
621728
622060
  }), __privateAdd(this, _onEvent, (event) => {
@@ -636522,6 +636854,27 @@ function getRuleByContentsForToolName(context7, toolName, behavior) {
636522
636854
  }
636523
636855
  return ruleByContents;
636524
636856
  }
636857
+ function getRuleListForToolName(context7, toolName, behavior) {
636858
+ let rules2 = [];
636859
+ switch (behavior) {
636860
+ case "allow":
636861
+ rules2 = getAllowRules(context7);
636862
+ break;
636863
+ case "deny":
636864
+ rules2 = getDenyRules(context7);
636865
+ break;
636866
+ case "ask":
636867
+ rules2 = getAskRules(context7);
636868
+ break;
636869
+ }
636870
+ const matched = [];
636871
+ for (const rule of rules2) {
636872
+ if (rule.ruleValue.toolName === toolName && rule.ruleValue.ruleContent !== undefined && rule.ruleBehavior === behavior) {
636873
+ matched.push(rule);
636874
+ }
636875
+ }
636876
+ return matched;
636877
+ }
636525
636878
  async function runPermissionRequestHooksForHeadlessAgent(tool, input2, toolUseID, context7, permissionMode, suggestions) {
636526
636879
  try {
636527
636880
  for await (const hookResult of executePermissionRequestHooks(tool.name, toolUseID, input2, context7, permissionMode, suggestions, context7.abortController.signal)) {
@@ -643055,7 +643408,7 @@ async function ensureZombieKill(pid, graceMs = 3000) {
643055
643408
  var init_process2 = () => {};
643056
643409
 
643057
643410
  // src/daemon/lockfile.ts
643058
- import { open as open13, readFile as readFile50, unlink as unlink22, writeFile as writeFile43 } from "fs/promises";
643411
+ import { open as open14, readFile as readFile50, unlink as unlink22, writeFile as writeFile43 } from "fs/promises";
643059
643412
  import { existsSync as existsSync18, statSync as statSync16 } from "fs";
643060
643413
  import { join as join135 } from "path";
643061
643414
  function getDaemonLockfilePath() {
@@ -643089,7 +643442,7 @@ async function acquireLockfile(identity9) {
643089
643442
  await mkdir41(getClaudeConfigHomeDir(), { recursive: true }).catch(() => {});
643090
643443
  if (!existsSync18(path35)) {
643091
643444
  try {
643092
- const fh = await open13(path35, "ax");
643445
+ const fh = await open14(path35, "ax");
643093
643446
  const contents = {
643094
643447
  supervisorPid: identity9.supervisorPid,
643095
643448
  supervisorProcStart: identity9.supervisorProcStart,
@@ -643125,7 +643478,7 @@ async function acquireLockfile(identity9) {
643125
643478
  await unlink22(path35);
643126
643479
  } catch {}
643127
643480
  try {
643128
- const fh = await open13(path35, "ax");
643481
+ const fh = await open14(path35, "ax");
643129
643482
  const contents = {
643130
643483
  supervisorPid: identity9.supervisorPid,
643131
643484
  supervisorProcStart: identity9.supervisorProcStart,
@@ -645071,6 +645424,9 @@ var init_ScrollBox = __esm(() => {
645071
645424
  });
645072
645425
 
645073
645426
  // src/utils/sideQuestion.ts
645427
+ function containsFakeToolCalls(text2) {
645428
+ return BTW_FAKE_TOOLCALL_DETECTOR.test(text2);
645429
+ }
645074
645430
  function findBtwTriggerPositions(text2) {
645075
645431
  const positions = [];
645076
645432
  const matches = text2.matchAll(BTW_PATTERN);
@@ -645099,6 +645455,7 @@ IMPORTANT CONTEXT:
645099
645455
 
645100
645456
  CRITICAL CONSTRAINTS:
645101
645457
  - You have NO tools available - you cannot read files, run commands, search, or take any actions
645458
+ - Do NOT write tool calls or tool output as text (for example invoke or function_calls XML blocks) - nothing you write here is executed; if answering would need reading files, running commands, or searching, say that can't be checked from a side question and suggest asking in the main conversation
645102
645459
  - This is a one-off response - there will be no follow-up turns
645103
645460
  - You can ONLY provide information based on what you already know from the conversation context
645104
645461
  - NEVER say things like "Let me try...", "I'll now...", "Let me check...", or promise to take any action
@@ -645131,8 +645488,11 @@ function extractSideQuestionResponse(messages) {
645131
645488
  const text2 = extractTextContent(assistantBlocks, `
645132
645489
 
645133
645490
  `).trim();
645134
- if (text2)
645135
- return text2;
645491
+ if (text2) {
645492
+ return containsFakeToolCalls(text2) ? `${text2}
645493
+
645494
+ ${BTW_TOOLCALL_DISCLAIMER}` : text2;
645495
+ }
645136
645496
  const toolUse = assistantBlocks.find((b6) => b6.type === "tool_use");
645137
645497
  if (toolUse) {
645138
645498
  const toolName = "name" in toolUse ? toolUse.name : "a tool";
@@ -645145,12 +645505,13 @@ function extractSideQuestionResponse(messages) {
645145
645505
  }
645146
645506
  return null;
645147
645507
  }
645148
- var BTW_PATTERN;
645508
+ var BTW_PATTERN, BTW_TOOL_CALL_PREFIX = "antml:", BTW_FAKE_TOOLCALL_DETECTOR, BTW_TOOLCALL_DISCLAIMER = "_/btw can't run tools: any tool calls or tool output shown above were not executed and may not reflect your actual files or data. Ask in the main conversation to check._";
645149
645509
  var init_sideQuestion = __esm(() => {
645150
645510
  init_errorUtils();
645151
645511
  init_forkedAgent();
645152
645512
  init_messages3();
645153
645513
  BTW_PATTERN = /^\/btw\b/gi;
645514
+ BTW_FAKE_TOOLCALL_DETECTOR = new RegExp(`<(?:${BTW_TOOL_CALL_PREFIX})?(?:function_calls>|invoke name=)|</(?:${BTW_TOOL_CALL_PREFIX})?(?:function_calls|invoke)>`);
645154
645515
  });
645155
645516
 
645156
645517
  // src/commands/btw/btw.tsx
@@ -683248,11 +683609,11 @@ var require_dijkstra = __commonJS((exports, module) => {
683248
683609
  var predecessors = {};
683249
683610
  var costs = {};
683250
683611
  costs[s4] = 0;
683251
- var open14 = dijkstra.PriorityQueue.make();
683252
- open14.push(s4, 0);
683612
+ var open15 = dijkstra.PriorityQueue.make();
683613
+ open15.push(s4, 0);
683253
683614
  var closest, u7, v6, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
683254
- while (!open14.empty()) {
683255
- closest = open14.pop();
683615
+ while (!open15.empty()) {
683616
+ closest = open15.pop();
683256
683617
  u7 = closest.value;
683257
683618
  cost_of_s_to_u = closest.cost;
683258
683619
  adjacent_nodes = graph[u7] || {};
@@ -683264,7 +683625,7 @@ var require_dijkstra = __commonJS((exports, module) => {
683264
683625
  first_visit = typeof costs[v6] === "undefined";
683265
683626
  if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
683266
683627
  costs[v6] = cost_of_s_to_u_plus_cost_of_e;
683267
- open14.push(v6, cost_of_s_to_u_plus_cost_of_e);
683628
+ open15.push(v6, cost_of_s_to_u_plus_cost_of_e);
683268
683629
  predecessors[v6] = u7;
683269
683630
  }
683270
683631
  }
@@ -687838,13 +688199,13 @@ function computeSearchText(msg) {
687838
688199
  break;
687839
688200
  }
687840
688201
  let t4 = raw;
687841
- let open14 = t4.indexOf("<system-reminder>");
687842
- while (open14 >= 0) {
687843
- const close = t4.indexOf(SYSTEM_REMINDER_CLOSE, open14);
688202
+ let open15 = t4.indexOf("<system-reminder>");
688203
+ while (open15 >= 0) {
688204
+ const close = t4.indexOf(SYSTEM_REMINDER_CLOSE, open15);
687844
688205
  if (close < 0)
687845
688206
  break;
687846
- t4 = t4.slice(0, open14) + t4.slice(close + SYSTEM_REMINDER_CLOSE.length);
687847
- open14 = t4.indexOf("<system-reminder>");
688207
+ t4 = t4.slice(0, open15) + t4.slice(close + SYSTEM_REMINDER_CLOSE.length);
688208
+ open15 = t4.indexOf("<system-reminder>");
687848
688209
  }
687849
688210
  return t4;
687850
688211
  }
@@ -704179,6 +704540,7 @@ var init_cd2 = __esm(() => {
704179
704540
  var exports_focus = {};
704180
704541
  __export(exports_focus, {
704181
704542
  setFocusViewEnabled: () => setFocusViewEnabled,
704543
+ isFullscreenActive: () => isFullscreenActive2,
704182
704544
  isFocusViewEnabled: () => isFocusViewEnabled,
704183
704545
  call: () => call46
704184
704546
  });
@@ -715294,8 +715656,8 @@ var init_advisor2 = __esm(() => {
715294
715656
  });
715295
715657
 
715296
715658
  // src/skills/bundledSkills.ts
715297
- import { constants as fsConstants8 } from "fs";
715298
- import { mkdir as mkdir49, open as open14 } from "fs/promises";
715659
+ import { constants as fsConstants9 } from "fs";
715660
+ import { mkdir as mkdir49, open as open15 } from "fs/promises";
715299
715661
  import { dirname as dirname68, isAbsolute as isAbsolute33, join as join158, normalize as normalize16, sep as pathSep2 } from "path";
715300
715662
  function registerBundledSkill(definition) {
715301
715663
  const { files: files3 } = definition;
@@ -715376,7 +715738,7 @@ async function writeSkillFiles(dir, files3) {
715376
715738
  }));
715377
715739
  }
715378
715740
  async function safeWriteFile(p4, content) {
715379
- const fh = await open14(p4, SAFE_WRITE_FLAGS, 384);
715741
+ const fh = await open15(p4, SAFE_WRITE_FLAGS, 384);
715380
715742
  try {
715381
715743
  await fh.writeFile(content, "utf8");
715382
715744
  } finally {
@@ -715407,8 +715769,8 @@ var init_bundledSkills = __esm(() => {
715407
715769
  init_debug();
715408
715770
  init_filesystem();
715409
715771
  bundledSkills = [];
715410
- O_NOFOLLOW = fsConstants8.O_NOFOLLOW ?? 0;
715411
- SAFE_WRITE_FLAGS = process.platform === "win32" ? "wx" : fsConstants8.O_WRONLY | fsConstants8.O_CREAT | fsConstants8.O_EXCL | O_NOFOLLOW;
715772
+ O_NOFOLLOW = fsConstants9.O_NOFOLLOW ?? 0;
715773
+ SAFE_WRITE_FLAGS = process.platform === "win32" ? "wx" : fsConstants9.O_WRONLY | fsConstants9.O_CREAT | fsConstants9.O_EXCL | O_NOFOLLOW;
715412
715774
  });
715413
715775
 
715414
715776
  // src/commands/env/index.js
@@ -720995,7 +721357,7 @@ __export(exports_insights, {
720995
721357
  buildExportData: () => buildExportData
720996
721358
  });
720997
721359
  import { execFileSync as execFileSync7 } from "child_process";
720998
- import { constants as fsConstants9 } from "fs";
721360
+ import { constants as fsConstants10 } from "fs";
720999
721361
  import {
721000
721362
  copyFile as copyFile10,
721001
721363
  mkdir as mkdir51,
@@ -722805,7 +723167,7 @@ var init_insights = __esm(() => {
722805
723167
  const srcFile = join160(projectPath, fileName);
722806
723168
  const destFile = join160(destProjectPath, fileName);
722807
723169
  try {
722808
- await copyFile10(srcFile, destFile, fsConstants9.COPYFILE_EXCL);
723170
+ await copyFile10(srcFile, destFile, fsConstants10.COPYFILE_EXCL);
722809
723171
  result.copied++;
722810
723172
  } catch {
722811
723173
  result.skipped++;
@@ -723211,6 +723573,21 @@ async function getWorkflowCommands(_cwd) {
723211
723573
  function getBuiltInCommandByName(name3) {
723212
723574
  return COMMANDS().find((_4) => _4.name === name3 || _4.aliases?.includes(name3));
723213
723575
  }
723576
+ function isSkillNameSafeToDisplay(name3) {
723577
+ return name3.length > 0 && name3.length <= MAX_SAFE_SKILL_NAME_LENGTH && !UNSAFE_SKILL_NAME_CHARS_RE.test(name3);
723578
+ }
723579
+ function findPluginSkillFullNameMatch(query2, commands7) {
723580
+ if (query2 === "" || query2.includes(":"))
723581
+ return { kind: "none" };
723582
+ const suffix2 = `:${query2}`;
723583
+ const matches = commands7.filter((cmd) => cmd.type === "prompt" && cmd.name.endsWith(suffix2));
723584
+ if (matches.length > 1)
723585
+ return { kind: "ambiguous", candidates: matches };
723586
+ const unique = matches[0];
723587
+ if (unique === undefined || unique.source !== "plugin")
723588
+ return { kind: "none" };
723589
+ return { kind: "unique", command: unique };
723590
+ }
723214
723591
  async function getSkills(cwd2) {
723215
723592
  try {
723216
723593
  const [skillDirCommands, pluginSkills] = await Promise.all([
@@ -723355,7 +723732,7 @@ function formatDescriptionWithSource(cmd) {
723355
723732
  }
723356
723733
  return `${cmd.description} (${getSettingSourceName(cmd.source)})`;
723357
723734
  }
723358
- var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteControlServerCommand, voiceCommand, forceSnip, workflowsCmd, webCmd, clearSkillIndexCache3, subscribePr, ultraplan, torch, peersCmd, forkCmd, buddy, usageReport2, INTERNAL_ONLY_COMMANDS2, COMMANDS, builtInCommandNames, getWorkflowCommands2, loadAllCommands, getSkillToolCommands, getSlashCommandToolSkills, REMOTE_SAFE_COMMANDS, BRIDGE_SAFE_COMMANDS;
723735
+ var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteControlServerCommand, voiceCommand, forceSnip, workflowsCmd, webCmd, clearSkillIndexCache3, subscribePr, ultraplan, torch, peersCmd, forkCmd, buddy, usageReport2, INTERNAL_ONLY_COMMANDS2, COMMANDS, builtInCommandNames, UNSAFE_SKILL_NAME_CHARS_RE, MAX_SAFE_SKILL_NAME_LENGTH = 256, getWorkflowCommands2, loadAllCommands, getSkillToolCommands, getSlashCommandToolSkills, REMOTE_SAFE_COMMANDS, BRIDGE_SAFE_COMMANDS;
723359
723736
  var init_commands5 = __esm(() => {
723360
723737
  init_envUtils();
723361
723738
  init_add_dir2();
@@ -723649,6 +724026,7 @@ var init_commands5 = __esm(() => {
723649
724026
  ...process.env.USER_TYPE === "ant" && !process.env.IS_DEMO ? INTERNAL_ONLY_COMMANDS2 : []
723650
724027
  ]);
723651
724028
  builtInCommandNames = memoize_default(() => new Set(COMMANDS().flatMap((_4) => [_4.name, ..._4.aliases ?? []])));
724029
+ UNSAFE_SKILL_NAME_CHARS_RE = /[\x00-\x1f\x7f-\x9f\u2028\u2029<>]/;
723652
724030
  getWorkflowCommands2 = feature("WORKFLOW_SCRIPTS") ? __toCommonJS(exports_createWorkflowCommand).getWorkflowCommands : null;
723653
724031
  loadAllCommands = memoize_default(async (cwd2) => {
723654
724032
  const [
@@ -727372,9 +727750,12 @@ import { posix as posix8 } from "path";
727372
727750
  function unescapePatternSegment(segment2) {
727373
727751
  return segment2.replace(/\\([\s\S])/g, (match, char) => ESCAPABLE_PATTERN_CHAR.test(char) ? char : match);
727374
727752
  }
727375
- function escapePatternPath(path39) {
727753
+ function escapePatternPath(path39, opts) {
727754
+ const escapeGlobs = opts?.escapeGlobs ?? true;
727376
727755
  let escaped = path39.replaceAll("\\", "\\\\").replace(/[[\]()|+^$]/g, (char) => `\\${char}`);
727377
- escaped = escaped.replaceAll("*", "\\*");
727756
+ if (escapeGlobs) {
727757
+ escaped = escaped.replaceAll("*", "\\*");
727758
+ }
727378
727759
  if (escaped.startsWith("!") || escaped.startsWith("#")) {
727379
727760
  escaped = `\\${escaped}`;
727380
727761
  }
@@ -727771,7 +728152,7 @@ function getFileReadIgnorePatterns(toolPermissionContext) {
727771
728152
  const matchersByRoot = getCachedPatternMatchers(toolPermissionContext, "read", "deny");
727772
728153
  const result = new Map;
727773
728154
  for (const [patternRoot, { patternMap }] of matchersByRoot.entries()) {
727774
- result.set(patternRoot, Array.from(patternMap.keys()));
728155
+ result.set(patternRoot, Array.from(patternMap.keys()).filter((pattern) => !pattern.startsWith("!")));
727775
728156
  }
727776
728157
  return result;
727777
728158
  }
@@ -727819,6 +728200,30 @@ function normalizeIgnorePattern(pattern) {
727819
728200
  }
727820
728201
  return pattern;
727821
728202
  }
728203
+ function warnUnusablePermissionRule(tag, pattern, reason, action2 = "treating it as matching nothing") {
728204
+ const dedupKey = `${tag}\x00${pattern}`;
728205
+ if (warnedUnusablePatterns.has(dedupKey)) {
728206
+ return;
728207
+ }
728208
+ warnedUnusablePatterns.add(dedupKey);
728209
+ logForDebugging(`[${tag}] gitignore-style pattern is unusable (${reason}); ${action2}: ${pattern}`, { level: "warn" });
728210
+ }
728211
+ function normalizePermissionRulePattern(pattern, isAllow) {
728212
+ const normalized = normalizeTrailingGlobstar(pattern, isAllow);
728213
+ const reason = !isAllow && BARE_NEGATION_PATTERN.test(normalized) ? "a negation of every path" : unusablePatternReason(normalized);
728214
+ if (reason === null) {
728215
+ return pattern;
728216
+ }
728217
+ const bangPrefix = pattern.startsWith("!") ? "!" : "";
728218
+ const shouldDrop = bangPrefix ? !isAllow : isAllow;
728219
+ warnUnusablePermissionRule("permission_rules", pattern, reason, shouldDrop ? "dropping it" : "matching the literal path it spells");
728220
+ if (shouldDrop) {
728221
+ return null;
728222
+ }
728223
+ const globstarSuffix = pattern.endsWith("/**") ? "/**" : "";
728224
+ const middle = pattern.slice(bangPrefix.length, pattern.length - globstarSuffix.length);
728225
+ return bangPrefix + escapePatternPath(unescapePatternSegment(middle), { escapeGlobs: false }) + globstarSuffix;
728226
+ }
727822
728227
  function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
727823
728228
  const rulesObject = behavior === "deny" ? toolPermissionContext.alwaysDenyRules : behavior === "ask" ? toolPermissionContext.alwaysAskRules : null;
727824
728229
  const additionalDirs = JSON.stringify([...toolPermissionContext.additionalWorkingDirectories.keys()].sort());
@@ -727842,23 +728247,7 @@ function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
727842
728247
  }
727843
728248
  }
727844
728249
  }
727845
- const patternsByRoot = getPatternsByRoot(toolPermissionContext, toolType, behavior);
727846
- const result = new Map;
727847
- for (const [root3, patternMap] of patternsByRoot.entries()) {
727848
- let ig;
727849
- let useCount = 0;
727850
- result.set(root3, {
727851
- patternMap,
727852
- getIg: () => {
727853
- if (ig === undefined || ++useCount > MATCHER_RECOMPILE_THRESHOLD) {
727854
- useCount = 1;
727855
- const patternsToAdd = behavior === "allow" ? Array.from(patternMap.keys()) : Array.from(patternMap.keys(), normalizeIgnorePattern);
727856
- ig = import_ignore6.default().add(patternsToAdd);
727857
- }
727858
- return ig;
727859
- }
727860
- });
727861
- }
728250
+ const result = buildPatternBuckets(toolPermissionContext, toolType, behavior);
727862
728251
  if (rulesObject !== null) {
727863
728252
  let innerMap = matcherCache.get(rulesObject);
727864
728253
  if (innerMap === undefined) {
@@ -727875,7 +728264,7 @@ function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
727875
728264
  }
727876
728265
  return result;
727877
728266
  }
727878
- function getPatternsByRoot(toolPermissionContext, toolType, behavior) {
728267
+ function buildPatternBuckets(toolPermissionContext, toolType, behavior) {
727879
728268
  const toolName = (() => {
727880
728269
  switch (toolType) {
727881
728270
  case "edit":
@@ -727884,36 +728273,73 @@ function getPatternsByRoot(toolPermissionContext, toolType, behavior) {
727884
728273
  return FILE_READ_TOOL_NAME;
727885
728274
  }
727886
728275
  })();
727887
- const rules2 = getRuleByContentsForToolName(toolPermissionContext, toolName, behavior);
727888
- const patternsByRoot = new Map;
727889
- for (const [pattern, rule] of rules2.entries()) {
727890
- const { relativePattern, root: root3 } = patternWithRoot(pattern, rule.source);
727891
- let patternsForRoot = patternsByRoot.get(root3);
727892
- if (patternsForRoot === undefined) {
727893
- patternsForRoot = new Map;
727894
- patternsByRoot.set(root3, patternsForRoot);
727895
- }
727896
- patternsForRoot.set(relativePattern, rule);
727897
- if (behavior === "allow" || root3 === null) {
728276
+ const isAllow = behavior === "allow";
728277
+ const rulesList = getRuleListForToolName(toolPermissionContext, toolName, behavior);
728278
+ const rules2 = isAllow ? Array.from(new Map(rulesList.map((rule) => [rule.ruleValue.ruleContent, rule])).values()) : rulesList;
728279
+ const bucketsByRoot = new Map;
728280
+ const getMatcher = (root3, source2) => {
728281
+ let bucket = bucketsByRoot.get(root3);
728282
+ if (bucket === undefined) {
728283
+ bucket = { patternMap: new Map, matchers: [] };
728284
+ bucketsByRoot.set(root3, bucket);
728285
+ }
728286
+ let matcher = bucket.matchers.find((candidate) => candidate.source === source2);
728287
+ if (matcher === undefined) {
728288
+ const patternMap = new Map;
728289
+ let ig;
728290
+ let useCount = 0;
728291
+ matcher = {
728292
+ source: source2,
728293
+ patternMap,
728294
+ getIg: () => {
728295
+ if (ig === undefined || ++useCount > MATCHER_RECOMPILE_THRESHOLD) {
728296
+ useCount = 1;
728297
+ const patternsToAdd = isAllow ? Array.from(patternMap.keys()) : Array.from(patternMap.keys(), normalizeIgnorePattern);
728298
+ ig = import_ignore6.default().add(patternsToAdd);
728299
+ }
728300
+ return ig;
728301
+ }
728302
+ };
728303
+ bucket.matchers.push(matcher);
728304
+ }
728305
+ return { bucket, matcher };
728306
+ };
728307
+ for (const rule of rules2) {
728308
+ const ruleContent = rule.ruleValue.ruleContent;
728309
+ if (ruleContent === undefined) {
728310
+ continue;
728311
+ }
728312
+ const { relativePattern, root: root3 } = patternWithRoot(ruleContent, rule.source);
728313
+ const pattern = normalizePermissionRulePattern(collapsePatternSlashes(relativePattern), isAllow);
728314
+ if (pattern === null) {
728315
+ continue;
728316
+ }
728317
+ const matcherSource = isAllow ? null : rule.source;
728318
+ const { bucket, matcher } = getMatcher(root3, matcherSource);
728319
+ if (!isAllow) {
728320
+ matcher.patternMap.delete(pattern);
728321
+ }
728322
+ matcher.patternMap.set(pattern, rule);
728323
+ bucket.patternMap.set(pattern, rule);
728324
+ if (isAllow || root3 === null) {
727898
728325
  continue;
727899
728326
  }
727900
- const twins = getOrInitPhysicalTwins(makePhysicalTwinsKey(root3, relativePattern));
727901
- const twin = resolvePhysicalTwinPattern(root3, relativePattern);
728327
+ const twins = getOrInitPhysicalTwins(makePhysicalTwinsKey(root3, pattern));
728328
+ const twin = resolvePhysicalTwinPattern(root3, pattern);
727902
728329
  if (twin !== null) {
727903
728330
  twins.add(twin);
727904
728331
  }
727905
728332
  for (const twinPattern of twins) {
727906
- let rootSlashPatterns = patternsByRoot.get(DIR_SEP2);
727907
- if (rootSlashPatterns === undefined) {
727908
- rootSlashPatterns = new Map;
727909
- patternsByRoot.set(DIR_SEP2, rootSlashPatterns);
728333
+ const { bucket: twinBucket, matcher: twinMatcher } = getMatcher(DIR_SEP2, matcherSource);
728334
+ if (!twinMatcher.patternMap.has(twinPattern)) {
728335
+ twinMatcher.patternMap.set(twinPattern, rule);
727910
728336
  }
727911
- if (!rootSlashPatterns.has(twinPattern)) {
727912
- rootSlashPatterns.set(twinPattern, rule);
728337
+ if (!twinBucket.patternMap.has(twinPattern)) {
728338
+ twinBucket.patternMap.set(twinPattern, rule);
727913
728339
  }
727914
728340
  }
727915
728341
  }
727916
- return patternsByRoot;
728342
+ return bucketsByRoot;
727917
728343
  }
727918
728344
  function matchingRuleForInput(path39, toolPermissionContext, toolType, behavior) {
727919
728345
  let fileAbsolutePath = expandPath(path39);
@@ -727921,8 +728347,7 @@ function matchingRuleForInput(path39, toolPermissionContext, toolType, behavior)
727921
728347
  fileAbsolutePath = windowsPathToPosixPath(fileAbsolutePath);
727922
728348
  }
727923
728349
  const matchersByRoot = getCachedPatternMatchers(toolPermissionContext, toolType, behavior);
727924
- for (const [root3, { patternMap, getIg }] of matchersByRoot.entries()) {
727925
- const ig = getIg();
728350
+ for (const [root3, { matchers }] of matchersByRoot.entries()) {
727926
728351
  const relativePathStr = relativePath(root3 ?? getCwd(), fileAbsolutePath ?? getCwd());
727927
728352
  if (relativePathStr.startsWith(`..${DIR_SEP2}`)) {
727928
728353
  continue;
@@ -727930,14 +728355,31 @@ function matchingRuleForInput(path39, toolPermissionContext, toolType, behavior)
727930
728355
  if (!relativePathStr) {
727931
728356
  continue;
727932
728357
  }
727933
- const igResult = ig.test(relativePathStr);
727934
- if (igResult.ignored && igResult.rule) {
728358
+ for (let i6 = matchers.length - 1;i6 >= 0; i6--) {
728359
+ const matcher = matchers[i6];
728360
+ if (matcher === undefined) {
728361
+ continue;
728362
+ }
728363
+ const { patternMap, getIg } = matcher;
728364
+ const igResult = getIg().test(relativePathStr);
728365
+ if (!igResult.ignored || !igResult.rule) {
728366
+ continue;
728367
+ }
727935
728368
  const originalPattern = igResult.rule.pattern;
727936
728369
  const withWildcard = originalPattern + "/**";
727937
- if (patternMap.has(withWildcard)) {
728370
+ if (patternMap.has(withWildcard) && (originalPattern.includes("/") || behavior !== "allow")) {
727938
728371
  return patternMap.get(withWildcard) ?? null;
727939
728372
  }
727940
- return patternMap.get(originalPattern) ?? null;
728373
+ if (originalPattern.startsWith("/")) {
728374
+ const withoutLeadingSlash = originalPattern.slice(1) + "/**";
728375
+ if (patternMap.has(withoutLeadingSlash)) {
728376
+ return patternMap.get(withoutLeadingSlash) ?? null;
728377
+ }
728378
+ }
728379
+ const rule = patternMap.get(originalPattern);
728380
+ if (rule !== undefined || behavior === "allow") {
728381
+ return rule ?? null;
728382
+ }
727941
728383
  }
727942
728384
  }
727943
728385
  return null;
@@ -728385,7 +728827,7 @@ function checkReadableInternalPath(absolutePath, input2) {
728385
728827
  }
728386
728828
  return { behavior: "passthrough", message: "" };
728387
728829
  }
728388
- var import_ignore6, DANGEROUS_FILES2, DANGEROUS_DIRECTORIES2, DIR_SEP2, getClaudeTempDir, getBundledSkillsRoot, getResolvedWorkingDirPaths, MATCHER_RECOMPILE_THRESHOLD = 1e4, MATCHER_CACHE_MAX_ENTRIES = 16, matcherCache;
728830
+ var import_ignore6, DANGEROUS_FILES2, DANGEROUS_DIRECTORIES2, DIR_SEP2, getClaudeTempDir, getBundledSkillsRoot, getResolvedWorkingDirPaths, MATCHER_RECOMPILE_THRESHOLD = 1e4, MATCHER_CACHE_MAX_ENTRIES = 16, matcherCache, BARE_NEGATION_PATTERN, warnedUnusablePatterns;
728389
728831
  var init_filesystem = __esm(() => {
728390
728832
  init_featureFlags();
728391
728833
  init_memoize();
@@ -728395,6 +728837,7 @@ var init_filesystem = __esm(() => {
728395
728837
  init_growthbook();
728396
728838
  init_prompt3();
728397
728839
  init_cwd2();
728840
+ init_debug();
728398
728841
  init_envUtils();
728399
728842
  init_fsOperations();
728400
728843
  init_path2();
@@ -728445,6 +728888,8 @@ var init_filesystem = __esm(() => {
728445
728888
  });
728446
728889
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
728447
728890
  matcherCache = new WeakMap;
728891
+ BARE_NEGATION_PATTERN = /^!\s*$/;
728892
+ warnedUnusablePatterns = new Set;
728448
728893
  });
728449
728894
 
728450
728895
  // src/utils/task/diskOutput.ts
@@ -728468,10 +728913,10 @@ __export(exports_diskOutput, {
728468
728913
  MAX_TASK_OUTPUT_BYTES: () => MAX_TASK_OUTPUT_BYTES,
728469
728914
  DiskTaskOutput: () => DiskTaskOutput
728470
728915
  });
728471
- import { constants as fsConstants10 } from "fs";
728916
+ import { constants as fsConstants11 } from "fs";
728472
728917
  import {
728473
728918
  mkdir as mkdir53,
728474
- open as open15,
728919
+ open as open16,
728475
728920
  stat as stat45,
728476
728921
  symlink as symlink4,
728477
728922
  unlink as unlink27
@@ -728559,7 +729004,7 @@ class DiskTaskOutput {
728559
729004
  try {
728560
729005
  if (!this.#fileHandle) {
728561
729006
  await ensureOutputDir();
728562
- this.#fileHandle = await open15(this.#path, process.platform === "win32" ? "a" : fsConstants10.O_WRONLY | fsConstants10.O_APPEND | fsConstants10.O_CREAT | O_NOFOLLOW2);
729007
+ this.#fileHandle = await open16(this.#path, process.platform === "win32" ? "a" : fsConstants11.O_WRONLY | fsConstants11.O_APPEND | fsConstants11.O_CREAT | O_NOFOLLOW2);
728563
729008
  }
728564
729009
  while (true) {
728565
729010
  const cancelCount = this.#cancelCount;
@@ -728770,7 +729215,7 @@ function initTaskOutput(taskId) {
728770
729215
  return track((async () => {
728771
729216
  await ensureOutputDir();
728772
729217
  const outputPath = getTaskOutputPath(taskId);
728773
- const fh = await open15(outputPath, process.platform === "win32" ? "wx" : fsConstants10.O_WRONLY | fsConstants10.O_CREAT | fsConstants10.O_EXCL | O_NOFOLLOW2);
729218
+ const fh = await open16(outputPath, process.platform === "win32" ? "wx" : fsConstants11.O_WRONLY | fsConstants11.O_CREAT | fsConstants11.O_EXCL | O_NOFOLLOW2);
728774
729219
  await fh.close();
728775
729220
  return outputPath;
728776
729221
  })());
@@ -728802,7 +729247,7 @@ var init_diskOutput = __esm(() => {
728802
729247
  init_fsOperations();
728803
729248
  init_log3();
728804
729249
  init_filesystem();
728805
- O_NOFOLLOW2 = fsConstants10.O_NOFOLLOW ?? 0;
729250
+ O_NOFOLLOW2 = fsConstants11.O_NOFOLLOW ?? 0;
728806
729251
  DEFAULT_MAX_READ_BYTES = 8 * 1024 * 1024;
728807
729252
  MAX_TASK_OUTPUT_BYTES = 5 * 1024 * 1024 * 1024;
728808
729253
  MAX_UNWRITTEN_CHARS_BEFORE_DROP = 16 * 1024 * 1024;
@@ -771976,8 +772421,8 @@ function findTextObject(text2, offset, objectType2, isInner) {
771976
772421
  return findWordObject(text2, offset, isInner, (ch2) => !isVimWhitespace(ch2));
771977
772422
  const pair = PAIRS[objectType2];
771978
772423
  if (pair) {
771979
- const [open16, close] = pair;
771980
- return open16 === close ? findQuoteObject(text2, offset, open16, isInner) : findBracketObject(text2, offset, open16, close, isInner);
772424
+ const [open17, close] = pair;
772425
+ return open17 === close ? findQuoteObject(text2, offset, open17, isInner) : findBracketObject(text2, offset, open17, close, isInner);
771981
772426
  }
771982
772427
  return null;
771983
772428
  }
@@ -772052,13 +772497,13 @@ function findQuoteObject(text2, offset, quote2, isInner) {
772052
772497
  }
772053
772498
  return null;
772054
772499
  }
772055
- function findBracketObject(text2, offset, open16, close, isInner) {
772500
+ function findBracketObject(text2, offset, open17, close, isInner) {
772056
772501
  let depth = 0;
772057
772502
  let start = -1;
772058
772503
  for (let i6 = offset;i6 >= 0; i6--) {
772059
772504
  if (text2[i6] === close && i6 !== offset)
772060
772505
  depth++;
772061
- else if (text2[i6] === open16) {
772506
+ else if (text2[i6] === open17) {
772062
772507
  if (depth === 0) {
772063
772508
  start = i6;
772064
772509
  break;
@@ -772071,7 +772516,7 @@ function findBracketObject(text2, offset, open16, close, isInner) {
772071
772516
  depth = 0;
772072
772517
  let end = -1;
772073
772518
  for (let i6 = start + 1;i6 < text2.length; i6++) {
772074
- if (text2[i6] === open16)
772519
+ if (text2[i6] === open17)
772075
772520
  depth++;
772076
772521
  else if (text2[i6] === close) {
772077
772522
  if (depth === 0) {
@@ -776284,6 +776729,43 @@ var init_PromptInputStashNotice = __esm(() => {
776284
776729
  jsx_runtime436 = __toESM(require_jsx_runtime(), 1);
776285
776730
  });
776286
776731
 
776732
+ // src/components/PromptInput/sanitizeBannerText.ts
776733
+ function stripLoneSurrogates(text2) {
776734
+ if (isWellFormed && isWellFormed(text2))
776735
+ return text2;
776736
+ return text2.replace(LONE_SURROGATE_RE, "");
776737
+ }
776738
+ function stripAnsiSequences(text2) {
776739
+ let result = text2;
776740
+ for (let pass2 = 0;pass2 < ANSI_STRIP_PASSES; pass2++) {
776741
+ const next2 = result.replace(ANSI_SEQUENCE_RE, "");
776742
+ if (next2 === result)
776743
+ break;
776744
+ result = next2;
776745
+ }
776746
+ return result;
776747
+ }
776748
+ function replaceControlsWithSpace(text2) {
776749
+ return text2.replace(CONTROL_FORMAT_RE, " ");
776750
+ }
776751
+ function sanitizeBannerText(text2) {
776752
+ return replaceControlsWithSpace(stripAnsiSequences(stripLoneSurrogates(text2))).replace(/ {2,}/g, " ").trim();
776753
+ }
776754
+ function clampBannerTextWidth(maxWidth) {
776755
+ return Math.max(1, Math.min(BANNER_TEXT_MAX_WIDTH, maxWidth - 1));
776756
+ }
776757
+ function sanitizeAndClampBannerText(text2, maxWidth) {
776758
+ return truncateToWidth(sanitizeBannerText(text2), clampBannerTextWidth(maxWidth));
776759
+ }
776760
+ var BANNER_TEXT_MAX_WIDTH = 24, ANSI_STRIP_PASSES = 4, ANSI_SEQUENCE_RE, LONE_SURROGATE_RE, CONTROL_FORMAT_RE, isWellFormed;
776761
+ var init_sanitizeBannerText = __esm(() => {
776762
+ init_truncate();
776763
+ ANSI_SEQUENCE_RE = /\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]|\x1b[\]PX^_][^\x1b\x07]*(?:\x07|\x1b\\)/g;
776764
+ LONE_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
776765
+ CONTROL_FORMAT_RE = /[\p{Cc}\p{Cf}\u2028\u2029]+/gu;
776766
+ isWellFormed = typeof String.prototype.isWellFormed === "function" ? Function.prototype.call.bind(String.prototype.isWellFormed) : undefined;
776767
+ });
776768
+
776287
776769
  // src/components/PromptInput/inputPaste.ts
776288
776770
  function maybeTruncateMessageForInput(text2, nextPasteId) {
776289
776771
  if (text2.length <= TRUNCATION_THRESHOLD) {
@@ -778403,6 +778885,7 @@ function PromptInput({
778403
778885
  })
778404
778886
  });
778405
778887
  }
778888
+ const bannerText = swarmBanner ? sanitizeAndClampBannerText(swarmBanner.text, columns) : "";
778406
778889
  const textInputElement = isVimModeEnabled() ? /* @__PURE__ */ jsx_runtime437.jsx(VimTextInput, {
778407
778890
  ...baseProps,
778408
778891
  initialMode: vimMode,
@@ -778432,15 +778915,15 @@ function PromptInput({
778432
778915
  children: [
778433
778916
  /* @__PURE__ */ jsx_runtime437.jsx(ThemedText, {
778434
778917
  color: swarmBanner.bgColor,
778435
- children: swarmBanner.text ? /* @__PURE__ */ jsx_runtime437.jsxs(jsx_runtime437.Fragment, {
778918
+ children: bannerText ? /* @__PURE__ */ jsx_runtime437.jsxs(jsx_runtime437.Fragment, {
778436
778919
  children: [
778437
- "\u2500".repeat(Math.max(0, columns - stringWidth(swarmBanner.text) - 4)),
778920
+ "\u2500".repeat(Math.max(0, columns - stringWidth(bannerText) - 4)),
778438
778921
  /* @__PURE__ */ jsx_runtime437.jsxs(ThemedText, {
778439
778922
  backgroundColor: swarmBanner.bgColor,
778440
778923
  color: "inverseText",
778441
778924
  children: [
778442
778925
  " ",
778443
- swarmBanner.text,
778926
+ bannerText,
778444
778927
  " "
778445
778928
  ]
778446
778929
  }),
@@ -778717,6 +779200,7 @@ var init_PromptInput = __esm(() => {
778717
779200
  init_PromptInputModeIndicator();
778718
779201
  init_PromptInputQueuedCommands();
778719
779202
  init_PromptInputStashNotice();
779203
+ init_sanitizeBannerText();
778720
779204
  init_useMaybeTruncateInput();
778721
779205
  init_usePromptInputPlaceholder();
778722
779206
  init_useShowFastIconHint();
@@ -794988,7 +795472,7 @@ function useSurveyState({
794988
795472
  setState("submitted");
794989
795473
  setTimeout(setState, hideThanksAfterMs, "closed");
794990
795474
  }, [hideThanksAfterMs]);
794991
- const open16 = import_react293.useCallback(() => {
795475
+ const open17 = import_react293.useCallback(() => {
794992
795476
  if (state4 !== "closed") {
794993
795477
  return;
794994
795478
  }
@@ -795039,7 +795523,7 @@ function useSurveyState({
795039
795523
  return {
795040
795524
  state: state4,
795041
795525
  lastResponse,
795042
- open: open16,
795526
+ open: open17,
795043
795527
  handleSelect,
795044
795528
  handleTranscriptSelect
795045
795529
  };
@@ -795175,7 +795659,7 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
795175
795659
  const {
795176
795660
  state: state4,
795177
795661
  lastResponse,
795178
- open: open16,
795662
+ open: open17,
795179
795663
  handleSelect,
795180
795664
  handleTranscriptSelect
795181
795665
  } = useSurveyState({
@@ -795256,9 +795740,9 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
795256
795740
  }, [state4, isLoading, hasActivePrompt, isModelAllowed2, feedbackSurvey.timeLastShown, feedbackSurvey.submitCountAtLastAppearance, submitCount, config8.minTimeBetweenFeedbackMs, config8.minTimeBetweenGlobalFeedbackMs, config8.minUserTurnsBetweenFeedback, config8.minTimeBeforeFeedbackMs, config8.minUserTurnsBeforeFeedback, config8.probability, settingsRate]);
795257
795741
  import_react294.useEffect(() => {
795258
795742
  if (shouldOpen) {
795259
- open16();
795743
+ open17();
795260
795744
  }
795261
- }, [shouldOpen, open16]);
795745
+ }, [shouldOpen, open17]);
795262
795746
  return {
795263
795747
  state: state4,
795264
795748
  lastResponse,
@@ -795402,7 +795886,7 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
795402
795886
  const {
795403
795887
  state: state4,
795404
795888
  lastResponse,
795405
- open: open16,
795889
+ open: open17,
795406
795890
  handleSelect,
795407
795891
  handleTranscriptSelect
795408
795892
  } = useSurveyState({
@@ -795455,9 +795939,9 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
795455
795939
  return;
795456
795940
  }
795457
795941
  if (Math.random() < SURVEY_PROBABILITY) {
795458
- open16();
795942
+ open17();
795459
795943
  }
795460
- }, [enabled2, state4, isLoading, hasActivePrompt, lastAssistant, messages, open16]);
795944
+ }, [enabled2, state4, isLoading, hasActivePrompt, lastAssistant, messages, open17]);
795461
795945
  return {
795462
795946
  state: state4,
795463
795947
  lastResponse,
@@ -795539,7 +796023,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
795539
796023
  const {
795540
796024
  state: state4,
795541
796025
  lastResponse,
795542
- open: open16,
796026
+ open: open17,
795543
796027
  handleSelect
795544
796028
  } = useSurveyState(t5);
795545
796029
  let t6;
@@ -795571,7 +796055,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
795571
796055
  const currentCompactBoundaries = t8;
795572
796056
  let t10;
795573
796057
  let t9;
795574
- if ($4[9] !== currentCompactBoundaries || $4[10] !== enabled2 || $4[11] !== gateEnabled || $4[12] !== hasActivePrompt || $4[13] !== isLoading || $4[14] !== messages || $4[15] !== open16 || $4[16] !== state4) {
796058
+ if ($4[9] !== currentCompactBoundaries || $4[10] !== enabled2 || $4[11] !== gateEnabled || $4[12] !== hasActivePrompt || $4[13] !== isLoading || $4[14] !== messages || $4[15] !== open17 || $4[16] !== state4) {
795575
796059
  t9 = () => {
795576
796060
  if (!enabled2) {
795577
796061
  return;
@@ -795595,7 +796079,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
795595
796079
  if (hasMessageAfterBoundary(messages, pendingCompactBoundaryUuid.current)) {
795596
796080
  pendingCompactBoundaryUuid.current = null;
795597
796081
  if (Math.random() < SURVEY_PROBABILITY2) {
795598
- open16();
796082
+ open17();
795599
796083
  }
795600
796084
  return;
795601
796085
  }
@@ -795606,14 +796090,14 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
795606
796090
  pendingCompactBoundaryUuid.current = newBoundaries[newBoundaries.length - 1];
795607
796091
  }
795608
796092
  };
795609
- t10 = [enabled2, currentCompactBoundaries, state4, isLoading, hasActivePrompt, gateEnabled, messages, open16];
796093
+ t10 = [enabled2, currentCompactBoundaries, state4, isLoading, hasActivePrompt, gateEnabled, messages, open17];
795610
796094
  $4[9] = currentCompactBoundaries;
795611
796095
  $4[10] = enabled2;
795612
796096
  $4[11] = gateEnabled;
795613
796097
  $4[12] = hasActivePrompt;
795614
796098
  $4[13] = isLoading;
795615
796099
  $4[14] = messages;
795616
- $4[15] = open16;
796100
+ $4[15] = open17;
795617
796101
  $4[16] = state4;
795618
796102
  $4[17] = t10;
795619
796103
  $4[18] = t9;
@@ -796945,6 +797429,7 @@ var init_tipRegistry = __esm(() => {
796945
797429
  init_fileHistory();
796946
797430
  init_settings2();
796947
797431
  init_terminalSetup();
797432
+ init_focus2();
796948
797433
  init_DesktopUpsellStartup();
796949
797434
  init_color();
796950
797435
  init_OverageCreditUpsell();
@@ -797421,6 +797906,12 @@ ${blue2(`/plugin install vercel@${OFFICIAL_MARKETPLACE_NAME}`)}`;
797421
797906
  const config8 = getGlobalConfig();
797422
797907
  return config8.numStartups > 5;
797423
797908
  }
797909
+ },
797910
+ {
797911
+ id: "focus-view",
797912
+ content: async () => "Use /focus to see just your prompt, a one-line summary of the work, and the response",
797913
+ cooldownSessions: 15,
797914
+ isRelevant: async () => isFullscreenActive2() && getSettings_DEPRECATED().viewMode === undefined && !isFocusViewEnabled()
797424
797915
  }
797425
797916
  ];
797426
797917
  internalOnlyTips = process.env.USER_TYPE === "ant" ? [
@@ -801765,12 +802256,13 @@ function AlternateScreen(t0) {
801765
802256
  if (!writeRaw) {
801766
802257
  return;
801767
802258
  }
801768
- writeRaw(ENTER_ALT_SCREEN + "\x1B[2J\x1B[H" + (mouseTracking ? ENABLE_MOUSE_TRACKING : ""));
802259
+ writeRaw(ENTER_ALT_SCREEN + "\x1B[2J\x1B[H" + (mouseTracking ? ENABLE_MOUSE_TRACKING : "") + (ink?.nativeCursorSeq ?? ""));
801769
802260
  ink?.setAltScreenActive(true, mouseTracking);
801770
802261
  return () => {
801771
802262
  ink?.setAltScreenActive(false);
801772
802263
  ink?.clearTextSelection();
801773
- writeRaw((mouseTracking ? DISABLE_MOUSE_TRACKING : "") + EXIT_ALT_SCREEN);
802264
+ const cursorSeq = !ink?.hasUnmounted ? ink?.nativeCursorSeq ?? "" : "";
802265
+ writeRaw((mouseTracking ? DISABLE_MOUSE_TRACKING : "") + EXIT_ALT_SCREEN + cursorSeq);
801774
802266
  };
801775
802267
  };
801776
802268
  t32 = [writeRaw, mouseTracking];
@@ -813647,7 +814139,7 @@ var init_claudeInChrome = __esm(() => {
813647
814139
  });
813648
814140
 
813649
814141
  // src/skills/bundled/debug.ts
813650
- import { open as open16, stat as stat52 } from "fs/promises";
814142
+ import { open as open17, stat as stat52 } from "fs/promises";
813651
814143
  function registerDebugSkill() {
813652
814144
  registerBundledSkill({
813653
814145
  name: "debug",
@@ -813664,7 +814156,7 @@ function registerDebugSkill() {
813664
814156
  const stats = await stat52(debugLogPath);
813665
814157
  const readSize = Math.min(stats.size, TAIL_READ_BYTES);
813666
814158
  const startOffset = stats.size - readSize;
813667
- const fd2 = await open16(debugLogPath, "r");
814159
+ const fd2 = await open17(debugLogPath, "r");
813668
814160
  try {
813669
814161
  const { buffer, bytesRead } = await fd2.read({
813670
814162
  buffer: Buffer.alloc(readSize),
@@ -818169,7 +818661,7 @@ __export(exports_fetchPluginZip, {
818169
818661
  DEFAULT_PLUGIN_ZIP_TIMEOUT_MS: () => DEFAULT_PLUGIN_ZIP_TIMEOUT_MS
818170
818662
  });
818171
818663
  import { randomUUID as randomUUID64 } from "crypto";
818172
- import { mkdir as mkdir60, open as open17, rm as rm14 } from "fs/promises";
818664
+ import { mkdir as mkdir60, open as open18, rm as rm14 } from "fs/promises";
818173
818665
  import { tmpdir as tmpdir19 } from "os";
818174
818666
  import { join as join186 } from "path";
818175
818667
  function validatePluginZipUrl(raw) {
@@ -818185,7 +818677,7 @@ function validatePluginZipUrl(raw) {
818185
818677
  return parsed;
818186
818678
  }
818187
818679
  async function openForWrite(path43) {
818188
- const handle2 = await open17(path43, "w");
818680
+ const handle2 = await open18(path43, "w");
818189
818681
  return {
818190
818682
  write: async (chunk) => {
818191
818683
  await handle2.writeFile(chunk);
@@ -819478,6 +819970,14 @@ class QueryEngine {
819478
819970
  updateFileHistoryState: processUserInputContext.updateFileHistoryState,
819479
819971
  updateAttributionState: processUserInputContext.updateAttributionState,
819480
819972
  setSDKStatus,
819973
+ onPermissionDenial: (tool, toolUseId, input2) => {
819974
+ this.permissionDenials.push({
819975
+ type: "permission_denial",
819976
+ tool_name: sdkCompatToolName(tool.name),
819977
+ tool_use_id: toolUseId,
819978
+ tool_input: input2
819979
+ });
819980
+ },
819481
819981
  taskRegistry: getHeadlessTaskRegistry()
819482
819982
  };
819483
819983
  headlessProfilerCheckpoint("before_skills_plugins");
@@ -824626,14 +825126,14 @@ async function startMCPServer(cwd3, debug10, verbose) {
824626
825126
  } catch (error52) {
824627
825127
  logError2(error52);
824628
825128
  const parts = error52 instanceof Error ? getErrorParts(error52) : [String(error52)];
824629
- const errorText = parts.filter(Boolean).join(`
825129
+ const errorText2 = parts.filter(Boolean).join(`
824630
825130
  `).trim() || "Error";
824631
825131
  return {
824632
825132
  isError: true,
824633
825133
  content: [
824634
825134
  {
824635
825135
  type: "text",
824636
- text: errorText
825136
+ text: errorText2
824637
825137
  }
824638
825138
  ]
824639
825139
  };