@zvada/agent-server 0.3.24 → 0.3.26

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 (190) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +3 -0
  3. package/dist/client/client.js +93 -34
  4. package/dist/core/agents/acp/acp-agent.js +91 -14
  5. package/dist/core/agents/acp/mappings.js +5 -1
  6. package/dist/core/agents/claude-code/approvals.js +2 -1
  7. package/dist/core/agents/claude-code/claude-agent.js +12 -2
  8. package/dist/core/agents/claude-code/mcp.js +9 -1
  9. package/dist/core/agents/claude-code/models.js +16 -10
  10. package/dist/core/agents/claude-code/options.js +23 -2
  11. package/dist/core/agents/claude-code/session.js +21 -1
  12. package/dist/core/agents/claude-code/tools.js +9 -4
  13. package/dist/core/agents/claude-code/turn.js +2 -0
  14. package/dist/core/agents/codex-app-server/adapter.js +2 -0
  15. package/dist/core/agents/codex-app-server/client.js +8 -5
  16. package/dist/core/agents/codex-app-server/codex-agent.js +35 -2
  17. package/dist/core/agents/codex-app-server/effort.js +13 -6
  18. package/dist/core/agents/codex-app-server/mcp.js +35 -18
  19. package/dist/core/agents/codex-app-server/models.js +10 -10
  20. package/dist/core/agents/codex-app-server/options.js +11 -2
  21. package/dist/core/agents/codex-app-server/session.js +11 -4
  22. package/dist/core/agents/codex-app-server/thread-settings.js +30 -11
  23. package/dist/core/agents/host-tools.js +493 -0
  24. package/dist/core/agents/mcp-config.js +6 -2
  25. package/dist/core/agents/scripted/scripted-agent.js +11 -4
  26. package/dist/core/agents/scripted/steps.js +5 -1
  27. package/dist/core/agents/session-agent.js +70 -2
  28. package/dist/core/agents/thinking-levels.js +8 -5
  29. package/dist/core/index.js +1 -0
  30. package/dist/core/presets.js +12 -2
  31. package/dist/core/processes/identity.js +1 -0
  32. package/dist/core/processes/lifeline.js +13 -1
  33. package/dist/core/processes/process-table.js +1 -0
  34. package/dist/core/provision/extract.js +1 -0
  35. package/dist/core/provision/pins.js +7 -16
  36. package/dist/core/provision/releases.js +25 -25
  37. package/dist/core/proxy/loopback.js +22 -4
  38. package/dist/core/runtime/agent-runtime.js +6 -3
  39. package/dist/core/runtime/turn.js +20 -10
  40. package/dist/protocol/config.js +21 -1
  41. package/dist/protocol/credentials.js +2 -1
  42. package/dist/protocol/errors.js +12 -3
  43. package/dist/protocol/model-catalog.js +58 -18
  44. package/dist/protocol/models.js +6 -27
  45. package/dist/protocol/thinking.js +22 -9
  46. package/dist/protocol/wire-api.js +2 -2
  47. package/dist/server/bin.js +6 -4
  48. package/dist/server/routes.js +3 -2
  49. package/dist/types/client/client.d.ts +6 -1
  50. package/dist/types/client/client.d.ts.map +1 -1
  51. package/dist/types/core/agents/acp/acp-agent.d.ts +15 -0
  52. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  53. package/dist/types/core/agents/acp/mappings.d.ts +5 -1
  54. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  55. package/dist/types/core/agents/acp/requests.d.ts +2 -0
  56. package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
  57. package/dist/types/core/agents/claude-code/approvals.d.ts +2 -1
  58. package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
  59. package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -0
  60. package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
  61. package/dist/types/core/agents/claude-code/mcp.d.ts +8 -1
  62. package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
  63. package/dist/types/core/agents/claude-code/models.d.ts +9 -5
  64. package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
  65. package/dist/types/core/agents/claude-code/options.d.ts +14 -1
  66. package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
  67. package/dist/types/core/agents/claude-code/session.d.ts +2 -0
  68. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  69. package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
  70. package/dist/types/core/agents/claude-code/turn.d.ts +3 -0
  71. package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
  72. package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
  73. package/dist/types/core/agents/codex-app-server/client.d.ts +2 -0
  74. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  75. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +11 -0
  76. package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
  77. package/dist/types/core/agents/codex-app-server/effort.d.ts +7 -7
  78. package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
  79. package/dist/types/core/agents/codex-app-server/mcp.d.ts +11 -3
  80. package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
  81. package/dist/types/core/agents/codex-app-server/models.d.ts +4 -1
  82. package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
  83. package/dist/types/core/agents/codex-app-server/options.d.ts +9 -2
  84. package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
  85. package/dist/types/core/agents/codex-app-server/requests.d.ts +2 -0
  86. package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
  87. package/dist/types/core/agents/codex-app-server/session.d.ts +6 -3
  88. package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
  89. package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
  90. package/dist/types/core/agents/host-tools.d.ts +162 -0
  91. package/dist/types/core/agents/host-tools.d.ts.map +1 -0
  92. package/dist/types/core/agents/mcp-config.d.ts +11 -2
  93. package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
  94. package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -1
  95. package/dist/types/core/agents/scripted/steps.d.ts +1 -1
  96. package/dist/types/core/agents/scripted/steps.d.ts.map +1 -1
  97. package/dist/types/core/agents/session-agent.d.ts +2 -7
  98. package/dist/types/core/agents/session-agent.d.ts.map +1 -1
  99. package/dist/types/core/agents/thinking-levels.d.ts +7 -3
  100. package/dist/types/core/agents/thinking-levels.d.ts.map +1 -1
  101. package/dist/types/core/index.d.ts +1 -0
  102. package/dist/types/core/index.d.ts.map +1 -1
  103. package/dist/types/core/presets.d.ts +11 -1
  104. package/dist/types/core/presets.d.ts.map +1 -1
  105. package/dist/types/core/processes/identity.d.ts.map +1 -1
  106. package/dist/types/core/processes/lifeline.d.ts.map +1 -1
  107. package/dist/types/core/processes/process-table.d.ts.map +1 -1
  108. package/dist/types/core/provision/extract.d.ts.map +1 -1
  109. package/dist/types/core/provision/pins.d.ts +5 -4
  110. package/dist/types/core/provision/pins.d.ts.map +1 -1
  111. package/dist/types/core/proxy/loopback.d.ts.map +1 -1
  112. package/dist/types/core/runtime/agent-runtime.d.ts +4 -1
  113. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
  114. package/dist/types/core/runtime/turn.d.ts +12 -7
  115. package/dist/types/core/runtime/turn.d.ts.map +1 -1
  116. package/dist/types/protocol/clis.d.ts +3 -3
  117. package/dist/types/protocol/config.d.ts +12 -19
  118. package/dist/types/protocol/config.d.ts.map +1 -1
  119. package/dist/types/protocol/conversation.d.ts +10 -42
  120. package/dist/types/protocol/conversation.d.ts.map +1 -1
  121. package/dist/types/protocol/credentials.d.ts +13 -1
  122. package/dist/types/protocol/credentials.d.ts.map +1 -1
  123. package/dist/types/protocol/errors.d.ts +6 -4
  124. package/dist/types/protocol/errors.d.ts.map +1 -1
  125. package/dist/types/protocol/execution.d.ts +2 -18
  126. package/dist/types/protocol/execution.d.ts.map +1 -1
  127. package/dist/types/protocol/lifecycle.d.ts +12 -76
  128. package/dist/types/protocol/lifecycle.d.ts.map +1 -1
  129. package/dist/types/protocol/model-catalog.d.ts.map +1 -1
  130. package/dist/types/protocol/models.d.ts +4 -42
  131. package/dist/types/protocol/models.d.ts.map +1 -1
  132. package/dist/types/protocol/thinking.d.ts +19 -19
  133. package/dist/types/protocol/thinking.d.ts.map +1 -1
  134. package/dist/types/protocol/wire-api.d.ts +32 -117
  135. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  136. package/dist/types/protocol/wire.d.ts +24 -125
  137. package/dist/types/protocol/wire.d.ts.map +1 -1
  138. package/dist/types/server/routes.d.ts.map +1 -1
  139. package/docs/consuming.md +92 -12
  140. package/docs/deploy.md +8 -0
  141. package/docs/harnesses.md +88 -27
  142. package/package.json +4 -4
  143. package/src/client/client.ts +114 -44
  144. package/src/core/agents/acp/acp-agent.ts +123 -17
  145. package/src/core/agents/acp/mappings.ts +5 -1
  146. package/src/core/agents/acp/requests.ts +2 -0
  147. package/src/core/agents/claude-code/approvals.ts +2 -1
  148. package/src/core/agents/claude-code/claude-agent.ts +14 -2
  149. package/src/core/agents/claude-code/mcp.ts +11 -1
  150. package/src/core/agents/claude-code/models.ts +15 -10
  151. package/src/core/agents/claude-code/options.ts +37 -3
  152. package/src/core/agents/claude-code/session.ts +26 -1
  153. package/src/core/agents/claude-code/tools.ts +10 -4
  154. package/src/core/agents/claude-code/turn.ts +4 -0
  155. package/src/core/agents/codex-app-server/adapter.ts +2 -0
  156. package/src/core/agents/codex-app-server/client.ts +11 -5
  157. package/src/core/agents/codex-app-server/codex-agent.ts +45 -1
  158. package/src/core/agents/codex-app-server/effort.ts +15 -20
  159. package/src/core/agents/codex-app-server/mcp.ts +46 -23
  160. package/src/core/agents/codex-app-server/models.ts +10 -10
  161. package/src/core/agents/codex-app-server/options.ts +16 -2
  162. package/src/core/agents/codex-app-server/requests.ts +2 -0
  163. package/src/core/agents/codex-app-server/session.ts +19 -4
  164. package/src/core/agents/codex-app-server/thread-settings.ts +31 -11
  165. package/src/core/agents/host-tools.ts +649 -0
  166. package/src/core/agents/mcp-config.ts +15 -3
  167. package/src/core/agents/scripted/scripted-agent.ts +11 -3
  168. package/src/core/agents/scripted/steps.ts +5 -1
  169. package/src/core/agents/session-agent.ts +78 -2
  170. package/src/core/agents/thinking-levels.ts +9 -6
  171. package/src/core/index.ts +9 -0
  172. package/src/core/presets.ts +24 -3
  173. package/src/core/processes/identity.ts +1 -0
  174. package/src/core/processes/lifeline.ts +14 -1
  175. package/src/core/processes/process-table.ts +1 -0
  176. package/src/core/provision/extract.ts +1 -0
  177. package/src/core/provision/pins.ts +7 -16
  178. package/src/core/provision/releases.ts +25 -25
  179. package/src/core/proxy/loopback.ts +25 -4
  180. package/src/core/runtime/agent-runtime.ts +6 -3
  181. package/src/core/runtime/turn.ts +21 -9
  182. package/src/protocol/config.ts +22 -1
  183. package/src/protocol/credentials.ts +19 -5
  184. package/src/protocol/errors.ts +12 -3
  185. package/src/protocol/model-catalog.ts +58 -18
  186. package/src/protocol/models.ts +6 -26
  187. package/src/protocol/thinking.ts +27 -14
  188. package/src/protocol/wire-api.ts +2 -2
  189. package/src/server/bin.ts +6 -4
  190. package/src/server/routes.ts +3 -2
@@ -201,7 +201,10 @@ export class ScriptedAgent extends SessionAgent {
201
201
  controller: AbortController,
202
202
  ): AsyncIterableIterator<RawAgentEvent> {
203
203
  const { signal } = controller;
204
- if (signal.aborted) throw stopped();
204
+ // A turn cancelled before it began is still a turn of its script: it
205
+ // opens it and stops at its first step (or at its end, when it has no
206
+ // step), so a queue skips the turn's steps through its `end` and the
207
+ // next turn plays its own.
205
208
  // A script runs nothing of its own: the abort stops it, so a cancel is confirmed at once.
206
209
  this.cancelWith(options, async () => true);
207
210
  const { sessionId, turnId } = options;
@@ -232,7 +235,11 @@ export class ScriptedAgent extends SessionAgent {
232
235
  for (let n = 1; ; n++) {
233
236
  // What the step before did is the value of its `yield` in a generator.
234
237
  const next = await untilAborted(Promise.resolve(iterator.next(outcome)), signal);
235
- if (next.done) return;
238
+ if (next.done) {
239
+ // No step left to stop at: the cancel was confirmed, so the turn ends cancelled.
240
+ if (signal.aborted) throw stopped();
241
+ return;
242
+ }
236
243
  const step = readStep(next.value, `Step ${n} of turn ${turnId}`);
237
244
  const played = yield* this.play(step, turn);
238
245
  if ("stop" in played || "end" in step) return;
@@ -249,7 +256,8 @@ export class ScriptedAgent extends SessionAgent {
249
256
  turn: { input: AgentInput; options: AgentExecuteOptions; signal: AbortSignal; calls: number },
250
257
  ): AsyncGenerator<ScriptedEvent, Played> {
251
258
  const { options, signal } = turn;
252
- if (signal.aborted) throw stopped();
259
+ // A hang takes its `stopTakes` whenever the cancel came: a product's test cancels without a sleep.
260
+ if (signal.aborted && !("hang" in step)) throw stopped();
253
261
  if ("say" in step) yield { type: "text", text: step.say };
254
262
  else if ("stream" in step) {
255
263
  for (const [i, word] of words(step.stream).entries()) {
@@ -70,7 +70,11 @@ export const ScriptStepSchema = z.union([
70
70
  z.strictObject({ echo: z.enum(["input", "config"]) }),
71
71
  /** A pause of this many ms. */
72
72
  z.strictObject({ wait: Ms }),
73
- /** Runs until the turn is cancelled, then `stopTakes` ms more before it stops. */
73
+ /**
74
+ * Runs until the turn is cancelled, then `stopTakes` ms more before it
75
+ * stops, also when the cancel came first; not in an async generator's
76
+ * script, whose next step a cancel does not wait for.
77
+ */
74
78
  z.strictObject({ hang: z.literal(true), stopTakes: Ms.optional() }),
75
79
  /**
76
80
  * Ends the turn in an error with this message: of `category` when given,
@@ -6,11 +6,14 @@ import {
6
6
  BaseAgent,
7
7
  CANCEL_CONFIRM_MS,
8
8
  type CancelResult,
9
+ type PermissionDecision,
10
+ type PermissionRequestHandler,
9
11
  type RawAgentEvent,
10
12
  type SteerOutcome,
11
13
  type SteerRequest,
12
14
  } from "./base.ts";
13
15
  import { configFingerprint } from "./config-fingerprint.ts";
16
+ import { withoutSecret } from "./host-tools.ts";
14
17
 
15
18
  /** Hands one steer to the harness's native turn. */
16
19
  export type DeliverSteer = (request: SteerRequest) => SteerOutcome | Promise<SteerOutcome>;
@@ -59,6 +62,50 @@ export interface SessionAgentOptions {
59
62
  * exported while its design is a Draft (LLP 0016); a product's own harness
60
63
  * extends `BaseAgent`, the public base.
61
64
  */
65
+ // @ref LLP 0018#who-can-read-the-secret — the broker publishes a request's options too
66
+ /**
67
+ * A permission request as the broker publishes it: its tool call and its
68
+ * options (a harness's own labels and ids) without the secret, and the
69
+ * option picked mapped back to the harness's own id.
70
+ */
71
+ async function permission(
72
+ ask: PermissionRequestHandler,
73
+ scrub: <T>(value: T) => T,
74
+ call: Parameters<PermissionRequestHandler>[0],
75
+ rest: [Parameters<PermissionRequestHandler>[1]?],
76
+ ): Promise<PermissionDecision> {
77
+ const [opts] = rest;
78
+ if (!opts) return ask(scrub(call), ...rest);
79
+ const scrubbed = scrub(opts);
80
+ // A choice whose id held the secret gets an opaque id of its own, unique, so
81
+ // two redacted the same can never be taken for each other.
82
+ const used = new Set(
83
+ (scrubbed.options ?? []).flatMap((option, index) =>
84
+ opts.options?.[index]?.optionId === option.optionId ? [option.optionId] : [],
85
+ ),
86
+ );
87
+ const opaque = (index: number) => {
88
+ let id = `redacted-option-${index}`;
89
+ while (used.has(id)) id += "-";
90
+ used.add(id);
91
+ return id;
92
+ };
93
+ const choices = (scrubbed.options ?? []).map((option, index) => {
94
+ const own = opts.options?.[index]?.optionId ?? option.optionId;
95
+ return {
96
+ option: own === option.optionId ? option : { ...option, optionId: opaque(index) },
97
+ own,
98
+ };
99
+ });
100
+ const native = new Map(choices.map(({ option, own }) => [option.optionId, own]));
101
+ const shown = scrubbed.options
102
+ ? { ...scrubbed, options: choices.map(({ option }) => option) }
103
+ : scrubbed;
104
+ const decision = await ask(scrub(call), shown);
105
+ if (decision.decision === "cancel" || decision.optionId === undefined) return decision;
106
+ return { ...decision, optionId: native.get(decision.optionId) ?? decision.optionId };
107
+ }
108
+
62
109
  export abstract class SessionAgent extends BaseAgent {
63
110
  private terminated = false;
64
111
  /**
@@ -106,8 +153,32 @@ export abstract class SessionAgent extends BaseAgent {
106
153
  try {
107
154
  // The adapter still produces its native cancellation result for an
108
155
  // already-aborted turn. It must not select a conversation or do setup.
109
- const prepared = controller.signal.aborted ? options : this.prepareSessionOptions(options);
110
- yield* this.executeTurn(input, prepared, controller);
156
+ const ready = controller.signal.aborted ? options : this.prepareSessionOptions(options);
157
+ // @ref LLP 0018#who-can-read-the-secret — the session's own secret leaves in no text
158
+ // Kept for the turn once seen: its output may still drain after the session's release.
159
+ let secret: string | undefined;
160
+ const scrub = <T>(value: T): T => {
161
+ secret ??= this.hostSecret(sessionId);
162
+ return withoutSecret(value, secret);
163
+ };
164
+ const { onWarning, onPermissionRequest, onElicitationRequest } = ready;
165
+ const prepared: AgentExecuteOptions = {
166
+ ...ready,
167
+ ...(onWarning && { onWarning: (warning) => onWarning(scrub(warning)) }),
168
+ // What the broker puts on the stream (a request's input, its title) is the agent's text too.
169
+ ...(onPermissionRequest && {
170
+ onPermissionRequest: (call, ...rest) =>
171
+ permission(onPermissionRequest, scrub, call, rest),
172
+ }),
173
+ ...(onElicitationRequest && {
174
+ onElicitationRequest: (request, ...rest) => onElicitationRequest(scrub(request), ...rest),
175
+ }),
176
+ };
177
+ try {
178
+ for await (const event of this.executeTurn(input, prepared, controller)) yield scrub(event);
179
+ } catch (error) {
180
+ throw scrub(error);
181
+ }
111
182
  } finally {
112
183
  this.executed.set(sessionId, options.turnId);
113
184
  if (this.steering.get(sessionId) === steering) this.steering.delete(sessionId);
@@ -227,6 +298,11 @@ export abstract class SessionAgent extends BaseAgent {
227
298
  }
228
299
 
229
300
  /** Native protocol execution; options are prepared and the session is exclusively owned. */
301
+ /** The session's host-tools secret, which no event, warning or error it lets out may hold. */
302
+ protected hostSecret(_sessionId: string): string | undefined {
303
+ return undefined;
304
+ }
305
+
230
306
  protected abstract executeTurn(
231
307
  input: AgentInput,
232
308
  options: AgentExecuteOptions,
@@ -1,9 +1,12 @@
1
- import { THINKING_LEVELS, type ThinkingLevel, isThinkingLevel } from "../../protocol/index.ts";
1
+ import type { ThinkingLevel } from "../../protocol/index.ts";
2
2
 
3
- /** The values that are thinking levels, once each, lowest first. */
4
- export function knownThinkingLevels(values: Iterable<unknown>): ThinkingLevel[] {
3
+ /**
4
+ * The levels a harness lists: each non-blank string once, in the order given.
5
+ * The order is the harness's own (both CLIs list lowest first), and a name
6
+ * this build does not know is kept.
7
+ */
8
+ export function listedThinkingLevels(values: Iterable<unknown>): ThinkingLevel[] {
5
9
  const levels = new Set<ThinkingLevel>();
6
- for (const value of values)
7
- if (typeof value === "string" && isThinkingLevel(value)) levels.add(value);
8
- return THINKING_LEVELS.filter((level) => levels.has(level));
10
+ for (const value of values) if (typeof value === "string" && /\S/.test(value)) levels.add(value);
11
+ return [...levels];
9
12
  }
package/src/core/index.ts CHANGED
@@ -32,6 +32,15 @@ export {
32
32
  } from "./agents/base.ts";
33
33
  export { AgentRegistry } from "./agents/registry.ts";
34
34
  export { type CredentialSource, credentialsFromUrl } from "./agents/credentials.ts";
35
+ export {
36
+ HOST_TOOL_TIMEOUT_MS,
37
+ type HostTool,
38
+ type HostToolCaller,
39
+ type HostToolContent,
40
+ type HostToolResult,
41
+ type HostToolSource,
42
+ type HostTools,
43
+ } from "./agents/host-tools.ts";
35
44
  export type {
36
45
  LoginOptions,
37
46
  LoginStatus,
@@ -11,6 +11,7 @@ import {
11
11
  type CodexAppServerAgentOptions,
12
12
  } from "./agents/codex-app-server/codex-agent.ts";
13
13
  import type { CredentialSource } from "./agents/credentials.ts";
14
+ import type { HostTools } from "./agents/host-tools.ts";
14
15
  import type { InheritConfig } from "./agents/inherit-config.ts";
15
16
  import { AgentRegistry } from "./agents/registry.ts";
16
17
  import { createScriptedTransformer } from "./agents/scripted/adapter.ts";
@@ -31,7 +32,8 @@ type SaidOnce =
31
32
  | "idleTimeoutMs"
32
33
  | "credentials"
33
34
  | "cancelConfirmMs"
34
- | "cancelGraceMs";
35
+ | "cancelGraceMs"
36
+ | "hostTools";
35
37
 
36
38
  export interface CreateRegistryOptions {
37
39
  /**
@@ -70,6 +72,15 @@ export interface CreateRegistryOptions {
70
72
  * Operator-level only.
71
73
  */
72
74
  credentials?: CredentialSource;
75
+ /**
76
+ * The host's own tools (LLP 0018): asked once for each session, at its
77
+ * first turn, for a source of tools the engine gives its agent on every
78
+ * harness, under one server name. Claude runs them in process; Codex, and
79
+ * an ACP agent that takes HTTP MCP servers, reach them at the engine's
80
+ * loopback by a secret of the session's own. Each call names its session,
81
+ * the turn running and the mode. Operator-level only.
82
+ */
83
+ hostTools?: HostTools;
73
84
  /**
74
85
  * How long a session's agent process may wait unused between turns before
75
86
  * it is ended (5 minutes by default); 0 never ends one for idleness, and
@@ -140,6 +151,7 @@ const HARNESSES: Record<
140
151
  onDiagnostic: opts.onDiagnostic,
141
152
  ...opts.claudeCode,
142
153
  credentials: opts.credentials,
154
+ hostTools: opts.hostTools,
143
155
  idleTimeoutMs: opts.idleTimeoutMs,
144
156
  cancelConfirmMs: opts.cancelConfirmMs,
145
157
  cancelGraceMs: opts.cancelGraceMs,
@@ -153,6 +165,7 @@ const HARNESSES: Record<
153
165
  new CodexAppServerAgent({
154
166
  ...opts.codexAppServer,
155
167
  credentials: opts.credentials,
168
+ hostTools: opts.hostTools,
156
169
  idleTimeoutMs: opts.idleTimeoutMs,
157
170
  cancelConfirmMs: opts.cancelConfirmMs,
158
171
  cancelGraceMs: opts.cancelGraceMs,
@@ -166,9 +179,16 @@ const HARNESSES: Record<
166
179
  if (!opts.acp) {
167
180
  throw new Error("the acp harness requires CreateRegistryOptions.acp (resolveLaunch)");
168
181
  }
169
- const { idleTimeoutMs, cancelConfirmMs, cancelGraceMs } = opts;
182
+ const { idleTimeoutMs, cancelConfirmMs, cancelGraceMs, hostTools } = opts;
170
183
  return [
171
- new AcpAgent({ ...opts.acp, idleTimeoutMs, cancelConfirmMs, cancelGraceMs, processes }),
184
+ new AcpAgent({
185
+ ...opts.acp,
186
+ idleTimeoutMs,
187
+ cancelConfirmMs,
188
+ cancelGraceMs,
189
+ hostTools,
190
+ processes,
191
+ }),
172
192
  createAcpTransformer,
173
193
  ];
174
194
  },
@@ -190,6 +210,7 @@ const SAID_ONCE: Record<SaidOnce, string> = {
190
210
  cancelConfirmMs: atTheTop("cancelConfirmMs"),
191
211
  cancelGraceMs: atTheTop("cancelGraceMs"),
192
212
  inheritConfig: atTheTop("inheritConfig"),
213
+ hostTools: atTheTop("hostTools"),
193
214
  processes:
194
215
  "the registry gives every harness its processes; say how they are owned with nativeProcesses",
195
216
  resolveCliPath: "the registry's provisioner finds each CLI; name one with provision.overrides",
@@ -36,6 +36,7 @@ export function bootId(): string | null {
36
36
  : POSIX
37
37
  ? execFileSync("/usr/sbin/sysctl", ["-n", "kern.bootsessionuuid"], {
38
38
  encoding: "utf8",
39
+ env: process.env,
39
40
  stdio: ["ignore", "pipe", "ignore"],
40
41
  }).trim()
41
42
  : null;
@@ -97,6 +97,7 @@ interface BunRuntime {
97
97
  stdout: "ignore";
98
98
  stderr: "ignore";
99
99
  detached: boolean;
100
+ env: Record<string, string | undefined>;
100
101
  onExit(): void;
101
102
  },
102
103
  ): {
@@ -117,6 +118,13 @@ interface BunRuntime {
117
118
  */
118
119
  function startShell(ticks: string, exited: () => void, failed: () => void): LifelineShell {
119
120
  const args = ["-c", LIFELINE_SCRIPT, LIFELINE_NAME, ticks];
121
+ // @ref LLP 0007#the-environment-a-process-is-given — only what its script needs
122
+ // It lives as long as the engine, and any process of this user can read its
123
+ // environment (`/proc/<pid>/environ`): `PATH` finds its `sed`, `awk`, `cat`,
124
+ // `tr` and `sleep`. Nothing else of the engine's environment is given;
125
+ // Node itself adds `NODE_V8_COVERAGE` to every child when the engine runs
126
+ // with it set (Bun adds nothing).
127
+ const env = { PATH: process.env.PATH };
120
128
  const bun = (globalThis as { Bun?: BunRuntime }).Bun;
121
129
  if (bun) {
122
130
  // @ref LLP 0007#the-lifeline — registered before the CLI gets input
@@ -128,6 +136,7 @@ function startShell(ticks: string, exited: () => void, failed: () => void): Life
128
136
  stdout: "ignore",
129
137
  stderr: "ignore",
130
138
  detached: true,
139
+ env,
131
140
  onExit: exited,
132
141
  });
133
142
  child.unref();
@@ -142,7 +151,11 @@ function startShell(ticks: string, exited: () => void, failed: () => void): Life
142
151
  };
143
152
  }
144
153
  // Node writes a pipe at once when it can (libuv's `uv_try_write`).
145
- const child = spawn("/bin/sh", args, { detached: true, stdio: ["pipe", "ignore", "ignore"] });
154
+ const child = spawn("/bin/sh", args, {
155
+ detached: true,
156
+ env,
157
+ stdio: ["pipe", "ignore", "ignore"],
158
+ });
146
159
  child.unref();
147
160
  (child.stdin as { unref?: () => void } | null)?.unref?.();
148
161
  child.stdin?.on("error", () => {});
@@ -57,6 +57,7 @@ function linuxTable(): ProcessRow[] {
57
57
  function psTable(): ProcessRow[] {
58
58
  const out = execFileSync("/bin/ps", ["-axo", "pid=,ppid=,pgid=,stat="], {
59
59
  encoding: "utf8",
60
+ env: process.env,
60
61
  stdio: ["ignore", "pipe", "ignore"],
61
62
  });
62
63
  const rows: ProcessRow[] = [];
@@ -12,6 +12,7 @@ const EXTRACT_TIMEOUT_MS = 5 * 60_000;
12
12
  export async function extractTarGz(tgzPath: string, destDir: string): Promise<void> {
13
13
  await new Promise<void>((resolve, reject) => {
14
14
  const proc = spawn("tar", ["-xzf", tgzPath, "-C", destDir], {
15
+ env: process.env,
15
16
  stdio: ["ignore", "ignore", "pipe"],
16
17
  timeout: EXTRACT_TIMEOUT_MS,
17
18
  });
@@ -16,22 +16,13 @@ import type { CliTool } from "./tools.ts";
16
16
  * `auto` an installed `@openai/codex` package (a lockfile's) runs instead,
17
17
  * and a `codex` on PATH only in `system` mode.
18
18
  *
19
- * After any bump, run `bun run releases:refresh` (each platform's build and
20
- * its checksums, `releases.ts`) and `bun run models:refresh` (the model
21
- * catalog, which records the versions that listed it); tests fail until both
22
- * match these pins.
19
+ * A bump is `bun run bump -- <tool>`: it writes what changed upstream, moves
20
+ * the pin, and runs both refreshes, `releases:refresh` (each platform's build
21
+ * and its checksums, `releases.ts`) and `models:refresh` (the model catalog,
22
+ * which records the versions that listed it); tests fail until both match
23
+ * these pins. The `bump-clis` skill says what to read and prove.
23
24
  */
24
25
  export const DEFAULT_PINS: Record<CliTool, string> = {
25
- // 0.3.288 verified 2026-10-03: the paired CLI honors `--thinking-display
26
- // summarized`, so reasoning parts carry text (2.1.233 ignored the flag and
27
- // streamed token-estimate placeholders). Re-check thinking summaries on
28
- // every bump (see options.ts extraArgs).
29
- claude: "0.3.288",
30
- // 0.160.0 re-verified 2026-10-03 against generate-ts: thread/turn/item
31
- // methods, token usage, approvals, and host-managed ChatGPT auth changed
32
- // only additively since 0.153.4. Of the GPT-6 family, 0.153.4 lists only
33
- // gpt-6-astra; the rest needs 0.159 or newer.
34
- // Since 0.160 a thread has one writer: resuming it from a second process
35
- // fails until the first releases it.
36
- codex: "0.160.0",
26
+ claude: "0.3.327",
27
+ codex: "0.169.1",
37
28
  };
@@ -9,77 +9,77 @@ import type { CliReleases } from "./checksums.ts";
9
9
  */
10
10
  export const CLI_RELEASES: CliReleases = {
11
11
  claude: {
12
- version: "0.3.288",
13
- cli: "2.1.288",
12
+ version: "0.3.327",
13
+ cli: "2.1.327",
14
14
  builds: {
15
15
  "darwin-arm64": {
16
16
  integrity:
17
- "sha512-85niGScWj8sr7yqOjSfqINaKv/zB47T45o4NBq1BmpaKRYFK7grtK24LA6C7cjx1Pznp+WT68mo373fbbwFW0A==",
18
- sha256: "bbe93063f7a0879a1021b2891e5c9354e5b3b98433e32efe6750f7710afed750",
17
+ "sha512-n+tQOPqz264l12BAKBcBPBbdB/bmZ2SfyONtEXQufTU6EeCoQMPS58RSt51Cxk5sDUme1hTF0vVAqRPdhq8tFg==",
18
+ sha256: "76d48205c926c8a6978cfc2171b631bcd01e20bbadd085638bb2ec57bea91c5b",
19
19
  },
20
20
  "darwin-x64": {
21
21
  integrity:
22
- "sha512-hY8MQtgAi+cRedFb+qSqZzAYXIfjC+ZiXtCxKCs4OqWbqrdVZ0GKcEv4nB6MfQGs/Qr4U24cDNuO2lskBbZAWA==",
23
- sha256: "946acab03a55b60e2016e30964c48b96ef6673cb5da684383f4835da410eede0",
22
+ "sha512-u091X+eQIyqg8BIEYLWJ0o6U3BaivMcf8Im4hI3hti/NGJ6YC5sR+LLEa1RjSIKE+JoOfCxipdCNSKaEI+0d5Q==",
23
+ sha256: "1fe75c05df7be824af1ed80ff9ccdf2be991f3a2212b97e05fc9a3bff2f39ef9",
24
24
  },
25
25
  "linux-arm64": {
26
26
  integrity:
27
- "sha512-CCj0xau64T+Ia+X2wZgjYFSUIWfNJRWIGFbT8+jKiCzQggaBo6OSZ8hAYyME3h13JYrgpyrUTzB5YiwKaw8ZFg==",
28
- sha256: "359ab6a058fcde9741dff54979a212fd134cdf8e8cfc2f8de02bc350b9e2b9d5",
27
+ "sha512-/k6BfV+L2er67UoLUabcp0w3L1DMemJjoijdxvXDiU8w81fGfHaKWKhRuhUQFmIrMLyMyQcBKaoyUNSLWovPnw==",
28
+ sha256: "acf0ef2f9da8d5ab08f193f007e19a06cbfb608b96a2f1f758d63a92a386cff8",
29
29
  },
30
30
  "linux-x64": {
31
31
  integrity:
32
- "sha512-Y5M496UZKttScbzptA45NI+CMHYONnskw0aq3rJ6s+gE6L6Jy8F8UoKt0lQO11R5xTY65TIeCasjQf/bLavuNg==",
33
- sha256: "0298068b686e7fdbaf9402a7a587bb7f49c0b0e084de09f69145a0719207640c",
32
+ "sha512-oAdL7KM9UVAZlATeSjh2haeEjex1N7ZcHzWO1tY2hgyhkyLNVw/tWUhITOucxMwokBx++h2dMVjxiPJiZ5uVOQ==",
33
+ sha256: "343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9",
34
34
  },
35
35
  "linux-arm64-musl": {
36
36
  integrity:
37
- "sha512-66MD4hzNTqrTL5MN21bSfxm/fhbnM+ERsmWHGEsJojxAWY5DXCUlDkaAYM0rxDpdvLMVt9PpRVIiWDptaiFPxA==",
38
- sha256: "6b9816b225b303dacc17acc9d83016055274498effdbce6227e62d5dbaa762b9",
37
+ "sha512-oV8/+ZixiPzEW1BStoP9FOXsHcznONaom6S2PwwIfhi5Pxa5fGuloy8TiOB9wK+03zavqt7jmzLgVPF2a2NsTA==",
38
+ sha256: "e44a59ef850788c578adaab7a6487d5d0af9c0844401da9d7263e7b41515754b",
39
39
  },
40
40
  "linux-x64-musl": {
41
41
  integrity:
42
- "sha512-g3HDERLfEamirfp+MJDVl1fT8YYQMILUH65jPzl+SzKLeBu26WmAXAoZFmU4dasEmKZkEnBdL0ZQy3qnDy5EXg==",
43
- sha256: "b4334268a2ce06bf984dab2d6925cc5afe9d2344fa427fc362e266da0d57a894",
42
+ "sha512-O0nDZ1gpXi83qAdd8SM0gTdjlzrqpOlW0M4W7PfHVrMXWLh9I+1tvHat+s17ehIW6A9VQIWIq4oMwq7jb708Dg==",
43
+ sha256: "d2b02e78664c1347aff8fcee045356ee044116be41d7f412721a6c50182b6d98",
44
44
  },
45
45
  "win32-arm64": {
46
46
  integrity:
47
- "sha512-ijVSU5Vl1L1SlEm1djPNEekxHm9FS5GOitz8kL8KLdYDspMA97bgFM4gy/+riA3qn4ERepJkjdDLE+oYMTO+UA==",
48
- sha256: "5015d2b92866232b85384ac6e5eef4ff155418a92123503e52714c29186af8c6",
47
+ "sha512-a5ju83mylDvUwvQyRt1E0TQ0ar2nzVMPeWZhjcmgpB1cNTjf+KT5jgUnLvxPOG2tyjhm8bYGysRMdgB+tVnhvw==",
48
+ sha256: "d2c3395d252007540a5662a2cfd4d8903a0beb5fa32c893cd13b81be427625a7",
49
49
  },
50
50
  "win32-x64": {
51
51
  integrity:
52
- "sha512-zh4yfGduDEBKUqb3BPtq/cLYwHoScqm7X5fJhmkSs0BJiSJGlb38j6FXWDvoPfe+OXNjE5onNx5HlAnDzsQzrA==",
53
- sha256: "84304f7d4b0cd0ebcbe8318695a260151b48991a6659c3366fdd5da290c0ab91",
52
+ "sha512-bf52nw4j5RCvkXI5Poj5Qf0jWvuLQ/UPFqdav86UwaGTZZ0txNV33MKBIUoCyxXV6IC1/p2BNfkwmCAZ+Uc9pw==",
53
+ sha256: "d6c8075bfb3b87f1c1254e64b6c35dadc628d21e75930ae51e47047b3f05a4a2",
54
54
  },
55
55
  },
56
56
  },
57
57
  codex: {
58
- version: "0.160.0",
58
+ version: "0.169.1",
59
59
  builds: {
60
60
  "darwin-arm64": {
61
61
  integrity:
62
- "sha512-aefV6cqZA2REZgR//4McyXlp7zLcTti4CI2v3j9IVgNndPBv2kCeNEcz07qeelXcwOdSFPUKb6roA48vZmDgrQ==",
62
+ "sha512-yOKvCJktlbxdETtXAidz2GcC4z/WMYPmu2plncYJtUI5AhnFIExen8n9eL/El6n9hYbzzZFf1JgyW7yHx6kwTw==",
63
63
  },
64
64
  "darwin-x64": {
65
65
  integrity:
66
- "sha512-ir7cdsPrb9VkqNqpTECoTiomv04xws/FQ968mHQzuL+2J5Da0Dkh2Qlxp7sguDDZJab4YpYmNjQvBVMXbTeQaQ==",
66
+ "sha512-IbHIskdPWGAXFCdGiB8CosfXXtdvMmusrQ2AdW2kFHd6aSJZ+dvgalwjpxmAytalnNM3pQgXwS/6fU1OclFv8Q==",
67
67
  },
68
68
  "linux-arm64": {
69
69
  integrity:
70
- "sha512-VnVdsS06YlDsL8OwaJjQ3xdqdJNG4i+eBJBV3LytddknzSaF/urijLzVg3ptkwvoj8C7Gn7iWpVE+y8WEaPiCg==",
70
+ "sha512-6vRE7ZxkngT6L5JQ9WUQ2UnztS6hqyfcQiFqvk0yhcvWsrZLJNiiDZcKzGbLfJK2sDy7tSt9uWdP1cIgMHIkaw==",
71
71
  },
72
72
  "linux-x64": {
73
73
  integrity:
74
- "sha512-KI/73OqGrHmR18s7ya7E1NqV6rT0y3lxr0s8S1qR2m6zU6QRF/HlR529jALLh5vjdUnsRT4Ahoxt0axb4kY99g==",
74
+ "sha512-KmlHQ/lB9jcn8Yy5z/tWCpSPsqBvI3pU+0PUPccr+pKiiU2NJSCvZcAD7s3dmIFq5ZvGYtGcSn2KdFFdaPQICg==",
75
75
  },
76
76
  "win32-arm64": {
77
77
  integrity:
78
- "sha512-tTvK9ZIGuj9WnYaYOAnfjJVSfPV7dKqWtDHqUPLf0Hadp6SgynTxx7S7iMXRieFeXVOI2XH76KxEHSOTOnz3zw==",
78
+ "sha512-EYXwgEdHHzwgA0nnDcK4pI98IdReB1aDebtOxcYixM1/GY2Y/76oDFYSs/u6DzA27f6Hhf5V92OwQFw/GLICUQ==",
79
79
  },
80
80
  "win32-x64": {
81
81
  integrity:
82
- "sha512-/gCFcuOmGlQkgGivWCtY8BNEDixh70Pue0HZOk9S8bj2vUIE1GLD9zcNB/KqqDJmn0S+lIttauLpzQnw6HOCHA==",
82
+ "sha512-fImXWqxwxqHh9+FhJWsRRFiBzgBrSeN1bYTvtGZtUKGTPzHefYAL1agmlf5XScfwY5i5pHsExfdhFekzRBbqIw==",
83
83
  },
84
84
  },
85
85
  },
@@ -55,31 +55,52 @@ interface BunRuntime {
55
55
  }): { readonly port: number; stop(closeActiveConnections?: boolean): unknown; unref(): void };
56
56
  }
57
57
 
58
+ /**
59
+ * Bun's own `Response`. A product's process may have replaced the global one
60
+ * (Hono's Node server does, with a class of its own), and `Bun.serve` refuses
61
+ * any other ("Expected a Response object"); `fetch` still answers with Bun's.
62
+ */
63
+ async function nativeResponse(): Promise<typeof Response> {
64
+ return (await fetch("data:,")).constructor as typeof Response;
65
+ }
66
+
58
67
  /**
59
68
  * Serve `handle` on 127.0.0.1, on a port of its own: with `Bun.serve` under
60
69
  * Bun, whose `node:http` says nothing of a client that left once its request
61
70
  * body was read (a stopped turn's request would run on upstream), and with
62
71
  * `node:http` under Node.
63
72
  */
64
- export function serveLoopback(handle: (request: Request) => Promise<Response>): Promise<Loopback> {
73
+ export async function serveLoopback(
74
+ handle: (request: Request) => Promise<Response>,
75
+ ): Promise<Loopback> {
65
76
  const bun = (globalThis as { Bun?: BunRuntime }).Bun;
66
77
  if (bun) {
78
+ const Native = await nativeResponse();
79
+ const native = (response: Response): Response =>
80
+ // Not `instanceof`: Hono's class sets Bun's prototype under its own.
81
+ response.constructor === Native
82
+ ? response
83
+ : new Native(response.body, {
84
+ status: response.status,
85
+ statusText: response.statusText,
86
+ headers: [...response.headers],
87
+ });
67
88
  const server = bun.serve({
68
89
  port: 0,
69
90
  hostname: "127.0.0.1",
70
91
  // A model can think longer than any idle limit between the events it streams.
71
92
  idleTimeout: 0,
72
- fetch: (request) => handle(request).catch(() => new Response(null, { status: 502 })),
93
+ fetch: (request) => handle(request).then(native, () => new Native(null, { status: 502 })),
73
94
  });
74
95
  // Nothing on it keeps the process alive.
75
96
  server.unref();
76
- return Promise.resolve({
97
+ return {
77
98
  url: `http://127.0.0.1:${server.port}`,
78
99
  // Not waited for: with a client still connected, Bun's stop can take its time.
79
100
  close: async () => {
80
101
  server.stop(true);
81
102
  },
82
- });
103
+ };
83
104
  }
84
105
  const server = createServer((req, res) => {
85
106
  bridge(handle, req, res).catch(() => {
@@ -350,11 +350,14 @@ export class AgentRuntime {
350
350
  * Cancel the session's in-flight turn. An idle session is a clean no-op ack
351
351
  * (`{confirmed: true, hadTurn: false}`); `confirmed: false` means a turn
352
352
  * existed but the harness did not acknowledge the interrupt — the agent may
353
- * still be running; `turn.ended` remains the source of truth.
353
+ * still be running; `turn.ended` remains the source of truth. A turn
354
+ * admitted but not yet on its harness answers `hadTurn: false` too (the
355
+ * harness had nothing to interrupt), and still ends `cancelled`: the turn
356
+ * keeps the cancel, and its harness begins it stopped.
354
357
  */
355
358
  async cancel(harness: AgentHarness, sessionId: string): Promise<CancelResult> {
356
- // Unblock any harness parked on an approval before (and regardless of)
357
- // the agent-level abort.
359
+ // The turn keeps the cancel (its signal), and any harness parked on an
360
+ // approval is unblocked, before (and regardless of) the agent-level abort.
358
361
  for (const turn of this.turnsOf(sessionId)) void turn.requestCancel();
359
362
  return await this.registry.getAgent(harness).cancel(sessionId);
360
363
  }
@@ -143,8 +143,14 @@ export class Turn {
143
143
  private readonly processor: EventProcessor;
144
144
  /** Its durable sink failed: the turn stops, and every later write fails with it. */
145
145
  private sinkFailure?: EventSinkError;
146
- /** `cancel` or `closeSession` asked it to stop. */
147
- private cancelRequested = false;
146
+ /**
147
+ * Aborted when `cancel` or `closeSession` asks the turn to stop: part of
148
+ * the signal its harness is given, so a cancel that comes before the
149
+ * harness has the turn is not lost.
150
+ */
151
+ private readonly cancelled = new AbortController();
152
+ /** The caller's signal, the runtime's shutdown and the turn's own cancel, together. */
153
+ private readonly signal: AbortSignal;
148
154
  private nativeSessionId?: string;
149
155
  /** When the turn requested a resume: whether the harness honored it. */
150
156
  private resumed?: boolean;
@@ -157,10 +163,11 @@ export class Turn {
157
163
  readonly inputKey: string,
158
164
  private readonly sink: EventSink,
159
165
  /** The caller's signal and the runtime's shutdown, together. */
160
- private readonly signal: AbortSignal,
166
+ signal: AbortSignal,
161
167
  private readonly host: TurnHost,
162
168
  ) {
163
169
  const { sessionId, turnId, config } = request;
170
+ this.signal = AbortSignal.any([signal, this.cancelled.signal]);
164
171
  this.sessionId = sessionId;
165
172
  this.turnId = turnId;
166
173
  this.harness = config.harness;
@@ -180,14 +187,19 @@ export class Turn {
180
187
  this.running = Promise.resolve().then(() => this.execute());
181
188
  }
182
189
 
190
+ // @ref LLP 0001#d9--the-wire-is-quick-ack-json-rpc-requests-flow-one-way — a cancel before the harness has the turn
183
191
  /**
184
- * A cancel was asked for: its open requests are answered as cancelled, and
185
- * what the harness throws from now on is it stopping. Resolves once their
186
- * `*.resolved` are written.
192
+ * A cancel was asked for: the turn's signal is aborted, so a harness that
193
+ * has not begun the turn yet begins it stopped; its open requests are
194
+ * answered as cancelled; and what the harness throws from now on is it
195
+ * stopping. Resolves once their `*.resolved` are written.
187
196
  */
188
197
  requestCancel(): Promise<void> {
189
- this.cancelRequested = true;
190
- return this.requests.cancelAll();
198
+ // Taken before the abort, which settles each request bound to the turn's
199
+ // signal and takes it out of the broker: the cancel would not wait for it.
200
+ const answered = this.requests.cancelAll();
201
+ this.cancelled.abort();
202
+ return answered;
191
203
  }
192
204
 
193
205
  private async execute(): Promise<RunSummary> {
@@ -253,7 +265,7 @@ export class Turn {
253
265
  if (this.sinkFailure) throw this.sinkFailure;
254
266
  // A harness asked to stop throws as it stops, whatever its words say;
255
267
  // one that was not is failing.
256
- threw = this.cancelRequested || this.signal.aborted ? "cancelled" : errorInfo(error);
268
+ threw = this.signal.aborted ? "cancelled" : errorInfo(error);
257
269
  if (threw !== "cancelled") {
258
270
  await this.emit({
259
271
  type: "error",