@opencow-ai/opencow-agent-sdk 0.4.19 → 0.4.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -31323,7 +31323,7 @@ function isFsInaccessible(e) {
31323
31323
  const code = getErrnoCode(e);
31324
31324
  return code === "ENOENT" || code === "EACCES" || code === "EPERM" || code === "ENOTDIR" || code === "ELOOP";
31325
31325
  }
31326
- var ClaudeError, MalformedCommandError, AbortError, ConfigParseError, ShellError, TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS;
31326
+ var ClaudeError, MalformedCommandError, AbortError, ToolContinuationStopError, ConfigParseError, ShellError, TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS;
31327
31327
  var init_errors5 = __esm(() => {
31328
31328
  init_canonical();
31329
31329
  ClaudeError = class ClaudeError extends Error {
@@ -31340,6 +31340,12 @@ var init_errors5 = __esm(() => {
31340
31340
  this.name = "AbortError";
31341
31341
  }
31342
31342
  };
31343
+ ToolContinuationStopError = class ToolContinuationStopError extends Error {
31344
+ constructor(message, options) {
31345
+ super(message, options);
31346
+ this.name = "ToolContinuationStopError";
31347
+ }
31348
+ };
31343
31349
  ConfigParseError = class ConfigParseError extends Error {
31344
31350
  filePath;
31345
31351
  defaultConfig;
@@ -46083,6 +46089,21 @@ var init_which = __esm(() => {
46083
46089
  // src/capabilities/git.ts
46084
46090
  import { readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync4 } from "fs";
46085
46091
  import { basename as basename3, dirname as dirname7, join as join12, resolve as resolve6, sep as sep4 } from "path";
46092
+ function hasValidGitMarker(gitPath) {
46093
+ const markerStat = statSync4(gitPath);
46094
+ if (markerStat.isDirectory()) {
46095
+ return statSync4(join12(gitPath, "HEAD")).isFile();
46096
+ }
46097
+ if (!markerStat.isFile()) {
46098
+ return false;
46099
+ }
46100
+ const marker = readFileSync5(gitPath, "utf-8").trim();
46101
+ if (!marker.startsWith("gitdir:")) {
46102
+ return false;
46103
+ }
46104
+ const gitDir = resolve6(dirname7(gitPath), marker.slice("gitdir:".length).trim());
46105
+ return statSync4(join12(gitDir, "HEAD")).isFile();
46106
+ }
46086
46107
  function createFindGitRoot() {
46087
46108
  function wrapper(startPath) {
46088
46109
  const result = findGitRootImpl(startPath);
@@ -46167,8 +46188,7 @@ var init_git = __esm(() => {
46167
46188
  try {
46168
46189
  const gitPath = join12(current, ".git");
46169
46190
  statCount++;
46170
- const stat4 = statSync4(gitPath);
46171
- if (stat4.isDirectory() || stat4.isFile()) {
46191
+ if (hasValidGitMarker(gitPath)) {
46172
46192
  logForDiagnosticsNoPII("info", "find_git_root_completed", {
46173
46193
  duration_ms: Date.now() - startTime,
46174
46194
  stat_count: statCount,
@@ -46186,8 +46206,7 @@ var init_git = __esm(() => {
46186
46206
  try {
46187
46207
  const gitPath = join12(root2, ".git");
46188
46208
  statCount++;
46189
- const stat4 = statSync4(gitPath);
46190
- if (stat4.isDirectory() || stat4.isFile()) {
46209
+ if (hasValidGitMarker(gitPath)) {
46191
46210
  logForDiagnosticsNoPII("info", "find_git_root_completed", {
46192
46211
  duration_ms: Date.now() - startTime,
46193
46212
  stat_count: statCount,
@@ -238157,6 +238176,21 @@ var init_RemoteAgentTask = __esm(() => {
238157
238176
  };
238158
238177
  });
238159
238178
 
238179
+ // src/lib/zodToJsonSchema.ts
238180
+ function zodToJsonSchema3(schema) {
238181
+ const hit = cache2.get(schema);
238182
+ if (hit)
238183
+ return hit;
238184
+ const result = toJSONSchema(schema);
238185
+ cache2.set(schema, result);
238186
+ return result;
238187
+ }
238188
+ var cache2;
238189
+ var init_zodToJsonSchema2 = __esm(() => {
238190
+ init_v4();
238191
+ cache2 = new WeakMap;
238192
+ });
238193
+
238160
238194
  // src/session/systemPrompt.ts
238161
238195
  function buildEffectiveSystemPrompt({
238162
238196
  mainThreadAgentDefinition,
@@ -238200,6 +238234,67 @@ function getTeleportLauncher() {
238200
238234
  }
238201
238235
  var _launcher = null;
238202
238236
 
238237
+ // src/capabilities/worktreeAvailability.ts
238238
+ import { spawnSync as spawnSync2 } from "child_process";
238239
+ import { resolve as resolve15 } from "path";
238240
+ function resolveGitWorktreeAvailability(cwd, gitExecutable = "git") {
238241
+ try {
238242
+ const rootResult = spawnSync2(gitExecutable, ["rev-parse", "--show-toplevel"], {
238243
+ cwd,
238244
+ encoding: "utf8",
238245
+ stdio: ["ignore", "pipe", "ignore"],
238246
+ windowsHide: true
238247
+ });
238248
+ if (rootResult.error) {
238249
+ return { available: false, reason: "git_unavailable" };
238250
+ }
238251
+ const gitRoot = rootResult.stdout.trim();
238252
+ if (rootResult.status !== 0 || !gitRoot) {
238253
+ return { available: false, reason: "not_git_repository" };
238254
+ }
238255
+ const headResult = spawnSync2(gitExecutable, ["rev-parse", "--verify", "HEAD^{commit}"], {
238256
+ cwd: gitRoot,
238257
+ encoding: "utf8",
238258
+ stdio: ["ignore", "pipe", "ignore"],
238259
+ windowsHide: true
238260
+ });
238261
+ if (headResult.error) {
238262
+ return { available: false, reason: "git_unavailable" };
238263
+ }
238264
+ const headCommit = headResult.stdout.trim();
238265
+ if (headResult.status !== 0 || !headCommit) {
238266
+ return { available: false, reason: "unborn_head" };
238267
+ }
238268
+ return {
238269
+ available: true,
238270
+ gitRoot: resolve15(gitRoot).normalize("NFC"),
238271
+ headCommit
238272
+ };
238273
+ } catch {
238274
+ return { available: false, reason: "git_unavailable" };
238275
+ }
238276
+ }
238277
+ function isGitWorktreeIsolationAvailable(cwd, gitExecutable = "git", cache3) {
238278
+ const cacheKey = `${resolve15(cwd).normalize("NFC")}\x00${gitExecutable}`;
238279
+ const cached2 = cache3?.get(cacheKey);
238280
+ if (cached2 !== undefined)
238281
+ return cached2;
238282
+ const available = resolveGitWorktreeAvailability(cwd, gitExecutable).available;
238283
+ cache3?.set(cacheKey, available);
238284
+ return available;
238285
+ }
238286
+ var WorktreeUnavailableError;
238287
+ var init_worktreeAvailability = __esm(() => {
238288
+ WorktreeUnavailableError = class WorktreeUnavailableError extends Error {
238289
+ reason;
238290
+ constructor(reason) {
238291
+ super(`Agent worktree is unavailable (${reason})`);
238292
+ this.reason = reason;
238293
+ this.name = "WorktreeUnavailableError";
238294
+ }
238295
+ };
238296
+ });
238297
+
238203
238298
  // src/session/agentId.ts
238204
238299
  function formatAgentId(agentName, teamName) {
238205
238300
  return `${agentName}@${teamName}`;
@@ -244847,13 +244942,13 @@ var init_sedValidation = __esm(() => {
244847
244942
 
244848
244943
  // src/capabilities/tools/BashTool/pathValidation.ts
244849
244944
  import { homedir as homedir16 } from "os";
244850
- import { isAbsolute as isAbsolute10, resolve as resolve15 } from "path";
244945
+ import { isAbsolute as isAbsolute10, resolve as resolve16 } from "path";
244851
244946
  function checkDangerousRemovalPaths(command, args, cwd) {
244852
244947
  const extractor = PATH_EXTRACTORS[command];
244853
244948
  const paths2 = extractor(args);
244854
244949
  for (const path10 of paths2) {
244855
244950
  const cleanPath = expandTilde(path10.replace(/^['"]|['"]$/g, ""));
244856
- const absolutePath = isAbsolute10(cleanPath) ? cleanPath : resolve15(cwd, cleanPath);
244951
+ const absolutePath = isAbsolute10(cleanPath) ? cleanPath : resolve16(cwd, cleanPath);
244857
244952
  if (isDangerousRemovalPath(absolutePath)) {
244858
244953
  return {
244859
244954
  behavior: "ask",
@@ -248294,7 +248389,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248294
248389
  }
248295
248390
  const setToolUseConfirmQueue = getLeaderToolUseConfirmQueue();
248296
248391
  if (setToolUseConfirmQueue) {
248297
- return new Promise((resolve16) => {
248392
+ return new Promise((resolve17) => {
248298
248393
  let decisionMade = false;
248299
248394
  const permissionStartMs = Date.now();
248300
248395
  const reportPermissionWait = () => {
@@ -248305,7 +248400,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248305
248400
  return;
248306
248401
  decisionMade = true;
248307
248402
  reportPermissionWait();
248308
- resolve16({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248403
+ resolve17({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248309
248404
  setToolUseConfirmQueue((queue3) => queue3.filter((item) => item.toolUseID !== toolUseID));
248310
248405
  };
248311
248406
  abortController.signal.addEventListener("abort", onAbortListener, {
@@ -248330,7 +248425,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248330
248425
  decisionMade = true;
248331
248426
  abortController.signal.removeEventListener("abort", onAbortListener);
248332
248427
  reportPermissionWait();
248333
- resolve16({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248428
+ resolve17({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248334
248429
  },
248335
248430
  async onAllow(updatedInput, permissionUpdates, feedback, contentBlocks) {
248336
248431
  if (decisionMade)
@@ -248350,7 +248445,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248350
248445
  }
248351
248446
  }
248352
248447
  const trimmedFeedback = feedback?.trim();
248353
- resolve16({
248448
+ resolve17({
248354
248449
  behavior: "allow",
248355
248450
  updatedInput,
248356
248451
  userModified: false,
@@ -248365,7 +248460,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248365
248460
  abortController.signal.removeEventListener("abort", onAbortListener);
248366
248461
  reportPermissionWait();
248367
248462
  const message = feedback ? `${SUBAGENT_REJECT_MESSAGE_WITH_REASON_PREFIX}${feedback}` : SUBAGENT_REJECT_MESSAGE;
248368
- resolve16({ behavior: "ask", message, contentBlocks });
248463
+ resolve17({ behavior: "ask", message, contentBlocks });
248369
248464
  },
248370
248465
  async recheckPermission() {
248371
248466
  if (decisionMade)
@@ -248376,7 +248471,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248376
248471
  abortController.signal.removeEventListener("abort", onAbortListener);
248377
248472
  reportPermissionWait();
248378
248473
  setToolUseConfirmQueue((queue4) => queue4.filter((item) => item.toolUseID !== toolUseID));
248379
- resolve16({
248474
+ resolve17({
248380
248475
  ...freshResult,
248381
248476
  updatedInput: input,
248382
248477
  userModified: false
@@ -248387,7 +248482,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248387
248482
  ]);
248388
248483
  });
248389
248484
  }
248390
- return new Promise((resolve16) => {
248485
+ return new Promise((resolve17) => {
248391
248486
  const request = createPermissionRequest({
248392
248487
  toolName: tool.name,
248393
248488
  toolUseId: toolUseID,
@@ -248406,7 +248501,7 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248406
248501
  cleanup();
248407
248502
  persistPermissionUpdates(permissionUpdates);
248408
248503
  const finalInput = updatedInput && Object.keys(updatedInput).length > 0 ? updatedInput : input;
248409
- resolve16({
248504
+ resolve17({
248410
248505
  behavior: "allow",
248411
248506
  updatedInput: finalInput,
248412
248507
  userModified: false,
@@ -248416,14 +248511,14 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248416
248511
  onReject(feedback, contentBlocks) {
248417
248512
  cleanup();
248418
248513
  const message = feedback ? `${SUBAGENT_REJECT_MESSAGE_WITH_REASON_PREFIX}${feedback}` : SUBAGENT_REJECT_MESSAGE;
248419
- resolve16({ behavior: "ask", message, contentBlocks });
248514
+ resolve17({ behavior: "ask", message, contentBlocks });
248420
248515
  }
248421
248516
  });
248422
248517
  sendPermissionRequestViaMailbox(request);
248423
- const pollInterval = setInterval(async (abortController2, cleanup2, resolve17, identity5, request2) => {
248518
+ const pollInterval = setInterval(async (abortController2, cleanup2, resolve18, identity5, request2) => {
248424
248519
  if (abortController2.signal.aborted) {
248425
248520
  cleanup2();
248426
- resolve17({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248521
+ resolve18({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248427
248522
  return;
248428
248523
  }
248429
248524
  const allMessages = await readMailbox(identity5.agentName, identity5.teamName);
@@ -248451,10 +248546,10 @@ function createInProcessCanUseTool(identity4, abortController, onPermissionWaitM
248451
248546
  }
248452
248547
  }
248453
248548
  }
248454
- }, PERMISSION_POLL_INTERVAL_MS, abortController, cleanup, resolve16, identity4, request);
248549
+ }, PERMISSION_POLL_INTERVAL_MS, abortController, cleanup, resolve17, identity4, request);
248455
248550
  const onAbortListener = () => {
248456
248551
  cleanup();
248457
- resolve16({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248552
+ resolve17({ behavior: "ask", message: SUBAGENT_REJECT_MESSAGE });
248458
248553
  };
248459
248554
  abortController.signal.addEventListener("abort", onAbortListener, {
248460
248555
  once: true
@@ -249194,8 +249289,8 @@ function waitForPaneShellReady() {
249194
249289
  }
249195
249290
  function acquirePaneCreationLock() {
249196
249291
  let release;
249197
- const newLock = new Promise((resolve16) => {
249198
- release = resolve16;
249292
+ const newLock = new Promise((resolve17) => {
249293
+ release = resolve17;
249199
249294
  });
249200
249295
  const previousLock = paneCreationLock;
249201
249296
  paneCreationLock = newLock;
@@ -249642,8 +249737,8 @@ __export(exports_ITermBackend, {
249642
249737
  });
249643
249738
  function acquirePaneCreationLock2() {
249644
249739
  let release;
249645
- const newLock = new Promise((resolve16) => {
249646
- release = resolve16;
249740
+ const newLock = new Promise((resolve17) => {
249741
+ release = resolve17;
249647
249742
  });
249648
249743
  const previousLock = paneCreationLock2;
249649
249744
  paneCreationLock2 = newLock;
@@ -250624,6 +250719,96 @@ var init_spawnMultiAgent = __esm(() => {
250624
250719
  init_loadAgentsDir();
250625
250720
  });
250626
250721
 
250722
+ // src/capabilities/tools/AgentTool/agentInvocationDedupe.ts
250723
+ import { isDeepStrictEqual } from "node:util";
250724
+ function isToolUseBlock(value) {
250725
+ if (!value || typeof value !== "object")
250726
+ return false;
250727
+ const block2 = value;
250728
+ return block2.type === "tool_use" && typeof block2.id === "string" && typeof block2.name === "string";
250729
+ }
250730
+ function isAgentToolUseBlock(block2) {
250731
+ return block2.name === AGENT_TOOL_NAME2 || block2.name === LEGACY_AGENT_TOOL_NAME;
250732
+ }
250733
+ function findEarlierDuplicateAgentToolUse(assistantMessage, currentToolUseId) {
250734
+ if (!currentToolUseId || !Array.isArray(assistantMessage?.message?.content)) {
250735
+ return;
250736
+ }
250737
+ const earlierAgentToolUses = [];
250738
+ for (const block2 of assistantMessage.message.content) {
250739
+ if (!isToolUseBlock(block2))
250740
+ continue;
250741
+ if (block2.id === currentToolUseId) {
250742
+ if (!isAgentToolUseBlock(block2))
250743
+ return;
250744
+ return earlierAgentToolUses.find((candidate) => isDeepStrictEqual(candidate.input, block2.input))?.id;
250745
+ }
250746
+ if (isAgentToolUseBlock(block2))
250747
+ earlierAgentToolUses.push(block2);
250748
+ }
250749
+ return;
250750
+ }
250751
+ var init_agentInvocationDedupe = __esm(() => {
250752
+ init_constants4();
250753
+ });
250754
+
250755
+ // src/capabilities/tools/AgentTool/worktreeIsolation.ts
250756
+ function getWorktreeIsolationUnavailableMessage(reason) {
250757
+ switch (reason) {
250758
+ case "not_git_repository":
250759
+ return "Worktree isolation is unavailable: the current directory is not a Git repository and no WorktreeCreate hook is configured. This model continuation has been stopped. Run the Agent task again without `isolation` only if using the current directory is safe; otherwise select a Git repository or configure a WorktreeCreate hook.";
250760
+ case "unborn_head":
250761
+ return "Worktree isolation is unavailable: the Git repository has no resolvable HEAD commit. This model continuation has been stopped. Run the Agent task again without `isolation` only if using the current directory is safe; otherwise create the initial commit.";
250762
+ case "git_unavailable":
250763
+ return "Worktree isolation is unavailable because Git could not be inspected. This model continuation has been stopped. Check that Git is installed and accessible, or run the Agent task again without `isolation` only if using the current directory is safe.";
250764
+ default: {
250765
+ const exhaustive = reason;
250766
+ return exhaustive;
250767
+ }
250768
+ }
250769
+ }
250770
+ var WORKTREE_ISOLATION_SCHEMA_DESCRIPTION = 'Isolation mode. Set "worktree" only when the user explicitly requests worktree isolation. It requires a Git repository with a resolvable HEAD commit or a configured WorktreeCreate hook; omit it for ordinary tasks, including read-only research.', WORKTREE_ISOLATION_USAGE_GUIDANCE = 'Only set `isolation: "worktree"` when the user explicitly requests worktree isolation. Omit it for ordinary tasks, including read-only research. Worktree isolation requires a Git repository with a resolvable HEAD commit or a configured WorktreeCreate hook.';
250771
+
250772
+ // src/capabilities/tools/AgentTool/inputSchema.ts
250773
+ function buildAgentInputSchema(options2) {
250774
+ const capabilityAwareSchema = options2.worktreeIsolationAvailable ? fullInputSchema() : inputSchemaWithoutWorktreeIsolation();
250775
+ const schema = options2.includeCwd ? capabilityAwareSchema : capabilityAwareSchema.omit({
250776
+ cwd: true
250777
+ });
250778
+ return options2.includeRunInBackground ? schema : schema.omit({
250779
+ run_in_background: true
250780
+ });
250781
+ }
250782
+ var baseInputSchema, fullInputSchema, inputSchemaWithoutWorktreeIsolation;
250783
+ var init_inputSchema = __esm(() => {
250784
+ init_v4();
250785
+ init_PermissionMode();
250786
+ baseInputSchema = lazySchema(() => exports_external2.object({
250787
+ description: exports_external2.string().describe("A short (3-5 word) description of the task"),
250788
+ prompt: exports_external2.string().describe("The task for the agent to perform"),
250789
+ subagent_type: exports_external2.string().optional().describe("The type of specialized agent to use for this task"),
250790
+ model: exports_external2.enum(["sonnet", "opus", "haiku"]).optional().describe("Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent."),
250791
+ run_in_background: exports_external2.boolean().optional().describe("Set to true to run this agent in the background. You will be notified when it completes.")
250792
+ }));
250793
+ fullInputSchema = lazySchema(() => {
250794
+ const multiAgentInputSchema = exports_external2.object({
250795
+ name: exports_external2.string().optional().describe("Name for the spawned agent. Makes it addressable via SendMessage({to: name}) while running."),
250796
+ team_name: exports_external2.string().optional().describe("Team name for spawning. Uses current team context if omitted."),
250797
+ mode: permissionModeSchema().optional().describe('Permission mode for spawned teammate (e.g., "plan" to require plan approval).')
250798
+ });
250799
+ const isolationInputSchema = exports_external2.object({
250800
+ isolation: exports_external2.enum(["worktree"]).optional().describe(WORKTREE_ISOLATION_SCHEMA_DESCRIPTION)
250801
+ });
250802
+ return baseInputSchema().merge(multiAgentInputSchema).extend({
250803
+ cwd: exports_external2.string().optional().describe('Absolute path to run the agent in. Overrides the working directory for all filesystem and shell operations within this agent. Mutually exclusive with isolation: "worktree".')
250804
+ }).merge(isolationInputSchema);
250805
+ });
250806
+ inputSchemaWithoutWorktreeIsolation = lazySchema(() => {
250807
+ const schema = fullInputSchema().omit({ isolation: true });
250808
+ return schema;
250809
+ });
250810
+ });
250811
+
250627
250812
  // src/capabilities/tools/AgentTool/forkSubagent.ts
250628
250813
  import { randomUUID as randomUUID7 } from "crypto";
250629
250814
  function isForkSubagentEnabled() {
@@ -250869,7 +251054,11 @@ The ${AGENT_TOOL_NAME2} tool launches specialized agents (subprocesses) that aut
250869
251054
 
250870
251055
  ${agentListSection}
250871
251056
 
250872
- ${forkEnabled ? `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself — a fork inherits your full conversation context. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.` : `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.`}`;
251057
+ ${forkEnabled ? `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type to use a specialized agent, or omit it to fork yourself — a fork inherits your full conversation context. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.` : `When using the ${AGENT_TOOL_NAME2} tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used. Only use subagent_type values that appear in the available agent types; never invent an agent type from an example.`}
251058
+
251059
+ Do not launch multiple Agent calls with exactly the same input.
251060
+
251061
+ ${WORKTREE_ISOLATION_USAGE_GUIDANCE}`;
250873
251062
  if (isCoordinator) {
250874
251063
  return shared2;
250875
251064
  }
@@ -250884,7 +251073,7 @@ When NOT to use the ${AGENT_TOOL_NAME2} tool:
250884
251073
  - Other tasks that are not related to the agent descriptions above
250885
251074
  `;
250886
251075
  const concurrencyNote = !listViaAttachment && getSubscriptionType() !== "pro" ? `
250887
- - Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses` : "";
251076
+ - Launch multiple agents concurrently for independent, non-overlapping tasks; to do that, use a single message with multiple tool uses` : "";
250888
251077
  return `${shared2}
250889
251078
  ${whenNotToUseSection}
250890
251079
 
@@ -250898,7 +251087,7 @@ Usage notes:
250898
251087
  - Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.)${forkEnabled ? "" : ", since it is not aware of the user's intent"}
250899
251088
  - If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
250900
251089
  - If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple ${AGENT_TOOL_NAME2} tool use content blocks. Each call must either omit subagent_type or use an exact type from the available agent list.
250901
- - You can optionally set \`isolation: "worktree"\` to run the agent in a temporary git worktree, giving it an isolated copy of the repository. The worktree is automatically cleaned up if the agent makes no changes; if changes are made, the worktree path and branch are returned in the result.${process.env.USER_TYPE === "ant" ? `
251090
+ ${process.env.USER_TYPE === "ant" ? `
250902
251091
  - You can set \`isolation: "remote"\` to run the agent in a remote CCR environment. This is always a background task; you'll be notified when it completes. Use for long-running tasks that need a fresh sandbox.` : ""}${isInProcessTeammate() ? `
250903
251092
  - The run_in_background, name, team_name, and mode parameters are not available in this context. Only synchronous subagents are supported.` : isTeammate() ? `
250904
251093
  - The name, team_name, and mode parameters are not available in this context — teammates cannot spawn other teammates. Omit them to spawn a subagent.` : ""}${whenToForkSection}${writingThePromptSection}
@@ -250924,12 +251113,57 @@ function getAutoBackgroundMs() {
250924
251113
  }
250925
251114
  return 0;
250926
251115
  }
251116
+ function buildConfiguredAgentInputSchema(worktreeIsolationAvailable) {
251117
+ const options2 = {
251118
+ worktreeIsolationAvailable,
251119
+ includeRunInBackground: !isBackgroundTasksDisabled && !isForkSubagentEnabled()
251120
+ };
251121
+ return buildAgentInputSchema({
251122
+ ...options2,
251123
+ includeCwd: false
251124
+ });
251125
+ }
251126
+ function getAdvertisedWorktreeAvailabilityCache() {
251127
+ try {
251128
+ const queryContext = getQueryContext();
251129
+ const now = Date.now();
251130
+ let cache3 = advertisedWorktreeAvailabilityByQuery.get(queryContext);
251131
+ if (!cache3 || cache3.expiresAt <= now || cache3.totalToolDuration !== queryContext.cost.totalToolDuration) {
251132
+ cache3 = {
251133
+ expiresAt: now + WORKTREE_AVAILABILITY_CACHE_TTL_MS,
251134
+ totalToolDuration: queryContext.cost.totalToolDuration,
251135
+ values: new Map
251136
+ };
251137
+ advertisedWorktreeAvailabilityByQuery.set(queryContext, cache3);
251138
+ }
251139
+ return cache3.values;
251140
+ } catch {
251141
+ return;
251142
+ }
251143
+ }
251144
+ function getAdvertisedAgentInputJSONSchema() {
251145
+ const worktreeIsolationAvailable = isAgentWorktreeIsolationAvailable({
251146
+ gitAvailabilityCache: getAdvertisedWorktreeAvailabilityCache()
251147
+ });
251148
+ const schemaVariant = "standard";
251149
+ const includeRunInBackground = !isBackgroundTasksDisabled && !isForkSubagentEnabled();
251150
+ const cacheKey = `${worktreeIsolationAvailable}:${schemaVariant}:${includeRunInBackground}`;
251151
+ const cached2 = advertisedInputJSONSchemaCache.get(cacheKey);
251152
+ if (cached2)
251153
+ return cached2;
251154
+ const schema = {
251155
+ ...zodToJsonSchema3(buildConfiguredAgentInputSchema(worktreeIsolationAvailable)),
251156
+ type: "object"
251157
+ };
251158
+ advertisedInputJSONSchemaCache.set(cacheKey, schema);
251159
+ return schema;
251160
+ }
250927
251161
  function resolveTeamName(input, appState) {
250928
251162
  if (!isAgentSwarmsEnabled())
250929
251163
  return;
250930
251164
  return input.team_name || appState.teamContext?.teamName;
250931
251165
  }
250932
- var getBackgroundHintJSX, renderGroupedAgentToolUse, renderToolResultMessage3, renderToolUseErrorMessage, renderToolUseMessage3, renderToolUseProgressMessage2, renderToolUseRejectedMessage, renderToolUseTag, userFacingName, userFacingNameBackgroundColor, proactiveModule = null, PROGRESS_THRESHOLD_MS = 2000, isBackgroundTasksDisabled, baseInputSchema, fullInputSchema, inputSchema6, outputSchema5, AgentTool;
251166
+ var getBackgroundHintJSX, renderGroupedAgentToolUse, renderToolResultMessage3, renderToolUseErrorMessage, renderToolUseMessage3, renderToolUseProgressMessage2, renderToolUseRejectedMessage, renderToolUseTag, userFacingName, userFacingNameBackgroundColor, proactiveModule = null, PROGRESS_THRESHOLD_MS = 2000, isBackgroundTasksDisabled, inputSchema6 = () => buildConfiguredAgentInputSchema(true), outputSchema5, advertisedInputJSONSchemaCache, WORKTREE_AVAILABILITY_CACHE_TTL_MS = 30000, advertisedWorktreeAvailabilityByQuery, agentToolRuntime, AgentTool;
250933
251167
  var init_AgentTool = __esm(() => {
250934
251168
  init_toolRuntime();
250935
251169
  init_promptCategory();
@@ -250948,9 +251182,9 @@ var init_AgentTool = __esm(() => {
250948
251182
  init_debug();
250949
251183
  init_envUtils();
250950
251184
  init_errors5();
251185
+ init_zodToJsonSchema2();
250951
251186
  init_messages4();
250952
251187
  init_agent();
250953
- init_PermissionMode();
250954
251188
  init_permissions2();
250955
251189
  init_sdkEventQueue();
250956
251190
  init_sessionStorage();
@@ -250961,11 +251195,14 @@ var init_AgentTool = __esm(() => {
250961
251195
  init_tokens();
250962
251196
  init_uuid();
250963
251197
  init_worktree();
251198
+ init_worktreeAvailability();
250964
251199
  init_toolUIRegistry();
250965
251200
  init_prompt2();
250966
251201
  init_spawnMultiAgent();
250967
251202
  init_agentColorManager();
251203
+ init_agentInvocationDedupe();
250968
251204
  init_agentToolUtils();
251205
+ init_inputSchema();
250969
251206
  init_generalPurposeAgent();
250970
251207
  init_constants4();
250971
251208
  init_forkSubagent();
@@ -250986,32 +251223,6 @@ var init_AgentTool = __esm(() => {
250986
251223
  userFacingNameBackgroundColor
250987
251224
  } = lazyUI("Agent"));
250988
251225
  isBackgroundTasksDisabled = isEnvTruthy(resolveEnvVar("DISABLE_BACKGROUND_TASKS"));
250989
- baseInputSchema = lazySchema(() => exports_external2.object({
250990
- description: exports_external2.string().describe("A short (3-5 word) description of the task"),
250991
- prompt: exports_external2.string().describe("The task for the agent to perform"),
250992
- subagent_type: exports_external2.string().optional().describe("The type of specialized agent to use for this task"),
250993
- model: exports_external2.enum(["sonnet", "opus", "haiku"]).optional().describe("Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent."),
250994
- run_in_background: exports_external2.boolean().optional().describe("Set to true to run this agent in the background. You will be notified when it completes.")
250995
- }));
250996
- fullInputSchema = lazySchema(() => {
250997
- const multiAgentInputSchema = exports_external2.object({
250998
- name: exports_external2.string().optional().describe("Name for the spawned agent. Makes it addressable via SendMessage({to: name}) while running."),
250999
- team_name: exports_external2.string().optional().describe("Team name for spawning. Uses current team context if omitted."),
251000
- mode: permissionModeSchema().optional().describe('Permission mode for spawned teammate (e.g., "plan" to require plan approval).')
251001
- });
251002
- return baseInputSchema().merge(multiAgentInputSchema).extend({
251003
- isolation: exports_external2.enum(["worktree"]).optional().describe('Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo.'),
251004
- cwd: exports_external2.string().optional().describe('Absolute path to run the agent in. Overrides the working directory for all filesystem and shell operations within this agent. Mutually exclusive with isolation: "worktree".')
251005
- });
251006
- });
251007
- inputSchema6 = lazySchema(() => {
251008
- const schema = fullInputSchema().omit({
251009
- cwd: true
251010
- });
251011
- return isBackgroundTasksDisabled || isForkSubagentEnabled() ? schema.omit({
251012
- run_in_background: true
251013
- }) : schema;
251014
- });
251015
251226
  outputSchema5 = lazySchema(() => {
251016
251227
  const syncOutputSchema = agentToolResultSchema().extend({
251017
251228
  status: exports_external2.literal("completed"),
@@ -251027,7 +251238,9 @@ var init_AgentTool = __esm(() => {
251027
251238
  });
251028
251239
  return exports_external2.union([syncOutputSchema, asyncOutputSchema]);
251029
251240
  });
251030
- AgentTool = buildToolRuntime({
251241
+ advertisedInputJSONSchemaCache = new Map;
251242
+ advertisedWorktreeAvailabilityByQuery = new WeakMap;
251243
+ agentToolRuntime = buildToolRuntime({
251031
251244
  async prompt({
251032
251245
  agents,
251033
251246
  tools,
@@ -251057,9 +251270,7 @@ var init_AgentTool = __esm(() => {
251057
251270
  async description() {
251058
251271
  return "Launch a new agent";
251059
251272
  },
251060
- get inputSchema() {
251061
- return inputSchema6();
251062
- },
251273
+ inputSchema: inputSchema6(),
251063
251274
  get outputSchema() {
251064
251275
  return outputSchema5();
251065
251276
  },
@@ -251075,6 +251286,10 @@ var init_AgentTool = __esm(() => {
251075
251286
  isolation,
251076
251287
  cwd
251077
251288
  }, toolUseContext, canUseTool, assistantMessage, onProgress) {
251289
+ const earlierDuplicateId = findEarlierDuplicateAgentToolUse(assistantMessage, toolUseContext.toolUseId);
251290
+ if (earlierDuplicateId) {
251291
+ throw new Error(`Duplicate Agent call skipped: this input duplicates earlier call ${earlierDuplicateId}. Do not retry it; wait for the earlier Agent result.`);
251292
+ }
251078
251293
  const startTime = Date.now();
251079
251294
  const model = isCoordinatorMode() ? undefined : modelParam;
251080
251295
  const appState = toolUseContext.getAppState();
@@ -251311,15 +251526,16 @@ ${reasons}`);
251311
251526
  try {
251312
251527
  worktreeInfo = await createAgentWorktree(slug);
251313
251528
  } catch (error41) {
251314
- const message = error41 instanceof Error ? error41.message : String(error41);
251315
- if (message.includes("Cannot create agent worktree: not in a git repository")) {
251316
- if (isolation === "worktree") {
251317
- throw error41;
251318
- }
251319
- logForDebugging("Agent worktree isolation unavailable outside a git repository; falling back to the current working directory.");
251320
- } else {
251529
+ if (!(error41 instanceof WorktreeUnavailableError)) {
251321
251530
  throw error41;
251322
251531
  }
251532
+ const unavailableMessage = getWorktreeIsolationUnavailableMessage(error41.reason);
251533
+ if (isolation === "worktree") {
251534
+ throw new ToolContinuationStopError(unavailableMessage, {
251535
+ cause: error41
251536
+ });
251537
+ }
251538
+ logForDebugging(`${unavailableMessage} Falling back to the current working directory.`);
251323
251539
  }
251324
251540
  }
251325
251541
  if (isForkPath && worktreeInfo) {
@@ -251912,6 +252128,15 @@ duration_ms: ${data.totalDurationMs}</usage>`
251912
252128
  renderToolUseErrorMessage,
251913
252129
  renderGroupedToolUse: renderGroupedAgentToolUse
251914
252130
  });
252131
+ AgentTool = {
252132
+ ...agentToolRuntime,
252133
+ get inputSchema() {
252134
+ return inputSchema6();
252135
+ },
252136
+ get inputJSONSchema() {
252137
+ return getAdvertisedAgentInputJSONSchema();
252138
+ }
252139
+ };
251915
252140
  });
251916
252141
 
251917
252142
  // node_modules/.bun/lodash-es@4.18.0/node_modules/lodash-es/_baseSlice.js
@@ -252058,7 +252283,7 @@ var init_idePathConversion = () => {};
252058
252283
 
252059
252284
  // src/capabilities/ide.ts
252060
252285
  import { createConnection } from "net";
252061
- import { basename as basename11, join as join49, sep as pathSeparator, resolve as resolve16 } from "path";
252286
+ import { basename as basename11, join as join49, sep as pathSeparator, resolve as resolve17 } from "path";
252062
252287
  function isVSCodeIde(ide) {
252063
252288
  if (!ide)
252064
252289
  return false;
@@ -252073,7 +252298,7 @@ function isJetBrainsIde(ide) {
252073
252298
  }
252074
252299
  async function checkIdeConnection(host, port, timeout = 500) {
252075
252300
  try {
252076
- return new Promise((resolve17) => {
252301
+ return new Promise((resolve18) => {
252077
252302
  const socket = createConnection({
252078
252303
  host,
252079
252304
  port,
@@ -252081,14 +252306,14 @@ async function checkIdeConnection(host, port, timeout = 500) {
252081
252306
  });
252082
252307
  socket.on("connect", () => {
252083
252308
  socket.destroy();
252084
- resolve17(true);
252309
+ resolve18(true);
252085
252310
  });
252086
252311
  socket.on("error", () => {
252087
- resolve17(false);
252312
+ resolve18(false);
252088
252313
  });
252089
252314
  socket.on("timeout", () => {
252090
252315
  socket.destroy();
252091
- resolve17(false);
252316
+ resolve18(false);
252092
252317
  });
252093
252318
  });
252094
252319
  } catch (_) {
@@ -255774,7 +255999,7 @@ async function getSnapshotScript(shellPath, snapshotFilePath, configFileExists)
255774
255999
  var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_TO_EXCLUDE2, createAndSaveSnapshot = async (binShell) => {
255775
256000
  const shellType = binShell.includes("zsh") ? "zsh" : binShell.includes("bash") ? "bash" : "sh";
255776
256001
  logForDebugging(`Creating shell snapshot for ${shellType} (${binShell})`);
255777
- return new Promise(async (resolve17) => {
256002
+ return new Promise(async (resolve18) => {
255778
256003
  try {
255779
256004
  const configFile = getConfigFile(binShell);
255780
256005
  logForDebugging(`Looking for shell config file: ${configFile}`);
@@ -255835,7 +256060,7 @@ ${stdout}`);
255835
256060
  error_signal_number: signalNumber,
255836
256061
  error_killed: execError?.killed
255837
256062
  });
255838
- resolve17(undefined);
256063
+ resolve18(undefined);
255839
256064
  } else {
255840
256065
  let snapshotSize;
255841
256066
  try {
@@ -255851,7 +256076,7 @@ ${stdout}`);
255851
256076
  logForDebugging(`Error cleaning up session snapshot: ${error42}`);
255852
256077
  }
255853
256078
  });
255854
- resolve17(shellSnapshotPath);
256079
+ resolve18(shellSnapshotPath);
255855
256080
  } else {
255856
256081
  logForDebugging(`Shell snapshot file not found after creation: ${shellSnapshotPath}`);
255857
256082
  logForDebugging(`Checking if parent directory still exists: ${snapshotsDir}`);
@@ -255862,7 +256087,7 @@ ${stdout}`);
255862
256087
  logForDebugging(`Parent directory does not exist or is not accessible: ${snapshotsDir}`);
255863
256088
  }
255864
256089
  logEvent("tengu_shell_unknown_error", {});
255865
- resolve17(undefined);
256090
+ resolve18(undefined);
255866
256091
  }
255867
256092
  }
255868
256093
  });
@@ -255873,7 +256098,7 @@ ${stdout}`);
255873
256098
  }
255874
256099
  logError(error41);
255875
256100
  logEvent("tengu_shell_snapshot_error", {});
255876
- resolve17(undefined);
256101
+ resolve18(undefined);
255877
256102
  }
255878
256103
  });
255879
256104
  };
@@ -256278,7 +256503,7 @@ var init_bashProvider = __esm(() => {
256278
256503
  import { spawn as spawn5 } from "child_process";
256279
256504
  import { constants as fsConstants4, readFileSync as readFileSync6, unlinkSync as unlinkSync2 } from "fs";
256280
256505
  import { mkdir as mkdir4, open as open4, realpath as realpath4 } from "fs/promises";
256281
- import { isAbsolute as isAbsolute16, resolve as resolve17 } from "path";
256506
+ import { isAbsolute as isAbsolute16, resolve as resolve18 } from "path";
256282
256507
  import { join as posixJoin3 } from "path/posix";
256283
256508
  async function findSuitableShell() {
256284
256509
  return (await requireShellCapability("bash")).path;
@@ -256419,7 +256644,7 @@ async function exec2(command, abortSignal, shellType, options2) {
256419
256644
  }
256420
256645
  }
256421
256646
  function setCwd(path10, relativeTo) {
256422
- const resolved = isAbsolute16(path10) ? path10 : resolve17(relativeTo || getFsImplementation().cwd(), path10);
256647
+ const resolved = isAbsolute16(path10) ? path10 : resolve18(relativeTo || getFsImplementation().cwd(), path10);
256423
256648
  let physicalPath;
256424
256649
  try {
256425
256650
  physicalPath = getFsImplementation().realpathSync(resolved);
@@ -256772,7 +256997,7 @@ var init_notebook = __esm(() => {
256772
256997
  var DESCRIPTION6 = "Replace the contents of a specific cell in a Jupyter notebook.", PROMPT4 = `Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number.`;
256773
256998
 
256774
256999
  // src/capabilities/tools/NotebookEditTool/NotebookEditTool.ts
256775
- import { extname as extname5, isAbsolute as isAbsolute17, resolve as resolve18 } from "path";
257000
+ import { extname as extname5, isAbsolute as isAbsolute17, resolve as resolve19 } from "path";
256776
257001
  var getToolUseSummary5, renderToolResultMessage8, renderToolUseErrorMessage6, renderToolUseMessage8, renderToolUseRejectedMessage4, inputSchema11, outputSchema10, NotebookEditTool;
256777
257002
  var init_NotebookEditTool = __esm(() => {
256778
257003
  init_fileHistory();
@@ -256887,7 +257112,7 @@ var init_NotebookEditTool = __esm(() => {
256887
257112
  renderToolUseErrorMessage: renderToolUseErrorMessage6,
256888
257113
  renderToolResultMessage: renderToolResultMessage8,
256889
257114
  async validateInput({ notebook_path, cell_type, cell_id, edit_mode = "replace" }, toolUseContext) {
256890
- const fullPath = isAbsolute17(notebook_path) ? notebook_path : resolve18(getCwd3(), notebook_path);
257115
+ const fullPath = isAbsolute17(notebook_path) ? notebook_path : resolve19(getCwd3(), notebook_path);
256891
257116
  if (fullPath.startsWith("\\\\") || fullPath.startsWith("//")) {
256892
257117
  return { result: true };
256893
257118
  }
@@ -256986,7 +257211,7 @@ var init_NotebookEditTool = __esm(() => {
256986
257211
  cell_type,
256987
257212
  edit_mode: originalEditMode
256988
257213
  }, { readFileState, updateFileHistoryState }, _, parentMessage) {
256989
- const fullPath = isAbsolute17(notebook_path) ? notebook_path : resolve18(getCwd3(), notebook_path);
257214
+ const fullPath = isAbsolute17(notebook_path) ? notebook_path : resolve19(getCwd3(), notebook_path);
256990
257215
  if (fileHistoryEnabled()) {
256991
257216
  await fileHistoryTrackEdit(updateFileHistoryState, fullPath, parentMessage.uuid);
256992
257217
  }
@@ -257246,7 +257471,7 @@ var init_gitOperationTracking = __esm(() => {
257246
257471
  });
257247
257472
 
257248
257473
  // src/session/fullscreen.ts
257249
- import { spawnSync as spawnSync2 } from "child_process";
257474
+ import { spawnSync as spawnSync3 } from "child_process";
257250
257475
  function isTmuxControlModeEnvHeuristic() {
257251
257476
  if (!process.env.TMUX)
257252
257477
  return false;
@@ -257265,7 +257490,7 @@ function probeTmuxControlModeSync() {
257265
257490
  return;
257266
257491
  let result;
257267
257492
  try {
257268
- result = spawnSync2("tmux", ["display-message", "-p", "#{client_control_mode}"], { encoding: "utf8", timeout: 2000 });
257493
+ result = spawnSync3("tmux", ["display-message", "-p", "#{client_control_mode}"], { encoding: "utf8", timeout: 2000 });
257269
257494
  } catch {
257270
257495
  return;
257271
257496
  }
@@ -257758,8 +257983,8 @@ function registerAgentForeground({
257758
257983
  diskLoaded: false
257759
257984
  };
257760
257985
  let resolveBackgroundSignal;
257761
- const backgroundSignal = new Promise((resolve19) => {
257762
- resolveBackgroundSignal = resolve19;
257986
+ const backgroundSignal = new Promise((resolve20) => {
257987
+ resolveBackgroundSignal = resolve20;
257763
257988
  });
257764
257989
  backgroundSignalResolvers.set(agentId, resolveBackgroundSignal);
257765
257990
  registerTask(taskState, setAppState);
@@ -259188,8 +259413,8 @@ async function* runShellCommand({
259188
259413
  let assistantAutoBackgrounded = false;
259189
259414
  let resolveProgress = null;
259190
259415
  function createProgressSignal() {
259191
- return new Promise((resolve19) => {
259192
- resolveProgress = () => resolve19(null);
259416
+ return new Promise((resolve20) => {
259417
+ resolveProgress = () => resolve20(null);
259193
259418
  });
259194
259419
  }
259195
259420
  const shouldAutoBackground = !isBackgroundTasksDisabled2 && isAutobackgroundingAllowed(command);
@@ -259200,10 +259425,10 @@ async function* runShellCommand({
259200
259425
  fullOutput = allLines;
259201
259426
  lastTotalLines = totalLines;
259202
259427
  lastTotalBytes = isIncomplete ? totalBytes : 0;
259203
- const resolve19 = resolveProgress;
259204
- if (resolve19) {
259428
+ const resolve20 = resolveProgress;
259429
+ if (resolve20) {
259205
259430
  resolveProgress = null;
259206
- resolve19();
259431
+ resolve20();
259207
259432
  }
259208
259433
  },
259209
259434
  preventCwdChanges,
@@ -259241,10 +259466,10 @@ async function* runShellCommand({
259241
259466
  }
259242
259467
  spawnBackgroundTask().then((shellId) => {
259243
259468
  backgroundShellId = shellId;
259244
- const resolve19 = resolveProgress;
259245
- if (resolve19) {
259469
+ const resolve20 = resolveProgress;
259470
+ if (resolve20) {
259246
259471
  resolveProgress = null;
259247
- resolve19();
259472
+ resolve20();
259248
259473
  }
259249
259474
  logEvent(eventName, {
259250
259475
  command_type: getCommandTypeForLogging(command)
@@ -259276,8 +259501,8 @@ async function* runShellCommand({
259276
259501
  const startTime = Date.now();
259277
259502
  let foregroundTaskId = undefined;
259278
259503
  {
259279
- const initialResult = await Promise.race([resultPromise, new Promise((resolve19) => {
259280
- const t = setTimeout((r) => r(null), PROGRESS_THRESHOLD_MS2, resolve19);
259504
+ const initialResult = await Promise.race([resultPromise, new Promise((resolve20) => {
259505
+ const t = setTimeout((r) => r(null), PROGRESS_THRESHOLD_MS2, resolve20);
259281
259506
  t.unref();
259282
259507
  })]);
259283
259508
  if (initialResult !== null) {
@@ -260800,7 +261025,7 @@ var init_parser5 = __esm(() => {
260800
261025
  });
260801
261026
 
260802
261027
  // src/capabilities/tools/PowerShellTool/gitSafety.ts
260803
- import { basename as basename13, posix as posix5, resolve as resolve19, sep as sep17 } from "path";
261028
+ import { basename as basename13, posix as posix5, resolve as resolve20, sep as sep17 } from "path";
260804
261029
  function resolveCwdReentry(normalized) {
260805
261030
  if (!normalized.startsWith("../../../tools"))
260806
261031
  return normalized;
@@ -260848,7 +261073,7 @@ function normalizeGitPathArg(arg) {
260848
261073
  }
260849
261074
  function resolveEscapingPathToCwdRelative(n2) {
260850
261075
  const cwd = getCwd3();
260851
- const abs = resolve19(cwd, n2);
261076
+ const abs = resolve20(cwd, n2);
260852
261077
  const cwdWithSep = cwd.endsWith(sep17) ? cwd : cwd + sep17;
260853
261078
  const absLower = abs.toLowerCase();
260854
261079
  const cwdLower = cwd.toLowerCase();
@@ -262121,7 +262346,7 @@ var init_modeValidation2 = __esm(() => {
262121
262346
 
262122
262347
  // src/capabilities/tools/PowerShellTool/pathValidation.ts
262123
262348
  import { homedir as homedir18 } from "os";
262124
- import { isAbsolute as isAbsolute18, resolve as resolve20 } from "path";
262349
+ import { isAbsolute as isAbsolute18, resolve as resolve21 } from "path";
262125
262350
  function matchesParam(paramLower, paramList) {
262126
262351
  for (const p of paramList) {
262127
262352
  if (p === paramLower || paramLower.length > 1 && p.startsWith(paramLower)) {
@@ -262229,7 +262454,7 @@ function checkDenyRuleForGuessedPath(strippedPath, cwd, toolPermissionContext, o
262229
262454
  if (!strippedPath || strippedPath.includes("\x00"))
262230
262455
  return null;
262231
262456
  const tildeExpanded = expandTilde2(strippedPath);
262232
- const abs = isAbsolute18(tildeExpanded) ? tildeExpanded : resolve20(cwd, tildeExpanded);
262457
+ const abs = isAbsolute18(tildeExpanded) ? tildeExpanded : resolve21(cwd, tildeExpanded);
262233
262458
  const { resolvedPath } = safeResolvePath(getFsImplementation(), abs);
262234
262459
  const permissionType = operationType === "read" ? "read" : "edit";
262235
262460
  const denyRule = matchingRuleForInput(resolvedPath, toolPermissionContext, permissionType, "deny");
@@ -262319,7 +262544,7 @@ function validatePath2(filePath, cwd, toolPermissionContext, operationType) {
262319
262544
  };
262320
262545
  }
262321
262546
  if (containsPathTraversal(normalizedPath)) {
262322
- const absolutePath2 = isAbsolute18(normalizedPath) ? normalizedPath : resolve20(cwd, normalizedPath);
262547
+ const absolutePath2 = isAbsolute18(normalizedPath) ? normalizedPath : resolve21(cwd, normalizedPath);
262323
262548
  const { resolvedPath: resolvedPath3, isCanonical: isCanonical2 } = safeResolvePath(getFsImplementation(), absolutePath2);
262324
262549
  const result2 = isPathAllowed2(resolvedPath3, toolPermissionContext, operationType, isCanonical2 ? [resolvedPath3] : undefined);
262325
262550
  return {
@@ -262329,7 +262554,7 @@ function validatePath2(filePath, cwd, toolPermissionContext, operationType) {
262329
262554
  };
262330
262555
  }
262331
262556
  const basePath = getGlobBaseDirectory2(normalizedPath);
262332
- const absoluteBasePath = isAbsolute18(basePath) ? basePath : resolve20(cwd, basePath);
262557
+ const absoluteBasePath = isAbsolute18(basePath) ? basePath : resolve21(cwd, basePath);
262333
262558
  const { resolvedPath: resolvedPath2 } = safeResolvePath(getFsImplementation(), absoluteBasePath);
262334
262559
  const permissionType = operationType === "read" ? "read" : "edit";
262335
262560
  const denyRule = matchingRuleForInput(resolvedPath2, toolPermissionContext, permissionType, "deny");
@@ -262349,7 +262574,7 @@ function validatePath2(filePath, cwd, toolPermissionContext, operationType) {
262349
262574
  }
262350
262575
  };
262351
262576
  }
262352
- const absolutePath = isAbsolute18(normalizedPath) ? normalizedPath : resolve20(cwd, normalizedPath);
262577
+ const absolutePath = isAbsolute18(normalizedPath) ? normalizedPath : resolve21(cwd, normalizedPath);
262353
262578
  const { resolvedPath, isCanonical } = safeResolvePath(getFsImplementation(), absolutePath);
262354
262579
  const result = isPathAllowed2(resolvedPath, toolPermissionContext, operationType, isCanonical ? [resolvedPath] : undefined);
262355
262580
  return {
@@ -264279,7 +264504,7 @@ var init_powershellSecurity = __esm(() => {
264279
264504
  var POWERSHELL_TOOL_NAME3 = "PowerShell";
264280
264505
 
264281
264506
  // src/capabilities/tools/PowerShellTool/powershellPermissions.ts
264282
- import { resolve as resolve21 } from "path";
264507
+ import { resolve as resolve22 } from "path";
264283
264508
  async function extractCommandName(command) {
264284
264509
  const trimmed = command.trim();
264285
264510
  if (!trimmed) {
@@ -264892,7 +265117,7 @@ async function powershellToolHasPermission(input, context3) {
264892
265117
  const canonical = resolveToCanonical(element.name);
264893
265118
  if (canonical === "set-location" && element.args.length > 0) {
264894
265119
  const target = element.args.find((a2) => a2.length === 0 || !PS_TOKENIZER_DASH_CHARS.has(a2[0]));
264895
- if (target && resolve21(getCwd3(), target) === getCwd3()) {
265120
+ if (target && resolve22(getCwd3(), target) === getCwd3()) {
264896
265121
  return false;
264897
265122
  }
264898
265123
  }
@@ -265288,8 +265513,8 @@ async function* runPowerShellCommand({
265288
265513
  let assistantAutoBackgrounded = false;
265289
265514
  let resolveProgress = null;
265290
265515
  function createProgressSignal() {
265291
- return new Promise((resolve22) => {
265292
- resolveProgress = () => resolve22(null);
265516
+ return new Promise((resolve23) => {
265517
+ resolveProgress = () => resolve23(null);
265293
265518
  });
265294
265519
  }
265295
265520
  const shouldAutoBackground = !isBackgroundTasksDisabled3 && isAutobackgroundingAllowed2(command);
@@ -265359,10 +265584,10 @@ async function* runPowerShellCommand({
265359
265584
  }
265360
265585
  spawnBackgroundTask().then((shellId) => {
265361
265586
  backgroundShellId = shellId;
265362
- const resolve22 = resolveProgress;
265363
- if (resolve22) {
265587
+ const resolve23 = resolveProgress;
265588
+ if (resolve23) {
265364
265589
  resolveProgress = null;
265365
- resolve22();
265590
+ resolve23();
265366
265591
  }
265367
265592
  logEvent(eventName, {
265368
265593
  command_type: getCommandTypeForLogging2(command)
@@ -265400,7 +265625,7 @@ async function* runPowerShellCommand({
265400
265625
  const now = Date.now();
265401
265626
  const timeUntilNextProgress = Math.max(0, nextProgressTime - now);
265402
265627
  const progressSignal = createProgressSignal();
265403
- const result = await Promise.race([resultPromise, new Promise((resolve22) => setTimeout((r) => r(null), timeUntilNextProgress, resolve22).unref()), progressSignal]);
265628
+ const result = await Promise.race([resultPromise, new Promise((resolve23) => setTimeout((r) => r(null), timeUntilNextProgress, resolve23).unref()), progressSignal]);
265404
265629
  if (result !== null) {
265405
265630
  if (result.backgroundTaskId !== undefined) {
265406
265631
  markTaskNotified2(result.backgroundTaskId, setAppState);
@@ -267998,7 +268223,7 @@ var init_officialMarketplaceGcs = __esm(() => {
267998
268223
  });
267999
268224
 
268000
268225
  // src/capabilities/plugins/marketplaceManager.ts
268001
- import { basename as basename18, dirname as dirname31, isAbsolute as isAbsolute20, join as join59, resolve as resolve22, sep as sep18 } from "path";
268226
+ import { basename as basename18, dirname as dirname31, isAbsolute as isAbsolute20, join as join59, resolve as resolve23, sep as sep18 } from "path";
268002
268227
  function getKnownMarketplacesFile() {
268003
268228
  return join59(getPluginsDirectory(), "known_marketplaces.json");
268004
268229
  }
@@ -268564,14 +268789,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
268564
268789
  throw new Error("NPM marketplace sources not yet implemented");
268565
268790
  }
268566
268791
  case "file": {
268567
- const absPath = resolve22(source.path);
268792
+ const absPath = resolve23(source.path);
268568
268793
  marketplacePath = absPath;
268569
268794
  temporaryCachePath = dirname31(dirname31(absPath));
268570
268795
  cleanupNeeded = false;
268571
268796
  break;
268572
268797
  }
268573
268798
  case "directory": {
268574
- const absPath = resolve22(source.path);
268799
+ const absPath = resolve23(source.path);
268575
268800
  marketplacePath = join59(absPath, ".claude-plugin", "marketplace.json");
268576
268801
  temporaryCachePath = absPath;
268577
268802
  cleanupNeeded = false;
@@ -268603,8 +268828,8 @@ async function loadAndCacheMarketplace(source, onProgress) {
268603
268828
  throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage(e)}`);
268604
268829
  }
268605
268830
  const finalCachePath = join59(cacheDir, marketplace.name);
268606
- const resolvedFinal = resolve22(finalCachePath);
268607
- const resolvedCacheDir = resolve22(cacheDir);
268831
+ const resolvedFinal = resolve23(finalCachePath);
268832
+ const resolvedCacheDir = resolve23(cacheDir);
268608
268833
  if (!resolvedFinal.startsWith(resolvedCacheDir + sep18)) {
268609
268834
  throw new Error(`Marketplace name '${marketplace.name}' resolves to a path outside the cache directory`);
268610
268835
  }
@@ -268965,11 +269190,11 @@ var init_pluginVersioning = __esm(() => {
268965
269190
  });
268966
269191
 
268967
269192
  // src/capabilities/plugins/pluginInstallationHelpers.ts
268968
- import { dirname as dirname33, join as join61, resolve as resolve23, sep as sep19 } from "path";
269193
+ import { dirname as dirname33, join as join61, resolve as resolve24, sep as sep19 } from "path";
268969
269194
  function validatePathWithinBase(basePath, relativePath2) {
268970
- const resolvedPath = resolve23(basePath, relativePath2);
268971
- const normalizedBase = resolve23(basePath) + sep19;
268972
- if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve23(basePath)) {
269195
+ const resolvedPath = resolve24(basePath, relativePath2);
269196
+ const normalizedBase = resolve24(basePath) + sep19;
269197
+ if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve24(basePath)) {
268973
269198
  throw new Error(`Path traversal detected: "${relativePath2}" would escape the base directory`);
268974
269199
  }
268975
269200
  return resolvedPath;
@@ -268995,7 +269220,7 @@ var init_pluginInstallationHelpers = __esm(() => {
268995
269220
  });
268996
269221
 
268997
269222
  // src/capabilities/plugins/pluginLoader.ts
268998
- import { basename as basename19, dirname as dirname34, join as join62, relative as relative11, resolve as resolve24, sep as sep20 } from "path";
269223
+ import { basename as basename19, dirname as dirname34, join as join62, relative as relative11, resolve as resolve25, sep as sep20 } from "path";
268999
269224
  function getPluginCachePath() {
269000
269225
  return join62(getPluginsDirectory(), "cache");
269001
269226
  }
@@ -270349,7 +270574,7 @@ async function loadSessionOnlyPlugins(sessionPluginPaths) {
270349
270574
  const errors4 = [];
270350
270575
  for (const [index, pluginPath] of sessionPluginPaths.entries()) {
270351
270576
  try {
270352
- const resolvedPath = resolve24(pluginPath);
270577
+ const resolvedPath = resolve25(pluginPath);
270353
270578
  if (!await pathExists(resolvedPath)) {
270354
270579
  logForDebugging(`Plugin path does not exist: ${resolvedPath}, skipping`, { level: "warn" });
270355
270580
  errors4.push({
@@ -271716,14 +271941,14 @@ function waitForCallback(port, expectedState, abortSignal, onListening) {
271716
271941
  abortHandler = null;
271717
271942
  }
271718
271943
  };
271719
- return new Promise((resolve25, reject2) => {
271944
+ return new Promise((resolve26, reject2) => {
271720
271945
  let resolved = false;
271721
271946
  const resolveOnce = (v) => {
271722
271947
  if (resolved)
271723
271948
  return;
271724
271949
  resolved = true;
271725
271950
  cleanup();
271726
- resolve25(v);
271951
+ resolve26(v);
271727
271952
  };
271728
271953
  const rejectOnce = (e) => {
271729
271954
  if (resolved)
@@ -272194,13 +272419,13 @@ async function performMCPOAuthFlow(serverName, serverConfig, onAuthorizationUrl,
272194
272419
  }
272195
272420
  logMCPDebug(serverName, `MCP OAuth server cleaned up`);
272196
272421
  };
272197
- const authorizationCode = await new Promise((resolve25, reject2) => {
272422
+ const authorizationCode = await new Promise((resolve26, reject2) => {
272198
272423
  let resolved = false;
272199
272424
  const resolveOnce = (code) => {
272200
272425
  if (resolved)
272201
272426
  return;
272202
272427
  resolved = true;
272203
- resolve25(code);
272428
+ resolve26(code);
272204
272429
  };
272205
272430
  const rejectOnce = (error41) => {
272206
272431
  if (resolved)
@@ -273120,8 +273345,8 @@ function createMcpAuthTool(serverName, config2) {
273120
273345
  }
273121
273346
  const sseOrHttpConfig = config2;
273122
273347
  let resolveAuthUrl;
273123
- const authUrlPromise = new Promise((resolve25) => {
273124
- resolveAuthUrl = resolve25;
273348
+ const authUrlPromise = new Promise((resolve26) => {
273349
+ resolveAuthUrl = resolve26;
273125
273350
  });
273126
273351
  const controller = new AbortController;
273127
273352
  const { setAppState } = context3;
@@ -273603,15 +273828,15 @@ class WebSocketTransport {
273603
273828
  isBun = typeof Bun !== "undefined";
273604
273829
  constructor(ws) {
273605
273830
  this.ws = ws;
273606
- this.opened = new Promise((resolve25, reject2) => {
273831
+ this.opened = new Promise((resolve26, reject2) => {
273607
273832
  if (this.ws.readyState === WS_OPEN) {
273608
- resolve25();
273833
+ resolve26();
273609
273834
  } else if (this.isBun) {
273610
273835
  const nws = this.ws;
273611
273836
  const onOpen = () => {
273612
273837
  nws.removeEventListener("open", onOpen);
273613
273838
  nws.removeEventListener("error", onError);
273614
- resolve25();
273839
+ resolve26();
273615
273840
  };
273616
273841
  const onError = (event) => {
273617
273842
  nws.removeEventListener("open", onOpen);
@@ -273624,7 +273849,7 @@ class WebSocketTransport {
273624
273849
  } else {
273625
273850
  const nws = this.ws;
273626
273851
  nws.on("open", () => {
273627
- resolve25();
273852
+ resolve26();
273628
273853
  });
273629
273854
  nws.on("error", (error41) => {
273630
273855
  logForDiagnosticsNoPII("error", "mcp_websocket_connect_fail");
@@ -273723,12 +273948,12 @@ class WebSocketTransport {
273723
273948
  if (this.isBun) {
273724
273949
  this.ws.send(json2);
273725
273950
  } else {
273726
- await new Promise((resolve25, reject2) => {
273951
+ await new Promise((resolve26, reject2) => {
273727
273952
  this.ws.send(json2, (error41) => {
273728
273953
  if (error41) {
273729
273954
  reject2(error41);
273730
273955
  } else {
273731
- resolve25();
273956
+ resolve26();
273732
273957
  }
273733
273958
  });
273734
273959
  });
@@ -277643,12 +277868,12 @@ class StdioServerTransport {
277643
277868
  this.onclose?.();
277644
277869
  }
277645
277870
  send(message) {
277646
- return new Promise((resolve25) => {
277871
+ return new Promise((resolve26) => {
277647
277872
  const json2 = serializeMessage(message);
277648
277873
  if (this._stdout.write(json2)) {
277649
- resolve25();
277874
+ resolve26();
277650
277875
  } else {
277651
- this._stdout.once("drain", resolve25);
277876
+ this._stdout.once("drain", resolve26);
277652
277877
  }
277653
277878
  });
277654
277879
  }
@@ -277973,8 +278198,8 @@ function getMcpAuthCache() {
277973
278198
  return authCachePromise;
277974
278199
  }
277975
278200
  async function isMcpAuthCached(serverId) {
277976
- const cache2 = await getMcpAuthCache();
277977
- const entry = cache2[serverId];
278201
+ const cache3 = await getMcpAuthCache();
278202
+ const entry = cache3[serverId];
277978
278203
  if (!entry) {
277979
278204
  return false;
277980
278205
  }
@@ -277982,11 +278207,11 @@ async function isMcpAuthCached(serverId) {
277982
278207
  }
277983
278208
  function setMcpAuthCacheEntry(serverId) {
277984
278209
  writeChain = writeChain.then(async () => {
277985
- const cache2 = await getMcpAuthCache();
277986
- cache2[serverId] = { timestamp: Date.now() };
278210
+ const cache3 = await getMcpAuthCache();
278211
+ cache3[serverId] = { timestamp: Date.now() };
277987
278212
  const cachePath = getMcpAuthCachePath();
277988
278213
  await getFsImplementation().mkdir(dirname36(cachePath), { recursive: true });
277989
- await getFsImplementation().writeFile(cachePath, jsonStringify(cache2));
278214
+ await getFsImplementation().writeFile(cachePath, jsonStringify(cache3));
277990
278215
  authCachePromise = null;
277991
278216
  }).catch(() => {});
277992
278217
  }
@@ -278470,9 +278695,9 @@ async function callMCPToolWithUrlElicitationRetry({
278470
278695
  actionLabel: "Retry now",
278471
278696
  showCancel: true
278472
278697
  };
278473
- userResult = await new Promise((resolve25) => {
278698
+ userResult = await new Promise((resolve26) => {
278474
278699
  const onAbort = () => {
278475
- resolve25({ action: "cancel" });
278700
+ resolve26({ action: "cancel" });
278476
278701
  };
278477
278702
  if (signal.aborted) {
278478
278703
  onAbort();
@@ -278495,14 +278720,14 @@ async function callMCPToolWithUrlElicitationRetry({
278495
278720
  return;
278496
278721
  }
278497
278722
  signal.removeEventListener("abort", onAbort);
278498
- resolve25(result);
278723
+ resolve26(result);
278499
278724
  },
278500
278725
  onWaitingDismiss: (action) => {
278501
278726
  signal.removeEventListener("abort", onAbort);
278502
278727
  if (action === "retry") {
278503
- resolve25({ action: "accept" });
278728
+ resolve26({ action: "accept" });
278504
278729
  } else {
278505
- resolve25({ action: "cancel" });
278730
+ resolve26({ action: "cancel" });
278506
278731
  }
278507
278732
  }
278508
278733
  }
@@ -279200,7 +279425,7 @@ var init_client5 = __esm(() => {
279200
279425
  logMCPDebug(name, `Error sending SIGINT: ${error41}`);
279201
279426
  return;
279202
279427
  }
279203
- await new Promise(async (resolve25) => {
279428
+ await new Promise(async (resolve26) => {
279204
279429
  let resolved = false;
279205
279430
  const checkInterval = setInterval(() => {
279206
279431
  try {
@@ -279211,7 +279436,7 @@ var init_client5 = __esm(() => {
279211
279436
  clearInterval(checkInterval);
279212
279437
  clearTimeout(failsafeTimeout);
279213
279438
  logMCPDebug(name, "MCP server process exited cleanly");
279214
- resolve25();
279439
+ resolve26();
279215
279440
  }
279216
279441
  }
279217
279442
  }, 50);
@@ -279220,7 +279445,7 @@ var init_client5 = __esm(() => {
279220
279445
  resolved = true;
279221
279446
  clearInterval(checkInterval);
279222
279447
  logMCPDebug(name, "Cleanup timeout reached, stopping process monitoring");
279223
- resolve25();
279448
+ resolve26();
279224
279449
  }
279225
279450
  }, 600);
279226
279451
  try {
@@ -279236,14 +279461,14 @@ var init_client5 = __esm(() => {
279236
279461
  resolved = true;
279237
279462
  clearInterval(checkInterval);
279238
279463
  clearTimeout(failsafeTimeout);
279239
- resolve25();
279464
+ resolve26();
279240
279465
  return;
279241
279466
  }
279242
279467
  } catch {
279243
279468
  resolved = true;
279244
279469
  clearInterval(checkInterval);
279245
279470
  clearTimeout(failsafeTimeout);
279246
- resolve25();
279471
+ resolve26();
279247
279472
  return;
279248
279473
  }
279249
279474
  await sleep2(400);
@@ -279260,7 +279485,7 @@ var init_client5 = __esm(() => {
279260
279485
  resolved = true;
279261
279486
  clearInterval(checkInterval);
279262
279487
  clearTimeout(failsafeTimeout);
279263
- resolve25();
279488
+ resolve26();
279264
279489
  }
279265
279490
  }
279266
279491
  }
@@ -279268,14 +279493,14 @@ var init_client5 = __esm(() => {
279268
279493
  resolved = true;
279269
279494
  clearInterval(checkInterval);
279270
279495
  clearTimeout(failsafeTimeout);
279271
- resolve25();
279496
+ resolve26();
279272
279497
  }
279273
279498
  } catch {
279274
279499
  if (!resolved) {
279275
279500
  resolved = true;
279276
279501
  clearInterval(checkInterval);
279277
279502
  clearTimeout(failsafeTimeout);
279278
- resolve25();
279503
+ resolve26();
279279
279504
  }
279280
279505
  }
279281
279506
  });
@@ -280848,19 +281073,24 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input, toolUseContex
280848
281073
  }
280849
281074
  return [
280850
281075
  {
280851
- message: createUserMessage({
280852
- content: [
280853
- {
280854
- type: "tool_result",
280855
- content,
280856
- is_error: true,
280857
- tool_use_id: toolUseID
280858
- }
280859
- ],
280860
- toolUseResult: `Error: ${content}`,
280861
- mcpMeta: toolUseContext.agentId ? undefined : error41 instanceof McpToolCallError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS ? error41.mcpMeta : undefined,
280862
- sourceToolAssistantUUID: assistantMessage.uuid
280863
- })
281076
+ message: {
281077
+ ...createUserMessage({
281078
+ content: [
281079
+ {
281080
+ type: "tool_result",
281081
+ content,
281082
+ is_error: true,
281083
+ tool_use_id: toolUseID
281084
+ }
281085
+ ],
281086
+ toolUseResult: `Error: ${content}`,
281087
+ mcpMeta: toolUseContext.agentId ? undefined : error41 instanceof McpToolCallError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS ? error41.mcpMeta : undefined,
281088
+ sourceToolAssistantUUID: assistantMessage.uuid
281089
+ }),
281090
+ ...error41 instanceof ToolContinuationStopError && {
281091
+ preventContinuation: true
281092
+ }
281093
+ }
280864
281094
  },
280865
281095
  ...hookMessages
280866
281096
  ];
@@ -281167,8 +281397,8 @@ class StreamingToolExecutor {
281167
281397
  }
281168
281398
  if (this.hasExecutingTools() && !this.hasCompletedResults() && !this.hasPendingProgress()) {
281169
281399
  const executingPromises = this.tools.filter((t) => t.status === "executing" && t.promise).map((t) => t.promise);
281170
- const progressPromise = new Promise((resolve25) => {
281171
- this.progressAvailableResolve = resolve25;
281400
+ const progressPromise = new Promise((resolve26) => {
281401
+ this.progressAvailableResolve = resolve26;
281172
281402
  });
281173
281403
  if (executingPromises.length > 0) {
281174
281404
  await Promise.race([...executingPromises, progressPromise]);
@@ -281410,7 +281640,7 @@ function streamOnEnd() {
281410
281640
  });
281411
281641
  }
281412
281642
  function readFileInRangeStreaming(filePath, offset, maxLines, maxBytes, truncateOnByteLimit, signal) {
281413
- return new Promise((resolve25, reject2) => {
281643
+ return new Promise((resolve26, reject2) => {
281414
281644
  const state3 = {
281415
281645
  stream: createReadStream2(filePath, {
281416
281646
  encoding: "utf8",
@@ -281421,7 +281651,7 @@ function readFileInRangeStreaming(filePath, offset, maxLines, maxBytes, truncate
281421
281651
  endLine: maxLines !== undefined ? offset + maxLines : Infinity,
281422
281652
  maxBytes,
281423
281653
  truncateOnByteLimit,
281424
- resolve: resolve25,
281654
+ resolve: resolve26,
281425
281655
  totalBytesRead: 0,
281426
281656
  selectedBytes: 0,
281427
281657
  truncatedByBytes: false,
@@ -281919,6 +282149,9 @@ function* yieldMissingToolResultBlocks(assistantMessages, errorMessage2) {
281919
282149
  function isWithheldMaxOutputTokens(msg) {
281920
282150
  return msg?.type === "assistant" && msg.apiError === "max_output_tokens";
281921
282151
  }
282152
+ function messagePreventsContinuation(message) {
282153
+ return message.type === "user" && message.preventContinuation === true || message.type === "attachment" && message.attachment.type === "hook_stopped_continuation";
282154
+ }
281922
282155
  async function* query(params) {
281923
282156
  const consumedCommandUuids = [];
281924
282157
  const terminal2 = yield* queryLoop(params, consumedCommandUuids);
@@ -282086,6 +282319,7 @@ async function* queryLoop(params, consumedCommandUuids) {
282086
282319
  const toolResults = [];
282087
282320
  const toolUseBlocks = [];
282088
282321
  let needsFollowUp = false;
282322
+ let shouldPreventContinuation = false;
282089
282323
  queryCheckpoint("query_setup_start");
282090
282324
  const useStreamingToolExecution = config2.gates.streamingToolExecution;
282091
282325
  let streamingToolExecutor = useStreamingToolExecution ? new StreamingToolExecutor(toolUseContext.options.tools, canUseTool, toolUseContext) : null;
@@ -282183,6 +282417,7 @@ async function* queryLoop(params, consumedCommandUuids) {
282183
282417
  toolResults.length = 0;
282184
282418
  toolUseBlocks.length = 0;
282185
282419
  needsFollowUp = false;
282420
+ shouldPreventContinuation = false;
282186
282421
  if (streamingToolExecutor) {
282187
282422
  streamingToolExecutor.discard();
282188
282423
  streamingToolExecutor = new StreamingToolExecutor(toolUseContext.options.tools, canUseTool, toolUseContext);
@@ -282245,6 +282480,9 @@ async function* queryLoop(params, consumedCommandUuids) {
282245
282480
  for (const result of streamingToolExecutor.getCompletedResults()) {
282246
282481
  if (result.message) {
282247
282482
  yield result.message;
282483
+ if (messagePreventsContinuation(result.message)) {
282484
+ shouldPreventContinuation = true;
282485
+ }
282248
282486
  toolResults.push(...normalizeMessagesForAPI([result.message], toolUseContext.options.tools).filter((_) => _.type === "user"));
282249
282487
  }
282250
282488
  }
@@ -282261,6 +282499,7 @@ async function* queryLoop(params, consumedCommandUuids) {
282261
282499
  toolResults.length = 0;
282262
282500
  toolUseBlocks.length = 0;
282263
282501
  needsFollowUp = false;
282502
+ shouldPreventContinuation = false;
282264
282503
  if (streamingToolExecutor) {
282265
282504
  streamingToolExecutor.discard();
282266
282505
  streamingToolExecutor = new StreamingToolExecutor(toolUseContext.options.tools, canUseTool, toolUseContext);
@@ -282458,7 +282697,6 @@ async function* queryLoop(params, consumedCommandUuids) {
282458
282697
  if (false) {}
282459
282698
  return { reason: "completed" };
282460
282699
  }
282461
- let shouldPreventContinuation = false;
282462
282700
  let updatedToolRuntimeContext = toolUseContext;
282463
282701
  queryCheckpoint("query_tool_execution_start");
282464
282702
  if (streamingToolExecutor) {
@@ -282478,7 +282716,7 @@ async function* queryLoop(params, consumedCommandUuids) {
282478
282716
  for await (const update of toolUpdates) {
282479
282717
  if (update.message) {
282480
282718
  yield update.message;
282481
- if (update.message.type === "attachment" && update.message.attachment.type === "hook_stopped_continuation") {
282719
+ if (messagePreventsContinuation(update.message)) {
282482
282720
  shouldPreventContinuation = true;
282483
282721
  }
282484
282722
  toolResults.push(...normalizeMessagesForAPI([update.message], toolUseContext.options.tools).filter((_) => _.type === "user"));
@@ -282492,7 +282730,7 @@ async function* queryLoop(params, consumedCommandUuids) {
282492
282730
  }
282493
282731
  queryCheckpoint("query_tool_execution_end");
282494
282732
  let nextPendingToolUseSummary;
282495
- if (config2.gates.emitToolUseSummaries && toolUseBlocks.length > 0 && !toolUseContext.abortController.signal.aborted && !toolUseContext.agentId) {
282733
+ if (!shouldPreventContinuation && config2.gates.emitToolUseSummaries && toolUseBlocks.length > 0 && !toolUseContext.abortController.signal.aborted && !toolUseContext.agentId) {
282496
282734
  const lastAssistantMessage = assistantMessages.at(-1);
282497
282735
  let lastAssistantText;
282498
282736
  if (lastAssistantMessage) {
@@ -282825,7 +283063,7 @@ function getAnthropicEnvMetadata() {
282825
283063
  function getBuildAgeMinutes() {
282826
283064
  if (false)
282827
283065
  ;
282828
- const buildTime = new Date("2026-07-20T09:45:03.714Z").getTime();
283066
+ const buildTime = new Date("2026-07-21T10:56:17.312Z").getTime();
282829
283067
  if (isNaN(buildTime))
282830
283068
  return;
282831
283069
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -284623,10 +284861,10 @@ function DANGEROUS_uncachedSystemPromptSection(name, compute, _reason) {
284623
284861
  return { name, compute, cacheBreak: true };
284624
284862
  }
284625
284863
  async function resolveSystemPromptSections(sections) {
284626
- const cache2 = getSystemPromptSectionCache();
284864
+ const cache3 = getSystemPromptSectionCache();
284627
284865
  return Promise.all(sections.map(async (s) => {
284628
- if (!s.cacheBreak && cache2.has(s.name)) {
284629
- return cache2.get(s.name) ?? null;
284866
+ if (!s.cacheBreak && cache3.has(s.name)) {
284867
+ return cache3.get(s.name) ?? null;
284630
284868
  }
284631
284869
  const value = await s.compute();
284632
284870
  setSystemPromptSectionCacheEntry(s.name, value);
@@ -285341,21 +285579,6 @@ var init_analyzeContext = __esm(() => {
285341
285579
  init_state2();
285342
285580
  });
285343
285581
 
285344
- // src/lib/zodToJsonSchema.ts
285345
- function zodToJsonSchema3(schema) {
285346
- const hit = cache2.get(schema);
285347
- if (hit)
285348
- return hit;
285349
- const result = toJSONSchema(schema);
285350
- cache2.set(schema, result);
285351
- return result;
285352
- }
285353
- var cache2;
285354
- var init_zodToJsonSchema2 = __esm(() => {
285355
- init_v4();
285356
- cache2 = new WeakMap;
285357
- });
285358
-
285359
285582
  // src/controller/toolSearch.ts
285360
285583
  function parseAutoPercentage(value) {
285361
285584
  if (!value.startsWith("auto:"))
@@ -285470,7 +285693,8 @@ async function calculateDeferredToolDescriptionChars(tools, getToolPermissionCon
285470
285693
  tools,
285471
285694
  agents
285472
285695
  });
285473
- const inputSchema16 = tool.inputJSONSchema ? jsonStringify(tool.inputJSONSchema) : tool.inputSchema ? jsonStringify(zodToJsonSchema3(tool.inputSchema)) : "";
285696
+ const inputJSONSchema = tool.inputJSONSchema;
285697
+ const inputSchema16 = inputJSONSchema ? jsonStringify(inputJSONSchema) : tool.inputSchema ? jsonStringify(zodToJsonSchema3(tool.inputSchema)) : "";
285474
285698
  return tool.name.length + description.length + inputSchema16.length;
285475
285699
  }));
285476
285700
  return sizes.reduce((total, size) => total + size, 0);
@@ -287029,7 +287253,7 @@ var init_findRelevantMemories = __esm(() => {
287029
287253
  });
287030
287254
 
287031
287255
  // src/session/attachments.ts
287032
- import { dirname as dirname37, parse as parse12, relative as relative12, resolve as resolve25 } from "path";
287256
+ import { dirname as dirname37, parse as parse12, relative as relative12, resolve as resolve26 } from "path";
287033
287257
  import { randomUUID as randomUUID13 } from "crypto";
287034
287258
  async function getAttachments(input, toolUseContext, ideSelection, queuedCommands, messages, querySource, options2) {
287035
287259
  if (isEnvTruthy(resolveEnvVar("DISABLE_ATTACHMENTS")) || isEnvTruthy(resolveEnvVar("SIMPLE"))) {
@@ -287407,7 +287631,7 @@ async function getSelectedLinesFromIDE(ideSelection, toolUseContext) {
287407
287631
  ];
287408
287632
  }
287409
287633
  function getDirectoriesToProcess(targetPath, originalCwd) {
287410
- const targetDir = dirname37(resolve25(targetPath));
287634
+ const targetDir = dirname37(resolve26(targetPath));
287411
287635
  const nestedDirs = [];
287412
287636
  let currentDir = targetDir;
287413
287637
  while (currentDir !== originalCwd && currentDir !== parse12(currentDir).root) {
@@ -287863,7 +288087,7 @@ async function getDynamicSkillAttachments(toolUseContext) {
287863
288087
  const candidates = entries.filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => e.name);
287864
288088
  const checked = await Promise.all(candidates.map(async (name) => {
287865
288089
  try {
287866
- await getFsImplementation().stat(resolve25(skillDir, name, "SKILL.md"));
288090
+ await getFsImplementation().stat(resolve26(skillDir, name, "SKILL.md"));
287867
288091
  return name;
287868
288092
  } catch {
287869
288093
  return null;
@@ -289485,7 +289709,7 @@ function executeInBackground({
289485
289709
  }) {
289486
289710
  if (asyncRewake) {
289487
289711
  shellCommand.result.then(async (result) => {
289488
- await new Promise((resolve26) => setImmediate(resolve26));
289712
+ await new Promise((resolve27) => setImmediate(resolve27));
289489
289713
  const stdout = await shellCommand.taskOutput.getStdout();
289490
289714
  const stderr = shellCommand.taskOutput.getStderr();
289491
289715
  shellCommand.cleanup();
@@ -289928,8 +290152,8 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
289928
290152
  child.stderr.setEncoding("utf8");
289929
290153
  let initialResponseChecked = false;
289930
290154
  let asyncResolve = null;
289931
- const childIsAsyncPromise = new Promise((resolve26) => {
289932
- asyncResolve = resolve26;
290155
+ const childIsAsyncPromise = new Promise((resolve27) => {
290156
+ asyncResolve = resolve27;
289933
290157
  });
289934
290158
  const processedPromptLines = new Set;
289935
290159
  let promptChain = Promise.resolve();
@@ -290020,13 +290244,13 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
290020
290244
  hookEvent,
290021
290245
  getOutput: async () => ({ stdout, stderr, output })
290022
290246
  });
290023
- const stdoutEndPromise = new Promise((resolve26) => {
290024
- child.stdout.on("end", () => resolve26());
290247
+ const stdoutEndPromise = new Promise((resolve27) => {
290248
+ child.stdout.on("end", () => resolve27());
290025
290249
  });
290026
- const stderrEndPromise = new Promise((resolve26) => {
290027
- child.stderr.on("end", () => resolve26());
290250
+ const stderrEndPromise = new Promise((resolve27) => {
290251
+ child.stderr.on("end", () => resolve27());
290028
290252
  });
290029
- const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve26, reject2) => {
290253
+ const stdinWritePromise = stdinWritten ? Promise.resolve() : new Promise((resolve27, reject2) => {
290030
290254
  child.stdin.on("error", (err2) => {
290031
290255
  if (!requestPrompt) {
290032
290256
  reject2(err2);
@@ -290039,12 +290263,12 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
290039
290263
  if (!requestPrompt) {
290040
290264
  child.stdin.end();
290041
290265
  }
290042
- resolve26();
290266
+ resolve27();
290043
290267
  });
290044
290268
  const childErrorPromise = new Promise((_, reject2) => {
290045
290269
  child.on("error", reject2);
290046
290270
  });
290047
- const childClosePromise = new Promise((resolve26) => {
290271
+ const childClosePromise = new Promise((resolve27) => {
290048
290272
  let exitCode = null;
290049
290273
  child.on("close", (code) => {
290050
290274
  exitCode = code ?? 1;
@@ -290052,7 +290276,7 @@ async function execCommandHook(hook, hookEvent, hookName, jsonInput, signal, hoo
290052
290276
  const finalStdout = processedPromptLines.size === 0 ? stdout : stdout.split(`
290053
290277
  `).filter((line) => !processedPromptLines.has(line.trim())).join(`
290054
290278
  `);
290055
- resolve26({
290279
+ resolve27({
290056
290280
  stdout: finalStdout,
290057
290281
  stderr,
290058
290282
  output,
@@ -292107,12 +292331,12 @@ async function executeFunctionHook({
292107
292331
  hook
292108
292332
  };
292109
292333
  }
292110
- const passed = await new Promise((resolve26, reject2) => {
292334
+ const passed = await new Promise((resolve27, reject2) => {
292111
292335
  const onAbort = () => reject2(new Error("Function hook cancelled"));
292112
292336
  abortSignal.addEventListener("abort", onAbort);
292113
292337
  Promise.resolve(hook.callback(messages, abortSignal)).then((result) => {
292114
292338
  abortSignal.removeEventListener("abort", onAbort);
292115
- resolve26(result);
292339
+ resolve27(result);
292116
292340
  }).catch((error41) => {
292117
292341
  abortSignal.removeEventListener("abort", onAbort);
292118
292342
  reject2(error41);
@@ -292569,10 +292793,11 @@ async function createAgentWorktree(slug) {
292569
292793
  logForDebugging(`Created hook-based agent worktree at: ${hookResult.worktreePath}`);
292570
292794
  return { worktreePath: hookResult.worktreePath, hookBased: true };
292571
292795
  }
292572
- const gitRoot = findCanonicalGitRoot(getCwd3());
292573
- if (!gitRoot) {
292574
- throw new Error("Cannot create agent worktree: not in a git repository and no WorktreeCreate hooks are configured. " + "Configure WorktreeCreate/WorktreeRemove hooks in settings.json to use worktree isolation with other VCS systems.");
292796
+ const availability = resolveGitWorktreeAvailability(getCwd3(), gitExe());
292797
+ if (!availability.available) {
292798
+ throw new WorktreeUnavailableError(availability.reason);
292575
292799
  }
292800
+ const gitRoot = findCanonicalGitRoot(availability.gitRoot) ?? availability.gitRoot;
292576
292801
  const { worktreePath, worktreeBranch, headCommit, existed } = await getOrCreateWorktree(gitRoot, slug);
292577
292802
  if (!existed) {
292578
292803
  logForDebugging(`Created agent worktree at: ${worktreePath} on branch: ${worktreeBranch}`);
@@ -292584,6 +292809,16 @@ async function createAgentWorktree(slug) {
292584
292809
  }
292585
292810
  return { worktreePath, worktreeBranch, headCommit, gitRoot };
292586
292811
  }
292812
+ function isAgentWorktreeIsolationAvailable(options2 = {}) {
292813
+ try {
292814
+ if (options2.hasCreateHook ?? hasWorktreeCreateHook()) {
292815
+ return true;
292816
+ }
292817
+ return isGitWorktreeIsolationAvailable(options2.cwd ?? getCwd3(), gitExe(), options2.gitAvailabilityCache);
292818
+ } catch {
292819
+ return false;
292820
+ }
292821
+ }
292587
292822
  async function removeAgentWorktree(worktreePath, worktreeBranch, gitRoot, hookBased) {
292588
292823
  if (hookBased) {
292589
292824
  const hookRan = await executeWorktreeRemoveHook(worktreePath);
@@ -292655,6 +292890,7 @@ var init_worktree = __esm(() => {
292655
292890
  init_settings2();
292656
292891
  init_detection();
292657
292892
  init_fsOperations();
292893
+ init_worktreeAvailability();
292658
292894
  import_ignore4 = __toESM(require_ignore(), 1);
292659
292895
  VALID_WORKTREE_SLUG_SEGMENT = /^[a-zA-Z0-9._-]+$/;
292660
292896
  GIT_NO_PROMPT_ENV2 = {
@@ -293146,12 +293382,13 @@ function filterSwarmFieldsFromSchema(toolName, schema) {
293146
293382
  return filtered;
293147
293383
  }
293148
293384
  async function toolToAPISchema(tool, options2) {
293149
- const cacheKey = "inputJSONSchema" in tool && tool.inputJSONSchema ? `${tool.name}:${jsonStringify(tool.inputJSONSchema)}` : tool.name;
293385
+ const inputJSONSchema = tool.inputJSONSchema;
293386
+ const cacheKey = inputJSONSchema ? `${tool.name}:${jsonStringify(inputJSONSchema)}` : tool.name;
293150
293387
  const cache3 = getToolSchemaCache();
293151
293388
  let base2 = cache3.get(cacheKey);
293152
293389
  if (!base2) {
293153
293390
  const strictToolsEnabled = checkStatsigFeatureGate_CACHED_MAY_BE_STALE("tengu_tool_pear");
293154
- let input_schema = "inputJSONSchema" in tool && tool.inputJSONSchema ? tool.inputJSONSchema : zodToJsonSchema3(tool.inputSchema);
293391
+ let input_schema = inputJSONSchema ?? zodToJsonSchema3(tool.inputSchema);
293155
293392
  if (!isAgentSwarmsEnabled()) {
293156
293393
  input_schema = filterSwarmFieldsFromSchema(tool.name, input_schema);
293157
293394
  }
@@ -296239,7 +296476,7 @@ var init_permissionSetup = __esm(() => {
296239
296476
 
296240
296477
  // src/capabilities/markdownConfigLoader.ts
296241
296478
  import { homedir as homedir20 } from "os";
296242
- import { dirname as dirname39, join as join74, resolve as resolve26, sep as sep21 } from "path";
296479
+ import { dirname as dirname39, join as join74, resolve as resolve27, sep as sep21 } from "path";
296243
296480
  function extractDescriptionFromMarkdown(content, defaultDescription = "Custom item") {
296244
296481
  const lines = content.split(`
296245
296482
  `);
@@ -296321,9 +296558,9 @@ function resolveStopBoundary(cwd) {
296321
296558
  return cwdGitRoot;
296322
296559
  }
296323
296560
  function getProjectDirsUpToHome(subdir, cwd) {
296324
- const home = resolve26(homedir20()).normalize("NFC");
296561
+ const home = resolve27(homedir20()).normalize("NFC");
296325
296562
  const gitRoot = resolveStopBoundary(cwd);
296326
- let current = resolve26(cwd);
296563
+ let current = resolve27(cwd);
296327
296564
  const dirs = [];
296328
296565
  while (true) {
296329
296566
  if (normalizePathForComparison(current) === normalizePathForComparison(home)) {
@@ -317960,7 +318197,7 @@ var HttpClient = class {
317960
318197
  } else if (extractStatus.status === "failed" || extractStatus.status === "cancelled") {
317961
318198
  throw new FirecrawlError(`Extract job ${extractStatus.status}. Error: ${extractStatus.error}`, statusResponse.status);
317962
318199
  }
317963
- await new Promise((resolve27) => setTimeout(resolve27, 1000));
318200
+ await new Promise((resolve28) => setTimeout(resolve28, 1000));
317964
318201
  } while (extractStatus.status !== "completed");
317965
318202
  } else {
317966
318203
  this.handleError(response, "extract");
@@ -318059,7 +318296,7 @@ var HttpClient = class {
318059
318296
  }
318060
318297
  } else if (["active", "paused", "pending", "queued", "waiting", "scraping"].includes(statusData.status)) {
318061
318298
  checkInterval = Math.max(checkInterval, 2);
318062
- await new Promise((resolve27) => setTimeout(resolve27, checkInterval * 1000));
318299
+ await new Promise((resolve28) => setTimeout(resolve28, checkInterval * 1000));
318063
318300
  } else {
318064
318301
  throw new FirecrawlError(`Crawl job failed or was stopped. Status: ${statusData.status}`, 500);
318065
318302
  }
@@ -318073,7 +318310,7 @@ var HttpClient = class {
318073
318310
  if (this.isRetryableError(error41) && networkRetries < maxNetworkRetries) {
318074
318311
  networkRetries++;
318075
318312
  const backoffDelay = Math.min(1000 * Math.pow(2, networkRetries - 1), 1e4);
318076
- await new Promise((resolve27) => setTimeout(resolve27, backoffDelay));
318313
+ await new Promise((resolve28) => setTimeout(resolve28, backoffDelay));
318077
318314
  continue;
318078
318315
  }
318079
318316
  throw new FirecrawlError(error41, 500);
@@ -318156,7 +318393,7 @@ var HttpClient = class {
318156
318393
  if (researchStatus.status !== "processing") {
318157
318394
  break;
318158
318395
  }
318159
- await new Promise((resolve27) => setTimeout(resolve27, 2000));
318396
+ await new Promise((resolve28) => setTimeout(resolve28, 2000));
318160
318397
  }
318161
318398
  return { success: false, error: "Research job terminated unexpectedly" };
318162
318399
  } catch (error41) {
@@ -318244,7 +318481,7 @@ var HttpClient = class {
318244
318481
  if (researchStatus.status !== "processing") {
318245
318482
  break;
318246
318483
  }
318247
- await new Promise((resolve27) => setTimeout(resolve27, 2000));
318484
+ await new Promise((resolve28) => setTimeout(resolve28, 2000));
318248
318485
  }
318249
318486
  return { success: false, error: "Research job terminated unexpectedly" };
318250
318487
  } catch (error41) {
@@ -318315,7 +318552,7 @@ var HttpClient = class {
318315
318552
  if (generationStatus.status !== "processing") {
318316
318553
  break;
318317
318554
  }
318318
- await new Promise((resolve27) => setTimeout(resolve27, 2000));
318555
+ await new Promise((resolve28) => setTimeout(resolve28, 2000));
318319
318556
  }
318320
318557
  return { success: false, error: "LLMs.txt generation job terminated unexpectedly" };
318321
318558
  } catch (error41) {
@@ -325152,9 +325389,9 @@ var require_needle = __commonJS((exports, module) => {
325152
325389
  verb = args.shift();
325153
325390
  if (verb.match(/get|head/i) && args.length == 2)
325154
325391
  args.splice(1, 0, null);
325155
- return new Promise(function(resolve27, reject2) {
325392
+ return new Promise(function(resolve28, reject2) {
325156
325393
  module.exports.request(verb, args[0], args[1], args[2], function(err2, resp) {
325157
- return err2 ? reject2(err2) : resolve27(resp);
325394
+ return err2 ? reject2(err2) : resolve28(resp);
325158
325395
  });
325159
325396
  });
325160
325397
  };
@@ -335805,14 +336042,14 @@ class AuthCodeListener {
335805
336042
  this.callbackPath = callbackPath;
335806
336043
  }
335807
336044
  async start(port) {
335808
- return new Promise((resolve27, reject2) => {
336045
+ return new Promise((resolve28, reject2) => {
335809
336046
  this.localServer.once("error", (err2) => {
335810
336047
  reject2(new Error(`Failed to start OAuth callback server: ${err2.message}`));
335811
336048
  });
335812
336049
  this.localServer.listen({ port: port ?? 0, host: "::", ipv6Only: false }, () => {
335813
336050
  const address = this.localServer.address();
335814
336051
  this.port = address.port;
335815
- resolve27(this.port);
336052
+ resolve28(this.port);
335816
336053
  });
335817
336054
  });
335818
336055
  }
@@ -335823,8 +336060,8 @@ class AuthCodeListener {
335823
336060
  return this.pendingResponse !== null;
335824
336061
  }
335825
336062
  async waitForAuthorization(state3, onReady) {
335826
- return new Promise((resolve27, reject2) => {
335827
- this.promiseResolver = resolve27;
336063
+ return new Promise((resolve28, reject2) => {
336064
+ this.promiseResolver = resolve28;
335828
336065
  this.promiseRejecter = reject2;
335829
336066
  this.expectedState = state3;
335830
336067
  this.startLocalListener(onReady);
@@ -335990,11 +336227,11 @@ class OAuthService {
335990
336227
  }
335991
336228
  }
335992
336229
  async waitForAuthorizationCode(state3, onReady) {
335993
- return new Promise((resolve27, reject2) => {
335994
- this.manualAuthCodeResolver = resolve27;
336230
+ return new Promise((resolve28, reject2) => {
336231
+ this.manualAuthCodeResolver = resolve28;
335995
336232
  this.authCodeListener?.waitForAuthorization(state3, onReady).then((authorizationCode) => {
335996
336233
  this.manualAuthCodeResolver = null;
335997
- resolve27(authorizationCode);
336234
+ resolve28(authorizationCode);
335998
336235
  }).catch((error41) => {
335999
336236
  this.manualAuthCodeResolver = null;
336000
336237
  reject2(error41);
@@ -336467,4 +336704,4 @@ export {
336467
336704
  AbortError2 as AbortError
336468
336705
  };
336469
336706
 
336470
- //# debugId=96A7445415A37CC164756E2164756E21
336707
+ //# debugId=802EF03F664786CA64756E2164756E21