zidane 6.2.31 → 6.2.33

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 (89) hide show
  1. package/dist/{acp-C04z4yA7.js → acp-DlgMFlUN.js} +3 -3
  2. package/dist/{acp-C04z4yA7.js.map → acp-DlgMFlUN.js.map} +1 -1
  3. package/dist/acp-cli.js +4 -4
  4. package/dist/acp.d.ts +1 -1
  5. package/dist/acp.js +1 -1
  6. package/dist/{agent-CbFirigA.js → agent-CdnYdiRY.js} +127 -28
  7. package/dist/agent-CdnYdiRY.js.map +1 -0
  8. package/dist/agent.d.ts +1 -1
  9. package/dist/agent.js +1 -1
  10. package/dist/{anthropic-fUETpZNm.js → anthropic--S5Wg4Oy.js} +2 -2
  11. package/dist/{anthropic-fUETpZNm.js.map → anthropic--S5Wg4Oy.js.map} +1 -1
  12. package/dist/{auth-qXqkD--3.js → auth-up7hgE9H.js} +2 -2
  13. package/dist/{auth-qXqkD--3.js.map → auth-up7hgE9H.js.map} +1 -1
  14. package/dist/chat/pure.d.ts +4 -4
  15. package/dist/chat/pure.js +3 -3
  16. package/dist/chat.d.ts +112 -5
  17. package/dist/chat.d.ts.map +1 -1
  18. package/dist/chat.js +6 -6
  19. package/dist/contexts/daytona.d.ts +1 -1
  20. package/dist/contexts/e2b.d.ts +1 -1
  21. package/dist/eval.d.ts +1 -1
  22. package/dist/eval.js +1 -1
  23. package/dist/extensions.d.ts +1 -1
  24. package/dist/extensions.js +1 -1
  25. package/dist/headless.d.ts +1 -1
  26. package/dist/headless.js +3 -3
  27. package/dist/{index-5AFYbHjc.d.ts → index-LLXx0VRf.d.ts} +250 -4
  28. package/dist/index-LLXx0VRf.d.ts.map +1 -0
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +8 -8
  31. package/dist/{login-CEOlp1r6.js → login-CWwu9Sex.js} +114 -5
  32. package/dist/login-CWwu9Sex.js.map +1 -0
  33. package/dist/mcp.d.ts +1 -1
  34. package/dist/{messages-Dy9t7DbQ.js → messages-t5Sv-vyv.js} +161 -2
  35. package/dist/{messages-Dy9t7DbQ.js.map → messages-t5Sv-vyv.js.map} +1 -1
  36. package/dist/output/stream-json.d.ts +1 -1
  37. package/dist/output/terminal.d.ts +1 -1
  38. package/dist/presets.d.ts +1 -1
  39. package/dist/presets.js +1 -1
  40. package/dist/providers/anthropic.d.ts +1 -1
  41. package/dist/providers/anthropic.js +1 -1
  42. package/dist/providers/arcee.d.ts +1 -1
  43. package/dist/providers/baseten.d.ts +1 -1
  44. package/dist/providers/cerebras.d.ts +1 -1
  45. package/dist/providers/local.d.ts +1 -1
  46. package/dist/providers/openai-compat.d.ts +1 -1
  47. package/dist/providers/openai.d.ts +1 -1
  48. package/dist/providers/openai.js +1 -1
  49. package/dist/providers/openrouter.d.ts +1 -1
  50. package/dist/providers/xai.d.ts +1 -1
  51. package/dist/providers.d.ts +1 -1
  52. package/dist/providers.js +1 -1
  53. package/dist/read-state-rDmfeLmz.js.map +1 -1
  54. package/dist/restate.d.ts +1 -1
  55. package/dist/session/sqlite.d.ts +1 -1
  56. package/dist/{session-DkVnYGm9.js → session-DtRtNDBz.js} +61 -5
  57. package/dist/session-DtRtNDBz.js.map +1 -0
  58. package/dist/session.d.ts +2 -2
  59. package/dist/session.js +3 -3
  60. package/dist/skills.d.ts +1 -1
  61. package/dist/{tool-formatters-Dft7YVHI.d.ts → tool-formatters-DtUL8zcF.d.ts} +14 -3
  62. package/dist/tool-formatters-DtUL8zcF.d.ts.map +1 -0
  63. package/dist/tools/fetch-url.d.ts +1 -1
  64. package/dist/tools/web-search.d.ts +1 -1
  65. package/dist/tools.d.ts +1 -1
  66. package/dist/tools.js +1 -1
  67. package/dist/{transcript-anchors-TsFlSKWp.js → transcript-anchors-CKkH7rJY.js} +3330 -2639
  68. package/dist/transcript-anchors-CKkH7rJY.js.map +1 -0
  69. package/dist/{transcript-anchors-DcsjjcXp.d.ts → transcript-anchors-Cmn6Apac.d.ts} +12 -3
  70. package/dist/{transcript-anchors-DcsjjcXp.d.ts.map → transcript-anchors-Cmn6Apac.d.ts.map} +1 -1
  71. package/dist/tui.d.ts +11 -3
  72. package/dist/tui.d.ts.map +1 -1
  73. package/dist/tui.js +241 -805
  74. package/dist/tui.js.map +1 -1
  75. package/dist/{turn-operations-4tnvKwfJ.js → turn-operations-CtEpeB_s.js} +99 -3
  76. package/dist/turn-operations-CtEpeB_s.js.map +1 -0
  77. package/dist/{turn-operations-ScYurEvl.d.ts → turn-operations-PPSEo4C3.d.ts} +16 -4
  78. package/dist/turn-operations-PPSEo4C3.d.ts.map +1 -0
  79. package/dist/types-BIarq1qE.js.map +1 -1
  80. package/dist/types.d.ts +1 -1
  81. package/package.json +1 -1
  82. package/dist/agent-CbFirigA.js.map +0 -1
  83. package/dist/index-5AFYbHjc.d.ts.map +0 -1
  84. package/dist/login-CEOlp1r6.js.map +0 -1
  85. package/dist/session-DkVnYGm9.js.map +0 -1
  86. package/dist/tool-formatters-Dft7YVHI.d.ts.map +0 -1
  87. package/dist/transcript-anchors-TsFlSKWp.js.map +0 -1
  88. package/dist/turn-operations-4tnvKwfJ.js.map +0 -1
  89. package/dist/turn-operations-ScYurEvl.d.ts.map +0 -1
package/dist/acp-cli.js CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { It as resolveStorageDirs, ut as basic_default } from "./agent-CbFirigA.js";
2
+ import { It as resolveStorageDirs, ut as basic_default } from "./agent-CdnYdiRY.js";
3
3
  import { r as createProcessContext } from "./contexts-o8y5B3Tm.js";
4
4
  import { createSandboxContext } from "./contexts/sandbox.js";
5
5
  import { m as openaiCompat } from "./openai-compat-pHI0kBWH.js";
6
- import { t as anthropic } from "./anthropic-fUETpZNm.js";
6
+ import { t as anthropic } from "./anthropic--S5Wg4Oy.js";
7
7
  import { arcee } from "./providers/arcee.js";
8
8
  import { baseten } from "./providers/baseten.js";
9
9
  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-C04z4yA7.js";
14
- import { f as credKeyOf, i as readCredentials, l as BUILTIN_PROVIDERS, r as credentialsPath, t as detectAuth, y as modelsForDescriptor } from "./auth-qXqkD--3.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-DlgMFlUN.js";
14
+ import { f as credKeyOf, i as readCredentials, l as BUILTIN_PROVIDERS, r as credentialsPath, t as detectAuth, y as modelsForDescriptor } from "./auth-up7hgE9H.js";
15
15
  import { createDaytonaProvider } from "./contexts/daytona.js";
16
16
  import { createDockerContext } from "./contexts/docker.js";
17
17
  import { createE2BProvider } from "./contexts/e2b.js";
package/dist/acp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Li as AgentOptions, Md as AgentBehavior, Pf as TurnUsage, Pi as Agent, Tf as ToolResultContent, am as Provider, if as PromptPart, pf as SessionContentBlock, qd as McpServerConfig, rp as Session, sp as SessionStore, t as Preset, zf as ToolDef } from "./index-5AFYbHjc.js";
1
+ import { Ef as SessionContentBlock, Gd as AgentBehavior, Qf as ToolDef, Rf as ToolResultContent, Sm as Provider, Wi as Agent, _f as PromptPart, _p as Session, of as McpServerConfig, qf as TurnUsage, qi as AgentOptions, t as Preset, xp as SessionStore } from "./index-LLXx0VRf.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-C04z4yA7.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-DlgMFlUN.js";
2
2
  export { AcpProtocolError, JsonRpcRemoteError, acpMcpServersToZidane, acpPromptToPromptParts, createAcpServer, createJsonRpcConnection, runAcpStdioServer, sessionBlocksToAcp, stopReasonFromRun, toolResultToAcpContent, withAcpDefaultTools, wrapToolsForAcpClient };
@@ -17,8 +17,8 @@ import { n as reconcileImageMediaType } from "./media-sniff-Bn76JxAu.js";
17
17
  import { n as connectMcpServers, o as nonOwningMcpView, r as deriveMcpToolMeta, u as wrapDiscoveredMcpTools } from "./mcp-Ct5tF4oj.js";
18
18
  import { C as canonicalizePrompt, S as buildPromptMessage } from "./openai-compat-pHI0kBWH.js";
19
19
  import { appendStaticSection, renderSystemForWire } from "./prompt.js";
20
- import { a as detectTurnInterruption, c as filterUnresolvedToolUses, f as remintDuplicateToolCallIds, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, o as ensureEndsWithUserMessage, p as resolveContentRefsInMessages, s as ensureToolResultPairing } from "./messages-Dy9t7DbQ.js";
21
- import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-DkVnYGm9.js";
20
+ import { a as detectTurnInterruption, c as ensureToolResultPairing, l as filterUnresolvedToolUses, m as resolveContentRefsInMessages, n as SYNTHETIC_TOOL_RESULT_PLACEHOLDER, p as remintDuplicateToolCallIds, s as ensureEndsWithUserMessage } from "./messages-t5Sv-vyv.js";
21
+ import { a as getExtensionSessionState, c as setExtensionSessionState, l as withExtensionSession, n as currentExtensionSession, r as deleteExtensionSessionState, s as resumeChainRunIds } from "./session-DtRtNDBz.js";
22
22
  import { n as flattenTurns, r as formatTokenUsage, t as effectiveInputFromTurn } from "./stats-DAKBEKjc.js";
23
23
  import { a as withInactivityTimeout, i as settleWithinTimeout, n as linkAbortSignal, o as withTimeout$1, r as resolveTimeoutMs, t as OperationTimeoutError } from "./timeout-BDetbuN6.js";
24
24
  import { createRequire } from "node:module";
@@ -112,12 +112,19 @@ function installDedupToolsGate(hooks, getDedupTools, getSession) {
112
112
  ctx.block = true;
113
113
  ctx.reason = formatReason(config.reason, ctx.name, ctx.input, count);
114
114
  state.set(key, {
115
- hash,
116
- result: prior.result,
115
+ ...prior,
117
116
  repeats: priorRepeats + 1
118
117
  });
119
118
  return;
120
119
  }
120
+ if (prior.failed) {
121
+ pending.set(pendingKey(ctx.callId, ctx.name), {
122
+ hash,
123
+ repeats: priorRepeats + 1,
124
+ key
125
+ });
126
+ return;
127
+ }
121
128
  ctx.result = prior.result;
122
129
  pending.set(pendingKey(ctx.callId, ctx.name), {
123
130
  hash,
@@ -139,10 +146,12 @@ function installDedupToolsGate(hooks, getDedupTools, getSession) {
139
146
  pending.delete(key);
140
147
  const state = getToolDedupState(getSession());
141
148
  if (!state) return;
149
+ const failed = ctx.isError || ctx.outcome === "failed" || ctx.outcome === "noop";
142
150
  state.set(entry.key, {
143
151
  hash: entry.hash,
144
152
  result: ctx.result,
145
- repeats: entry.repeats
153
+ repeats: entry.repeats,
154
+ ...failed ? { failed: true } : {}
146
155
  });
147
156
  }
148
157
  const unregisterGate = hooks.hook("tool:gate", gateHandler);
@@ -1453,12 +1462,71 @@ function evictModuleGraph(dir) {
1453
1462
  }
1454
1463
  }
1455
1464
  /**
1465
+ * Node-only resolver shim for TypeScript extensions. Bun resolves an
1466
+ * extensionless relative import (`./commit`) to `commit.ts` natively, so
1467
+ * multi-file TS extensions Just Work under the TUI — but Node's ESM
1468
+ * resolver does not, so the SAME extension errored in any Node host
1469
+ * (the Electron GUI) with "Cannot find module …/commit" while its
1470
+ * single-file siblings loaded fine via type stripping. The hook retries
1471
+ * a FAILED relative extensionless resolution with `.ts` then
1472
+ * `/index.ts` appended; it never fires for resolutions that succeed, so
1473
+ * host-app and node_modules resolution are untouched.
1474
+ *
1475
+ * `module.registerHooks` (sync, in-thread) needs Node ≥ 22.15 — absent
1476
+ * (or under Bun, where the fallback is native) this is a silent no-op
1477
+ * and multi-file TS extensions keep failing with the resolver's own
1478
+ * error, same as before.
1479
+ */
1480
+ let nodeTsResolutionInstall;
1481
+ /**
1482
+ * File-URL prefixes of extension dirs the retry may fire under. Scoping
1483
+ * by the importing module's parent keeps the hook inert for the host
1484
+ * app's own failed resolutions — a host relying on a failed-resolution
1485
+ * catch path must never silently load an unexpected `.ts` file.
1486
+ */
1487
+ const nodeTsResolutionParents = /* @__PURE__ */ new Set();
1488
+ function ensureNodeTsExtensionResolution(extensionDir) {
1489
+ if (typeof Bun !== "undefined") return Promise.resolve();
1490
+ try {
1491
+ const url = pathToFileURL(extensionDir.endsWith(sep) ? extensionDir : extensionDir + sep).href;
1492
+ nodeTsResolutionParents.add(url);
1493
+ } catch {}
1494
+ nodeTsResolutionInstall ??= installNodeTsResolution();
1495
+ return nodeTsResolutionInstall;
1496
+ }
1497
+ async function installNodeTsResolution() {
1498
+ try {
1499
+ const registerHooks = (await import("node:module")).registerHooks;
1500
+ if (typeof registerHooks !== "function") return;
1501
+ registerHooks({ resolve(specifier, context, nextResolve) {
1502
+ try {
1503
+ return nextResolve(specifier, context);
1504
+ } catch (err) {
1505
+ const relative = specifier.startsWith("./") || specifier.startsWith("../");
1506
+ const extensionless = !/\.[cm]?[jt]sx?$/.test(specifier) && !specifier.endsWith(".json");
1507
+ const parent = context?.parentURL ?? "";
1508
+ const underExtension = [...nodeTsResolutionParents].some((prefix) => parent.startsWith(prefix));
1509
+ if (relative && extensionless && underExtension) {
1510
+ try {
1511
+ return nextResolve(`${specifier}.ts`, context);
1512
+ } catch {}
1513
+ try {
1514
+ return nextResolve(`${specifier}/index.ts`, context);
1515
+ } catch {}
1516
+ }
1517
+ throw err;
1518
+ }
1519
+ } });
1520
+ } catch {}
1521
+ }
1522
+ /**
1456
1523
  * Import + validate a single extension entry. Always returns a
1457
1524
  * {@link LoadedExtension} — the load error (if any) lives on the
1458
1525
  * returned object, never as a thrown exception.
1459
1526
  */
1460
1527
  async function loadExtensionFromDisk(entry, timeoutMs) {
1461
1528
  try {
1529
+ await ensureNodeTsExtensionResolution(entry.dir);
1462
1530
  evictModuleGraph(entry.dir);
1463
1531
  importGeneration += 1;
1464
1532
  const definition = pickExtensionDefinition(await withTimeout(import(`${pathToFileURL(entry.entry).href}?zidane-gen=${importGeneration}`), timeoutMs, `Timed out importing ${entry.entry} after ${timeoutMs}ms. The module's top-level code may still be running — imports cannot be cancelled.`));
@@ -10813,6 +10881,18 @@ function wrapProviderError(err, ctx) {
10813
10881
  }
10814
10882
  return wrapped;
10815
10883
  }
10884
+ /**
10885
+ * Operation names carried by watchdog `OperationTimeoutError`s. Shared
10886
+ * between the watchdog racer (`streamWithWatchdogs`) and the retry
10887
+ * classifier so the retry carve-out can't silently detach from the errors
10888
+ * it targets when a label is renamed.
10889
+ */
10890
+ const PROVIDER_WATCHDOG_OPERATIONS = {
10891
+ "first response": "provider first response",
10892
+ "total stream": "provider total stream",
10893
+ "stream inactivity": "provider stream inactivity"
10894
+ };
10895
+ const PROVIDER_WATCHDOG_OPERATION_SET = new Set(Object.values(PROVIDER_WATCHDOG_OPERATIONS));
10816
10896
  function providerWatchdogTimeouts(ctx) {
10817
10897
  return {
10818
10898
  startTimeoutMs: resolveTimeoutMs(ctx.providerStreamStartTimeoutMs, DEFAULT_PROVIDER_STREAM_START_TIMEOUT_MS, ctx.maxWallMs),
@@ -10962,10 +11042,22 @@ async function streamWithWatchdogs(ctx, options, callbacks, turnId, opts) {
10962
11042
  if (idleTimer) clearTimeout(idleTimer);
10963
11043
  unlinkParentAbort();
10964
11044
  };
11045
+ let lastActivityAt = 0;
11046
+ const armIdleTimer = (delayMs) => {
11047
+ idleTimer = setTimeout(() => {
11048
+ if (settled) return;
11049
+ const idleMs = Date.now() - lastActivityAt;
11050
+ if (idleMs < idleTimeoutMs) {
11051
+ armIdleTimer(idleTimeoutMs - idleMs);
11052
+ return;
11053
+ }
11054
+ onIdleTimeout?.();
11055
+ }, delayMs);
11056
+ };
10965
11057
  const recordActivity = () => {
10966
11058
  if (idleTimeoutMs <= 0 || settled) return;
10967
- if (idleTimer) clearTimeout(idleTimer);
10968
- idleTimer = setTimeout(() => onIdleTimeout?.(), idleTimeoutMs);
11059
+ lastActivityAt = Date.now();
11060
+ if (idleTimer === void 0) armIdleTimer(idleTimeoutMs);
10969
11061
  };
10970
11062
  const markFirstObserved = () => {
10971
11063
  recordActivity();
@@ -10988,21 +11080,23 @@ async function streamWithWatchdogs(ctx, options, callbacks, turnId, opts) {
10988
11080
  markFirstObserved();
10989
11081
  callbacks.onText(delta);
10990
11082
  },
10991
- ...callbacks.onThinking ? { onThinking(delta) {
11083
+ onThinking(delta) {
10992
11084
  if (settled) return;
10993
11085
  markFirstObserved();
10994
11086
  callbacks.onThinking?.(delta);
10995
- } } : {},
10996
- ...callbacks.onServerToolUse ? { onServerToolUse(block) {
11087
+ },
11088
+ onServerToolUse(block) {
11089
+ opts?.onServerToolActivity?.();
10997
11090
  if (settled) return;
10998
11091
  markFirstObserved();
10999
11092
  callbacks.onServerToolUse?.(block);
11000
- } } : {},
11001
- ...callbacks.onServerToolResult ? { onServerToolResult(block) {
11093
+ },
11094
+ onServerToolResult(block) {
11095
+ opts?.onServerToolActivity?.();
11002
11096
  if (settled) return;
11003
11097
  markFirstObserved();
11004
11098
  callbacks.onServerToolResult?.(block);
11005
- } } : {},
11099
+ },
11006
11100
  onToolCallDelta() {
11007
11101
  if (settled) return;
11008
11102
  markFirstObserved();
@@ -11010,7 +11104,7 @@ async function streamWithWatchdogs(ctx, options, callbacks, turnId, opts) {
11010
11104
  }
11011
11105
  });
11012
11106
  } catch (err) {
11013
- unlinkParentAbort();
11107
+ cleanup();
11014
11108
  throw err;
11015
11109
  }
11016
11110
  streamPromise.catch(() => {});
@@ -11018,7 +11112,7 @@ async function streamWithWatchdogs(ctx, options, callbacks, turnId, opts) {
11018
11112
  const failTimeout = (kind, timeoutMs) => {
11019
11113
  if (settled) return;
11020
11114
  settled = true;
11021
- const err = new OperationTimeoutError(`provider ${kind}`, timeoutMs, kind === "stream inactivity" ? `Provider stream timed out: no stream events for ${timeoutMs}ms (turn ${turnId}).` : `Provider stream timed out waiting for ${kind} after ${timeoutMs}ms (turn ${turnId}).`);
11115
+ const err = new OperationTimeoutError(PROVIDER_WATCHDOG_OPERATIONS[kind], timeoutMs, kind === "stream inactivity" ? `Provider stream timed out: no stream events for ${timeoutMs}ms (turn ${turnId}).` : `Provider stream timed out waiting for ${kind} after ${timeoutMs}ms (turn ${turnId}).`);
11022
11116
  attemptAbort.abort(err);
11023
11117
  cleanup();
11024
11118
  reject(err);
@@ -11063,11 +11157,12 @@ const ERROR_PLACEHOLDER_MAX = 280;
11063
11157
  * suffix. Falls back to the original generic placeholder when no message
11064
11158
  * can be extracted.
11065
11159
  */
11066
- function buildStreamErrorPlaceholder(err) {
11160
+ function buildStreamErrorPlaceholder(err, midOutput = false) {
11161
+ const prefix = midOutput ? "Streaming failed mid-output" : "Streaming failed before any output";
11067
11162
  const raw = errorMessage(err).trim();
11068
- if (raw.length === 0) return "[✗ Streaming failed before any output.]";
11163
+ if (raw.length === 0) return `[✗ ${prefix}.]`;
11069
11164
  const oneLine = raw.replace(/\s+/g, " ");
11070
- return `[✗ Streaming failed before any output: ${oneLine.length > ERROR_PLACEHOLDER_MAX ? `${oneLine.slice(0, ERROR_PLACEHOLDER_MAX - 1).trimEnd()}…` : oneLine}]`;
11165
+ return `[✗ ${prefix}: ${oneLine.length > ERROR_PLACEHOLDER_MAX ? `${oneLine.slice(0, ERROR_PLACEHOLDER_MAX - 1).trimEnd()}…` : oneLine}]`;
11071
11166
  }
11072
11167
  function buildCumulativeUsage(prior, turnUsage) {
11073
11168
  const cost = prior.priorCost + (turnUsage.cost ?? 0);
@@ -11520,6 +11615,7 @@ async function executeTurn(ctx, turn, priorUsage) {
11520
11615
  streamOptions.messages = ensureEndsWithUserMessage(streamOptions.messages, ctx.provider);
11521
11616
  let currentText = "";
11522
11617
  let currentThinking = "";
11618
+ let serverToolActivity = false;
11523
11619
  const streamStartedAt = Date.now();
11524
11620
  let turnTtftMs;
11525
11621
  const markTurnTtft = () => {
@@ -11582,15 +11678,20 @@ async function executeTurn(ctx, turn, priorUsage) {
11582
11678
  onOAuthRefresh(refreshCtx) {
11583
11679
  return ctx.hooks.callHook("oauth:refresh", refreshCtx);
11584
11680
  }
11585
- }, turnId, attempt > 1 ? { startTimeoutCapMs: RETRY_STREAM_START_TIMEOUT_CAP_MS } : void 0);
11681
+ }, turnId, {
11682
+ ...attempt > 1 ? { startTimeoutCapMs: RETRY_STREAM_START_TIMEOUT_CAP_MS } : {},
11683
+ onServerToolActivity: () => {
11684
+ serverToolActivity = true;
11685
+ }
11686
+ });
11586
11687
  break;
11587
11688
  } catch (caught) {
11588
11689
  let terminalErr = caught;
11589
11690
  let wasAborted = ctx.signal.aborted || caught instanceof Error && caught.name === "AbortError";
11590
11691
  const classified = !wasAborted ? ctx.provider.classifyError?.(caught) : null;
11591
11692
  const isRetryable = classified?.kind === "provider_error" && classified.retryable === true;
11592
- const cleanSlate = currentText === "" && currentThinking === "";
11593
- const isStreamWatchdogTimeout = !wasAborted && caught instanceof OperationTimeoutError && (caught.operation === "provider first response" || caught.operation === "provider total stream" || caught.operation === "provider stream inactivity");
11693
+ const cleanSlate = currentText === "" && currentThinking === "" && !serverToolActivity;
11694
+ const isStreamWatchdogTimeout = !wasAborted && caught instanceof OperationTimeoutError && PROVIDER_WATCHDOG_OPERATION_SET.has(caught.operation);
11594
11695
  const canRetry = !wasAborted && (isRetryable || isStreamWatchdogTimeout) && cleanSlate && attempt < retryCfg.maxAttempts;
11595
11696
  const retryAfterMs = canRetry ? extractRetryAfterMs(caught) : void 0;
11596
11697
  const hasNextTarget = ctx.targets !== void 0 && (ctx.activeTargetIndex ?? 0) + 1 < ctx.targets.length;
@@ -11698,13 +11799,10 @@ async function executeTurn(ctx, turn, priorUsage) {
11698
11799
  input: 0,
11699
11800
  output: 0
11700
11801
  };
11701
- const placeholderText = wasAborted ? "[⏹ Streaming was aborted.]" : buildStreamErrorPlaceholder(terminalErr);
11702
- const errorContent = currentText ? [{
11802
+ const placeholderText = wasAborted ? "[⏹ Streaming was aborted.]" : buildStreamErrorPlaceholder(terminalErr, currentText !== "");
11803
+ const errorContent = [{
11703
11804
  type: "text",
11704
- text: currentText
11705
- }] : [{
11706
- type: "text",
11707
- text: placeholderText
11805
+ text: currentText ? `${currentText}\n\n${placeholderText}` : placeholderText
11708
11806
  }];
11709
11807
  const errorTurn = {
11710
11808
  id: turnId,
@@ -12391,6 +12489,7 @@ async function emitToolResult(ctx, params) {
12391
12489
  await ctx.hooks.callHook("tool:after", {
12392
12490
  ...buildToolHookBase(ctx, turnId, callId, name, displayName, input),
12393
12491
  result: output,
12492
+ isError,
12394
12493
  outputBytes: toolOutputByteLength(output),
12395
12494
  runToolCounts,
12396
12495
  ...coercions ? { coercions } : {},
@@ -15431,4 +15530,4 @@ function createAgent(rawOptions) {
15431
15530
  //#endregion
15432
15531
  export { buildExtensionRegistry as $, defaultExtensionScanPaths as $t, buildUpToCompactPrompt as A, listFiles as At, createExtensionPromptBridge as B, KEYBINDING_KEY_COL_WIDTH as Bt, BASE_INSTRUCTIONS as C, tailTruncate as Ct, buildFromCompactPrompt as D, createModelSearchTool as Dt, buildCompactPrompt as E, multiEdit as Et, summaryToTurn as F, validateToolArgs as Ft, parseExtensionInstallSource as G, matchesBinding as Gt, fetchExtensionSource as H, formatBindingForDisplay as Ht, truncateHeadForPtlRetry as I, resolveStorageDirs as It, updateInstalledExtension as J, readKeybindings as Jt, readExtensionInstallProvenance as K, mergeKeybindings as Kt, CompactInvalidInputError as L, DEFAULT_KEYBINDINGS as Lt, anchorPreviewFor as M, grep as Mt, sliceForCompaction as N, glob as Nt, buildFullCompactPrompt as O, formatModelLine as Ot, stripImagesFromTurns as P, edit as Pt, buildExtensionPreset as Q, ENTRY_CANDIDATES as Qt, CompactPromptTooLongError as R, KEYBINDING_DEFS as Rt, compactConversation as S, shell as St, TRAILER as T, looksBinary as Tt, installExtensionFromSpec as U, groupBindings as Ut, ExtensionInstallError as V, ensureKeybindingsFile as Vt, listExtensionCandidates as W, keybindingsPath as Wt, registerExtensionHostModules as X, resolveExtensionKeybindings as Xt, createExtensionHud as Y, readKeybindingsRaw as Yt, discoverAndBuildExtensionRegistry as Z, stripJsonComments as Zt, resolveTasksDir as _, shouldAutoCompact as _n, createSkillsUseTool as _t, SHELL_CASCADE_CANCEL_MESSAGE as a, defineExtension as an, createExtensionHostRuntimeBridge as at, selectFilesFromSession as b, normalizeShellCommand as bn, shellKill as bt, applyCompactSummaryCutoff as c, isValidExtensionConfigItem as cn, definePreset as ct, buildPersistedStub as d, resolveExtensionConfigValue as dn, writeFile$1 as dt, discoverExtensions as en, composeExtensionPreset as et, cleanupPersistedSession as f, sanitizeExtensionConfigActionPatch as fn, WAIT_TASK_TIMED_OUT_PREFIX as ft, resolvePersistDir as g, effectiveContextWindow as gn, isSpawnTool as gt, resolveMcpWarningsDir as h, OUTPUT_RESERVE_TOKENS as hn, createSpawnTool as ht, INTERRUPT_MESSAGE_FOR_TOOL_USE as i, scanExtensionDirectories as in, partitionExtensionCatalog as it, ANCHOR_PREVIEW_MAX_CHARS as j, createInteractionTool as jt, buildTailCompactPrompt as k, matchModelEntries as kt, PERSISTED_STUB_PREFIX as l, isValidExtensionConfigValue as ln, basicTools as lt, rehomePersistedStubs as m, AUTO_COMPACT_MIN_GROWTH_FRACTION as mn, createToolSearchTool as mt, normalizeProviders as n, isExtensionDefinition as nn, filterExtensionRegistry as nt, TOOL_USE_CANCELLED_MESSAGE as o, clampExtensionConfigNumber as on, createWorkspaceSurface as ot, maybePersistToolResult as p, toWireConfigSchema as pn, waitTask as pt, removeInstalledExtension as q, parseBindingSpec as qt, resolveModelTargets as r, parseExtensionScanPathEnv as rn, mergeContributions as rt, TOOL_USE_SKIPPED_MESSAGE as s, coerceExtensionConfigInput as sn, composePresets as st, createAgent as t, inlineLoadedExtension as tn, disposeExtensionRegistry as tt, PERSISTENCE_PREVIEW_BYTES as u, resolveExtensionConfig as un, basic_default as ut, buildPostCompactAttachments as v, defaultRepeatGuardNormalize as vn, createSkillsRunScriptTool as vt, NO_TOOLS_PREAMBLE as w, readFile$1 as wt, selectRecentFiles as x, stableStringify as xn, createShellTool as xt, selectFilesFromReadState as y, defaultRepeatGuardTracked as yn, createSkillsReadTool as yt, EMPTY_EXTENSION_REGISTRY as z, KEYBINDING_DEF_BY_ACTION as zt };
15433
15532
 
15434
- //# sourceMappingURL=agent-CbFirigA.js.map
15533
+ //# sourceMappingURL=agent-CdnYdiRY.js.map