zidane 6.2.22 → 6.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/{acp-Cwp_Y78H.js → acp-B7wH6LhE.js} +3 -3
  2. package/dist/{acp-Cwp_Y78H.js.map → acp-B7wH6LhE.js.map} +1 -1
  3. package/dist/acp-cli.js +2 -2
  4. package/dist/acp.d.ts +1 -1
  5. package/dist/acp.js +1 -1
  6. package/dist/{agent-IPshmLIF.js → agent-BSIMsEtD.js} +112 -14
  7. package/dist/agent-BSIMsEtD.js.map +1 -0
  8. package/dist/agent.d.ts +1 -1
  9. package/dist/agent.js +1 -1
  10. package/dist/chat/pure.d.ts +3 -3
  11. package/dist/chat.d.ts +4 -4
  12. package/dist/chat.d.ts.map +1 -1
  13. package/dist/chat.js +2 -2
  14. package/dist/contexts/daytona.d.ts +1 -1
  15. package/dist/contexts/e2b.d.ts +1 -1
  16. package/dist/eval.d.ts +1 -1
  17. package/dist/eval.js +1 -1
  18. package/dist/extensions.d.ts +1 -1
  19. package/dist/extensions.js +1 -1
  20. package/dist/headless.d.ts +1 -1
  21. package/dist/headless.js +2 -2
  22. package/dist/{index-BDtxt4FY.d.ts → index-Bv9qhj4n.d.ts} +44 -1
  23. package/dist/index-Bv9qhj4n.d.ts.map +1 -0
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/mcp.d.ts +1 -1
  27. package/dist/output/stream-json.d.ts +1 -1
  28. package/dist/output/terminal.d.ts +1 -1
  29. package/dist/presets.d.ts +1 -1
  30. package/dist/presets.js +1 -1
  31. package/dist/providers/anthropic.d.ts +1 -1
  32. package/dist/providers/arcee.d.ts +1 -1
  33. package/dist/providers/baseten.d.ts +1 -1
  34. package/dist/providers/cerebras.d.ts +1 -1
  35. package/dist/providers/local.d.ts +1 -1
  36. package/dist/providers/openai-compat.d.ts +1 -1
  37. package/dist/providers/openai.d.ts +1 -1
  38. package/dist/providers/openrouter.d.ts +1 -1
  39. package/dist/providers/xai.d.ts +1 -1
  40. package/dist/providers.d.ts +1 -1
  41. package/dist/restate.d.ts +1 -1
  42. package/dist/session/sqlite.d.ts +1 -1
  43. package/dist/{session-DzrXKLw-.js → session-Dbvz1ZUE.js} +3 -2
  44. package/dist/session-Dbvz1ZUE.js.map +1 -0
  45. package/dist/session.d.ts +1 -1
  46. package/dist/session.js +1 -1
  47. package/dist/skills.d.ts +1 -1
  48. package/dist/{tool-formatters-CMrkqO4q.d.ts → tool-formatters-D9P6Znip.d.ts} +2 -2
  49. package/dist/{tool-formatters-CMrkqO4q.d.ts.map → tool-formatters-D9P6Znip.d.ts.map} +1 -1
  50. package/dist/tools/fetch-url.d.ts +1 -1
  51. package/dist/tools/web-search.d.ts +1 -1
  52. package/dist/tools.d.ts +1 -1
  53. package/dist/tools.js +1 -1
  54. package/dist/{transcript-anchors-Bvb8iMiY.d.ts → transcript-anchors-Ci5888xS.d.ts} +12 -4
  55. package/dist/{transcript-anchors-Bvb8iMiY.d.ts.map → transcript-anchors-Ci5888xS.d.ts.map} +1 -1
  56. package/dist/{transcript-anchors-DvLIRYLz.js → transcript-anchors-CqzIr74w.js} +48 -4
  57. package/dist/transcript-anchors-CqzIr74w.js.map +1 -0
  58. package/dist/tui.d.ts +3 -3
  59. package/dist/tui.js +18 -13
  60. package/dist/tui.js.map +1 -1
  61. package/dist/{turn-operations-BIw6n_H2.d.ts → turn-operations-C3y6A82G.d.ts} +3 -3
  62. package/dist/{turn-operations-BIw6n_H2.d.ts.map → turn-operations-C3y6A82G.d.ts.map} +1 -1
  63. package/dist/types-BIarq1qE.js.map +1 -1
  64. package/dist/types.d.ts +1 -1
  65. package/package.json +1 -1
  66. package/dist/agent-IPshmLIF.js.map +0 -1
  67. package/dist/index-BDtxt4FY.d.ts.map +0 -1
  68. package/dist/session-DzrXKLw-.js.map +0 -1
  69. package/dist/transcript-anchors-DvLIRYLz.js.map +0 -1
package/dist/acp-cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Ft as resolveStorageDirs, lt as basic_default } from "./agent-IPshmLIF.js";
2
+ import { Ft as resolveStorageDirs, lt as basic_default } from "./agent-BSIMsEtD.js";
3
3
  import { r as createProcessContext } from "./contexts-A4ep-iJs.js";
4
4
  import { createSandboxContext } from "./contexts/sandbox.js";
5
5
  import { m as openaiCompat } from "./openai-compat-pHI0kBWH.js";
@@ -10,7 +10,7 @@ import { cerebras } from "./providers/cerebras.js";
10
10
  import { t as xai } from "./xai-BwhzoehX.js";
11
11
  import { openai } from "./providers/openai.js";
12
12
  import { openrouter } from "./providers/openrouter.js";
13
- import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-Cwp_Y78H.js";
13
+ import { d as StartUsageError, f as buildStartLocalOptions, h as startProviderNames, i as withAcpDefaultTools, m as startLocalArgOptions, p as parseStartArgValues, t as runAcpStdioServer } from "./acp-B7wH6LhE.js";
14
14
  import { f as credKeyOf, i as readCredentials, l as BUILTIN_PROVIDERS, r as credentialsPath, t as detectAuth, y as modelsForDescriptor } from "./auth-CpdQebUy.js";
15
15
  import { createDaytonaProvider } from "./contexts/daytona.js";
16
16
  import { createDockerContext } from "./contexts/docker.js";
package/dist/acp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $p as Provider, Li as AgentOptions, Md as AgentBehavior, Pf as TurnUsage, Pi as Agent, Tf as ToolResultContent, if as PromptPart, pf as SessionContentBlock, qd as McpServerConfig, rp as Session, sp as SessionStore, t as Preset, zf as ToolDef } from "./index-BDtxt4FY.js";
1
+ import { $p as Provider, Li as AgentOptions, Md as AgentBehavior, Pf as TurnUsage, Pi as Agent, Tf as ToolResultContent, if as PromptPart, pf as SessionContentBlock, qd as McpServerConfig, rp as Session, sp as SessionStore, t as Preset, zf as ToolDef } from "./index-Bv9qhj4n.js";
2
2
  import { c as ExecutionContext } from "./types-BDccavwj.js";
3
3
  import { Readable, Writable } from "node:stream";
4
4
 
package/dist/acp.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as createJsonRpcConnection, a as wrapToolsForAcpClient, c as sessionBlocksToAcp, g as JsonRpcRemoteError, i as withAcpDefaultTools, l as stopReasonFromRun, n as AcpProtocolError, o as acpMcpServersToZidane, r as createAcpServer, s as acpPromptToPromptParts, t as runAcpStdioServer, u as toolResultToAcpContent } from "./acp-Cwp_Y78H.js";
1
+ import { _ as createJsonRpcConnection, a as wrapToolsForAcpClient, c as sessionBlocksToAcp, g as JsonRpcRemoteError, i as withAcpDefaultTools, l as stopReasonFromRun, n as AcpProtocolError, o as acpMcpServersToZidane, r as createAcpServer, s as acpPromptToPromptParts, t as runAcpStdioServer, u as toolResultToAcpContent } from "./acp-B7wH6LhE.js";
2
2
  export { AcpProtocolError, JsonRpcRemoteError, acpMcpServersToZidane, acpPromptToPromptParts, createAcpServer, createJsonRpcConnection, runAcpStdioServer, sessionBlocksToAcp, stopReasonFromRun, toolResultToAcpContent, withAcpDefaultTools, wrapToolsForAcpClient };
@@ -18,7 +18,7 @@ import { n as flattenTurns, r as formatTokenUsage, t as effectiveInputFromTurn }
18
18
  import { C as canonicalizePrompt, S as buildPromptMessage } from "./openai-compat-pHI0kBWH.js";
19
19
  import { appendStaticSection, renderSystemForWire } from "./prompt.js";
20
20
  import { a as detectTurnInterruption, c as filterUnresolvedToolUses, d as remintDuplicateToolCallIds, f as resolveContentRefsInMessages, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, o as ensureEndsWithUserMessage, s as ensureToolResultPairing } from "./messages-CvHfYB7f.js";
21
- import { a as getExtensionSessionState, c as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as setExtensionSessionState } from "./session-DzrXKLw-.js";
21
+ import { a as getExtensionSessionState, c as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as setExtensionSessionState } from "./session-Dbvz1ZUE.js";
22
22
  import { a as withInactivityTimeout, i as settleWithinTimeout, n as linkAbortSignal, o as withTimeout$1, r as resolveTimeoutMs, t as OperationTimeoutError } from "./timeout-BDetbuN6.js";
23
23
  import { createRequire } from "node:module";
24
24
  import { basename, delimiter, dirname, isAbsolute, join, resolve, sep } from "node:path";
@@ -4878,6 +4878,21 @@ const CHILD_MUTABLE_EVENT_NAME = {
4878
4878
  "tool:transform": "child:tool:transform"
4879
4879
  };
4880
4880
  const sessionChildCounters = /* @__PURE__ */ new WeakMap();
4881
+ /** Chronological child runs (depth > 0) — index + 1 is the `child-N` label. */
4882
+ function childRunsOf(session) {
4883
+ return session.runs.filter((r) => (r.depth ?? 0) > 0);
4884
+ }
4885
+ /**
4886
+ * Human/model-facing list of this session's child runs, labeled the same
4887
+ * way `reserveChildLabel` numbers them (chronological order of depth > 0
4888
+ * runs). Rendered into resume-rejection messages so the model can
4889
+ * self-correct with a valid label.
4890
+ */
4891
+ function describeChildRuns(session) {
4892
+ const childRuns = childRunsOf(session);
4893
+ if (childRuns.length === 0) return "No child runs exist in this session.";
4894
+ return childRuns.map((r, i) => `- child-${i + 1} · ${r.status} · ${r.prompt.slice(0, 80)}`).join("\n");
4895
+ }
4881
4896
  function reserveChildLabel(session) {
4882
4897
  let counter = sessionChildCounters.get(session);
4883
4898
  if (counter === void 0) counter = session.runs.filter((r) => (r.depth ?? 0) > 0).length;
@@ -5213,6 +5228,10 @@ function buildSpawnTool(options, state) {
5213
5228
  type: "string",
5214
5229
  description: buildModelFieldDescription(modelCatalog)
5215
5230
  } } : {};
5231
+ const resumeProperty = options.persist ? { resume: {
5232
+ type: "string",
5233
+ description: "Child label of a prior stopped/failed sub-agent to resume (e.g. \"child-2\", as reported in its result header). The new run is seeded with that child's full prior conversation; `task` becomes the continuation instruction instead of a fresh task. Only terminal children (aborted / timed out / errored / completed) can be resumed."
5234
+ } } : {};
5216
5235
  const tool = {
5217
5236
  maxConcurrent,
5218
5237
  get children() {
@@ -5245,7 +5264,7 @@ function buildSpawnTool(options, state) {
5245
5264
  isConcurrencySafe: true,
5246
5265
  spec: {
5247
5266
  name: "spawn",
5248
- description: `Spawn a sub-agent for a self-contained task that benefits from isolation (separate context window, separate retries) — for example, a deep research dive or a long codegen pass on a specific file. The sub-agent inherits your tool set (including \`spawn\` itself, depth-capped) and your system prompt unless overridden, runs independently, and returns its final response. Do NOT spawn for sequential steps you could do yourself.${modelCatalog ? " Children can run on a DIFFERENT model via the `model` field — cost-tier your delegation: mechanical, parallelizable, or high-volume search work belongs on cheaper/faster models, while synthesis and judgment stay on your own model." : ""}`,
5267
+ description: `Spawn a sub-agent for a self-contained task that benefits from isolation (separate context window, separate retries) — for example, a deep research dive or a long codegen pass on a specific file. The sub-agent inherits your tool set (including \`spawn\` itself, depth-capped) and your system prompt unless overridden, runs independently, and returns its final response. Do NOT spawn for sequential steps you could do yourself.${modelCatalog ? " Children can run on a DIFFERENT model via the `model` field — cost-tier your delegation: mechanical, parallelizable, or high-volume search work belongs on cheaper/faster models, while synthesis and judgment stay on your own model." : ""}${options.persist ? " A stopped or failed sub-agent can be CONTINUED instead of restarted: pass `resume` with its child label (e.g. \"child-2\") and put the continuation instruction in `task` — the child picks up with its prior conversation intact." : ""}`,
5249
5268
  inputSchema: {
5250
5269
  type: "object",
5251
5270
  properties: {
@@ -5258,7 +5277,8 @@ function buildSpawnTool(options, state) {
5258
5277
  description: "Optional system prompt override for this specific sub-agent. REPLACES the entire inherited system prompt — identity, doctrine, and environment info (cwd, platform, date) are all lost. Prefer omitting this and putting specialization in `task`; if you do override, restate the working directory and any constraints the child must keep."
5259
5278
  },
5260
5279
  ...subagentTypeProperty,
5261
- ...modelProperty
5280
+ ...modelProperty,
5281
+ ...resumeProperty
5262
5282
  },
5263
5283
  required: ["task"]
5264
5284
  }
@@ -5296,6 +5316,37 @@ function buildSpawnTool(options, state) {
5296
5316
  const inheritedModel = childProvider === ctx.provider ? ctx.model : void 0;
5297
5317
  const childModel = chosenModelId ?? inheritedModel;
5298
5318
  const announcedModel = childModel ?? childProvider.meta.defaultModel;
5319
+ let resumeRun;
5320
+ let resumeLabel;
5321
+ if (typeof input.resume === "string" && input.resume.trim() !== "") {
5322
+ const wanted = input.resume.trim();
5323
+ if (!options.persist || !ctx.session) return {
5324
+ status: "rejected",
5325
+ text: "",
5326
+ message: "Cannot resume: resuming a sub-agent requires the spawn tool to be configured with persist: true and the parent to have a session — no prior child turns are stored here."
5327
+ };
5328
+ const childRuns = childRunsOf(ctx.session);
5329
+ const labelMatch = /^child-(\d+)$/.exec(wanted);
5330
+ const index = labelMatch ? Number(labelMatch[1]) - 1 : childRuns.findIndex((r) => r.id === wanted);
5331
+ const run = index >= 0 ? childRuns[index] : void 0;
5332
+ if (!run) return {
5333
+ status: "rejected",
5334
+ text: "",
5335
+ message: `Cannot resume: no child run matches "${wanted}". Child runs in this session:\n${describeChildRuns(ctx.session)}`
5336
+ };
5337
+ if (run.status === "running") return {
5338
+ status: "rejected",
5339
+ text: "",
5340
+ message: `Cannot resume: child-${index + 1} is still running. Only terminal children (aborted / error / completed) can be resumed.`
5341
+ };
5342
+ if (!ctx.session.turns.some((t) => t.runId === run.id)) return {
5343
+ status: "rejected",
5344
+ text: "",
5345
+ message: `Cannot resume: child-${index + 1} has no persisted turns (it likely failed before producing anything). Spawn a fresh child with a full task instead.`
5346
+ };
5347
+ resumeRun = run;
5348
+ resumeLabel = `child-${index + 1}`;
5349
+ }
5299
5350
  const parentDepth = ctx.depth ?? 0;
5300
5351
  const childDepth = parentDepth + 1;
5301
5352
  if (childDepth > maxDepth) return {
@@ -5370,6 +5421,7 @@ function buildSpawnTool(options, state) {
5370
5421
  const spawnHookCtx = {
5371
5422
  id,
5372
5423
  task,
5424
+ ...resumeLabel !== void 0 ? { resumesChildId: resumeLabel } : {},
5373
5425
  depth: childDepth,
5374
5426
  model: announcedModel,
5375
5427
  provider: childProvider.name,
@@ -5386,6 +5438,7 @@ function buildSpawnTool(options, state) {
5386
5438
  signal: ctx.signal,
5387
5439
  depth: childDepth,
5388
5440
  ...options.persist && ctx.runId ? { parentRunId: ctx.runId } : {},
5441
+ ...resumeRun ? { resumeRunId: resumeRun.id } : {},
5389
5442
  ...propagatedTracing ? { tracingContext: propagatedTracing } : {}
5390
5443
  });
5391
5444
  try {
@@ -9902,6 +9955,23 @@ function applyMediaAgeout(messages, keep, options) {
9902
9955
  };
9903
9956
  }
9904
9957
  /**
9958
+ * Distinct `read_file` paths called inside the given turns (optionally
9959
+ * filtered to an id set). Canonical tool names — the alias rewrite is
9960
+ * wire-only, so session turns always carry `read_file` verbatim.
9961
+ */
9962
+ function readFilePathsInTurns(turns, ids) {
9963
+ const paths = /* @__PURE__ */ new Set();
9964
+ for (const turn of turns) {
9965
+ if (ids && !ids.has(turn.id)) continue;
9966
+ for (const block of turn.content) {
9967
+ if (block.type !== "tool_call" || block.name !== "read_file") continue;
9968
+ const path = block.input.path;
9969
+ if (typeof path === "string" && path.length > 0) paths.add(path);
9970
+ }
9971
+ }
9972
+ return [...paths];
9973
+ }
9974
+ /**
9905
9975
  * Build a call_id → file path map for `read_file` tool calls in `messages`.
9906
9976
  * Tail compaction uses it to learn which stubbed `tool_result`s were file
9907
9977
  * reads, so their read-state dedup can be invalidated. Resolve this from the
@@ -10546,8 +10616,9 @@ async function repairInvalidAnthropicThinkingHistory(ctx, streamOptions, repair)
10546
10616
  }
10547
10617
  return Math.max(removed, sessionRemoved);
10548
10618
  }
10549
- async function streamWithWatchdogs(ctx, options, callbacks, turnId) {
10550
- const { startTimeoutMs, totalTimeoutMs } = providerWatchdogTimeouts(ctx);
10619
+ async function streamWithWatchdogs(ctx, options, callbacks, turnId, opts) {
10620
+ let { startTimeoutMs, totalTimeoutMs } = providerWatchdogTimeouts(ctx);
10621
+ if (opts?.startTimeoutCapMs !== void 0 && startTimeoutMs > 0) startTimeoutMs = Math.min(startTimeoutMs, opts.startTimeoutCapMs);
10551
10622
  const callerHistoryRepair = callbacks.onHistoryRepair;
10552
10623
  callbacks = {
10553
10624
  ...callbacks,
@@ -10711,6 +10782,18 @@ const RETRY_DEFAULTS = {
10711
10782
  maxDelayMs: 3e4
10712
10783
  };
10713
10784
  /**
10785
+ * First-response watchdog cap for RETRY attempts (attempt ≥ 2). The first
10786
+ * attempt gets the full `providerStreamStartTimeoutMs` window (large-prompt
10787
+ * prefill legitimately takes a while on a cold request), but a healthy
10788
+ * re-issue — fired after backoff already waited out any declared
10789
+ * rate-limit window — either starts streaming quickly or is dead. Without
10790
+ * the cap, retrying watchdog timeouts multiplies worst-case silent latency
10791
+ * (3 × 5 min for the defaults) and a stuck provider blocks a whole /ticket
10792
+ * stage for that long. Only applied when the start watchdog is enabled —
10793
+ * an explicit `0` (disabled) stays disabled on retries too.
10794
+ */
10795
+ const RETRY_STREAM_START_TIMEOUT_CAP_MS = 12e4;
10796
+ /**
10714
10797
  * Reactive context-overflow recovery schedule. When a turn is rejected with
10715
10798
  * `context_exceeded` (pre-stream — the request was too big for the model's
10716
10799
  * window), the loop emergency-compacts older `tool_result` bodies via
@@ -10862,6 +10945,9 @@ async function maybeAutoCompact(ctx, turn, lastTurnUsage, state) {
10862
10945
  }
10863
10946
  ctx.turns.push(summaryTurn, ...restorationTurns);
10864
10947
  await ctx.persistTurns?.();
10948
+ const absorbedIds = /* @__PURE__ */ new Set([...result.summarizedTurnIds, ...result.droppedDueToPtl]);
10949
+ const onWireReads = new Set(readFilePathsInTurns(applyCompactSummaryCutoff(ctx.turns)));
10950
+ markReadStateForElidedPaths(ctx, ctx.handle.cwd, readFilePathsInTurns(ctx.turns, absorbedIds).filter((p) => !onWireReads.has(p)));
10865
10951
  const effectiveTokens = (result.usage.output ?? 0) + restorationTokens;
10866
10952
  state.lastCompactedInputTokens = effectiveTokens;
10867
10953
  state.consecutiveFailures = 0;
@@ -11151,7 +11237,7 @@ async function executeTurn(ctx, turn, priorUsage) {
11151
11237
  onOAuthRefresh(refreshCtx) {
11152
11238
  return ctx.hooks.callHook("oauth:refresh", refreshCtx);
11153
11239
  }
11154
- }, turnId);
11240
+ }, turnId, attempt > 1 ? { startTimeoutCapMs: RETRY_STREAM_START_TIMEOUT_CAP_MS } : void 0);
11155
11241
  break;
11156
11242
  } catch (caught) {
11157
11243
  let terminalErr = caught;
@@ -11159,7 +11245,8 @@ async function executeTurn(ctx, turn, priorUsage) {
11159
11245
  const classified = !wasAborted ? ctx.provider.classifyError?.(caught) : null;
11160
11246
  const isRetryable = classified?.kind === "provider_error" && classified.retryable === true;
11161
11247
  const cleanSlate = currentText === "" && currentThinking === "";
11162
- const canRetry = !wasAborted && isRetryable && cleanSlate && attempt < retryCfg.maxAttempts;
11248
+ const isStreamWatchdogTimeout = !wasAborted && caught instanceof OperationTimeoutError && (caught.operation === "provider first response" || caught.operation === "provider total stream");
11249
+ const canRetry = !wasAborted && (isRetryable || isStreamWatchdogTimeout) && cleanSlate && attempt < retryCfg.maxAttempts;
11163
11250
  const retryAfterMs = canRetry ? extractRetryAfterMs(caught) : void 0;
11164
11251
  const hasNextTarget = ctx.targets !== void 0 && (ctx.activeTargetIndex ?? 0) + 1 < ctx.targets.length;
11165
11252
  if (canRetry && !(retryAfterMs !== void 0 && retryAfterMs > LONG_RETRY_AFTER_FALLBACK_MS && hasNextTarget)) {
@@ -13851,6 +13938,11 @@ function createAgent(rawOptions) {
13851
13938
  const targets = resolveModelTargets(providers, options.model);
13852
13939
  const runProvider = targets[0].provider;
13853
13940
  const resumeFilteredTurns = validateAndPrepareResume(session, options.prompt, pendingTaskNotifications.size > 0);
13941
+ if (options.resumeRunId) {
13942
+ if (!session) throw new Error("resumeRunId requires a session (the prior run's turns live there)");
13943
+ if (!options.prompt) throw new Error("resumeRunId requires a prompt — pass the continuation instruction");
13944
+ if (!session.turns.some((t) => t.runId === options.resumeRunId)) throw new Error(`resumeRunId "${options.resumeRunId}" has no persisted turns in this session — nothing to resume`);
13945
+ }
13854
13946
  const clock = options.clock ?? agentClock ?? DEFAULT_AGENT_CLOCK;
13855
13947
  let externalAbortListener;
13856
13948
  const externalSignal = options.signal;
@@ -13870,7 +13962,8 @@ function createAgent(rawOptions) {
13870
13962
  const promptLabel = typeof options.prompt === "string" ? options.prompt : Array.isArray(options.prompt) ? options.prompt.filter((p) => p.type === "text").map((p) => p.text).join("\n") : "";
13871
13963
  session?.startRun(runId, promptLabel, {
13872
13964
  ...options.parentRunId ? { parentRunId: options.parentRunId } : {},
13873
- depth: typeof options.depth === "number" ? options.depth : 0
13965
+ depth: typeof options.depth === "number" ? options.depth : 0,
13966
+ ...options.resumeRunId ? { resumedFromRunId: options.resumeRunId } : {}
13874
13967
  });
13875
13968
  const sessionRun = session?.runs.find((r) => r.id === runId);
13876
13969
  if (sessionRun) sessionRun.startedAt = runStartedAt;
@@ -14096,15 +14189,20 @@ function createAgent(rawOptions) {
14096
14189
  });
14097
14190
  }
14098
14191
  const turns = [];
14099
- if (session && session.turns.length > 0 && (session.runs.length > 0 || !options.prompt) && !options.parentRunId) {
14192
+ const isResume = session && session.turns.length > 0 && (session.runs.length > 0 || !options.prompt) && !options.parentRunId && !options.resumeRunId;
14193
+ let seededTurns;
14194
+ if (options.resumeRunId && session) seededTurns = filterUnresolvedToolUses(session.turns.filter((t) => t.runId === options.resumeRunId));
14195
+ else if (isResume) {
14100
14196
  const childRunIds = childRunIdSet(session);
14101
14197
  const resumed = childRunIds.size === 0 ? session.turns : session.turns.filter((t) => !t.runId || !childRunIds.has(t.runId));
14102
- const filteredForRuntime = resumeFilteredTurns && resumed === session.turns ? resumeFilteredTurns : filterUnresolvedToolUses(resumed);
14103
- turns.push(...filteredForRuntime);
14198
+ seededTurns = resumeFilteredTurns && resumed === session.turns ? resumeFilteredTurns : filterUnresolvedToolUses(resumed);
14199
+ }
14200
+ if (seededTurns) {
14201
+ turns.push(...seededTurns);
14104
14202
  if (shouldInjectToolSearch && disclosure.lazyEntries.length > 0) {
14105
14203
  const resolvedCallIds = /* @__PURE__ */ new Set();
14106
- for (const turn of filteredForRuntime) for (const block of turn.content) if (block.type === "tool_result" && !block.isError) resolvedCallIds.add(block.callId);
14107
- for (const turn of filteredForRuntime) for (const block of turn.content) {
14204
+ for (const turn of seededTurns) for (const block of turn.content) if (block.type === "tool_result" && !block.isError) resolvedCallIds.add(block.callId);
14205
+ for (const turn of seededTurns) for (const block of turn.content) {
14108
14206
  if (block.type !== "tool_call") continue;
14109
14207
  if (block.name !== "tool_search") continue;
14110
14208
  if (!resolvedCallIds.has(block.id)) continue;
@@ -14970,4 +15068,4 @@ function createAgent(rawOptions) {
14970
15068
  //#endregion
14971
15069
  export { composeExtensionPreset as $, discoverExtensions as $t, ANCHOR_PREVIEW_MAX_CHARS as A, createInteractionTool as At, ExtensionInstallError as B, ensureKeybindingsFile as Bt, NO_TOOLS_PREAMBLE as C, readFile$1 as Ct, buildFullCompactPrompt as D, formatModelLine as Dt, buildFromCompactPrompt as E, createModelSearchTool as Et, truncateHeadForPtlRetry as F, resolveStorageDirs as Ft, readExtensionInstallProvenance as G, mergeKeybindings as Gt, installExtensionFromSpec as H, groupBindings as Ht, CompactInvalidInputError as I, DEFAULT_KEYBINDINGS as It, createExtensionHud as J, readKeybindingsRaw as Jt, removeInstalledExtension as K, parseBindingSpec as Kt, CompactPromptTooLongError as L, KEYBINDING_DEFS as Lt, sliceForCompaction as M, glob as Mt, stripImagesFromTurns as N, edit as Nt, buildTailCompactPrompt as O, matchModelEntries as Ot, summaryToTurn as P, validateToolArgs as Pt, buildExtensionRegistry as Q, defaultExtensionScanPaths as Qt, EMPTY_EXTENSION_REGISTRY as R, KEYBINDING_DEF_BY_ACTION as Rt, BASE_INSTRUCTIONS as S, tailTruncate as St, buildCompactPrompt as T, multiEdit as Tt, listExtensionCandidates as U, keybindingsPath as Ut, fetchExtensionSource as V, formatBindingForDisplay as Vt, parseExtensionInstallSource as W, matchesBinding as Wt, discoverAndBuildExtensionRegistry as X, stripJsonComments as Xt, registerExtensionHostModules as Y, resolveExtensionKeybindings as Yt, buildExtensionPreset as Z, ENTRY_CANDIDATES as Zt, buildPostCompactAttachments as _, defaultRepeatGuardNormalize as _n, createSkillsRunScriptTool as _t, SHELL_CASCADE_CANCEL_MESSAGE as a, clampExtensionConfigNumber as an, createWorkspaceSurface as at, selectRecentFiles as b, stableStringify as bn, createShellTool as bt, applyCompactSummaryCutoff as c, isValidExtensionConfigValue as cn, basicTools as ct, buildPersistedStub as d, sanitizeExtensionConfigActionPatch as dn, WAIT_TASK_TIMED_OUT_PREFIX as dt, inlineLoadedExtension as en, disposeExtensionRegistry as et, cleanupPersistedSession as f, toWireConfigSchema as fn, waitTask as ft, resolveTasksDir as g, shouldAutoCompact as gn, createSkillsUseTool as gt, resolvePersistDir as h, effectiveContextWindow as hn, isSpawnTool as ht, INTERRUPT_MESSAGE_FOR_TOOL_USE as i, defineExtension as in, createExtensionHostRuntimeBridge as it, anchorPreviewFor as j, grep as jt, buildUpToCompactPrompt as k, listFiles as kt, PERSISTED_STUB_PREFIX as l, resolveExtensionConfig as ln, basic_default as lt, resolveMcpWarningsDir as m, OUTPUT_RESERVE_TOKENS as mn, createSpawnTool as mt, normalizeProviders as n, parseExtensionScanPathEnv as nn, mergeContributions as nt, TOOL_USE_CANCELLED_MESSAGE as o, coerceExtensionConfigInput as on, composePresets as ot, maybePersistToolResult as p, AUTO_COMPACT_MIN_GROWTH_FRACTION as pn, createToolSearchTool as pt, updateInstalledExtension as q, readKeybindings as qt, resolveModelTargets as r, scanExtensionDirectories as rn, partitionExtensionCatalog as rt, TOOL_USE_SKIPPED_MESSAGE as s, isValidExtensionConfigItem as sn, definePreset as st, createAgent as t, isExtensionDefinition as tn, filterExtensionRegistry as tt, PERSISTENCE_PREVIEW_BYTES as u, resolveExtensionConfigValue as un, writeFile$1 as ut, selectFilesFromReadState as v, defaultRepeatGuardTracked as vn, createSkillsReadTool as vt, TRAILER as w, looksBinary as wt, compactConversation as x, shell as xt, selectFilesFromSession as y, normalizeShellCommand as yn, shellKill as yt, createExtensionPromptBridge as z, KEYBINDING_KEY_COL_WIDTH as zt };
14972
15070
 
14973
- //# sourceMappingURL=agent-IPshmLIF.js.map
15071
+ //# sourceMappingURL=agent-BSIMsEtD.js.map