@ai-sdk/harness 1.0.132 → 1.0.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
- import { Experimental_SandboxSession, UserModelMessage, ToolResultPart, ProviderOptions, ToolSet, FlexibleSchema, Tool, FunctionTool } from '@ai-sdk/provider-utils';
3
- import { z } from 'zod/v4';
4
- import * as _ai_sdk_provider from '@ai-sdk/provider';
5
- import { JSONSchema7, JSONValue, LanguageModelV4StreamPart, LanguageModelV4ToolCall, LanguageModelV4ToolApprovalRequest, LanguageModelV4ToolResult, LanguageModelV4FinishReason, LanguageModelV4Usage, SharedV4ProviderMetadata, AISDKError } from '@ai-sdk/provider';
6
-
1
+ import { Experimental_SandboxSession, FlexibleSchema, FunctionTool, ProviderOptions, Tool, ToolResultPart, ToolSet, UserModelMessage } from "@ai-sdk/provider-utils";
2
+ import { z } from "zod/v4";
3
+ import { AISDKError, JSONSchema7, JSONValue, LanguageModelV4CustomPart, LanguageModelV4FilePart, LanguageModelV4FinishReason, LanguageModelV4ReasoningFilePart, LanguageModelV4ReasoningPart, LanguageModelV4StreamPart, LanguageModelV4TextPart, LanguageModelV4ToolApprovalRequest, LanguageModelV4ToolApprovalResponsePart, LanguageModelV4ToolCall, LanguageModelV4ToolCallPart, LanguageModelV4ToolResult, LanguageModelV4ToolResultOutput, LanguageModelV4ToolResultPart, LanguageModelV4Usage, SharedV4ProviderMetadata } from "@ai-sdk/provider";
4
+ //#region src/v1/harness-v1-bootstrap.d.ts
7
5
  /**
8
6
  * One file to write into the sandbox as part of an adapter's bootstrap recipe.
9
7
  * Absolute paths are used as-is. Relative paths are resolved against the
@@ -11,8 +9,8 @@ import { JSONSchema7, JSONValue, LanguageModelV4StreamPart, LanguageModelV4ToolC
11
9
  * {@link HarnessV1Bootstrap.bootstrapDir}.
12
10
  */
13
11
  interface HarnessV1BootstrapFile {
14
- readonly path: string;
15
- readonly content: string;
12
+ readonly path: string;
13
+ readonly content: string;
16
14
  }
17
15
  /**
18
16
  * One command to run in the sandbox as part of an adapter's bootstrap recipe.
@@ -20,7 +18,7 @@ interface HarnessV1BootstrapFile {
20
18
  * aborts the bootstrap.
21
19
  */
22
20
  interface HarnessV1BootstrapCommand {
23
- readonly command: string;
21
+ readonly command: string;
24
22
  }
25
23
  /**
26
24
  * Adapter-owned bootstrap recipe. The adapter declares the files and commands
@@ -29,32 +27,33 @@ interface HarnessV1BootstrapCommand {
29
27
  * reuse, and applies the recipe idempotently before the bridge spawns.
30
28
  */
31
29
  interface HarnessV1Bootstrap {
32
- /**
33
- * Stable id of the adapter that owns this recipe. Conventionally matches
34
- * {@link HarnessV1.harnessId}. Contributes to the recipe hash.
35
- */
36
- readonly harnessId: string;
37
- /**
38
- * Path inside the sandbox where this recipe writes its state. Absolute paths
39
- * are used as-is. Relative paths are resolved against the harness state
40
- * directory (`$HOME/.ai-sdk-harness`). The marker file lives directly under
41
- * it. Files declared in {@link files} should also use this prefix so an
42
- * adapter upgrade can sweep stale state by clearing the directory.
43
- */
44
- readonly bootstrapDir: string;
45
- /** Files to write into the sandbox before any command runs. */
46
- readonly files: ReadonlyArray<HarnessV1BootstrapFile>;
47
- /** Commands to run from the bootstrap directory after files are written. */
48
- readonly commands: ReadonlyArray<HarnessV1BootstrapCommand>;
30
+ /**
31
+ * Stable id of the adapter that owns this recipe. Conventionally matches
32
+ * {@link HarnessV1.harnessId}. Contributes to the recipe hash.
33
+ */
34
+ readonly harnessId: string;
35
+ /**
36
+ * Path inside the sandbox where this recipe writes its state. Absolute paths
37
+ * are used as-is. Relative paths are resolved against the harness state
38
+ * directory (`$HOME/.ai-sdk-harness`). The marker file lives directly under
39
+ * it. Files declared in {@link files} should also use this prefix so an
40
+ * adapter upgrade can sweep stale state by clearing the directory.
41
+ */
42
+ readonly bootstrapDir: string;
43
+ /** Files to write into the sandbox before any command runs. */
44
+ readonly files: ReadonlyArray<HarnessV1BootstrapFile>;
45
+ /** Commands to run from the bootstrap directory after files are written. */
46
+ readonly commands: ReadonlyArray<HarnessV1BootstrapCommand>;
49
47
  }
50
-
48
+ //#endregion
49
+ //#region src/v1/harness-v1-network-sandbox-session.d.ts
51
50
  /**
52
51
  * Connection details for a sandbox-exposed port. Headers are scoped to the
53
52
  * returned URL and must be included when opening the connection.
54
53
  */
55
54
  type HarnessV1PortEndpoint = {
56
- readonly url: string;
57
- readonly headers?: Readonly<Record<string, string>>;
55
+ readonly url: string;
56
+ readonly headers?: Readonly<Record<string, string>>;
58
57
  };
59
58
  /**
60
59
  * Fixed, non-configurable path for harness-generated state (bootstrap files,
@@ -65,8 +64,8 @@ type HarnessV1PortEndpoint = {
65
64
  * framework also calls this with a symbolic `$HOME` when hashing bootstrap
66
65
  * recipes, so changes to the state path invalidate existing templates.
67
66
  */
68
- declare function harnessStateDirectoryPath({ sandboxHomeDir, }: {
69
- sandboxHomeDir: string;
67
+ export declare function harnessStateDirectoryPath({ sandboxHomeDir }: {
68
+ sandboxHomeDir: string;
70
69
  }): string;
71
70
  /**
72
71
  * Network sandbox session returned by sandbox adapter creation and resume
@@ -80,94 +79,94 @@ declare function harnessStateDirectoryPath({ sandboxHomeDir, }: {
80
79
  * network access, or transform requests.
81
80
  */
82
81
  interface HarnessV1NetworkSandboxSession extends Experimental_SandboxSession {
83
- /**
84
- * Identifier for the sandbox session. Persist this separately from the
85
- * harness session ID and resume state when reattaching across processes.
86
- */
87
- readonly id: string;
88
- /**
89
- * The sandbox's default working directory — the absolute path that
90
- * `run`/`spawn` resolve relative commands against when no `workingDirectory`
91
- * is given. Read from the live sandbox, never hardcoded.
92
- *
93
- * The framework composes each session's working directory underneath this
94
- * path (`<defaultWorkingDirectory>/<harnessId>-<sessionId>`) so adapters do
95
- * not bake a provider-specific base into their own paths.
96
- */
97
- readonly defaultWorkingDirectory: string;
98
- /** Ports the sandbox exposes; resolvable via `getPortEndpoint`. */
99
- readonly ports: ReadonlyArray<number>;
100
- /**
101
- * Resolve the connection details for a sandbox-exposed port. Bridge-backed
102
- * adapters call this to open their WebSocket to the in-sandbox bridge.
103
- */
104
- readonly getPortEndpoint: (options: {
105
- port: number;
106
- protocol?: 'http' | 'https' | 'ws';
107
- }) => PromiseLike<HarnessV1PortEndpoint>;
108
- /**
109
- * Resolve a publicly-reachable URL for a sandbox-exposed port.
110
- *
111
- * @deprecated Use `getPortEndpoint` instead.
112
- */
113
- readonly getPortUrl: (options: {
114
- port: number;
115
- protocol?: 'http' | 'https' | 'ws';
116
- }) => PromiseLike<string>;
117
- /** Stop the sandbox. Idempotent. */
118
- readonly stop: () => PromiseLike<void>;
119
- /**
120
- * Stop the sandbox session, then perform any additional cleanup necessary
121
- * to destroy it, such as deleting its backing resource or freeing resources.
122
- * Implementations with no cleanup beyond stopping may delegate to `stop()`.
123
- * Implementations must handle both a still-running sandbox and a previously
124
- * stopped sandbox.
125
- */
126
- readonly destroy: () => PromiseLike<void>;
127
- /**
128
- * Update the sandbox's outbound network policy. Optional — implementations
129
- * without a local enforcement primitive omit this. Callers
130
- * use optional-call (`sandboxSession.setNetworkPolicy?.(policy)`); a
131
- * missing implementation is a no-op.
132
- */
133
- readonly setNetworkPolicy?: (policy: HarnessV1NetworkPolicy) => PromiseLike<void>;
134
- /**
135
- * Replace the sandbox's outbound request-transformation rules. Optional —
136
- * implementations expose this only when credentials can be injected outside
137
- * the sandbox security boundary. Calling this method assumes authority over
138
- * the complete transformation set; harness adapters should normally use
139
- * `addRequestTransformations` instead. Adapters may preserve legacy
140
- * credential-forwarding behavior when additive request transformations are
141
- * unavailable.
142
- */
143
- readonly setRequestTransformations?: (transformations: ReadonlyArray<HarnessV1RequestTransformation>) => PromiseLike<void>;
144
- /**
145
- * Add outbound request-transformation rules without replacing rules already
146
- * managed by the sandbox session. Optional for the same reason as
147
- * `setRequestTransformations`. Harness adapters should use this additive
148
- * capability unless they explicitly own the complete transformation set.
149
- */
150
- readonly addRequestTransformations?: (transformations: ReadonlyArray<HarnessV1RequestTransformation>) => PromiseLike<void>;
151
- /**
152
- * Replace the set of ports exposed by the sandbox. Full-replacement
153
- * semantics: ports omitted from the array are deregistered. Optional —
154
- * implementations that cannot expose ports omit this.
155
- */
156
- readonly setPorts?: (ports: ReadonlyArray<number>, options?: {
157
- abortSignal?: AbortSignal;
158
- }) => PromiseLike<void>;
159
- /**
160
- * Reduced view of this session, typed as the bare {@link SandboxSession}
161
- * (file I/O, exec, spawn) — nothing that could stop the sandbox or change
162
- * its network policy. Pass this to user-tool `execute()` calls and other
163
- * code that must not reach the infra surface.
164
- *
165
- * The returned object points at exactly the same underlying sandbox
166
- * resource as the network sandbox session it was produced from; it is only a
167
- * narrower surface over the same resource, not a separate sandbox. In
168
- * particular, it cannot mutate network access or request transformations.
169
- */
170
- readonly restricted: () => Experimental_SandboxSession;
82
+ /**
83
+ * Identifier for the sandbox session. Persist this separately from the
84
+ * harness session ID and resume state when reattaching across processes.
85
+ */
86
+ readonly id: string;
87
+ /**
88
+ * The sandbox's default working directory — the absolute path that
89
+ * `run`/`spawn` resolve relative commands against when no `workingDirectory`
90
+ * is given. Read from the live sandbox, never hardcoded.
91
+ *
92
+ * The framework composes each session's working directory underneath this
93
+ * path (`<defaultWorkingDirectory>/<harnessId>-<sessionId>`) so adapters do
94
+ * not bake a provider-specific base into their own paths.
95
+ */
96
+ readonly defaultWorkingDirectory: string;
97
+ /** Ports the sandbox exposes; resolvable via `getPortEndpoint`. */
98
+ readonly ports: ReadonlyArray<number>;
99
+ /**
100
+ * Resolve the connection details for a sandbox-exposed port. Bridge-backed
101
+ * adapters call this to open their WebSocket to the in-sandbox bridge.
102
+ */
103
+ readonly getPortEndpoint: (options: {
104
+ port: number;
105
+ protocol?: 'http' | 'https' | 'ws';
106
+ }) => PromiseLike<HarnessV1PortEndpoint>;
107
+ /**
108
+ * Resolve a publicly-reachable URL for a sandbox-exposed port.
109
+ *
110
+ * @deprecated Use `getPortEndpoint` instead.
111
+ */
112
+ readonly getPortUrl: (options: {
113
+ port: number;
114
+ protocol?: 'http' | 'https' | 'ws';
115
+ }) => PromiseLike<string>;
116
+ /** Stop the sandbox. Idempotent. */
117
+ readonly stop: () => PromiseLike<void>;
118
+ /**
119
+ * Stop the sandbox session, then perform any additional cleanup necessary
120
+ * to destroy it, such as deleting its backing resource or freeing resources.
121
+ * Implementations with no cleanup beyond stopping may delegate to `stop()`.
122
+ * Implementations must handle both a still-running sandbox and a previously
123
+ * stopped sandbox.
124
+ */
125
+ readonly destroy: () => PromiseLike<void>;
126
+ /**
127
+ * Update the sandbox's outbound network policy. Optional — implementations
128
+ * without a local enforcement primitive omit this. Callers
129
+ * use optional-call (`sandboxSession.setNetworkPolicy?.(policy)`); a
130
+ * missing implementation is a no-op.
131
+ */
132
+ readonly setNetworkPolicy?: (policy: HarnessV1NetworkPolicy) => PromiseLike<void>;
133
+ /**
134
+ * Replace the sandbox's outbound request-transformation rules. Optional —
135
+ * implementations expose this only when credentials can be injected outside
136
+ * the sandbox security boundary. Calling this method assumes authority over
137
+ * the complete transformation set; harness adapters should normally use
138
+ * `addRequestTransformations` instead. Adapters may preserve legacy
139
+ * credential-forwarding behavior when additive request transformations are
140
+ * unavailable.
141
+ */
142
+ readonly setRequestTransformations?: (transformations: ReadonlyArray<HarnessV1RequestTransformation>) => PromiseLike<void>;
143
+ /**
144
+ * Add outbound request-transformation rules without replacing rules already
145
+ * managed by the sandbox session. Optional for the same reason as
146
+ * `setRequestTransformations`. Harness adapters should use this additive
147
+ * capability unless they explicitly own the complete transformation set.
148
+ */
149
+ readonly addRequestTransformations?: (transformations: ReadonlyArray<HarnessV1RequestTransformation>) => PromiseLike<void>;
150
+ /**
151
+ * Replace the set of ports exposed by the sandbox. Full-replacement
152
+ * semantics: ports omitted from the array are deregistered. Optional —
153
+ * implementations that cannot expose ports omit this.
154
+ */
155
+ readonly setPorts?: (ports: ReadonlyArray<number>, options?: {
156
+ abortSignal?: AbortSignal;
157
+ }) => PromiseLike<void>;
158
+ /**
159
+ * Reduced view of this session, typed as the bare {@link SandboxSession}
160
+ * (file I/O, exec, spawn) — nothing that could stop the sandbox or change
161
+ * its network policy. Pass this to user-tool `execute()` calls and other
162
+ * code that must not reach the infra surface.
163
+ *
164
+ * The returned object points at exactly the same underlying sandbox
165
+ * resource as the network sandbox session it was produced from; it is only a
166
+ * narrower surface over the same resource, not a separate sandbox. In
167
+ * particular, it cannot mutate network access or request transformations.
168
+ */
169
+ readonly restricted: () => Experimental_SandboxSession;
171
170
  }
172
171
  /**
173
172
  * Outbound network policy applied by the sandbox runtime.
@@ -185,37 +184,37 @@ interface HarnessV1NetworkSandboxSession extends Experimental_SandboxSession {
185
184
  * equivalent to `'deny-all'`.
186
185
  */
187
186
  type HarnessV1NetworkPolicy = {
188
- mode: 'allow-all';
187
+ mode: 'allow-all';
189
188
  } | {
190
- mode: 'deny-all';
189
+ mode: 'deny-all';
191
190
  } | {
192
- mode: 'custom';
193
- allowedHosts: ReadonlyArray<string>;
194
- allowedCIDRs?: ReadonlyArray<string>;
195
- deniedCIDRs?: ReadonlyArray<string>;
191
+ mode: 'custom';
192
+ allowedHosts: ReadonlyArray<string>;
193
+ allowedCIDRs?: ReadonlyArray<string>;
194
+ deniedCIDRs?: ReadonlyArray<string>;
196
195
  } | {
197
- mode: 'custom';
198
- allowedHosts?: ReadonlyArray<string>;
199
- allowedCIDRs: ReadonlyArray<string>;
200
- deniedCIDRs?: ReadonlyArray<string>;
196
+ mode: 'custom';
197
+ allowedHosts?: ReadonlyArray<string>;
198
+ allowedCIDRs: ReadonlyArray<string>;
199
+ deniedCIDRs?: ReadonlyArray<string>;
201
200
  };
202
201
  type HarnessV1RequestTransformationPathMatcher = {
203
- exact: string;
202
+ exact: string;
204
203
  } | {
205
- startsWith: string;
204
+ startsWith: string;
206
205
  } | {
207
- regex: string;
206
+ regex: string;
208
207
  };
209
208
  type HarnessV1RequestTransformationKeyValuePartMatcher = {
210
- exact: string;
209
+ exact: string;
211
210
  } | {
212
- startsWith: string;
211
+ startsWith: string;
213
212
  } | {
214
- regex: string;
213
+ regex: string;
215
214
  };
216
215
  type HarnessV1RequestTransformationKeyValueMatcher = {
217
- readonly key?: HarnessV1RequestTransformationKeyValuePartMatcher;
218
- readonly value?: HarnessV1RequestTransformationKeyValuePartMatcher;
216
+ readonly key?: HarnessV1RequestTransformationKeyValuePartMatcher;
217
+ readonly value?: HarnessV1RequestTransformationKeyValuePartMatcher;
219
218
  };
220
219
  /**
221
220
  * Outbound HTTPS request transformation applied outside the sandbox security
@@ -229,30 +228,31 @@ type HarnessV1RequestTransformationKeyValueMatcher = {
229
228
  * making transformed values available inside it.
230
229
  */
231
230
  type HarnessV1RequestTransformation = {
232
- readonly match: {
233
- readonly host: string;
234
- readonly path?: HarnessV1RequestTransformationPathMatcher;
235
- readonly method?: ReadonlyArray<string>;
236
- readonly queryString?: ReadonlyArray<HarnessV1RequestTransformationKeyValueMatcher>;
237
- readonly headers?: ReadonlyArray<HarnessV1RequestTransformationKeyValueMatcher>;
238
- };
239
- readonly transform: {
240
- readonly headers: Readonly<Record<string, string>>;
241
- };
231
+ readonly match: {
232
+ readonly host: string;
233
+ readonly path?: HarnessV1RequestTransformationPathMatcher;
234
+ readonly method?: ReadonlyArray<string>;
235
+ readonly queryString?: ReadonlyArray<HarnessV1RequestTransformationKeyValueMatcher>;
236
+ readonly headers?: ReadonlyArray<HarnessV1RequestTransformationKeyValueMatcher>;
237
+ };
238
+ readonly transform: {
239
+ readonly headers: Readonly<Record<string, string>>;
240
+ };
242
241
  };
243
242
  type HarnessV1RequestTransformationSources<AuthenticationMode> = {
244
- env: Record<string, string>;
245
- sandboxEnv: Record<string, string>;
246
- auth: AuthenticationMode;
243
+ env: Record<string, string>;
244
+ sandboxEnv: Record<string, string>;
245
+ auth: AuthenticationMode;
247
246
  };
248
-
247
+ //#endregion
248
+ //#region src/v1/harness-v1-diagnostic.d.ts
249
249
  /** Severity of a diagnostic, ordered most → least severe. */
250
- declare const harnessV1DebugLevelSchema: z.ZodEnum<{
251
- error: "error";
252
- warn: "warn";
253
- info: "info";
254
- debug: "debug";
255
- trace: "trace";
250
+ export declare const harnessV1DebugLevelSchema: z.ZodEnum<{
251
+ error: "error";
252
+ warn: "warn";
253
+ info: "info";
254
+ debug: "debug";
255
+ trace: "trace";
256
256
  }>;
257
257
  type HarnessV1DebugLevel = z.infer<typeof harnessV1DebugLevelSchema>;
258
258
  /**
@@ -261,16 +261,16 @@ type HarnessV1DebugLevel = z.infer<typeof harnessV1DebugLevelSchema>;
261
261
  * captures and emits nothing. `subsystems` filters structured events by dotted
262
262
  * prefix; console capture is independent of the subsystem filter.
263
263
  */
264
- declare const harnessV1DebugConfigSchema: z.ZodObject<{
265
- enabled: z.ZodOptional<z.ZodBoolean>;
266
- level: z.ZodOptional<z.ZodEnum<{
267
- error: "error";
268
- warn: "warn";
269
- info: "info";
270
- debug: "debug";
271
- trace: "trace";
272
- }>>;
273
- subsystems: z.ZodOptional<z.ZodArray<z.ZodString>>;
264
+ export declare const harnessV1DebugConfigSchema: z.ZodObject<{
265
+ enabled: z.ZodOptional<z.ZodBoolean>;
266
+ level: z.ZodOptional<z.ZodEnum<{
267
+ error: "error";
268
+ warn: "warn";
269
+ info: "info";
270
+ debug: "debug";
271
+ trace: "trace";
272
+ }>>;
273
+ subsystems: z.ZodOptional<z.ZodArray<z.ZodString>>;
274
274
  }, z.core.$strip>;
275
275
  type HarnessV1DebugConfig = z.infer<typeof harnessV1DebugConfigSchema>;
276
276
  /**
@@ -279,32 +279,33 @@ type HarnessV1DebugConfig = z.infer<typeof harnessV1DebugConfigSchema>;
279
279
  * emission shape, that is the external consumption shape.
280
280
  */
281
281
  type HarnessV1Diagnostic = {
282
- /** Severity. */
283
- readonly level: HarnessV1DebugLevel;
284
- /** Human-readable line (console capture) or message (structured event). */
285
- readonly message: string;
286
- /** Dotted subsystem (`sandbox.log.<source>` for console capture). */
287
- readonly subsystem: string;
288
- /** `'log'` = captured console line; `'event'` = structured emission. */
289
- readonly kind: 'log' | 'event';
290
- /** Originating source label (console capture). */
291
- readonly source?: string;
292
- /** Which standard stream the line came from (console capture). */
293
- readonly stream?: 'stdout' | 'stderr';
294
- /** Structured attributes (structured events only). */
295
- readonly attrs?: Record<string, unknown>;
296
- /** Error payload (structured events only). */
297
- readonly error?: {
298
- name?: string;
299
- message: string;
300
- stack?: string;
301
- };
302
- /** The harness session this diagnostic originated from. */
303
- readonly sessionId?: string;
304
- /** Emission time (epoch ms). */
305
- readonly timestamp: number;
282
+ /** Severity. */
283
+ readonly level: HarnessV1DebugLevel;
284
+ /** Human-readable line (console capture) or message (structured event). */
285
+ readonly message: string;
286
+ /** Dotted subsystem (`sandbox.log.<source>` for console capture). */
287
+ readonly subsystem: string;
288
+ /** `'log'` = captured console line; `'event'` = structured emission. */
289
+ readonly kind: 'log' | 'event';
290
+ /** Originating source label (console capture). */
291
+ readonly source?: string;
292
+ /** Which standard stream the line came from (console capture). */
293
+ readonly stream?: 'stdout' | 'stderr';
294
+ /** Structured attributes (structured events only). */
295
+ readonly attrs?: Record<string, unknown>;
296
+ /** Error payload (structured events only). */
297
+ readonly error?: {
298
+ name?: string;
299
+ message: string;
300
+ stack?: string;
301
+ };
302
+ /** The harness session this diagnostic originated from. */
303
+ readonly sessionId?: string;
304
+ /** Emission time (epoch ms). */
305
+ readonly timestamp: number;
306
306
  };
307
-
307
+ //#endregion
308
+ //#region src/v1/harness-v1-observability.d.ts
308
309
  /**
309
310
  * Diagnostics wiring the framework hands to an adapter's `doStart`. `report` is
310
311
  * the general emission sink: a bridge adapter normalizes each wire frame into a
@@ -314,12 +315,13 @@ type HarnessV1Diagnostic = {
314
315
  * Absent when the consumer has not enabled diagnostics.
315
316
  */
316
317
  type HarnessV1Observability = {
317
- /** Per-session debug config gating what the adapter captures/emits. */
318
- readonly debug?: HarnessV1DebugConfig;
319
- /** General emission sink — any adapter reports a `HarnessV1Diagnostic` here. */
320
- readonly report?: (diagnostic: HarnessV1Diagnostic) => void;
318
+ /** Per-session debug config gating what the adapter captures/emits. */
319
+ readonly debug?: HarnessV1DebugConfig;
320
+ /** General emission sink — any adapter reports a `HarnessV1Diagnostic` here. */
321
+ readonly report?: (diagnostic: HarnessV1Diagnostic) => void;
321
322
  };
322
-
323
+ //#endregion
324
+ //#region src/v1/harness-v1-permission-mode.d.ts
323
325
  /**
324
326
  * Baseline permission mode for adapter-native built-in tools.
325
327
  *
@@ -328,7 +330,8 @@ type HarnessV1Observability = {
328
330
  * status map.
329
331
  */
330
332
  type HarnessV1PermissionMode = 'allow-reads' | 'allow-edits' | 'allow-all';
331
-
333
+ //#endregion
334
+ //#region src/v1/harness-v1-prompt.d.ts
332
335
  /**
333
336
  * Prompt shape passed to `HarnessV1Session.doPromptTurn`.
334
337
  *
@@ -338,7 +341,8 @@ type HarnessV1PermissionMode = 'allow-reads' | 'allow-edits' | 'allow-all';
338
341
  * `UserModelMessage`.
339
342
  */
340
343
  type HarnessV1Prompt = string | UserModelMessage;
341
-
344
+ //#endregion
345
+ //#region src/v1/harness-v1-prompt-control.d.ts
342
346
  /**
343
347
  * Bidirectional control surface returned by `doPromptTurn`.
344
348
  *
@@ -349,41 +353,41 @@ type HarnessV1Prompt = string | UserModelMessage;
349
353
  * messages require `submitUserMessage`).
350
354
  */
351
355
  type HarnessV1PromptControl = {
352
- /**
353
- * Provide a result for a `tool-call` the adapter emitted. The adapter
354
- * forwards the result to the underlying runtime so the model can continue.
355
- */
356
- submitToolResult(input: {
357
- toolCallId: string;
358
- output: unknown;
359
- isError?: boolean;
360
- toolResult?: ToolResultPart;
361
- }): PromiseLike<void>;
362
- /**
363
- * Respond to a `tool-approval-request` the adapter emitted.
364
- */
365
- submitToolApproval?(input: {
366
- approvalId: string;
367
- approved: boolean;
368
- reason?: string;
369
- }): PromiseLike<void>;
370
- /**
371
- * Inject a fresh user message into a turn that is still in flight.
372
- * Supported only by runtimes that accept interactive input.
373
- */
374
- submitUserMessage?(text: string): PromiseLike<void>;
375
- /**
376
- * Resolves when the adapter has finished the turn (success or failure).
377
- * Rejects with the underlying error when the turn fails.
378
- */
379
- readonly done: PromiseLike<void>;
356
+ /**
357
+ * Provide a result for a `tool-call` the adapter emitted. The adapter
358
+ * forwards the result to the underlying runtime so the model can continue.
359
+ */
360
+ submitToolResult(input: {
361
+ toolCallId: string;
362
+ output: unknown;
363
+ isError?: boolean;
364
+ toolResult?: ToolResultPart;
365
+ }): PromiseLike<void>;
366
+ /**
367
+ * Respond to a `tool-approval-request` the adapter emitted.
368
+ */
369
+ submitToolApproval?(input: {
370
+ approvalId: string;
371
+ approved: boolean;
372
+ reason?: string;
373
+ }): PromiseLike<void>;
374
+ /**
375
+ * Inject a fresh user message into a turn that is still in flight.
376
+ * Supported only by runtimes that accept interactive input.
377
+ */
378
+ submitUserMessage?(text: string): PromiseLike<void>;
379
+ /**
380
+ * Resolves when the adapter has finished the turn (success or failure).
381
+ * Rejects with the underlying error when the turn fails.
382
+ */
383
+ readonly done: PromiseLike<void>;
380
384
  };
381
-
385
+ //#endregion
386
+ //#region src/v1/harness-v1-response-format.d.ts
382
387
  type HarnessV1JSONValue = null | boolean | number | string | HarnessV1JSONArray | HarnessV1JSONObject;
383
- interface HarnessV1JSONArray extends Array<HarnessV1JSONValue> {
384
- }
388
+ interface HarnessV1JSONArray extends Array<HarnessV1JSONValue> {}
385
389
  interface HarnessV1JSONObject {
386
- [key: string]: HarnessV1JSONValue | undefined;
390
+ [key: string]: HarnessV1JSONValue | undefined;
387
391
  }
388
392
  type HarnessV1JSONSchema = HarnessV1JSONObject;
389
393
  /**
@@ -395,46 +399,48 @@ type HarnessV1JSONSchema = HarnessV1JSONObject;
395
399
  * contract can cross process and package boundaries.
396
400
  */
397
401
  type HarnessV1ResponseFormat = {
398
- readonly type: 'text';
402
+ readonly type: 'text';
399
403
  } | {
400
- readonly type: 'json';
401
- readonly schema?: HarnessV1JSONSchema;
402
- readonly name?: string;
403
- readonly description?: string;
404
+ readonly type: 'json';
405
+ readonly schema?: HarnessV1JSONSchema;
406
+ readonly name?: string;
407
+ readonly description?: string;
404
408
  };
405
-
409
+ //#endregion
410
+ //#region src/v1/harness-v1-skill.d.ts
406
411
  /**
407
412
  * A self-contained instruction bundle the underlying runtime can load into
408
413
  * its context. Adapters decide how to surface skills to the runtime.
409
414
  */
410
415
  type HarnessV1Skill = {
411
- /** Stable identifier for the skill (kebab-case slug). */
412
- readonly name: string;
413
- /**
414
- * Short, model-facing description. This is what the runtime sees to
415
- * decide whether the skill is relevant.
416
- */
417
- readonly description: string;
418
- /** Full skill content the model loads when the skill is active. */
419
- readonly content: string;
420
- /**
421
- * Additional files that belong to this skill. Adapters with native skill
422
- * directories materialize these next to `SKILL.md`; adapters without native
423
- * skill files include them with the skill content.
424
- */
425
- readonly files?: ReadonlyArray<HarnessV1SkillFile>;
416
+ /** Stable identifier for the skill (kebab-case slug). */
417
+ readonly name: string;
418
+ /**
419
+ * Short, model-facing description. This is what the runtime sees to
420
+ * decide whether the skill is relevant.
421
+ */
422
+ readonly description: string;
423
+ /** Full skill content the model loads when the skill is active. */
424
+ readonly content: string;
425
+ /**
426
+ * Additional files that belong to this skill. Adapters with native skill
427
+ * directories materialize these next to `SKILL.md`; adapters without native
428
+ * skill files include them with the skill content.
429
+ */
430
+ readonly files?: ReadonlyArray<HarnessV1SkillFile>;
426
431
  };
427
432
  type HarnessV1SkillFile = {
428
- /**
429
- * Skill-relative POSIX path, for example `reference.md` or
430
- * `references/codes.md`. Absolute paths and `..` segments are rejected by
431
- * adapters before writing.
432
- */
433
- readonly path: string;
434
- /** UTF-8 text content for the file. */
435
- readonly content: string;
433
+ /**
434
+ * Skill-relative POSIX path, for example `reference.md` or
435
+ * `references/codes.md`. Absolute paths and `..` segments are rejected by
436
+ * adapters before writing.
437
+ */
438
+ readonly path: string;
439
+ /** UTF-8 text content for the file. */
440
+ readonly content: string;
436
441
  };
437
-
442
+ //#endregion
443
+ //#region src/v1/harness-v1-tool-spec.d.ts
438
444
  /**
439
445
  * Description of a host-defined tool that the harness should make available
440
446
  * to the underlying agent runtime.
@@ -446,43 +452,44 @@ type HarnessV1SkillFile = {
446
452
  * `submitToolResult` from the caller.
447
453
  */
448
454
  type HarnessV1ToolSpec = {
449
- /**
450
- * Tool name the agent runtime sees. Must match the name on incoming
451
- * `tool-call` events.
452
- */
453
- readonly name: string;
454
- /**
455
- * Human-readable description handed to the runtime, used to help the model
456
- * decide when to call the tool.
457
- */
458
- readonly description?: string;
459
- /**
460
- * JSON Schema describing the expected input for the tool. Optional because
461
- * some runtimes accept tools without schemas (free-form arguments).
462
- */
463
- readonly inputSchema?: JSONSchema7;
455
+ /**
456
+ * Tool name the agent runtime sees. Must match the name on incoming
457
+ * `tool-call` events.
458
+ */
459
+ readonly name: string;
460
+ /**
461
+ * Human-readable description handed to the runtime, used to help the model
462
+ * decide when to call the tool.
463
+ */
464
+ readonly description?: string;
465
+ /**
466
+ * JSON Schema describing the expected input for the tool. Optional because
467
+ * some runtimes accept tools without schemas (free-form arguments).
468
+ */
469
+ readonly inputSchema?: JSONSchema7;
464
470
  };
465
-
471
+ //#endregion
472
+ //#region src/v1/harness-v1-lifecycle-state.d.ts
466
473
  type HarnessV1PendingToolApproval = {
467
- readonly approvalId: string;
468
- readonly toolCallId: string;
469
- readonly toolName: string;
470
- readonly input: string;
471
- readonly kind: 'builtin' | 'custom';
472
- readonly providerExecuted?: boolean;
473
- readonly nativeName?: string;
474
+ readonly approvalId: string;
475
+ readonly toolCallId: string;
476
+ readonly toolName: string;
477
+ readonly input: string;
478
+ readonly kind: 'builtin' | 'custom';
479
+ readonly providerExecuted?: boolean;
480
+ readonly nativeName?: string;
474
481
  };
475
482
  type HarnessV1PendingToolResult = {
476
- readonly toolCallId: string;
477
- readonly toolName: string;
478
- readonly input: string;
479
- readonly providerOptions?: ProviderOptions;
480
- /** Executed while suspending; submit on resume without running the tool again. */
481
- readonly completedResult?: {
482
- readonly output: unknown;
483
- readonly isError?: boolean;
484
- readonly toolResult?: ToolResultPart;
485
- };
483
+ readonly toolCallId: string;
484
+ readonly toolName: string;
485
+ readonly input: string;
486
+ readonly providerOptions?: ProviderOptions;
487
+ /** Executed while suspending; submit on resume without running the tool again. */
488
+ readonly completedResult?: {
489
+ readonly output: unknown;
490
+ readonly isError?: boolean;
491
+ readonly toolResult?: ToolResultPart;
492
+ };
486
493
  };
487
494
  /**
488
495
  * Framework-owned settings captured when a turn begins. The same settings are
@@ -490,47 +497,47 @@ type HarnessV1PendingToolResult = {
490
497
  * so a resumed continuation cannot pick up configuration from a later turn.
491
498
  */
492
499
  type HarnessV1TurnSettings = {
493
- /**
494
- * Model identifier selected for this turn. Adapters interpret this value
495
- * according to the underlying harness runtime. Rerun-based continuations
496
- * reuse it when reconstructing the turn.
497
- */
498
- readonly model?: string;
499
- /**
500
- * Skills made available to the underlying runtime for this turn. Adapters
501
- * must replace skills from the preceding completed turn before starting a
502
- * fresh turn. Rerun-based continuations use them to reconstruct the turn.
503
- */
504
- readonly skills: ReadonlyArray<HarnessV1Skill>;
505
- /**
506
- * Free-form instructions for this turn. Adapters should apply them through
507
- * the runtime's native system or developer instruction mechanism when
508
- * supported. Rerun-based continuations use them to reconstruct the turn.
509
- */
510
- readonly instructions?: string;
511
- /**
512
- * Host-defined tools made available to the underlying runtime for this turn.
513
- * The harness emits `tool-call` events when the runtime calls one and waits
514
- * for `submitToolResult`. Rerun-based continuations use them to reconstruct
515
- * the turn.
516
- */
517
- readonly tools: ReadonlyArray<HarnessV1ToolSpec>;
500
+ /**
501
+ * Model identifier selected for this turn. Adapters interpret this value
502
+ * according to the underlying harness runtime. Rerun-based continuations
503
+ * reuse it when reconstructing the turn.
504
+ */
505
+ readonly model?: string;
506
+ /**
507
+ * Skills made available to the underlying runtime for this turn. Adapters
508
+ * must replace skills from the preceding completed turn before starting a
509
+ * fresh turn. Rerun-based continuations use them to reconstruct the turn.
510
+ */
511
+ readonly skills: ReadonlyArray<HarnessV1Skill>;
512
+ /**
513
+ * Free-form instructions for this turn. Adapters should apply them through
514
+ * the runtime's native system or developer instruction mechanism when
515
+ * supported. Rerun-based continuations use them to reconstruct the turn.
516
+ */
517
+ readonly instructions?: string;
518
+ /**
519
+ * Host-defined tools made available to the underlying runtime for this turn.
520
+ * The harness emits `tool-call` events when the runtime calls one and waits
521
+ * for `submitToolResult`. Rerun-based continuations use them to reconstruct
522
+ * the turn.
523
+ */
524
+ readonly tools: ReadonlyArray<HarnessV1ToolSpec>;
518
525
  };
519
526
  type HarnessV1LifecycleStateBase = {
520
- /**
521
- * Identifier of the harness that produced this state. Used by adapters to
522
- * refuse mismatched payloads.
523
- */
524
- readonly harnessId: string;
525
- /**
526
- * Spec version of the harness that produced this state.
527
- */
528
- readonly specificationVersion: 'harness-v1';
529
- /**
530
- * Adapter-defined payload. May be persisted as JSON; the adapter is
531
- * responsible for any necessary encoding.
532
- */
533
- readonly data: JSONValue;
527
+ /**
528
+ * Identifier of the harness that produced this state. Used by adapters to
529
+ * refuse mismatched payloads.
530
+ */
531
+ readonly harnessId: string;
532
+ /**
533
+ * Spec version of the harness that produced this state.
534
+ */
535
+ readonly specificationVersion: 'harness-v1';
536
+ /**
537
+ * Adapter-defined payload. May be persisted as JSON; the adapter is
538
+ * responsible for any necessary encoding.
539
+ */
540
+ readonly data: JSONValue;
534
541
  };
535
542
  /**
536
543
  * Opaque payload returned by between-turn session lifecycle methods and
@@ -538,12 +545,12 @@ type HarnessV1LifecycleStateBase = {
538
545
  * underlying session before starting a new turn.
539
546
  */
540
547
  type HarnessV1ResumeSessionState = HarnessV1LifecycleStateBase & {
541
- readonly type: 'resume-session';
542
- /**
543
- * Optional unfinished-turn state. When present, the session must be resumed
544
- * before the turn is continued.
545
- */
546
- readonly continueFrom?: HarnessV1ContinueTurnState;
548
+ readonly type: 'resume-session';
549
+ /**
550
+ * Optional unfinished-turn state. When present, the session must be resumed
551
+ * before the turn is continued.
552
+ */
553
+ readonly continueFrom?: HarnessV1ContinueTurnState;
547
554
  };
548
555
  /**
549
556
  * Opaque payload returned by `doSuspendTurn` and accepted by a future
@@ -551,27 +558,28 @@ type HarnessV1ResumeSessionState = HarnessV1LifecycleStateBase & {
551
558
  * continuing the suspended turn.
552
559
  */
553
560
  type HarnessV1ContinueTurnState = HarnessV1LifecycleStateBase & {
554
- readonly type: 'continue-turn';
555
- /**
556
- * Framework-owned pending approval records. These are intentionally outside
557
- * adapter-defined `data` so callers can persist the entire lifecycle payload
558
- * without the harness framework owning storage.
559
- */
560
- readonly pendingToolApprovals?: readonly HarnessV1PendingToolApproval[];
561
- /**
562
- * Framework-owned client tool calls that are waiting for a caller-provided
563
- * result before the underlying turn can continue.
564
- */
565
- readonly pendingToolResults?: readonly HarnessV1PendingToolResult[];
566
- /**
567
- * Framework-owned settings captured when the unfinished turn began. They
568
- * are persisted outside adapter data so a resumed continuation cannot pick
569
- * up settings prepared for a later turn.
570
- */
571
- readonly turnSettings?: HarnessV1TurnSettings;
561
+ readonly type: 'continue-turn';
562
+ /**
563
+ * Framework-owned pending approval records. These are intentionally outside
564
+ * adapter-defined `data` so callers can persist the entire lifecycle payload
565
+ * without the harness framework owning storage.
566
+ */
567
+ readonly pendingToolApprovals?: readonly HarnessV1PendingToolApproval[];
568
+ /**
569
+ * Framework-owned client tool calls that are waiting for a caller-provided
570
+ * result before the underlying turn can continue.
571
+ */
572
+ readonly pendingToolResults?: readonly HarnessV1PendingToolResult[];
573
+ /**
574
+ * Framework-owned settings captured when the unfinished turn began. They
575
+ * are persisted outside adapter data so a resumed continuation cannot pick
576
+ * up settings prepared for a later turn.
577
+ */
578
+ readonly turnSettings?: HarnessV1TurnSettings;
572
579
  };
573
580
  type HarnessV1LifecycleState = HarnessV1ResumeSessionState | HarnessV1ContinueTurnState;
574
-
581
+ //#endregion
582
+ //#region src/v1/harness-v1-call-warning.d.ts
575
583
  /**
576
584
  * Warning emitted by a harness adapter during a call.
577
585
  *
@@ -580,18 +588,19 @@ type HarnessV1LifecycleState = HarnessV1ResumeSessionState | HarnessV1ContinueTu
580
588
  * in the harness namespace.
581
589
  */
582
590
  type HarnessV1CallWarning = {
583
- type: 'unsupported-setting';
584
- setting: string;
585
- details?: string;
591
+ type: 'unsupported-setting';
592
+ setting: string;
593
+ details?: string;
586
594
  } | {
587
- type: 'unsupported-tool';
588
- tool: string;
589
- details?: string;
595
+ type: 'unsupported-tool';
596
+ tool: string;
597
+ details?: string;
590
598
  } | {
591
- type: 'other';
592
- message: string;
599
+ type: 'other';
600
+ message: string;
593
601
  };
594
-
602
+ //#endregion
603
+ //#region src/v1/harness-v1-metadata.d.ts
595
604
  /**
596
605
  * Adapter-namespaced opaque data attached to harness events.
597
606
  *
@@ -603,7 +612,8 @@ type HarnessV1CallWarning = {
603
612
  * JSON-serializable data the adapter chooses to surface to callers.
604
613
  */
605
614
  type HarnessV1Metadata = Record<string, Record<string, JSONValue>>;
606
-
615
+ //#endregion
616
+ //#region src/v1/harness-v1-stream-part.d.ts
607
617
  /**
608
618
  * One event emitted by a harness adapter during a prompt turn.
609
619
  *
@@ -619,176 +629,176 @@ type HarnessV1Metadata = Record<string, Record<string, JSONValue>>;
619
629
  * agent rebinds it when forwarding to AI SDK consumers.
620
630
  */
621
631
  type HarnessV1StreamPart = {
622
- type: 'stream-start';
623
- warnings?: ReadonlyArray<HarnessV1CallWarning>;
624
- /**
625
- * The model the runtime actually resolved to for this turn, when the
626
- * adapter learns it at stream start (e.g. Claude Code's `init` message
627
- * reports the resolved/default model). Surfaced into telemetry as
628
- * `gen_ai.request.model`. Omitted when the adapter doesn't know it here.
629
- */
630
- modelId?: string;
632
+ type: 'stream-start';
633
+ warnings?: ReadonlyArray<HarnessV1CallWarning>;
634
+ /**
635
+ * The model the runtime actually resolved to for this turn, when the
636
+ * adapter learns it at stream start (e.g. Claude Code's `init` message
637
+ * reports the resolved/default model). Surfaced into telemetry as
638
+ * `gen_ai.request.model`. Omitted when the adapter doesn't know it here.
639
+ */
640
+ modelId?: string;
631
641
  } | {
632
- type: 'text-start';
633
- id: string;
634
- harnessMetadata?: HarnessV1Metadata;
642
+ type: 'text-start';
643
+ id: string;
644
+ harnessMetadata?: HarnessV1Metadata;
635
645
  } | {
636
- type: 'text-delta';
637
- id: string;
638
- delta: string;
639
- harnessMetadata?: HarnessV1Metadata;
646
+ type: 'text-delta';
647
+ id: string;
648
+ delta: string;
649
+ harnessMetadata?: HarnessV1Metadata;
640
650
  } | {
641
- type: 'text-end';
642
- id: string;
643
- harnessMetadata?: HarnessV1Metadata;
651
+ type: 'text-end';
652
+ id: string;
653
+ harnessMetadata?: HarnessV1Metadata;
644
654
  } | {
645
- type: 'reasoning-start';
646
- id: string;
647
- harnessMetadata?: HarnessV1Metadata;
655
+ type: 'reasoning-start';
656
+ id: string;
657
+ harnessMetadata?: HarnessV1Metadata;
648
658
  } | {
649
- type: 'reasoning-delta';
650
- id: string;
651
- delta: string;
652
- harnessMetadata?: HarnessV1Metadata;
659
+ type: 'reasoning-delta';
660
+ id: string;
661
+ delta: string;
662
+ harnessMetadata?: HarnessV1Metadata;
653
663
  } | {
654
- type: 'reasoning-end';
655
- id: string;
656
- harnessMetadata?: HarnessV1Metadata;
664
+ type: 'reasoning-end';
665
+ id: string;
666
+ harnessMetadata?: HarnessV1Metadata;
657
667
  } | Extract<LanguageModelV4StreamPart, {
658
- type: 'tool-input-start';
668
+ type: 'tool-input-start';
659
669
  }> | Extract<LanguageModelV4StreamPart, {
660
- type: 'tool-input-delta';
670
+ type: 'tool-input-delta';
661
671
  }> | Extract<LanguageModelV4StreamPart, {
662
- type: 'tool-input-end';
672
+ type: 'tool-input-end';
663
673
  }> | (LanguageModelV4ToolCall & {
664
- nativeName?: string;
665
- /**
666
- * Total tool calls in the current model step, when known before tool
667
- * execution begins. Populate this on every tool call in the step.
668
- */
669
- stepToolCallCount?: number;
674
+ nativeName?: string;
675
+ /**
676
+ * Total tool calls in the current model step, when known before tool
677
+ * execution begins. Populate this on every tool call in the step.
678
+ */
679
+ stepToolCallCount?: number;
670
680
  }) | LanguageModelV4ToolApprovalRequest | LanguageModelV4ToolResult | {
671
- type: 'finish-step';
672
- finishReason: LanguageModelV4FinishReason;
673
- usage: LanguageModelV4Usage;
674
- harnessMetadata?: HarnessV1Metadata;
681
+ type: 'finish-step';
682
+ finishReason: LanguageModelV4FinishReason;
683
+ usage: LanguageModelV4Usage;
684
+ harnessMetadata?: HarnessV1Metadata;
675
685
  } | {
676
- type: 'finish';
677
- finishReason: LanguageModelV4FinishReason;
678
- totalUsage: LanguageModelV4Usage;
679
- harnessMetadata?: HarnessV1Metadata;
686
+ type: 'finish';
687
+ finishReason: LanguageModelV4FinishReason;
688
+ totalUsage: LanguageModelV4Usage;
689
+ harnessMetadata?: HarnessV1Metadata;
680
690
  } | {
681
- type: 'file-change';
682
- event: 'create' | 'modify' | 'delete';
683
- path: string;
684
- harnessMetadata?: HarnessV1Metadata;
691
+ type: 'file-change';
692
+ event: 'create' | 'modify' | 'delete';
693
+ path: string;
694
+ harnessMetadata?: HarnessV1Metadata;
685
695
  } | {
686
- type: 'compaction';
687
- trigger: 'manual' | 'auto';
688
- summary: string;
689
- tokensBefore?: number;
690
- tokensAfter?: number;
691
- harnessMetadata?: HarnessV1Metadata;
696
+ type: 'compaction';
697
+ trigger: 'manual' | 'auto';
698
+ summary: string;
699
+ tokensBefore?: number;
700
+ tokensAfter?: number;
701
+ harnessMetadata?: HarnessV1Metadata;
692
702
  } | {
693
- type: 'error';
694
- error: unknown;
703
+ type: 'error';
704
+ error: unknown;
695
705
  } | {
696
- type: 'raw';
697
- rawValue: unknown;
706
+ type: 'raw';
707
+ rawValue: unknown;
698
708
  };
699
- declare const harnessV1StreamStartPartSchema: z.ZodObject<{
700
- type: z.ZodLiteral<"stream-start">;
701
- warnings: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<HarnessV1CallWarning, unknown, z.core.$ZodTypeInternals<HarnessV1CallWarning, unknown>>>>>;
702
- modelId: z.ZodOptional<z.ZodString>;
709
+ export declare const harnessV1StreamStartPartSchema: z.ZodObject<{
710
+ type: z.ZodLiteral<"stream-start">;
711
+ warnings: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<HarnessV1CallWarning, unknown, z.core.$ZodTypeInternals<HarnessV1CallWarning, unknown>>>>>;
712
+ modelId: z.ZodOptional<z.ZodString>;
703
713
  }, z.core.$strip>;
704
- declare const harnessV1TextStartPartSchema: z.ZodObject<{
705
- type: z.ZodLiteral<"text-start">;
706
- id: z.ZodString;
707
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
714
+ export declare const harnessV1TextStartPartSchema: z.ZodObject<{
715
+ type: z.ZodLiteral<"text-start">;
716
+ id: z.ZodString;
717
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
708
718
  }, z.core.$strip>;
709
- declare const harnessV1TextDeltaPartSchema: z.ZodObject<{
710
- type: z.ZodLiteral<"text-delta">;
711
- id: z.ZodString;
712
- delta: z.ZodString;
713
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
719
+ export declare const harnessV1TextDeltaPartSchema: z.ZodObject<{
720
+ type: z.ZodLiteral<"text-delta">;
721
+ id: z.ZodString;
722
+ delta: z.ZodString;
723
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
714
724
  }, z.core.$strip>;
715
- declare const harnessV1TextEndPartSchema: z.ZodObject<{
716
- type: z.ZodLiteral<"text-end">;
717
- id: z.ZodString;
718
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
725
+ export declare const harnessV1TextEndPartSchema: z.ZodObject<{
726
+ type: z.ZodLiteral<"text-end">;
727
+ id: z.ZodString;
728
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
719
729
  }, z.core.$strip>;
720
- declare const harnessV1ReasoningStartPartSchema: z.ZodObject<{
721
- type: z.ZodLiteral<"reasoning-start">;
722
- id: z.ZodString;
723
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
730
+ export declare const harnessV1ReasoningStartPartSchema: z.ZodObject<{
731
+ type: z.ZodLiteral<"reasoning-start">;
732
+ id: z.ZodString;
733
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
724
734
  }, z.core.$strip>;
725
- declare const harnessV1ReasoningDeltaPartSchema: z.ZodObject<{
726
- type: z.ZodLiteral<"reasoning-delta">;
727
- id: z.ZodString;
728
- delta: z.ZodString;
729
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
735
+ export declare const harnessV1ReasoningDeltaPartSchema: z.ZodObject<{
736
+ type: z.ZodLiteral<"reasoning-delta">;
737
+ id: z.ZodString;
738
+ delta: z.ZodString;
739
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
730
740
  }, z.core.$strip>;
731
- declare const harnessV1ReasoningEndPartSchema: z.ZodObject<{
732
- type: z.ZodLiteral<"reasoning-end">;
733
- id: z.ZodString;
734
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
741
+ export declare const harnessV1ReasoningEndPartSchema: z.ZodObject<{
742
+ type: z.ZodLiteral<"reasoning-end">;
743
+ id: z.ZodString;
744
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
735
745
  }, z.core.$strip>;
736
- declare const harnessV1ToolCallPartSchema: z.ZodObject<{
737
- type: z.ZodLiteral<"tool-call">;
738
- toolCallId: z.ZodString;
739
- toolName: z.ZodString;
740
- input: z.ZodString;
741
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
742
- dynamic: z.ZodOptional<z.ZodBoolean>;
743
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
744
- nativeName: z.ZodOptional<z.ZodString>;
745
- stepToolCallCount: z.ZodOptional<z.ZodNumber>;
746
+ export declare const harnessV1ToolCallPartSchema: z.ZodObject<{
747
+ type: z.ZodLiteral<"tool-call">;
748
+ toolCallId: z.ZodString;
749
+ toolName: z.ZodString;
750
+ input: z.ZodString;
751
+ providerExecuted: z.ZodOptional<z.ZodBoolean>;
752
+ dynamic: z.ZodOptional<z.ZodBoolean>;
753
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
754
+ nativeName: z.ZodOptional<z.ZodString>;
755
+ stepToolCallCount: z.ZodOptional<z.ZodNumber>;
746
756
  }, z.core.$strip>;
747
- declare const harnessV1ToolApprovalRequestPartSchema: z.ZodObject<{
748
- type: z.ZodLiteral<"tool-approval-request">;
749
- approvalId: z.ZodString;
750
- toolCallId: z.ZodString;
751
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
757
+ export declare const harnessV1ToolApprovalRequestPartSchema: z.ZodObject<{
758
+ type: z.ZodLiteral<"tool-approval-request">;
759
+ approvalId: z.ZodString;
760
+ toolCallId: z.ZodString;
761
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
752
762
  }, z.core.$strip>;
753
- declare const harnessV1ToolResultPartSchema: z.ZodObject<{
754
- type: z.ZodLiteral<"tool-result">;
755
- toolCallId: z.ZodString;
756
- toolName: z.ZodString;
757
- result: z.ZodType<NonNullable<JSONValue>, unknown, z.core.$ZodTypeInternals<NonNullable<JSONValue>, unknown>>;
758
- isError: z.ZodOptional<z.ZodBoolean>;
759
- preliminary: z.ZodOptional<z.ZodBoolean>;
760
- dynamic: z.ZodOptional<z.ZodBoolean>;
761
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
763
+ export declare const harnessV1ToolResultPartSchema: z.ZodObject<{
764
+ type: z.ZodLiteral<"tool-result">;
765
+ toolCallId: z.ZodString;
766
+ toolName: z.ZodString;
767
+ result: z.ZodType<NonNullable<JSONValue>, unknown, z.core.$ZodTypeInternals<NonNullable<JSONValue>, unknown>>;
768
+ isError: z.ZodOptional<z.ZodBoolean>;
769
+ preliminary: z.ZodOptional<z.ZodBoolean>;
770
+ dynamic: z.ZodOptional<z.ZodBoolean>;
771
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
762
772
  }, z.core.$strip>;
763
- declare const harnessV1FinishStepPartSchema: z.ZodObject<{
764
- type: z.ZodLiteral<"finish-step">;
765
- finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
766
- usage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
767
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
773
+ export declare const harnessV1FinishStepPartSchema: z.ZodObject<{
774
+ type: z.ZodLiteral<"finish-step">;
775
+ finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
776
+ usage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
777
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
768
778
  }, z.core.$strip>;
769
- declare const harnessV1FinishPartSchema: z.ZodObject<{
770
- type: z.ZodLiteral<"finish">;
771
- finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
772
- totalUsage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
773
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
779
+ export declare const harnessV1FinishPartSchema: z.ZodObject<{
780
+ type: z.ZodLiteral<"finish">;
781
+ finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
782
+ totalUsage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
783
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
774
784
  }, z.core.$strip>;
775
- declare const harnessV1FileChangePartSchema: z.ZodObject<{
776
- type: z.ZodLiteral<"file-change">;
777
- event: z.ZodEnum<{
778
- create: "create";
779
- modify: "modify";
780
- delete: "delete";
781
- }>;
782
- path: z.ZodString;
783
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
785
+ export declare const harnessV1FileChangePartSchema: z.ZodObject<{
786
+ type: z.ZodLiteral<"file-change">;
787
+ event: z.ZodEnum<{
788
+ create: "create";
789
+ modify: "modify";
790
+ delete: "delete";
791
+ }>;
792
+ path: z.ZodString;
793
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
784
794
  }, z.core.$strip>;
785
- declare const harnessV1ErrorPartSchema: z.ZodObject<{
786
- type: z.ZodLiteral<"error">;
787
- error: z.ZodUnknown;
795
+ export declare const harnessV1ErrorPartSchema: z.ZodObject<{
796
+ type: z.ZodLiteral<"error">;
797
+ error: z.ZodUnknown;
788
798
  }, z.core.$strip>;
789
- declare const harnessV1RawPartSchema: z.ZodObject<{
790
- type: z.ZodLiteral<"raw">;
791
- rawValue: z.ZodUnknown;
799
+ export declare const harnessV1RawPartSchema: z.ZodObject<{
800
+ type: z.ZodLiteral<"raw">;
801
+ rawValue: z.ZodUnknown;
792
802
  }, z.core.$strip>;
793
803
  /**
794
804
  * Assembled discriminated union over every `HarnessV1StreamPart` variant. Left
@@ -796,129 +806,192 @@ declare const harnessV1RawPartSchema: z.ZodObject<{
796
806
  * composes the individual member schemas, and the type test asserts the
797
807
  * inferred union equals `HarnessV1StreamPart`.
798
808
  */
799
- declare const harnessV1StreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
800
- type: z.ZodLiteral<"stream-start">;
801
- warnings: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<HarnessV1CallWarning, unknown, z.core.$ZodTypeInternals<HarnessV1CallWarning, unknown>>>>>;
802
- modelId: z.ZodOptional<z.ZodString>;
809
+ export declare const harnessV1StreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
810
+ type: z.ZodLiteral<"stream-start">;
811
+ warnings: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<HarnessV1CallWarning, unknown, z.core.$ZodTypeInternals<HarnessV1CallWarning, unknown>>>>>;
812
+ modelId: z.ZodOptional<z.ZodString>;
803
813
  }, z.core.$strip>, z.ZodObject<{
804
- type: z.ZodLiteral<"text-start">;
805
- id: z.ZodString;
806
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
814
+ type: z.ZodLiteral<"text-start">;
815
+ id: z.ZodString;
816
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
807
817
  }, z.core.$strip>, z.ZodObject<{
808
- type: z.ZodLiteral<"text-delta">;
809
- id: z.ZodString;
810
- delta: z.ZodString;
811
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
818
+ type: z.ZodLiteral<"text-delta">;
819
+ id: z.ZodString;
820
+ delta: z.ZodString;
821
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
812
822
  }, z.core.$strip>, z.ZodObject<{
813
- type: z.ZodLiteral<"text-end">;
814
- id: z.ZodString;
815
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
823
+ type: z.ZodLiteral<"text-end">;
824
+ id: z.ZodString;
825
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
816
826
  }, z.core.$strip>, z.ZodObject<{
817
- type: z.ZodLiteral<"reasoning-start">;
818
- id: z.ZodString;
819
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
827
+ type: z.ZodLiteral<"reasoning-start">;
828
+ id: z.ZodString;
829
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
820
830
  }, z.core.$strip>, z.ZodObject<{
821
- type: z.ZodLiteral<"reasoning-delta">;
822
- id: z.ZodString;
823
- delta: z.ZodString;
824
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
831
+ type: z.ZodLiteral<"reasoning-delta">;
832
+ id: z.ZodString;
833
+ delta: z.ZodString;
834
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
825
835
  }, z.core.$strip>, z.ZodObject<{
826
- type: z.ZodLiteral<"reasoning-end">;
827
- id: z.ZodString;
828
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
836
+ type: z.ZodLiteral<"reasoning-end">;
837
+ id: z.ZodString;
838
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
829
839
  }, z.core.$strip>, z.ZodObject<{
830
- type: z.ZodLiteral<"tool-input-start">;
831
- id: z.ZodString;
832
- toolName: z.ZodString;
833
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
834
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
835
- dynamic: z.ZodOptional<z.ZodBoolean>;
836
- title: z.ZodOptional<z.ZodString>;
840
+ type: z.ZodLiteral<"tool-input-start">;
841
+ id: z.ZodString;
842
+ toolName: z.ZodString;
843
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
844
+ providerExecuted: z.ZodOptional<z.ZodBoolean>;
845
+ dynamic: z.ZodOptional<z.ZodBoolean>;
846
+ title: z.ZodOptional<z.ZodString>;
837
847
  }, z.core.$strip>, z.ZodObject<{
838
- type: z.ZodLiteral<"tool-input-delta">;
839
- id: z.ZodString;
840
- delta: z.ZodString;
841
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
848
+ type: z.ZodLiteral<"tool-input-delta">;
849
+ id: z.ZodString;
850
+ delta: z.ZodString;
851
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
842
852
  }, z.core.$strip>, z.ZodObject<{
843
- type: z.ZodLiteral<"tool-input-end">;
844
- id: z.ZodString;
845
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
853
+ type: z.ZodLiteral<"tool-input-end">;
854
+ id: z.ZodString;
855
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
846
856
  }, z.core.$strip>, z.ZodObject<{
847
- type: z.ZodLiteral<"tool-call">;
848
- toolCallId: z.ZodString;
849
- toolName: z.ZodString;
850
- input: z.ZodString;
851
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
852
- dynamic: z.ZodOptional<z.ZodBoolean>;
853
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
854
- nativeName: z.ZodOptional<z.ZodString>;
855
- stepToolCallCount: z.ZodOptional<z.ZodNumber>;
857
+ type: z.ZodLiteral<"tool-call">;
858
+ toolCallId: z.ZodString;
859
+ toolName: z.ZodString;
860
+ input: z.ZodString;
861
+ providerExecuted: z.ZodOptional<z.ZodBoolean>;
862
+ dynamic: z.ZodOptional<z.ZodBoolean>;
863
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
864
+ nativeName: z.ZodOptional<z.ZodString>;
865
+ stepToolCallCount: z.ZodOptional<z.ZodNumber>;
856
866
  }, z.core.$strip>, z.ZodObject<{
857
- type: z.ZodLiteral<"tool-approval-request">;
858
- approvalId: z.ZodString;
859
- toolCallId: z.ZodString;
860
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
867
+ type: z.ZodLiteral<"tool-approval-request">;
868
+ approvalId: z.ZodString;
869
+ toolCallId: z.ZodString;
870
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
861
871
  }, z.core.$strip>, z.ZodObject<{
862
- type: z.ZodLiteral<"tool-result">;
863
- toolCallId: z.ZodString;
864
- toolName: z.ZodString;
865
- result: z.ZodType<NonNullable<JSONValue>, unknown, z.core.$ZodTypeInternals<NonNullable<JSONValue>, unknown>>;
866
- isError: z.ZodOptional<z.ZodBoolean>;
867
- preliminary: z.ZodOptional<z.ZodBoolean>;
868
- dynamic: z.ZodOptional<z.ZodBoolean>;
869
- providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
872
+ type: z.ZodLiteral<"tool-result">;
873
+ toolCallId: z.ZodString;
874
+ toolName: z.ZodString;
875
+ result: z.ZodType<NonNullable<JSONValue>, unknown, z.core.$ZodTypeInternals<NonNullable<JSONValue>, unknown>>;
876
+ isError: z.ZodOptional<z.ZodBoolean>;
877
+ preliminary: z.ZodOptional<z.ZodBoolean>;
878
+ dynamic: z.ZodOptional<z.ZodBoolean>;
879
+ providerMetadata: z.ZodOptional<z.ZodType<SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<SharedV4ProviderMetadata, unknown>>>;
870
880
  }, z.core.$strip>, z.ZodObject<{
871
- type: z.ZodLiteral<"finish-step">;
872
- finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
873
- usage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
874
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
881
+ type: z.ZodLiteral<"finish-step">;
882
+ finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
883
+ usage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
884
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
875
885
  }, z.core.$strip>, z.ZodObject<{
876
- type: z.ZodLiteral<"finish">;
877
- finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
878
- totalUsage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
879
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
886
+ type: z.ZodLiteral<"finish">;
887
+ finishReason: z.ZodType<LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<LanguageModelV4FinishReason, unknown>>;
888
+ totalUsage: z.ZodType<LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<LanguageModelV4Usage, unknown>>;
889
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
880
890
  }, z.core.$strip>, z.ZodObject<{
881
- type: z.ZodLiteral<"file-change">;
882
- event: z.ZodEnum<{
883
- create: "create";
884
- modify: "modify";
885
- delete: "delete";
886
- }>;
887
- path: z.ZodString;
888
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
891
+ type: z.ZodLiteral<"file-change">;
892
+ event: z.ZodEnum<{
893
+ create: "create";
894
+ modify: "modify";
895
+ delete: "delete";
896
+ }>;
897
+ path: z.ZodString;
898
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
889
899
  }, z.core.$strip>, z.ZodObject<{
890
- type: z.ZodLiteral<"compaction">;
891
- trigger: z.ZodEnum<{
892
- manual: "manual";
893
- auto: "auto";
894
- }>;
895
- summary: z.ZodString;
896
- tokensBefore: z.ZodOptional<z.ZodNumber>;
897
- tokensAfter: z.ZodOptional<z.ZodNumber>;
898
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
900
+ type: z.ZodLiteral<"compaction">;
901
+ trigger: z.ZodEnum<{
902
+ manual: "manual";
903
+ auto: "auto";
904
+ }>;
905
+ summary: z.ZodString;
906
+ tokensBefore: z.ZodOptional<z.ZodNumber>;
907
+ tokensAfter: z.ZodOptional<z.ZodNumber>;
908
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
899
909
  }, z.core.$strip>, z.ZodObject<{
900
- type: z.ZodLiteral<"error">;
901
- error: z.ZodUnknown;
910
+ type: z.ZodLiteral<"error">;
911
+ error: z.ZodUnknown;
902
912
  }, z.core.$strip>, z.ZodObject<{
903
- type: z.ZodLiteral<"raw">;
904
- rawValue: z.ZodUnknown;
913
+ type: z.ZodLiteral<"raw">;
914
+ rawValue: z.ZodUnknown;
905
915
  }, z.core.$strip>]>;
906
-
916
+ //#endregion
917
+ //#region src/v1/harness-v1-message.d.ts
918
+ type LanguageModelV4ToolResultContentPart = Extract<LanguageModelV4ToolResultOutput, {
919
+ type: 'content';
920
+ }>['value'][number];
921
+ type HarnessV1TextPart = Omit<LanguageModelV4TextPart, 'providerOptions'>;
922
+ type HarnessV1FilePart = Omit<LanguageModelV4FilePart, 'providerOptions'>;
923
+ type HarnessV1CustomPart = Omit<LanguageModelV4CustomPart, 'providerOptions'>;
924
+ type HarnessV1ReasoningPart = Omit<LanguageModelV4ReasoningPart, 'providerOptions'>;
925
+ type HarnessV1ReasoningFilePart = Omit<LanguageModelV4ReasoningFilePart, 'providerOptions'>;
926
+ type HarnessV1ToolCallPart = Omit<LanguageModelV4ToolCallPart, 'providerOptions'> & {
927
+ nativeName?: string;
928
+ };
929
+ type HarnessV1ToolResultOutput = Omit<Extract<LanguageModelV4ToolResultOutput, {
930
+ type: 'text';
931
+ }>, 'providerOptions'> | Omit<Extract<LanguageModelV4ToolResultOutput, {
932
+ type: 'json';
933
+ }>, 'providerOptions'> | Omit<Extract<LanguageModelV4ToolResultOutput, {
934
+ type: 'execution-denied';
935
+ }>, 'providerOptions'> | Omit<Extract<LanguageModelV4ToolResultOutput, {
936
+ type: 'error-text';
937
+ }>, 'providerOptions'> | Omit<Extract<LanguageModelV4ToolResultOutput, {
938
+ type: 'error-json';
939
+ }>, 'providerOptions'> | {
940
+ type: 'content';
941
+ value: Array<Omit<Extract<LanguageModelV4ToolResultContentPart, {
942
+ type: 'text';
943
+ }>, 'providerOptions'> | Omit<Extract<LanguageModelV4ToolResultContentPart, {
944
+ type: 'file';
945
+ }>, 'providerOptions'> | Omit<Extract<LanguageModelV4ToolResultContentPart, {
946
+ type: 'custom';
947
+ }>, 'providerOptions'>>;
948
+ };
949
+ type HarnessV1ToolResultPart = Omit<LanguageModelV4ToolResultPart, 'output' | 'providerOptions'> & {
950
+ output: HarnessV1ToolResultOutput;
951
+ };
952
+ type HarnessV1ToolApprovalResponsePart = Omit<LanguageModelV4ToolApprovalResponsePart, 'providerOptions'>;
953
+ type HarnessV1MessagePart = HarnessV1TextPart | HarnessV1FilePart | HarnessV1CustomPart | HarnessV1ReasoningPart | HarnessV1ReasoningFilePart | HarnessV1ToolCallPart | HarnessV1ToolResultPart | HarnessV1ToolApprovalResponsePart;
954
+ type HarnessV1UserMessage = {
955
+ readonly role: 'user';
956
+ readonly content: Array<HarnessV1TextPart | HarnessV1FilePart>;
957
+ readonly at?: string;
958
+ readonly harnessMetadata?: HarnessV1Metadata;
959
+ };
960
+ type HarnessV1AssistantMessage = {
961
+ readonly role: 'assistant';
962
+ readonly content: Array<HarnessV1TextPart | HarnessV1FilePart | HarnessV1CustomPart | HarnessV1ReasoningPart | HarnessV1ReasoningFilePart | HarnessV1ToolCallPart | HarnessV1ToolResultPart>;
963
+ readonly at?: string;
964
+ readonly harnessMetadata?: HarnessV1Metadata;
965
+ };
966
+ type HarnessV1ToolMessage = {
967
+ readonly role: 'tool';
968
+ readonly content: Array<HarnessV1ToolResultPart | HarnessV1ToolApprovalResponsePart>;
969
+ readonly at?: string;
970
+ readonly harnessMetadata?: HarnessV1Metadata;
971
+ };
972
+ /**
973
+ * A persisted harness message using V4 prompt content shapes and metadata
974
+ * scoped to the adapter that produced it.
975
+ */
976
+ type HarnessV1Message = HarnessV1UserMessage | HarnessV1AssistantMessage | HarnessV1ToolMessage;
977
+ //#endregion
978
+ //#region src/v1/harness-v1-tool-filtering.d.ts
907
979
  type HarnessV1BuiltinToolFiltering = {
908
- mode: 'allow';
909
- toolNames: string[];
980
+ mode: 'allow';
981
+ toolNames: string[];
910
982
  } | {
911
- mode: 'deny';
912
- toolNames: string[];
983
+ mode: 'deny';
984
+ toolNames: string[];
913
985
  };
914
- declare function isHarnessV1BuiltinToolIncluded(input: {
915
- toolName: string;
916
- toolFiltering: HarnessV1BuiltinToolFiltering | undefined;
986
+ export declare function isHarnessV1BuiltinToolIncluded(input: {
987
+ toolName: string;
988
+ toolFiltering: HarnessV1BuiltinToolFiltering | undefined;
917
989
  }): boolean;
918
- declare function getHarnessV1BuiltinToolFilteringDenialReason(input: {
919
- toolName: string;
990
+ export declare function getHarnessV1BuiltinToolFilteringDenialReason(input: {
991
+ toolName: string;
920
992
  }): string;
921
-
993
+ //#endregion
994
+ //#region src/v1/harness-v1-session.d.ts
922
995
  /**
923
996
  * Options passed to `HarnessV1.doStart`.
924
997
  *
@@ -927,93 +1000,101 @@ declare function getHarnessV1BuiltinToolFilteringDenialReason(input: {
927
1000
  * calling the adapter, so adapters never need to derive provider-specific paths.
928
1001
  */
929
1002
  type HarnessV1StartOptions = {
930
- /**
931
- * Additional normalized HTTP headers to send with model requests.
932
- */
933
- readonly headers?: Readonly<Record<string, string>>;
934
- /**
935
- * Stable identifier for this harness session. Used as the underlying
936
- * resource name where the adapter has a notion of a named session
937
- * (sandbox name, native session id, …).
938
- */
939
- readonly sessionId: string;
940
- /**
941
- * Optional resume payload returned by a prior session lifecycle method. When
942
- * provided, the adapter should resume the existing session before accepting a
943
- * new prompt or continuing a nested unfinished turn.
944
- */
945
- readonly resumeFrom?: HarnessV1ResumeSessionState;
946
- /**
947
- * Optional continuation payload returned by `doSuspendTurn`, or nested in
948
- * `resumeFrom`. When provided, the adapter should resume the existing session
949
- * in a shape ready for `doContinueTurn` rather than for a fresh prompt.
950
- */
951
- readonly continueFrom?: HarnessV1ContinueTurnState;
952
- /**
953
- * Approval policy for built-in adapter-native tool use. Custom host-executed
954
- * tools are approved by the framework before results are submitted back to
955
- * the adapter.
956
- */
957
- readonly permissionMode?: HarnessV1PermissionMode;
958
- /**
959
- * Adapter-native built-in tools that should be available for this session.
960
- * Custom host-executed tools are filtered by the framework before they reach
961
- * the adapter.
962
- */
963
- readonly builtinToolFiltering?: HarnessV1BuiltinToolFiltering;
964
- /**
965
- * Signal that aborts startup. The adapter must propagate cancellation to
966
- * any spawned processes or network calls.
967
- */
968
- readonly abortSignal?: AbortSignal;
969
- /**
970
- * Diagnostics wiring. The framework populates this; the adapter only
971
- * forwards `observability.onDiagnostic` into its `SandboxChannel` and
972
- * `observability.debug` into the bridge `start` message. Absent when the
973
- * consumer has not enabled diagnostics.
974
- */
975
- readonly observability?: HarnessV1Observability;
976
- /**
977
- * Sandbox session the adapter operates against. Network sandbox sessions
978
- * expose optional infrastructure capabilities for bridge wiring; caller-
979
- * provided basic sandbox sessions expose only filesystem and process APIs.
980
- * Adapters must not stop or destroy the sandbox themselves.
981
- */
982
- readonly sandboxSession: HarnessV1NetworkSandboxSession | Experimental_SandboxSession;
983
- /**
984
- * Absolute path the adapter runs the agent in for this session. Composed
985
- * underneath the sandbox's resolved default working directory and created
986
- * before `doStart`.
987
- */
988
- readonly sessionWorkDir: string;
1003
+ /**
1004
+ * Additional normalized HTTP headers to send with model requests.
1005
+ */
1006
+ readonly headers?: Readonly<Record<string, string>>;
1007
+ /**
1008
+ * Stable identifier for this harness session. Used as the underlying
1009
+ * resource name where the adapter has a notion of a named session
1010
+ * (sandbox name, native session id, …).
1011
+ */
1012
+ readonly sessionId: string;
1013
+ /**
1014
+ * Optional resume payload returned by a prior session lifecycle method. When
1015
+ * provided, the adapter should resume the existing session before accepting a
1016
+ * new prompt or continuing a nested unfinished turn.
1017
+ */
1018
+ readonly resumeFrom?: HarnessV1ResumeSessionState;
1019
+ /**
1020
+ * Optional continuation payload returned by `doSuspendTurn`, or nested in
1021
+ * `resumeFrom`. When provided, the adapter should resume the existing session
1022
+ * in a shape ready for `doContinueTurn` rather than for a fresh prompt.
1023
+ */
1024
+ readonly continueFrom?: HarnessV1ContinueTurnState;
1025
+ /**
1026
+ * Approval policy for built-in adapter-native tool use. Custom host-executed
1027
+ * tools are approved by the framework before results are submitted back to
1028
+ * the adapter.
1029
+ */
1030
+ readonly permissionMode?: HarnessV1PermissionMode;
1031
+ /**
1032
+ * Adapter-native built-in tools that should be available for this session.
1033
+ * Custom host-executed tools are filtered by the framework before they reach
1034
+ * the adapter.
1035
+ */
1036
+ readonly builtinToolFiltering?: HarnessV1BuiltinToolFiltering;
1037
+ /**
1038
+ * Signal that aborts startup. The adapter must propagate cancellation to
1039
+ * any spawned processes or network calls.
1040
+ */
1041
+ readonly abortSignal?: AbortSignal;
1042
+ /**
1043
+ * Diagnostics wiring. The framework populates this; the adapter only
1044
+ * forwards `observability.onDiagnostic` into its `SandboxChannel` and
1045
+ * `observability.debug` into the bridge `start` message. Absent when the
1046
+ * consumer has not enabled diagnostics.
1047
+ */
1048
+ readonly observability?: HarnessV1Observability;
1049
+ /**
1050
+ * Sandbox session the adapter operates against. Network sandbox sessions
1051
+ * expose optional infrastructure capabilities for bridge wiring; caller-
1052
+ * provided basic sandbox sessions expose only filesystem and process APIs.
1053
+ * Adapters must not stop or destroy the sandbox themselves.
1054
+ */
1055
+ readonly sandboxSession: HarnessV1NetworkSandboxSession | Experimental_SandboxSession;
1056
+ /**
1057
+ * Absolute path the adapter runs the agent in for this session. Composed
1058
+ * underneath the sandbox's resolved default working directory and created
1059
+ * before `doStart`.
1060
+ */
1061
+ readonly sessionWorkDir: string;
1062
+ };
1063
+ /**
1064
+ * Result of `HarnessV1Session.doReadHistory`.
1065
+ */
1066
+ type HarnessV1ReadHistoryResult = {
1067
+ readonly messages: ReadonlyArray<HarnessV1Message>;
1068
+ /** Opaque position; pass back as `since` to read only what follows. */
1069
+ readonly cursor: string;
989
1070
  };
990
1071
  /**
991
1072
  * Options passed to `HarnessV1Session.doPromptTurn`.
992
1073
  */
993
1074
  type HarnessV1PromptTurnOptions = HarnessV1TurnSettings & {
994
- /**
995
- * Fresh input for this turn — either a plain string or a single
996
- * `ModelMessage`. The harness session owns its own conversation history,
997
- * so prior turns are never replayed across the contract.
998
- */
999
- readonly prompt: HarnessV1Prompt;
1000
- /**
1001
- * Response format requested for this turn. Adapters that cannot honor a
1002
- * JSON response format must throw `HarnessCapabilityUnsupportedError`.
1003
- */
1004
- readonly responseFormat?: HarnessV1ResponseFormat;
1005
- /**
1006
- * Signal that aborts the in-flight turn. The adapter must cancel any
1007
- * underlying work and resolve `done` (with an error if appropriate).
1008
- */
1009
- readonly abortSignal?: AbortSignal;
1010
- /**
1011
- * Callback invoked once for each event the adapter produces during the
1012
- * turn. The adapter is responsible for the ordering and completeness of
1013
- * events. `done` resolves once the adapter has emitted all events for the
1014
- * turn (success or failure).
1015
- */
1016
- readonly emit: (event: HarnessV1StreamPart) => void;
1075
+ /**
1076
+ * Fresh input for this turn — either a plain string or a single
1077
+ * `ModelMessage`. The harness session owns its own conversation history,
1078
+ * so prior turns are never replayed across the contract.
1079
+ */
1080
+ readonly prompt: HarnessV1Prompt;
1081
+ /**
1082
+ * Response format requested for this turn. Adapters that cannot honor a
1083
+ * JSON response format must throw `HarnessCapabilityUnsupportedError`.
1084
+ */
1085
+ readonly responseFormat?: HarnessV1ResponseFormat;
1086
+ /**
1087
+ * Signal that aborts the in-flight turn. The adapter must cancel any
1088
+ * underlying work and resolve `done` (with an error if appropriate).
1089
+ */
1090
+ readonly abortSignal?: AbortSignal;
1091
+ /**
1092
+ * Callback invoked once for each event the adapter produces during the
1093
+ * turn. The adapter is responsible for the ordering and completeness of
1094
+ * events. `done` resolves once the adapter has emitted all events for the
1095
+ * turn (success or failure).
1096
+ */
1097
+ readonly emit: (event: HarnessV1StreamPart) => void;
1017
1098
  };
1018
1099
  /**
1019
1100
  * Options passed to `HarnessV1Session.doContinueTurn`.
@@ -1023,21 +1104,21 @@ type HarnessV1PromptTurnOptions = HarnessV1TurnSettings & {
1023
1104
  * that was previously suspended temporarily, e.g. by the workflow slice loop.
1024
1105
  */
1025
1106
  type HarnessV1ContinueTurnOptions = HarnessV1TurnSettings & {
1026
- /**
1027
- * Response format of the in-flight turn. Rerun-based adapters use this when
1028
- * reconstructing the turn; attach-based adapters may ignore it.
1029
- */
1030
- readonly responseFormat?: HarnessV1ResponseFormat;
1031
- /**
1032
- * Signal that aborts the continued turn. The adapter must cancel any
1033
- * underlying work and resolve `done` (with an error if appropriate).
1034
- */
1035
- readonly abortSignal?: AbortSignal;
1036
- /**
1037
- * Callback invoked once for each event the adapter produces while the
1038
- * continued turn runs. Same contract as `doPromptTurn`'s `emit`.
1039
- */
1040
- readonly emit: (event: HarnessV1StreamPart) => void;
1107
+ /**
1108
+ * Response format of the in-flight turn. Rerun-based adapters use this when
1109
+ * reconstructing the turn; attach-based adapters may ignore it.
1110
+ */
1111
+ readonly responseFormat?: HarnessV1ResponseFormat;
1112
+ /**
1113
+ * Signal that aborts the continued turn. The adapter must cancel any
1114
+ * underlying work and resolve `done` (with an error if appropriate).
1115
+ */
1116
+ readonly abortSignal?: AbortSignal;
1117
+ /**
1118
+ * Callback invoked once for each event the adapter produces while the
1119
+ * continued turn runs. Same contract as `doPromptTurn`'s `emit`.
1120
+ */
1121
+ readonly emit: (event: HarnessV1StreamPart) => void;
1041
1122
  };
1042
1123
  /**
1043
1124
  * Active harness session, returned by `HarnessV1.doStart`.
@@ -1048,94 +1129,122 @@ type HarnessV1ContinueTurnOptions = HarnessV1TurnSettings & {
1048
1129
  * instance via `doDetach`, `doStop`, or `doDestroy`.
1049
1130
  */
1050
1131
  type HarnessV1Session = {
1051
- /**
1052
- * Stable identifier for this session. Same value the host passed in via
1053
- * `HarnessV1StartOptions.sessionId`.
1054
- */
1055
- readonly sessionId: string;
1056
- /**
1057
- * Whether this session was created from `resumeFrom` or `continueFrom`. Fresh
1058
- * sessions report `false`; resumed sessions report `true`.
1059
- */
1060
- readonly isResume: boolean;
1061
- /**
1062
- * Run one prompt turn. Returns a control handle the host uses to feed
1063
- * tool results, approvals, and user messages back into the turn while it
1064
- * is in flight. The handle's `done` promise resolves when the turn ends.
1065
- */
1066
- doPromptTurn(options: HarnessV1PromptTurnOptions): PromiseLike<HarnessV1PromptControl>;
1067
- /**
1068
- * Request that the underlying runtime compact its context. The runtime owns
1069
- * the compaction — the harness neither implements nor schedules it; this is
1070
- * only the trigger. When compaction completes, the adapter surfaces a
1071
- * `compaction` stream part on the next/active turn.
1072
- *
1073
- * Required, but not every runtime can honour it: adapters whose transport
1074
- * exposes no manual compaction (e.g. Codex over `codex exec`, which still
1075
- * auto-compacts on its own) throw `HarnessCapabilityUnsupportedError`.
1076
- * `customInstructions`, when supported, steer the compaction summary.
1077
- */
1078
- doCompact(customInstructions?: string): PromiseLike<void>;
1079
- /**
1080
- * Continue the in-flight turn **without a new user prompt**, returning the
1081
- * same control surface as `doPromptTurn`. Used to keep consuming a turn that
1082
- * was suspended at a process boundary (the workflow slice loop), after the
1083
- * session itself has been resumed via `doStart({ continueFrom })`:
1084
- *
1085
- * - When the runtime's turn is still live and reachable (bridge `attach` /
1086
- * `replay`), the adapter subscribes to its events and resolves `done` on
1087
- * the turn's `finish` — **without** re-driving it. Lossless.
1088
- * - When the live turn is gone (bridge respawned `rerun`, or a host-resident
1089
- * runtime like Pi whose turn cannot survive its process), the adapter
1090
- * re-drives the runtime's own thread from its persisted state. Lossy: work
1091
- * in flight at the suspension is recomputed.
1092
- *
1093
- * Required on every adapter. The behaviour an adapter can guarantee follows
1094
- * from its architecture; the contract is uniform.
1095
- */
1096
- doContinueTurn(options: HarnessV1ContinueTurnOptions): PromiseLike<HarnessV1PromptControl>;
1097
- /**
1098
- * Gracefully freeze the active turn **at a precise cursor while keeping the
1099
- * runtime alive**, returning the continuation payload.
1100
- *
1101
- * This is the slice-boundary primitive. The adapter stops host-side
1102
- * consumption of the in-flight turn without telling the runtime to stop:
1103
- * for a bridge adapter it closes the host socket (the bridge keeps the turn
1104
- * running and accumulates events for replay) and resolves the active
1105
- * `doPromptTurn`/`doContinueTurn` `done` **cleanly** (not as an error) once buffered
1106
- * events have drained, so the cursor in the returned state equals the last
1107
- * event delivered to the host — guaranteeing the next slice's attach replays
1108
- * with no gap and no duplicate. A host-resident adapter (Pi) cannot keep its
1109
- * turn alive, so it persists what it can and the in-flight tail is recomputed
1110
- * on continue.
1111
- *
1112
- * Like `doDetach`, the sandbox/runtime is left running. Unlike `doDetach`,
1113
- * this is for an active turn at a slice boundary rather than a between-turn
1114
- * session handoff. Required on every adapter.
1115
- */
1116
- doSuspendTurn(): PromiseLike<HarnessV1ContinueTurnState>;
1117
- /**
1118
- * Detach from the underlying runtime without tearing it down, returning a
1119
- * payload the host can later pass to
1120
- * `HarnessV1.doStart({ resumeFrom })` to reconnect before a new turn. After
1121
- * `doDetach`, no further methods on this session instance may be called.
1122
- *
1123
- * Required. Adapters that cannot keep a live runtime parked still return the
1124
- * best resume session state they can while leaving the sandbox running.
1125
- */
1126
- doDetach(): PromiseLike<HarnessV1ResumeSessionState>;
1127
- /**
1128
- * Persist enough state to resume later, then stop the underlying runtime.
1129
- * After `doStop`, no further methods on this session instance may be called.
1130
- */
1131
- doStop(): PromiseLike<HarnessV1ResumeSessionState>;
1132
- /**
1133
- * Stop the underlying runtime without returning lifecycle state. After
1134
- * `doDestroy`, no further methods on this session instance may be called.
1135
- */
1136
- doDestroy(): PromiseLike<void>;
1132
+ /**
1133
+ * Stable identifier for this session. Same value the host passed in via
1134
+ * `HarnessV1StartOptions.sessionId`.
1135
+ */
1136
+ readonly sessionId: string;
1137
+ /**
1138
+ * Whether this session was created from `resumeFrom` or `continueFrom`. Fresh
1139
+ * sessions report `false`; resumed sessions report `true`.
1140
+ */
1141
+ readonly isResume: boolean;
1142
+ /**
1143
+ * Run one prompt turn. Returns a control handle the host uses to feed
1144
+ * tool results, approvals, and user messages back into the turn while it
1145
+ * is in flight. The handle's `done` promise resolves when the turn ends.
1146
+ */
1147
+ doPromptTurn(options: HarnessV1PromptTurnOptions): PromiseLike<HarnessV1PromptControl>;
1148
+ /**
1149
+ * Request that the underlying runtime compact its context. The runtime owns
1150
+ * the compaction — the harness neither implements nor schedules it; this is
1151
+ * only the trigger. When compaction completes, the adapter surfaces a
1152
+ * `compaction` stream part on the next/active turn.
1153
+ *
1154
+ * Required, but not every runtime can honour it: adapters whose transport
1155
+ * exposes no manual compaction (e.g. Codex over `codex exec`, which still
1156
+ * auto-compacts on its own) throw `HarnessCapabilityUnsupportedError`.
1157
+ * `customInstructions`, when supported, steer the compaction summary.
1158
+ */
1159
+ doCompact(customInstructions?: string): PromiseLike<void>;
1160
+ /**
1161
+ * Read the conversation history the runtime itself persisted, normalized
1162
+ * to `HarnessV1Message`.
1163
+ *
1164
+ * The session's history can grow outside the harness contract: the same
1165
+ * runtime conversation may be continued interactively (`claude --resume`),
1166
+ * by another process, or before this session attached. Hosts that render a
1167
+ * continuous record of the conversation — not just the turns they drove —
1168
+ * need to read that history back, and the runtime's own store is the only
1169
+ * source that has it. The adapter owns its runtime's persistence format,
1170
+ * so the read belongs here rather than in every host.
1171
+ *
1172
+ * `since` is the `cursor` from a previous read; the result then contains
1173
+ * only messages recorded after it. The cursor is adapter-owned and opaque
1174
+ * to the host.
1175
+ *
1176
+ * Optional capability: adapters that cannot read their runtime's store
1177
+ * omit the method entirely, and the agent surfaces that as
1178
+ * `HarnessCapabilityUnsupportedError`. An adapter that implements it but
1179
+ * cannot reach the store from the current environment (e.g. it lives
1180
+ * inside a remote sandbox) throws `HarnessHistoryUnavailableError`. A
1181
+ * conversation with no recorded messages yet is not an error — it resolves
1182
+ * to an empty `messages` array.
1183
+ */
1184
+ doReadHistory?(options: {
1185
+ readonly since?: string;
1186
+ }): PromiseLike<HarnessV1ReadHistoryResult>;
1187
+ /**
1188
+ * Continue the in-flight turn **without a new user prompt**, returning the
1189
+ * same control surface as `doPromptTurn`. Used to keep consuming a turn that
1190
+ * was suspended at a process boundary (the workflow slice loop), after the
1191
+ * session itself has been resumed via `doStart({ continueFrom })`:
1192
+ *
1193
+ * - When the runtime's turn is still live and reachable (bridge `attach` /
1194
+ * `replay`), the adapter subscribes to its events and resolves `done` on
1195
+ * the turn's `finish` — **without** re-driving it. Lossless.
1196
+ * - When the live turn is gone (bridge respawned `rerun`, or a host-resident
1197
+ * runtime like Pi whose turn cannot survive its process), the adapter
1198
+ * re-drives the runtime's own thread from its persisted state. Lossy: work
1199
+ * in flight at the suspension is recomputed.
1200
+ *
1201
+ * Required on every adapter. The behaviour an adapter can guarantee follows
1202
+ * from its architecture; the contract is uniform.
1203
+ */
1204
+ doContinueTurn(options: HarnessV1ContinueTurnOptions): PromiseLike<HarnessV1PromptControl>;
1205
+ /**
1206
+ * Gracefully freeze the active turn **at a precise cursor while keeping the
1207
+ * runtime alive**, returning the continuation payload.
1208
+ *
1209
+ * This is the slice-boundary primitive. The adapter stops host-side
1210
+ * consumption of the in-flight turn without telling the runtime to stop:
1211
+ * for a bridge adapter it closes the host socket (the bridge keeps the turn
1212
+ * running and accumulates events for replay) and resolves the active
1213
+ * `doPromptTurn`/`doContinueTurn` `done` **cleanly** (not as an error) once buffered
1214
+ * events have drained, so the cursor in the returned state equals the last
1215
+ * event delivered to the host — guaranteeing the next slice's attach replays
1216
+ * with no gap and no duplicate. A host-resident adapter (Pi) cannot keep its
1217
+ * turn alive, so it persists what it can and the in-flight tail is recomputed
1218
+ * on continue.
1219
+ *
1220
+ * Like `doDetach`, the sandbox/runtime is left running. Unlike `doDetach`,
1221
+ * this is for an active turn at a slice boundary rather than a between-turn
1222
+ * session handoff. Required on every adapter.
1223
+ */
1224
+ doSuspendTurn(): PromiseLike<HarnessV1ContinueTurnState>;
1225
+ /**
1226
+ * Detach from the underlying runtime without tearing it down, returning a
1227
+ * payload the host can later pass to
1228
+ * `HarnessV1.doStart({ resumeFrom })` to reconnect before a new turn. After
1229
+ * `doDetach`, no further methods on this session instance may be called.
1230
+ *
1231
+ * Required. Adapters that cannot keep a live runtime parked still return the
1232
+ * best resume session state they can while leaving the sandbox running.
1233
+ */
1234
+ doDetach(): PromiseLike<HarnessV1ResumeSessionState>;
1235
+ /**
1236
+ * Persist enough state to resume later, then stop the underlying runtime.
1237
+ * After `doStop`, no further methods on this session instance may be called.
1238
+ */
1239
+ doStop(): PromiseLike<HarnessV1ResumeSessionState>;
1240
+ /**
1241
+ * Stop the underlying runtime without returning lifecycle state. After
1242
+ * `doDestroy`, no further methods on this session instance may be called.
1243
+ */
1244
+ doDestroy(): PromiseLike<void>;
1137
1245
  };
1138
-
1246
+ //#endregion
1247
+ //#region src/v1/harness-v1.d.ts
1139
1248
  /**
1140
1249
  * Versioned specification for a harness adapter — the integration point for
1141
1250
  * one third-party coding-agent runtime (Claude Code, Codex, …).
@@ -1150,73 +1259,74 @@ type HarnessV1Session = {
1150
1259
  * capability.
1151
1260
  */
1152
1261
  type HarnessV1<TBuiltinTools extends ToolSet = ToolSet> = {
1153
- /**
1154
- * Spec version this adapter implements. Always the literal `'harness-v1'`.
1155
- */
1156
- readonly specificationVersion: 'harness-v1';
1157
- /**
1158
- * Stable identifier for this harness, used as the key inside
1159
- * `HarnessV1Metadata` objects. Conventionally a kebab-case slug matching
1160
- * the package name (`'claude-code'`, `'codex'`).
1161
- */
1162
- readonly harnessId: string;
1163
- /**
1164
- * Tools the adapter's underlying runtime exposes natively, as a `ToolSet`
1165
- * keyed by what the bridge emits on `tool-call` events
1166
- * (`commonName ?? nativeName`). Each entry is a `HarnessV1BuiltinTool`
1167
- * (a `Tool` plus harness-specific `nativeName` / `commonName` metadata).
1168
- *
1169
- * The agent merges this with consumer-supplied user tools when validating
1170
- * inbound tool calls and when typing the consumer-facing stream.
1171
- */
1172
- readonly builtinTools: TBuiltinTools;
1173
- /**
1174
- * Whether the adapter can emit approval requests for built-in tools when
1175
- * `permissionMode` is not `'allow-all'`.
1176
- *
1177
- * Custom host-executed tool approvals are handled by `HarnessAgent`, so this
1178
- * only describes adapter-native tool approval support.
1179
- */
1180
- readonly supportsBuiltinToolApprovals?: boolean;
1181
- /**
1182
- * Whether the adapter can prevent its underlying runtime from seeing or
1183
- * calling inactive built-in tools for every tool in `builtinTools`.
1184
- *
1185
- * Adapters without native filtering can still support `activeTools` and
1186
- * `inactiveTools` for built-ins when `supportsBuiltinToolApprovals` is
1187
- * `true`: the framework routes inactive built-in tool calls through the
1188
- * approval path and auto-denies them before they execute.
1189
- */
1190
- readonly supportsBuiltinToolFiltering?: boolean;
1191
- /**
1192
- * Optional schema for the adapter-defined `data` payload returned by session
1193
- * lifecycle methods. When present, the adapter promises that exported state
1194
- * validated by this schema can be re-imported in a future
1195
- * `doStart({ resumeFrom })` or `doStart({ continueFrom })` call.
1196
- */
1197
- readonly lifecycleStateSchema?: FlexibleSchema<unknown>;
1198
- /**
1199
- * Optional bootstrap recipe. When defined, the harness session manager
1200
- * computes a stable identity from the recipe, passes it (along with a
1201
- * one-time recipe-application hook) to the sandbox provider, and applies
1202
- * the recipe idempotently after the provider returns the handle.
1203
- *
1204
- * Adapters with no bootstrap needs omit this. Adapters that need to install
1205
- * deps or ship bridge files into the sandbox declare them here so the
1206
- * provider can cache the result across sessions via snapshots when
1207
- * supported.
1208
- */
1209
- readonly getBootstrap?: (options?: {
1210
- abortSignal?: AbortSignal;
1211
- }) => PromiseLike<HarnessV1Bootstrap>;
1212
- /**
1213
- * Start a fresh session, resume a parked session via `resumeFrom`, or resume
1214
- * a suspended turn via `continueFrom`. The host then issues prompts against
1215
- * the returned session, ending with `doDetach`, `doStop`, or `doDestroy`.
1216
- */
1217
- doStart(options: HarnessV1StartOptions): PromiseLike<HarnessV1Session>;
1262
+ /**
1263
+ * Spec version this adapter implements. Always the literal `'harness-v1'`.
1264
+ */
1265
+ readonly specificationVersion: 'harness-v1';
1266
+ /**
1267
+ * Stable identifier for this harness, used as the key inside
1268
+ * `HarnessV1Metadata` objects. Conventionally a kebab-case slug matching
1269
+ * the package name (`'claude-code'`, `'codex'`).
1270
+ */
1271
+ readonly harnessId: string;
1272
+ /**
1273
+ * Tools the adapter's underlying runtime exposes natively, as a `ToolSet`
1274
+ * keyed by what the bridge emits on `tool-call` events
1275
+ * (`commonName ?? nativeName`). Each entry is a `HarnessV1BuiltinTool`
1276
+ * (a `Tool` plus harness-specific `nativeName` / `commonName` metadata).
1277
+ *
1278
+ * The agent merges this with consumer-supplied user tools when validating
1279
+ * inbound tool calls and when typing the consumer-facing stream.
1280
+ */
1281
+ readonly builtinTools: TBuiltinTools;
1282
+ /**
1283
+ * Whether the adapter can emit approval requests for built-in tools when
1284
+ * `permissionMode` is not `'allow-all'`.
1285
+ *
1286
+ * Custom host-executed tool approvals are handled by `HarnessAgent`, so this
1287
+ * only describes adapter-native tool approval support.
1288
+ */
1289
+ readonly supportsBuiltinToolApprovals?: boolean;
1290
+ /**
1291
+ * Whether the adapter can prevent its underlying runtime from seeing or
1292
+ * calling inactive built-in tools for every tool in `builtinTools`.
1293
+ *
1294
+ * Adapters without native filtering can still support `activeTools` and
1295
+ * `inactiveTools` for built-ins when `supportsBuiltinToolApprovals` is
1296
+ * `true`: the framework routes inactive built-in tool calls through the
1297
+ * approval path and auto-denies them before they execute.
1298
+ */
1299
+ readonly supportsBuiltinToolFiltering?: boolean;
1300
+ /**
1301
+ * Optional schema for the adapter-defined `data` payload returned by session
1302
+ * lifecycle methods. When present, the adapter promises that exported state
1303
+ * validated by this schema can be re-imported in a future
1304
+ * `doStart({ resumeFrom })` or `doStart({ continueFrom })` call.
1305
+ */
1306
+ readonly lifecycleStateSchema?: FlexibleSchema<unknown>;
1307
+ /**
1308
+ * Optional bootstrap recipe. When defined, the harness session manager
1309
+ * computes a stable identity from the recipe, passes it (along with a
1310
+ * one-time recipe-application hook) to the sandbox provider, and applies
1311
+ * the recipe idempotently after the provider returns the handle.
1312
+ *
1313
+ * Adapters with no bootstrap needs omit this. Adapters that need to install
1314
+ * deps or ship bridge files into the sandbox declare them here so the
1315
+ * provider can cache the result across sessions via snapshots when
1316
+ * supported.
1317
+ */
1318
+ readonly getBootstrap?: (options?: {
1319
+ abortSignal?: AbortSignal;
1320
+ }) => PromiseLike<HarnessV1Bootstrap>;
1321
+ /**
1322
+ * Start a fresh session, resume a parked session via `resumeFrom`, or resume
1323
+ * a suspended turn via `continueFrom`. The host then issues prompts against
1324
+ * the returned session, ending with `doDetach`, `doStop`, or `doDestroy`.
1325
+ */
1326
+ doStart(options: HarnessV1StartOptions): PromiseLike<HarnessV1Session>;
1218
1327
  };
1219
-
1328
+ //#endregion
1329
+ //#region src/v1/harness-authentication.d.ts
1220
1330
  /**
1221
1331
  * Authentication-related environment variables supplied directly to a harness.
1222
1332
  *
@@ -1228,10 +1338,9 @@ type HarnessV1AuthenticationEnvironment = Readonly<Record<string, string>>;
1228
1338
  * Authentication options shared by harness adapters. Adapter choices must be
1229
1339
  * a non-empty union of concrete string values.
1230
1340
  */
1231
- type HarnessV1Authentication<ADAPTER_CHOICES extends string = 'direct'> = [
1232
- ADAPTER_CHOICES
1233
- ] extends [never] ? never : string extends ADAPTER_CHOICES ? never : 'auto' | 'ai-gateway' | ADAPTER_CHOICES | HarnessV1AuthenticationEnvironment;
1234
-
1341
+ type HarnessV1Authentication<ADAPTER_CHOICES extends string = 'direct'> = [ADAPTER_CHOICES] extends [never] ? never : string extends ADAPTER_CHOICES ? never : 'auto' | 'ai-gateway' | ADAPTER_CHOICES | HarnessV1AuthenticationEnvironment;
1342
+ //#endregion
1343
+ //#region src/v1/harness-v1-credential-forwarding.d.ts
1235
1344
  /**
1236
1345
  * Customizes a credential value immediately before a harness adapter forwards
1237
1346
  * it into a sandbox process.
@@ -1241,24 +1350,26 @@ type HarnessV1Authentication<ADAPTER_CHOICES extends string = 'direct'> = [
1241
1350
  * otherwise access in the host process.
1242
1351
  */
1243
1352
  type HarnessV1CredentialForwarding = (options: {
1244
- /**
1245
- * The credential value that the adapter would otherwise forward. This is a
1246
- * generated sandbox placeholder when credential brokering is available and
1247
- * the real credential otherwise. Use `isSandboxCredentialPlaceholder` from
1248
- * `@ai-sdk/harness/utils` to distinguish generated placeholders.
1249
- */
1250
- readonly credential: string;
1251
- /** The environment variable name used to expose the value in the sandbox. */
1252
- readonly environmentVariableName: string;
1353
+ /**
1354
+ * The credential value that the adapter would otherwise forward. This is a
1355
+ * generated sandbox placeholder when credential brokering is available and
1356
+ * the real credential otherwise. Use `isSandboxCredentialPlaceholder` from
1357
+ * `@ai-sdk/harness/utils` to distinguish generated placeholders.
1358
+ */
1359
+ readonly credential: string;
1360
+ /** The environment variable name used to expose the value in the sandbox. */
1361
+ readonly environmentVariableName: string;
1253
1362
  }) => string | PromiseLike<string>;
1254
-
1363
+ //#endregion
1364
+ //#region src/v1/harness-v1-mint-bridge-token.d.ts
1255
1365
  /**
1256
1366
  * Creates the authentication token a bridge-backed harness adapter uses to
1257
1367
  * secure its sandbox bridge channel for one session. Defaults to a random
1258
1368
  * 32-byte hexadecimal token when omitted.
1259
1369
  */
1260
1370
  type HarnessV1MintBridgeTokenCallback = (sandboxId: string) => string;
1261
-
1371
+ //#endregion
1372
+ //#region src/v1/harness-v1-builtin-tool.d.ts
1262
1373
  /**
1263
1374
  * Cross-harness vocabulary of common built-in tool names with their baseline
1264
1375
  * input schemas. Adapters that declare a built-in with one of these
@@ -1268,68 +1379,68 @@ type HarnessV1MintBridgeTokenCallback = (sandboxId: string) => string;
1268
1379
  * Used both as runtime values (spread into `ToolSet`s for inspection) and as
1269
1380
  * a vocabulary source — `HarnessV1BuiltinToolName` is derived from its keys.
1270
1381
  */
1271
- declare const HARNESS_V1_BUILTIN_TOOLS: {
1272
- readonly read: Tool<{
1273
- file_path: string;
1274
- }, unknown, _ai_sdk_provider_utils.Context>;
1275
- readonly write: Tool<{
1276
- file_path: string;
1277
- content: string;
1278
- }, unknown, _ai_sdk_provider_utils.Context>;
1279
- readonly edit: Tool<{
1280
- file_path: string;
1281
- old_string: string;
1282
- new_string: string;
1283
- }, unknown, _ai_sdk_provider_utils.Context>;
1284
- readonly bash: Tool<{
1285
- command: string;
1286
- }, unknown, _ai_sdk_provider_utils.Context>;
1287
- readonly grep: Tool<{
1288
- pattern: string;
1289
- }, unknown, _ai_sdk_provider_utils.Context>;
1290
- readonly glob: Tool<{
1291
- pattern: string;
1292
- }, unknown, _ai_sdk_provider_utils.Context>;
1293
- readonly webSearch: Tool<{
1294
- query: string;
1295
- }, unknown, _ai_sdk_provider_utils.Context>;
1296
- readonly askUserQuestions: _ai_sdk_provider_utils.FunctionTool<{
1297
- allowPartialAnswers: boolean;
1298
- questions: {
1299
- id: string;
1300
- question: string;
1301
- header?: string | undefined;
1302
- options?: {
1303
- id: string;
1304
- label: string;
1305
- description?: string | undefined;
1306
- preview?: string | undefined;
1307
- }[] | undefined;
1308
- allowMultiple?: boolean | undefined;
1309
- allowFreeForm?: boolean | {
1310
- secret: boolean;
1311
- } | undefined;
1312
- }[];
1313
- }, {
1314
- action: "answered";
1315
- answers: Record<string, {
1316
- optionIds: string[];
1317
- freeform?: string | undefined;
1318
- }>;
1319
- } | {
1320
- action: "partially-answered";
1321
- answers: Record<string, {
1322
- optionIds: string[];
1323
- freeform?: string | undefined;
1324
- }>;
1325
- } | {
1326
- action: "declined";
1327
- } | {
1328
- action: "cancelled";
1382
+ export declare const HARNESS_V1_BUILTIN_TOOLS: {
1383
+ readonly read: Tool<{
1384
+ file_path: string;
1385
+ }, unknown, import("@ai-sdk/provider-utils").Context>;
1386
+ readonly write: Tool<{
1387
+ file_path: string;
1388
+ content: string;
1389
+ }, unknown, import("@ai-sdk/provider-utils").Context>;
1390
+ readonly edit: Tool<{
1391
+ file_path: string;
1392
+ old_string: string;
1393
+ new_string: string;
1394
+ }, unknown, import("@ai-sdk/provider-utils").Context>;
1395
+ readonly bash: Tool<{
1396
+ command: string;
1397
+ }, unknown, import("@ai-sdk/provider-utils").Context>;
1398
+ readonly grep: Tool<{
1399
+ pattern: string;
1400
+ }, unknown, import("@ai-sdk/provider-utils").Context>;
1401
+ readonly glob: Tool<{
1402
+ pattern: string;
1403
+ }, unknown, import("@ai-sdk/provider-utils").Context>;
1404
+ readonly webSearch: Tool<{
1405
+ query: string;
1406
+ }, unknown, import("@ai-sdk/provider-utils").Context>;
1407
+ readonly askUserQuestions: import("@ai-sdk/provider-utils").FunctionTool<{
1408
+ allowPartialAnswers: boolean;
1409
+ questions: {
1410
+ id: string;
1411
+ question: string;
1412
+ header?: string | undefined;
1413
+ options?: {
1414
+ id: string;
1415
+ label: string;
1416
+ description?: string | undefined;
1417
+ preview?: string | undefined;
1418
+ }[] | undefined;
1419
+ allowMultiple?: boolean | undefined;
1420
+ allowFreeForm?: boolean | {
1421
+ secret: boolean;
1422
+ } | undefined;
1423
+ }[];
1424
+ }, {
1425
+ action: "answered";
1426
+ answers: Record<string, {
1427
+ optionIds: string[];
1428
+ freeform?: string | undefined;
1329
1429
  }>;
1430
+ } | {
1431
+ action: "partially-answered";
1432
+ answers: Record<string, {
1433
+ optionIds: string[];
1434
+ freeform?: string | undefined;
1435
+ }>;
1436
+ } | {
1437
+ action: "declined";
1438
+ } | {
1439
+ action: "cancelled";
1440
+ }>;
1330
1441
  };
1331
1442
  type HarnessV1BuiltinToolName = keyof typeof HARNESS_V1_BUILTIN_TOOLS;
1332
- declare const HARNESS_V1_BUILTIN_TOOL_NAMES: ReadonlyArray<HarnessV1BuiltinToolName>;
1443
+ export declare const HARNESS_V1_BUILTIN_TOOL_NAMES: ReadonlyArray<HarnessV1BuiltinToolName>;
1333
1444
  type HarnessV1BuiltinToolUseKind = 'readonly' | 'edit' | 'bash';
1334
1445
  /**
1335
1446
  * A tool that the adapter's underlying runtime exposes natively. Extends the
@@ -1350,19 +1461,16 @@ type HarnessV1BuiltinToolUseKind = 'readonly' | 'edit' | 'bash';
1350
1461
  * (declare the tool with the AI SDK's `tool()` directly).
1351
1462
  */
1352
1463
  type HarnessV1BuiltinTool<INPUT = unknown, OUTPUT = unknown> = Tool<INPUT, OUTPUT, any> & {
1353
- readonly nativeName?: string;
1354
- readonly commonName?: HarnessV1BuiltinToolName;
1355
- readonly toolUseKind?: HarnessV1BuiltinToolUseKind;
1464
+ readonly nativeName?: string;
1465
+ readonly commonName?: HarnessV1BuiltinToolName;
1466
+ readonly toolUseKind?: HarnessV1BuiltinToolUseKind;
1356
1467
  };
1357
1468
  type InputOf<T> = T extends Tool<infer I, any, any> ? I : never;
1358
1469
  type StandardInputOf<N extends HarnessV1BuiltinToolName> = InputOf<(typeof HARNESS_V1_BUILTIN_TOOLS)[N]>;
1359
- type SupersetCheck<TStandard, TAdapter, TOk> = TStandard extends TAdapter ? TOk : [
1360
- 'ERROR: adapter input schema must be a superset of the standard schema',
1361
- {
1362
- expected: TStandard;
1363
- got: TAdapter;
1364
- }
1365
- ];
1470
+ type SupersetCheck<TStandard, TAdapter, TOk> = TStandard extends TAdapter ? TOk : ['ERROR: adapter input schema must be a superset of the standard schema', {
1471
+ expected: TStandard;
1472
+ got: TAdapter;
1473
+ }];
1366
1474
  /**
1367
1475
  * Declare a built-in tool that maps to a cross-harness common name. The
1368
1476
  * adapter's input schema must accept every input the standard schema for
@@ -1373,53 +1481,55 @@ type SupersetCheck<TStandard, TAdapter, TOk> = TStandard extends TAdapter ? TOk
1373
1481
  * which fails the surrounding `as const satisfies ToolSet` assignment and
1374
1482
  * surfaces a readable TypeScript error at the offending entry.
1375
1483
  */
1376
- declare function commonTool<TName extends HarnessV1BuiltinToolName, TInput>(commonName: TName, opts: {
1377
- readonly nativeName: string;
1378
- readonly toolUseKind?: HarnessV1BuiltinToolUseKind;
1379
- readonly description?: string;
1380
- readonly inputSchema: FlexibleSchema<TInput>;
1484
+ export declare function commonTool<TName extends HarnessV1BuiltinToolName, TInput>(commonName: TName, opts: {
1485
+ readonly nativeName: string;
1486
+ readonly toolUseKind?: HarnessV1BuiltinToolUseKind;
1487
+ readonly description?: string;
1488
+ readonly inputSchema: FlexibleSchema<TInput>;
1381
1489
  }): SupersetCheck<StandardInputOf<TName>, TInput, HarnessV1BuiltinTool<TInput>>;
1382
-
1383
- declare const harnessV1QuestionsToolInputSchema: z.ZodObject<{
1384
- allowPartialAnswers: z.ZodBoolean;
1385
- questions: z.ZodArray<z.ZodObject<{
1386
- id: z.ZodString;
1387
- question: z.ZodString;
1388
- header: z.ZodOptional<z.ZodString>;
1389
- options: z.ZodOptional<z.ZodArray<z.ZodObject<{
1390
- id: z.ZodString;
1391
- label: z.ZodString;
1392
- description: z.ZodOptional<z.ZodString>;
1393
- preview: z.ZodOptional<z.ZodString>;
1394
- }, z.core.$strip>>>;
1395
- allowMultiple: z.ZodOptional<z.ZodBoolean>;
1396
- allowFreeForm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
1397
- secret: z.ZodBoolean;
1398
- }, z.core.$strip>]>>;
1399
- }, z.core.$strip>>;
1490
+ //#endregion
1491
+ //#region src/v1/harness-v1-questions-tool.d.ts
1492
+ export declare const harnessV1QuestionsToolInputSchema: z.ZodObject<{
1493
+ allowPartialAnswers: z.ZodBoolean;
1494
+ questions: z.ZodArray<z.ZodObject<{
1495
+ id: z.ZodString;
1496
+ question: z.ZodString;
1497
+ header: z.ZodOptional<z.ZodString>;
1498
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
1499
+ id: z.ZodString;
1500
+ label: z.ZodString;
1501
+ description: z.ZodOptional<z.ZodString>;
1502
+ preview: z.ZodOptional<z.ZodString>;
1503
+ }, z.core.$strip>>>;
1504
+ allowMultiple: z.ZodOptional<z.ZodBoolean>;
1505
+ allowFreeForm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
1506
+ secret: z.ZodBoolean;
1507
+ }, z.core.$strip>]>>;
1508
+ }, z.core.$strip>>;
1400
1509
  }, z.core.$strip>;
1401
- declare const harnessV1QuestionsToolOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1402
- action: z.ZodLiteral<"answered">;
1403
- answers: z.ZodRecord<z.ZodString, z.ZodObject<{
1404
- optionIds: z.ZodArray<z.ZodString>;
1405
- freeform: z.ZodOptional<z.ZodString>;
1406
- }, z.core.$strip>>;
1510
+ export declare const harnessV1QuestionsToolOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1511
+ action: z.ZodLiteral<"answered">;
1512
+ answers: z.ZodRecord<z.ZodString, z.ZodObject<{
1513
+ optionIds: z.ZodArray<z.ZodString>;
1514
+ freeform: z.ZodOptional<z.ZodString>;
1515
+ }, z.core.$strip>>;
1407
1516
  }, z.core.$strip>, z.ZodObject<{
1408
- action: z.ZodLiteral<"partially-answered">;
1409
- answers: z.ZodRecord<z.ZodString, z.ZodObject<{
1410
- optionIds: z.ZodArray<z.ZodString>;
1411
- freeform: z.ZodOptional<z.ZodString>;
1412
- }, z.core.$strip>>;
1517
+ action: z.ZodLiteral<"partially-answered">;
1518
+ answers: z.ZodRecord<z.ZodString, z.ZodObject<{
1519
+ optionIds: z.ZodArray<z.ZodString>;
1520
+ freeform: z.ZodOptional<z.ZodString>;
1521
+ }, z.core.$strip>>;
1413
1522
  }, z.core.$strip>, z.ZodObject<{
1414
- action: z.ZodLiteral<"declined">;
1523
+ action: z.ZodLiteral<"declined">;
1415
1524
  }, z.core.$strip>, z.ZodObject<{
1416
- action: z.ZodLiteral<"cancelled">;
1525
+ action: z.ZodLiteral<"cancelled">;
1417
1526
  }, z.core.$strip>]>;
1418
1527
  type HarnessV1QuestionsToolInput = z.infer<typeof harnessV1QuestionsToolInputSchema>;
1419
1528
  type HarnessV1QuestionsToolOutput = z.infer<typeof harnessV1QuestionsToolOutputSchema>;
1420
1529
  declare const harnessV1QuestionsTool: FunctionTool<HarnessV1QuestionsToolInput, HarnessV1QuestionsToolOutput>;
1421
1530
  type HarnessV1QuestionsTool = typeof harnessV1QuestionsTool;
1422
-
1531
+ //#endregion
1532
+ //#region src/v1/harness-v1-sandbox-provider.d.ts
1423
1533
  /**
1424
1534
  * Provider that produces network sandbox sessions for harness sessions. Lives at
1425
1535
  * module scope as a stable, synchronous object — analogous to
@@ -1428,126 +1538,131 @@ type HarnessV1QuestionsTool = typeof harnessV1QuestionsTool;
1428
1538
  */
1429
1539
  /** @deprecated Supply a sandbox session to `HarnessAgent.createSession()` instead. */
1430
1540
  interface HarnessV1SandboxProvider {
1431
- readonly specificationVersion: 'harness-sandbox-v1';
1432
- readonly providerId: string;
1541
+ readonly specificationVersion: 'harness-sandbox-v1';
1542
+ readonly providerId: string;
1543
+ /**
1544
+ * Providers should throw `HarnessSandboxAuthenticationError` when sandbox
1545
+ * acquisition fails because credentials are missing, invalid, or not
1546
+ * authorized. This lets framework integrations distinguish configuration
1547
+ * failures from general sandbox infrastructure errors.
1548
+ */
1549
+ readonly createSession: (options?: {
1550
+ /**
1551
+ * Stable per-session identifier. When supplied, the provider names the
1552
+ * underlying resource deterministically so a future call to `resume`
1553
+ * (potentially from a different process) can find the same sandbox.
1554
+ * Omitted from prewarm and other paths that don't need a resumable
1555
+ * resource — in that case the provider falls back to its native
1556
+ * auto-naming.
1557
+ */
1558
+ sessionId?: string;
1559
+ abortSignal?: AbortSignal;
1433
1560
  /**
1434
- * Providers should throw `HarnessSandboxAuthenticationError` when sandbox
1435
- * acquisition fails because credentials are missing, invalid, or not
1436
- * authorized. This lets framework integrations distinguish configuration
1437
- * failures from general sandbox infrastructure errors.
1561
+ * Stable identity for snapshot-based reuse. Providers that support
1562
+ * persistence/snapshots use this as part of the persistent sandbox
1563
+ * name; subsequent calls with the same identity resume from snapshot.
1564
+ *
1565
+ * Ignored when the provider is wrapping a caller-provided sandbox.
1438
1566
  */
1439
- readonly createSession: (options?: {
1440
- /**
1441
- * Stable per-session identifier. When supplied, the provider names the
1442
- * underlying resource deterministically so a future call to `resume`
1443
- * (potentially from a different process) can find the same sandbox.
1444
- * Omitted from prewarm and other paths that don't need a resumable
1445
- * resource — in that case the provider falls back to its native
1446
- * auto-naming.
1447
- */
1448
- sessionId?: string;
1449
- abortSignal?: AbortSignal;
1450
- /**
1451
- * Stable identity for snapshot-based reuse. Providers that support
1452
- * persistence/snapshots use this as part of the persistent sandbox
1453
- * name; subsequent calls with the same identity resume from snapshot.
1454
- *
1455
- * Ignored when the provider is wrapping a caller-provided sandbox.
1456
- */
1457
- identity?: string;
1458
- /**
1459
- * Called exactly once per identity, on fresh creation. Snapshot-capable
1460
- * providers wire this into the platform's one-time-setup hook so the
1461
- * side effects are baked into the snapshot. Providers without snapshot
1462
- * support run it immediately after fresh create.
1463
- *
1464
- * Not called when the provider is wrapping a caller-provided sandbox
1465
- * (the caller owns the sandbox; the framework applies its own
1466
- * idempotent bootstrap post-create instead).
1467
- */
1468
- onFirstCreate?: (session: Experimental_SandboxSession, opts: {
1469
- abortSignal?: AbortSignal;
1470
- }) => Promise<void>;
1471
- }) => PromiseLike<HarnessV1NetworkSandboxSession>;
1567
+ identity?: string;
1472
1568
  /**
1473
- * Reattach to an existing sandbox previously created with the same
1474
- * `sessionId`. Optional — providers that cannot rehydrate by id omit
1475
- * this; the harness throws
1476
- * `HarnessCapabilityUnsupportedError` when resume is attempted against
1477
- * them.
1569
+ * Called exactly once per identity, on fresh creation. Snapshot-capable
1570
+ * providers wire this into the platform's one-time-setup hook so the
1571
+ * side effects are baked into the snapshot. Providers without snapshot
1572
+ * support run it immediately after fresh create.
1478
1573
  *
1479
- * The provider derives the sandbox identifier from `sessionId` using the
1480
- * same deterministic naming scheme it used in `createSession`. Returns a
1481
- * network sandbox session bound to the existing resource.
1574
+ * Not called when the provider is wrapping a caller-provided sandbox
1575
+ * (the caller owns the sandbox; the framework applies its own
1576
+ * idempotent bootstrap post-create instead).
1482
1577
  */
1483
- readonly resumeSession?: (options: {
1484
- sessionId: string;
1485
- abortSignal?: AbortSignal;
1486
- }) => PromiseLike<HarnessV1NetworkSandboxSession>;
1578
+ onFirstCreate?: (session: Experimental_SandboxSession, opts: {
1579
+ abortSignal?: AbortSignal;
1580
+ }) => Promise<void>;
1581
+ }) => PromiseLike<HarnessV1NetworkSandboxSession>;
1582
+ /**
1583
+ * Reattach to an existing sandbox previously created with the same
1584
+ * `sessionId`. Optional — providers that cannot rehydrate by id omit
1585
+ * this; the harness throws
1586
+ * `HarnessCapabilityUnsupportedError` when resume is attempted against
1587
+ * them.
1588
+ *
1589
+ * The provider derives the sandbox identifier from `sessionId` using the
1590
+ * same deterministic naming scheme it used in `createSession`. Returns a
1591
+ * network sandbox session bound to the existing resource.
1592
+ */
1593
+ readonly resumeSession?: (options: {
1594
+ sessionId: string;
1595
+ abortSignal?: AbortSignal;
1596
+ }) => PromiseLike<HarnessV1NetworkSandboxSession>;
1487
1597
  }
1488
-
1598
+ //#endregion
1599
+ //#region src/v1/harness-v1-sandbox-template.d.ts
1489
1600
  type HarnessV1SandboxTemplate = {
1490
- readonly identity: string;
1491
- readonly prepare: (options: {
1492
- readonly session: Experimental_SandboxSession;
1493
- readonly abortSignal?: AbortSignal;
1494
- }) => Promise<void>;
1601
+ readonly identity: string;
1602
+ readonly prepare: (options: {
1603
+ readonly session: Experimental_SandboxSession;
1604
+ readonly abortSignal?: AbortSignal;
1605
+ }) => Promise<void>;
1495
1606
  };
1496
-
1607
+ //#endregion
1608
+ //#region src/v1/harness-v1-sandbox-session-create-options.d.ts
1497
1609
  type HarnessV1SandboxSessionCreateOptions<TProviderOptions extends object> = TProviderOptions & {
1498
- /**
1499
- * Manually assign the ID of a newly created sandbox session. Creation never
1500
- * looks up or resumes an existing session. An existing sandbox resource with
1501
- * the same ID is a creation conflict.
1502
- */
1503
- readonly sandboxId?: string;
1504
- readonly template?: HarnessV1SandboxTemplate;
1505
- readonly abortSignal?: AbortSignal;
1610
+ /**
1611
+ * Manually assign the ID of a newly created sandbox session. Creation never
1612
+ * looks up or resumes an existing session. An existing sandbox resource with
1613
+ * the same ID is a creation conflict.
1614
+ */
1615
+ readonly sandboxId?: string;
1616
+ readonly template?: HarnessV1SandboxTemplate;
1617
+ readonly abortSignal?: AbortSignal;
1506
1618
  };
1507
-
1619
+ //#endregion
1620
+ //#region src/v1/harness-v1-sandbox-session-resume-options.d.ts
1508
1621
  type HarnessV1SandboxSessionResumeOptions<TProviderOptions extends object> = TProviderOptions & {
1509
- /**
1510
- * ID of the existing sandbox session to reattach. Resume never creates a
1511
- * sandbox when the ID cannot be found.
1512
- */
1513
- readonly sandboxId: string;
1514
- readonly abortSignal?: AbortSignal;
1622
+ /**
1623
+ * ID of the existing sandbox session to reattach. Resume never creates a
1624
+ * sandbox when the ID cannot be found.
1625
+ */
1626
+ readonly sandboxId: string;
1627
+ readonly abortSignal?: AbortSignal;
1515
1628
  };
1516
-
1629
+ //#endregion
1630
+ //#region src/v1/harness-session-data-directory-path.d.ts
1517
1631
  /**
1518
1632
  * Return the per-session harness state path under `.agent-runs`. Session IDs
1519
1633
  * occupy one encoded path segment, so path separators and parent-directory
1520
1634
  * references cannot move session data outside the harness state directory.
1521
1635
  */
1522
- declare function harnessSessionDataDirectoryPath({ stateDirectory, sessionId, }: {
1523
- stateDirectory: string;
1524
- sessionId: string;
1636
+ export declare function harnessSessionDataDirectoryPath({ stateDirectory, sessionId }: {
1637
+ stateDirectory: string;
1638
+ sessionId: string;
1525
1639
  }): string;
1526
-
1640
+ //#endregion
1641
+ //#region src/v1/harness-v1-bridge-protocol.d.ts
1527
1642
  /**
1528
1643
  * The subset of a host-defined tool that travels on the `start` message. The
1529
1644
  * runtime only needs the name, description, and JSON-Schema input to surface
1530
1645
  * the tool; `execute` stays on the host.
1531
1646
  */
1532
- declare const harnessV1BridgeToolWireSchema: z.ZodObject<{
1533
- name: z.ZodString;
1534
- description: z.ZodOptional<z.ZodString>;
1535
- inputSchema: z.ZodOptional<z.ZodUnknown>;
1647
+ export declare const harnessV1BridgeToolWireSchema: z.ZodObject<{
1648
+ name: z.ZodString;
1649
+ description: z.ZodOptional<z.ZodString>;
1650
+ inputSchema: z.ZodOptional<z.ZodUnknown>;
1536
1651
  }, z.core.$strip>;
1537
1652
  type HarnessV1BridgeToolWire = z.infer<typeof harnessV1BridgeToolWireSchema>;
1538
- declare const harnessV1BridgePermissionModeSchema: z.ZodEnum<{
1539
- "allow-all": "allow-all";
1540
- "allow-reads": "allow-reads";
1541
- "allow-edits": "allow-edits";
1653
+ export declare const harnessV1BridgePermissionModeSchema: z.ZodEnum<{
1654
+ "allow-reads": "allow-reads";
1655
+ "allow-edits": "allow-edits";
1656
+ "allow-all": "allow-all";
1542
1657
  }>;
1543
- declare const harnessV1BridgeBuiltinToolFilteringSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1544
- mode: z.ZodLiteral<"allow">;
1545
- toolNames: z.ZodArray<z.ZodString>;
1658
+ export declare const harnessV1BridgeBuiltinToolFilteringSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1659
+ mode: z.ZodLiteral<"allow">;
1660
+ toolNames: z.ZodArray<z.ZodString>;
1546
1661
  }, z.core.$strip>, z.ZodObject<{
1547
- mode: z.ZodLiteral<"deny">;
1548
- toolNames: z.ZodArray<z.ZodString>;
1662
+ mode: z.ZodLiteral<"deny">;
1663
+ toolNames: z.ZodArray<z.ZodString>;
1549
1664
  }, z.core.$strip>]>;
1550
- declare const harnessV1BridgeResponseFormatSchema: z.ZodType<HarnessV1ResponseFormat>;
1665
+ export declare const harnessV1BridgeResponseFormatSchema: z.ZodType<HarnessV1ResponseFormat>;
1551
1666
  /**
1552
1667
  * Common fields of the inbound `start` message. Each adapter extends this with
1553
1668
  * its runtime-specific configuration (e.g. `thinking`/`continue` for Claude
@@ -1558,39 +1673,39 @@ declare const harnessV1BridgeResponseFormatSchema: z.ZodType<HarnessV1ResponseFo
1558
1673
  * a bridge concept, it just happens to ride the `start` frame for bridge-backed
1559
1674
  * adapters.
1560
1675
  */
1561
- declare const harnessV1BridgeStartBaseSchema: z.ZodObject<{
1562
- type: z.ZodLiteral<"start">;
1563
- prompt: z.ZodString;
1564
- tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
1565
- name: z.ZodString;
1566
- description: z.ZodOptional<z.ZodString>;
1567
- inputSchema: z.ZodOptional<z.ZodUnknown>;
1568
- }, z.core.$strip>>>;
1569
- model: z.ZodOptional<z.ZodString>;
1570
- debug: z.ZodOptional<z.ZodObject<{
1571
- enabled: z.ZodOptional<z.ZodBoolean>;
1572
- level: z.ZodOptional<z.ZodEnum<{
1573
- error: "error";
1574
- warn: "warn";
1575
- info: "info";
1576
- debug: "debug";
1577
- trace: "trace";
1578
- }>>;
1579
- subsystems: z.ZodOptional<z.ZodArray<z.ZodString>>;
1580
- }, z.core.$strip>>;
1581
- permissionMode: z.ZodOptional<z.ZodEnum<{
1582
- "allow-all": "allow-all";
1583
- "allow-reads": "allow-reads";
1584
- "allow-edits": "allow-edits";
1676
+ export declare const harnessV1BridgeStartBaseSchema: z.ZodObject<{
1677
+ type: z.ZodLiteral<"start">;
1678
+ prompt: z.ZodString;
1679
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
1680
+ name: z.ZodString;
1681
+ description: z.ZodOptional<z.ZodString>;
1682
+ inputSchema: z.ZodOptional<z.ZodUnknown>;
1683
+ }, z.core.$strip>>>;
1684
+ model: z.ZodOptional<z.ZodString>;
1685
+ debug: z.ZodOptional<z.ZodObject<{
1686
+ enabled: z.ZodOptional<z.ZodBoolean>;
1687
+ level: z.ZodOptional<z.ZodEnum<{
1688
+ error: "error";
1689
+ warn: "warn";
1690
+ info: "info";
1691
+ debug: "debug";
1692
+ trace: "trace";
1585
1693
  }>>;
1586
- builtinToolFiltering: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1587
- mode: z.ZodLiteral<"allow">;
1588
- toolNames: z.ZodArray<z.ZodString>;
1589
- }, z.core.$strip>, z.ZodObject<{
1590
- mode: z.ZodLiteral<"deny">;
1591
- toolNames: z.ZodArray<z.ZodString>;
1592
- }, z.core.$strip>]>>;
1593
- responseFormat: z.ZodOptional<z.ZodType<HarnessV1ResponseFormat, unknown, z.core.$ZodTypeInternals<HarnessV1ResponseFormat, unknown>>>;
1694
+ subsystems: z.ZodOptional<z.ZodArray<z.ZodString>>;
1695
+ }, z.core.$strip>>;
1696
+ permissionMode: z.ZodOptional<z.ZodEnum<{
1697
+ "allow-reads": "allow-reads";
1698
+ "allow-edits": "allow-edits";
1699
+ "allow-all": "allow-all";
1700
+ }>>;
1701
+ builtinToolFiltering: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
1702
+ mode: z.ZodLiteral<"allow">;
1703
+ toolNames: z.ZodArray<z.ZodString>;
1704
+ }, z.core.$strip>, z.ZodObject<{
1705
+ mode: z.ZodLiteral<"deny">;
1706
+ toolNames: z.ZodArray<z.ZodString>;
1707
+ }, z.core.$strip>]>>;
1708
+ responseFormat: z.ZodOptional<z.ZodType<HarnessV1ResponseFormat, unknown, z.core.$ZodTypeInternals<HarnessV1ResponseFormat, unknown>>>;
1594
1709
  }, z.core.$strip>;
1595
1710
  /**
1596
1711
  * Sent the instant the bridge accepts an authenticated WS connection. The host
@@ -1599,230 +1714,230 @@ declare const harnessV1BridgeStartBaseSchema: z.ZodObject<{
1599
1714
  * the bridge process — anything sent in that gap is dropped. Carries the
1600
1715
  * bridge's lifecycle `state` and highest emitted `seq` for reconnect.
1601
1716
  */
1602
- declare const harnessV1BridgeHelloSchema: z.ZodObject<{
1603
- type: z.ZodLiteral<"bridge-hello">;
1604
- state: z.ZodOptional<z.ZodString>;
1605
- lastSeq: z.ZodOptional<z.ZodNumber>;
1606
- capabilities: z.ZodOptional<z.ZodObject<{
1607
- experimental_userMessageResponses: z.ZodOptional<z.ZodBoolean>;
1608
- }, z.core.$strip>>;
1717
+ export declare const harnessV1BridgeHelloSchema: z.ZodObject<{
1718
+ type: z.ZodLiteral<"bridge-hello">;
1719
+ state: z.ZodOptional<z.ZodString>;
1720
+ lastSeq: z.ZodOptional<z.ZodNumber>;
1721
+ capabilities: z.ZodOptional<z.ZodObject<{
1722
+ experimental_userMessageResponses: z.ZodOptional<z.ZodBoolean>;
1723
+ }, z.core.$strip>>;
1609
1724
  }, z.core.$strip>;
1610
- declare const experimental_harnessV1BridgeUserMessageResponseSchema: z.ZodObject<{
1611
- type: z.ZodLiteral<"user-message-response">;
1612
- messageId: z.ZodString;
1613
- accepted: z.ZodBoolean;
1614
- error: z.ZodOptional<z.ZodObject<{
1615
- message: z.ZodString;
1616
- }, z.core.$strip>>;
1725
+ export declare const experimental_harnessV1BridgeUserMessageResponseSchema: z.ZodObject<{
1726
+ type: z.ZodLiteral<"user-message-response">;
1727
+ messageId: z.ZodString;
1728
+ accepted: z.ZodBoolean;
1729
+ error: z.ZodOptional<z.ZodObject<{
1730
+ message: z.ZodString;
1731
+ }, z.core.$strip>>;
1617
1732
  }, z.core.$strip>;
1618
1733
  /**
1619
1734
  * The bridge's reply to an inbound `stop`. Carries the adapter-specific
1620
1735
  * payload the host serializes into lifecycle state `data`.
1621
1736
  */
1622
- declare const harnessV1BridgeStopSchema: z.ZodObject<{
1623
- type: z.ZodLiteral<"bridge-stop">;
1624
- data: z.ZodUnknown;
1737
+ export declare const harnessV1BridgeStopSchema: z.ZodObject<{
1738
+ type: z.ZodLiteral<"bridge-stop">;
1739
+ data: z.ZodUnknown;
1625
1740
  }, z.core.$strip>;
1626
1741
  /**
1627
1742
  * A resume coordinate the bridge proactively announces (e.g. Codex's thread id)
1628
1743
  * so the host can cache it for a later resume without waiting for `stop`.
1629
1744
  */
1630
- declare const harnessV1BridgeThreadSchema: z.ZodObject<{
1631
- type: z.ZodLiteral<"bridge-thread">;
1632
- threadId: z.ZodString;
1745
+ export declare const harnessV1BridgeThreadSchema: z.ZodObject<{
1746
+ type: z.ZodLiteral<"bridge-thread">;
1747
+ threadId: z.ZodString;
1633
1748
  }, z.core.$strip>;
1634
1749
  /**
1635
1750
  * One captured console line from inside the sandbox. The bridge line-buffers
1636
1751
  * `process.stdout`/`process.stderr` and emits one of these per complete line.
1637
1752
  * Routed host-side to the diagnostics sink, never to the consumer stream.
1638
1753
  */
1639
- declare const harnessV1BridgeSandboxLogSchema: z.ZodObject<{
1640
- type: z.ZodLiteral<"sandbox-log">;
1641
- source: z.ZodString;
1642
- stream: z.ZodEnum<{
1643
- stdout: "stdout";
1644
- stderr: "stderr";
1645
- }>;
1646
- line: z.ZodString;
1754
+ export declare const harnessV1BridgeSandboxLogSchema: z.ZodObject<{
1755
+ type: z.ZodLiteral<"sandbox-log">;
1756
+ source: z.ZodString;
1757
+ stream: z.ZodEnum<{
1758
+ stdout: "stdout";
1759
+ stderr: "stderr";
1760
+ }>;
1761
+ line: z.ZodString;
1647
1762
  }, z.core.$strip>;
1648
1763
  /**
1649
1764
  * A structured diagnostic an adapter emits from inside the bridge via
1650
1765
  * `turn.bridgeLog(...)`. Gated by the session's debug level + subsystem filter.
1651
1766
  */
1652
- declare const harnessV1BridgeDebugEventSchema: z.ZodObject<{
1653
- type: z.ZodLiteral<"debug-event">;
1654
- level: z.ZodEnum<{
1655
- error: "error";
1656
- warn: "warn";
1657
- info: "info";
1658
- debug: "debug";
1659
- trace: "trace";
1660
- }>;
1661
- subsystem: z.ZodString;
1767
+ export declare const harnessV1BridgeDebugEventSchema: z.ZodObject<{
1768
+ type: z.ZodLiteral<"debug-event">;
1769
+ level: z.ZodEnum<{
1770
+ error: "error";
1771
+ warn: "warn";
1772
+ info: "info";
1773
+ debug: "debug";
1774
+ trace: "trace";
1775
+ }>;
1776
+ subsystem: z.ZodString;
1777
+ message: z.ZodString;
1778
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1779
+ error: z.ZodOptional<z.ZodObject<{
1780
+ name: z.ZodOptional<z.ZodString>;
1662
1781
  message: z.ZodString;
1663
- attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1664
- error: z.ZodOptional<z.ZodObject<{
1665
- name: z.ZodOptional<z.ZodString>;
1666
- message: z.ZodString;
1667
- stack: z.ZodOptional<z.ZodString>;
1668
- }, z.core.$strip>>;
1782
+ stack: z.ZodOptional<z.ZodString>;
1783
+ }, z.core.$strip>>;
1669
1784
  }, z.core.$strip>;
1670
1785
  /**
1671
1786
  * Every frame a bridge can send to the host: the stream-part events plus the
1672
1787
  * transport/control frames. This is the schema the host `SandboxChannel`
1673
1788
  * validates inbound frames against.
1674
1789
  */
1675
- declare const harnessV1BridgeOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1676
- type: z.ZodLiteral<"stream-start">;
1677
- warnings: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<HarnessV1CallWarning, unknown, z.core.$ZodTypeInternals<HarnessV1CallWarning, unknown>>>>>;
1678
- modelId: z.ZodOptional<z.ZodString>;
1790
+ export declare const harnessV1BridgeOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1791
+ type: z.ZodLiteral<"stream-start">;
1792
+ warnings: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<HarnessV1CallWarning, unknown, z.core.$ZodTypeInternals<HarnessV1CallWarning, unknown>>>>>;
1793
+ modelId: z.ZodOptional<z.ZodString>;
1679
1794
  }, z.core.$strip>, z.ZodObject<{
1680
- type: z.ZodLiteral<"text-start">;
1681
- id: z.ZodString;
1682
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1795
+ type: z.ZodLiteral<"text-start">;
1796
+ id: z.ZodString;
1797
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1683
1798
  }, z.core.$strip>, z.ZodObject<{
1684
- type: z.ZodLiteral<"text-delta">;
1685
- id: z.ZodString;
1686
- delta: z.ZodString;
1687
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1799
+ type: z.ZodLiteral<"text-delta">;
1800
+ id: z.ZodString;
1801
+ delta: z.ZodString;
1802
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1688
1803
  }, z.core.$strip>, z.ZodObject<{
1689
- type: z.ZodLiteral<"text-end">;
1690
- id: z.ZodString;
1691
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1804
+ type: z.ZodLiteral<"text-end">;
1805
+ id: z.ZodString;
1806
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1692
1807
  }, z.core.$strip>, z.ZodObject<{
1693
- type: z.ZodLiteral<"reasoning-start">;
1694
- id: z.ZodString;
1695
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1808
+ type: z.ZodLiteral<"reasoning-start">;
1809
+ id: z.ZodString;
1810
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1696
1811
  }, z.core.$strip>, z.ZodObject<{
1697
- type: z.ZodLiteral<"reasoning-delta">;
1698
- id: z.ZodString;
1699
- delta: z.ZodString;
1700
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1812
+ type: z.ZodLiteral<"reasoning-delta">;
1813
+ id: z.ZodString;
1814
+ delta: z.ZodString;
1815
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1701
1816
  }, z.core.$strip>, z.ZodObject<{
1702
- type: z.ZodLiteral<"reasoning-end">;
1703
- id: z.ZodString;
1704
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1817
+ type: z.ZodLiteral<"reasoning-end">;
1818
+ id: z.ZodString;
1819
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1705
1820
  }, z.core.$strip>, z.ZodObject<{
1706
- type: z.ZodLiteral<"tool-input-start">;
1707
- id: z.ZodString;
1708
- toolName: z.ZodString;
1709
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV4ProviderMetadata, unknown>>>;
1710
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1711
- dynamic: z.ZodOptional<z.ZodBoolean>;
1712
- title: z.ZodOptional<z.ZodString>;
1821
+ type: z.ZodLiteral<"tool-input-start">;
1822
+ id: z.ZodString;
1823
+ toolName: z.ZodString;
1824
+ providerMetadata: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown>>>;
1825
+ providerExecuted: z.ZodOptional<z.ZodBoolean>;
1826
+ dynamic: z.ZodOptional<z.ZodBoolean>;
1827
+ title: z.ZodOptional<z.ZodString>;
1713
1828
  }, z.core.$strip>, z.ZodObject<{
1714
- type: z.ZodLiteral<"tool-input-delta">;
1715
- id: z.ZodString;
1716
- delta: z.ZodString;
1717
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV4ProviderMetadata, unknown>>>;
1829
+ type: z.ZodLiteral<"tool-input-delta">;
1830
+ id: z.ZodString;
1831
+ delta: z.ZodString;
1832
+ providerMetadata: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown>>>;
1718
1833
  }, z.core.$strip>, z.ZodObject<{
1719
- type: z.ZodLiteral<"tool-input-end">;
1720
- id: z.ZodString;
1721
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV4ProviderMetadata, unknown>>>;
1834
+ type: z.ZodLiteral<"tool-input-end">;
1835
+ id: z.ZodString;
1836
+ providerMetadata: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown>>>;
1722
1837
  }, z.core.$strip>, z.ZodObject<{
1723
- type: z.ZodLiteral<"tool-call">;
1724
- toolCallId: z.ZodString;
1725
- toolName: z.ZodString;
1726
- input: z.ZodString;
1727
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1728
- dynamic: z.ZodOptional<z.ZodBoolean>;
1729
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV4ProviderMetadata, unknown>>>;
1730
- nativeName: z.ZodOptional<z.ZodString>;
1731
- stepToolCallCount: z.ZodOptional<z.ZodNumber>;
1838
+ type: z.ZodLiteral<"tool-call">;
1839
+ toolCallId: z.ZodString;
1840
+ toolName: z.ZodString;
1841
+ input: z.ZodString;
1842
+ providerExecuted: z.ZodOptional<z.ZodBoolean>;
1843
+ dynamic: z.ZodOptional<z.ZodBoolean>;
1844
+ providerMetadata: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown>>>;
1845
+ nativeName: z.ZodOptional<z.ZodString>;
1846
+ stepToolCallCount: z.ZodOptional<z.ZodNumber>;
1732
1847
  }, z.core.$strip>, z.ZodObject<{
1733
- type: z.ZodLiteral<"tool-approval-request">;
1734
- approvalId: z.ZodString;
1735
- toolCallId: z.ZodString;
1736
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV4ProviderMetadata, unknown>>>;
1848
+ type: z.ZodLiteral<"tool-approval-request">;
1849
+ approvalId: z.ZodString;
1850
+ toolCallId: z.ZodString;
1851
+ providerMetadata: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown>>>;
1737
1852
  }, z.core.$strip>, z.ZodObject<{
1738
- type: z.ZodLiteral<"tool-result">;
1739
- toolCallId: z.ZodString;
1740
- toolName: z.ZodString;
1741
- result: z.ZodType<NonNullable<_ai_sdk_provider.JSONValue>, unknown, z.core.$ZodTypeInternals<NonNullable<_ai_sdk_provider.JSONValue>, unknown>>;
1742
- isError: z.ZodOptional<z.ZodBoolean>;
1743
- preliminary: z.ZodOptional<z.ZodBoolean>;
1744
- dynamic: z.ZodOptional<z.ZodBoolean>;
1745
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV4ProviderMetadata, unknown>>>;
1853
+ type: z.ZodLiteral<"tool-result">;
1854
+ toolCallId: z.ZodString;
1855
+ toolName: z.ZodString;
1856
+ result: z.ZodType<NonNullable<import("@ai-sdk/provider").JSONValue>, unknown, z.core.$ZodTypeInternals<NonNullable<import("@ai-sdk/provider").JSONValue>, unknown>>;
1857
+ isError: z.ZodOptional<z.ZodBoolean>;
1858
+ preliminary: z.ZodOptional<z.ZodBoolean>;
1859
+ dynamic: z.ZodOptional<z.ZodBoolean>;
1860
+ providerMetadata: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV4ProviderMetadata, unknown>>>;
1746
1861
  }, z.core.$strip>, z.ZodObject<{
1747
- type: z.ZodLiteral<"finish-step">;
1748
- finishReason: z.ZodType<_ai_sdk_provider.LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.LanguageModelV4FinishReason, unknown>>;
1749
- usage: z.ZodType<_ai_sdk_provider.LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.LanguageModelV4Usage, unknown>>;
1750
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1862
+ type: z.ZodLiteral<"finish-step">;
1863
+ finishReason: z.ZodType<import("@ai-sdk/provider").LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").LanguageModelV4FinishReason, unknown>>;
1864
+ usage: z.ZodType<import("@ai-sdk/provider").LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").LanguageModelV4Usage, unknown>>;
1865
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1751
1866
  }, z.core.$strip>, z.ZodObject<{
1752
- type: z.ZodLiteral<"finish">;
1753
- finishReason: z.ZodType<_ai_sdk_provider.LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.LanguageModelV4FinishReason, unknown>>;
1754
- totalUsage: z.ZodType<_ai_sdk_provider.LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.LanguageModelV4Usage, unknown>>;
1755
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1867
+ type: z.ZodLiteral<"finish">;
1868
+ finishReason: z.ZodType<import("@ai-sdk/provider").LanguageModelV4FinishReason, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").LanguageModelV4FinishReason, unknown>>;
1869
+ totalUsage: z.ZodType<import("@ai-sdk/provider").LanguageModelV4Usage, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").LanguageModelV4Usage, unknown>>;
1870
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1756
1871
  }, z.core.$strip>, z.ZodObject<{
1757
- type: z.ZodLiteral<"file-change">;
1758
- event: z.ZodEnum<{
1759
- create: "create";
1760
- modify: "modify";
1761
- delete: "delete";
1762
- }>;
1763
- path: z.ZodString;
1764
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1872
+ type: z.ZodLiteral<"file-change">;
1873
+ event: z.ZodEnum<{
1874
+ create: "create";
1875
+ modify: "modify";
1876
+ delete: "delete";
1877
+ }>;
1878
+ path: z.ZodString;
1879
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1765
1880
  }, z.core.$strip>, z.ZodObject<{
1766
- type: z.ZodLiteral<"compaction">;
1767
- trigger: z.ZodEnum<{
1768
- manual: "manual";
1769
- auto: "auto";
1770
- }>;
1771
- summary: z.ZodString;
1772
- tokensBefore: z.ZodOptional<z.ZodNumber>;
1773
- tokensAfter: z.ZodOptional<z.ZodNumber>;
1774
- harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1881
+ type: z.ZodLiteral<"compaction">;
1882
+ trigger: z.ZodEnum<{
1883
+ manual: "manual";
1884
+ auto: "auto";
1885
+ }>;
1886
+ summary: z.ZodString;
1887
+ tokensBefore: z.ZodOptional<z.ZodNumber>;
1888
+ tokensAfter: z.ZodOptional<z.ZodNumber>;
1889
+ harnessMetadata: z.ZodOptional<z.ZodType<HarnessV1Metadata, unknown, z.core.$ZodTypeInternals<HarnessV1Metadata, unknown>>>;
1775
1890
  }, z.core.$strip>, z.ZodObject<{
1776
- type: z.ZodLiteral<"error">;
1777
- error: z.ZodUnknown;
1891
+ type: z.ZodLiteral<"error">;
1892
+ error: z.ZodUnknown;
1778
1893
  }, z.core.$strip>, z.ZodObject<{
1779
- type: z.ZodLiteral<"raw">;
1780
- rawValue: z.ZodUnknown;
1894
+ type: z.ZodLiteral<"raw">;
1895
+ rawValue: z.ZodUnknown;
1781
1896
  }, z.core.$strip>, z.ZodObject<{
1782
- type: z.ZodLiteral<"bridge-hello">;
1783
- state: z.ZodOptional<z.ZodString>;
1784
- lastSeq: z.ZodOptional<z.ZodNumber>;
1785
- capabilities: z.ZodOptional<z.ZodObject<{
1786
- experimental_userMessageResponses: z.ZodOptional<z.ZodBoolean>;
1787
- }, z.core.$strip>>;
1897
+ type: z.ZodLiteral<"bridge-hello">;
1898
+ state: z.ZodOptional<z.ZodString>;
1899
+ lastSeq: z.ZodOptional<z.ZodNumber>;
1900
+ capabilities: z.ZodOptional<z.ZodObject<{
1901
+ experimental_userMessageResponses: z.ZodOptional<z.ZodBoolean>;
1902
+ }, z.core.$strip>>;
1788
1903
  }, z.core.$strip>, z.ZodObject<{
1789
- type: z.ZodLiteral<"user-message-response">;
1790
- messageId: z.ZodString;
1791
- accepted: z.ZodBoolean;
1792
- error: z.ZodOptional<z.ZodObject<{
1793
- message: z.ZodString;
1794
- }, z.core.$strip>>;
1904
+ type: z.ZodLiteral<"user-message-response">;
1905
+ messageId: z.ZodString;
1906
+ accepted: z.ZodBoolean;
1907
+ error: z.ZodOptional<z.ZodObject<{
1908
+ message: z.ZodString;
1909
+ }, z.core.$strip>>;
1795
1910
  }, z.core.$strip>, z.ZodObject<{
1796
- type: z.ZodLiteral<"bridge-stop">;
1797
- data: z.ZodUnknown;
1911
+ type: z.ZodLiteral<"bridge-stop">;
1912
+ data: z.ZodUnknown;
1798
1913
  }, z.core.$strip>, z.ZodObject<{
1799
- type: z.ZodLiteral<"bridge-thread">;
1800
- threadId: z.ZodString;
1914
+ type: z.ZodLiteral<"bridge-thread">;
1915
+ threadId: z.ZodString;
1801
1916
  }, z.core.$strip>, z.ZodObject<{
1802
- type: z.ZodLiteral<"sandbox-log">;
1803
- source: z.ZodString;
1804
- stream: z.ZodEnum<{
1805
- stdout: "stdout";
1806
- stderr: "stderr";
1807
- }>;
1808
- line: z.ZodString;
1917
+ type: z.ZodLiteral<"sandbox-log">;
1918
+ source: z.ZodString;
1919
+ stream: z.ZodEnum<{
1920
+ stdout: "stdout";
1921
+ stderr: "stderr";
1922
+ }>;
1923
+ line: z.ZodString;
1809
1924
  }, z.core.$strip>, z.ZodObject<{
1810
- type: z.ZodLiteral<"debug-event">;
1811
- level: z.ZodEnum<{
1812
- error: "error";
1813
- warn: "warn";
1814
- info: "info";
1815
- debug: "debug";
1816
- trace: "trace";
1817
- }>;
1818
- subsystem: z.ZodString;
1925
+ type: z.ZodLiteral<"debug-event">;
1926
+ level: z.ZodEnum<{
1927
+ error: "error";
1928
+ warn: "warn";
1929
+ info: "info";
1930
+ debug: "debug";
1931
+ trace: "trace";
1932
+ }>;
1933
+ subsystem: z.ZodString;
1934
+ message: z.ZodString;
1935
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1936
+ error: z.ZodOptional<z.ZodObject<{
1937
+ name: z.ZodOptional<z.ZodString>;
1819
1938
  message: z.ZodString;
1820
- attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1821
- error: z.ZodOptional<z.ZodObject<{
1822
- name: z.ZodOptional<z.ZodString>;
1823
- message: z.ZodString;
1824
- stack: z.ZodOptional<z.ZodString>;
1825
- }, z.core.$strip>>;
1939
+ stack: z.ZodOptional<z.ZodString>;
1940
+ }, z.core.$strip>>;
1826
1941
  }, z.core.$strip>]>;
1827
1942
  type HarnessV1BridgeOutboundMessage = z.infer<typeof harnessV1BridgeOutboundMessageSchema>;
1828
1943
  type Experimental_HarnessV1BridgeUserMessageResponse = z.infer<typeof experimental_harnessV1BridgeUserMessageResponseSchema>;
@@ -1835,110 +1950,112 @@ type HarnessV1BridgeDebugEvent = z.infer<typeof harnessV1BridgeDebugEventSchema>
1835
1950
  * its fields through. This is the seam where the bridge's serialization is
1836
1951
  * lifted into the general emission shape every harness shares.
1837
1952
  */
1838
- declare function harnessV1DiagnosticFromBridgeFrame(frame: HarnessV1BridgeSandboxLog | HarnessV1BridgeDebugEvent, context: {
1839
- sessionId?: string;
1840
- timestamp: number;
1953
+ export declare function harnessV1DiagnosticFromBridgeFrame(frame: HarnessV1BridgeSandboxLog | HarnessV1BridgeDebugEvent, context: {
1954
+ sessionId?: string;
1955
+ timestamp: number;
1841
1956
  }): HarnessV1Diagnostic;
1842
- declare const harnessV1BridgeToolResultInboundSchema: z.ZodObject<{
1843
- type: z.ZodLiteral<"tool-result">;
1844
- toolCallId: z.ZodString;
1845
- output: z.ZodUnknown;
1846
- isError: z.ZodOptional<z.ZodBoolean>;
1847
- toolResult: z.ZodOptional<z.ZodUnknown>;
1957
+ export declare const harnessV1BridgeToolResultInboundSchema: z.ZodObject<{
1958
+ type: z.ZodLiteral<"tool-result">;
1959
+ toolCallId: z.ZodString;
1960
+ output: z.ZodUnknown;
1961
+ isError: z.ZodOptional<z.ZodBoolean>;
1962
+ toolResult: z.ZodOptional<z.ZodUnknown>;
1848
1963
  }, z.core.$strip>;
1849
- declare const harnessV1BridgeToolApprovalResponseInboundSchema: z.ZodObject<{
1850
- type: z.ZodLiteral<"tool-approval-response">;
1851
- approvalId: z.ZodString;
1852
- approved: z.ZodBoolean;
1853
- reason: z.ZodOptional<z.ZodString>;
1964
+ export declare const harnessV1BridgeToolApprovalResponseInboundSchema: z.ZodObject<{
1965
+ type: z.ZodLiteral<"tool-approval-response">;
1966
+ approvalId: z.ZodString;
1967
+ approved: z.ZodBoolean;
1968
+ reason: z.ZodOptional<z.ZodString>;
1854
1969
  }, z.core.$strip>;
1855
- declare const harnessV1BridgeUserMessageInboundSchema: z.ZodObject<{
1856
- type: z.ZodLiteral<"user-message">;
1857
- messageId: z.ZodOptional<z.ZodString>;
1858
- text: z.ZodString;
1970
+ export declare const harnessV1BridgeUserMessageInboundSchema: z.ZodObject<{
1971
+ type: z.ZodLiteral<"user-message">;
1972
+ messageId: z.ZodOptional<z.ZodString>;
1973
+ text: z.ZodString;
1859
1974
  }, z.core.$strip>;
1860
- declare const experimental_harnessV1BridgeUserMessageInboundSchema: z.ZodObject<{
1861
- type: z.ZodLiteral<"user-message">;
1862
- text: z.ZodString;
1863
- messageId: z.ZodString;
1975
+ export declare const experimental_harnessV1BridgeUserMessageInboundSchema: z.ZodObject<{
1976
+ type: z.ZodLiteral<"user-message">;
1977
+ text: z.ZodString;
1978
+ messageId: z.ZodString;
1864
1979
  }, z.core.$strip>;
1865
- declare const harnessV1BridgeAbortInboundSchema: z.ZodObject<{
1866
- type: z.ZodLiteral<"abort">;
1980
+ export declare const harnessV1BridgeAbortInboundSchema: z.ZodObject<{
1981
+ type: z.ZodLiteral<"abort">;
1867
1982
  }, z.core.$strip>;
1868
- declare const harnessV1BridgeDestroyInboundSchema: z.ZodObject<{
1869
- type: z.ZodLiteral<"destroy">;
1983
+ export declare const harnessV1BridgeDestroyInboundSchema: z.ZodObject<{
1984
+ type: z.ZodLiteral<"destroy">;
1870
1985
  }, z.core.$strip>;
1871
1986
  /**
1872
1987
  * Reconnect: after re-establishing the socket the host asks the bridge to
1873
1988
  * replay every buffered event with `seq > lastSeenEventId`.
1874
1989
  */
1875
- declare const harnessV1BridgeResumeInboundSchema: z.ZodObject<{
1876
- type: z.ZodLiteral<"resume">;
1877
- lastSeenEventId: z.ZodNumber;
1990
+ export declare const harnessV1BridgeResumeInboundSchema: z.ZodObject<{
1991
+ type: z.ZodLiteral<"resume">;
1992
+ lastSeenEventId: z.ZodNumber;
1878
1993
  }, z.core.$strip>;
1879
1994
  /**
1880
1995
  * The bridge replies with `bridge-stop` carrying any runtime resume data,
1881
1996
  * then exits.
1882
1997
  */
1883
- declare const harnessV1BridgeStopInboundSchema: z.ZodObject<{
1884
- type: z.ZodLiteral<"stop">;
1998
+ export declare const harnessV1BridgeStopInboundSchema: z.ZodObject<{
1999
+ type: z.ZodLiteral<"stop">;
1885
2000
  }, z.core.$strip>;
1886
2001
  /**
1887
2002
  * The inbound command members shared by every bridge adapter. Spread these
1888
2003
  * alongside the adapter's own `start` schema to build the final inbound union:
1889
2004
  * `z.discriminatedUnion('type', [adapterStartSchema, ...harnessV1BridgeInboundCommandSchemas])`.
1890
2005
  */
1891
- declare const harnessV1BridgeInboundCommandSchemas: readonly [z.ZodObject<{
1892
- type: z.ZodLiteral<"tool-result">;
1893
- toolCallId: z.ZodString;
1894
- output: z.ZodUnknown;
1895
- isError: z.ZodOptional<z.ZodBoolean>;
1896
- toolResult: z.ZodOptional<z.ZodUnknown>;
2006
+ export declare const harnessV1BridgeInboundCommandSchemas: readonly [z.ZodObject<{
2007
+ type: z.ZodLiteral<"tool-result">;
2008
+ toolCallId: z.ZodString;
2009
+ output: z.ZodUnknown;
2010
+ isError: z.ZodOptional<z.ZodBoolean>;
2011
+ toolResult: z.ZodOptional<z.ZodUnknown>;
1897
2012
  }, z.core.$strip>, z.ZodObject<{
1898
- type: z.ZodLiteral<"tool-approval-response">;
1899
- approvalId: z.ZodString;
1900
- approved: z.ZodBoolean;
1901
- reason: z.ZodOptional<z.ZodString>;
2013
+ type: z.ZodLiteral<"tool-approval-response">;
2014
+ approvalId: z.ZodString;
2015
+ approved: z.ZodBoolean;
2016
+ reason: z.ZodOptional<z.ZodString>;
1902
2017
  }, z.core.$strip>, z.ZodObject<{
1903
- type: z.ZodLiteral<"user-message">;
1904
- messageId: z.ZodOptional<z.ZodString>;
1905
- text: z.ZodString;
2018
+ type: z.ZodLiteral<"user-message">;
2019
+ messageId: z.ZodOptional<z.ZodString>;
2020
+ text: z.ZodString;
1906
2021
  }, z.core.$strip>, z.ZodObject<{
1907
- type: z.ZodLiteral<"abort">;
2022
+ type: z.ZodLiteral<"abort">;
1908
2023
  }, z.core.$strip>, z.ZodObject<{
1909
- type: z.ZodLiteral<"destroy">;
2024
+ type: z.ZodLiteral<"destroy">;
1910
2025
  }, z.core.$strip>, z.ZodObject<{
1911
- type: z.ZodLiteral<"resume">;
1912
- lastSeenEventId: z.ZodNumber;
2026
+ type: z.ZodLiteral<"resume">;
2027
+ lastSeenEventId: z.ZodNumber;
1913
2028
  }, z.core.$strip>, z.ZodObject<{
1914
- type: z.ZodLiteral<"stop">;
2029
+ type: z.ZodLiteral<"stop">;
1915
2030
  }, z.core.$strip>];
1916
2031
  /**
1917
2032
  * The JSON line the bridge writes to stdout once its WebSocket server is bound,
1918
2033
  * announcing the port the host should connect to.
1919
2034
  */
1920
- declare const harnessV1BridgeReadySchema: z.ZodObject<{
1921
- type: z.ZodLiteral<"bridge-ready">;
1922
- port: z.ZodNumber;
2035
+ export declare const harnessV1BridgeReadySchema: z.ZodObject<{
2036
+ type: z.ZodLiteral<"bridge-ready">;
2037
+ port: z.ZodNumber;
1923
2038
  }, z.core.$strip>;
1924
2039
  type HarnessV1BridgeReady = z.infer<typeof harnessV1BridgeReadySchema>;
1925
-
1926
- declare const symbol$2: unique symbol;
2040
+ //#endregion
2041
+ //#region src/errors/harness-error.d.ts
2042
+ declare const symbol$3: unique symbol;
1927
2043
  /**
1928
2044
  * Base error type for failures originating in or signalled by a harness
1929
2045
  * adapter. Specific failure modes (e.g. unsupported capability) extend this
1930
2046
  * class.
1931
2047
  */
1932
- declare class HarnessError extends AISDKError {
1933
- private readonly [symbol$2];
1934
- constructor({ message, cause }: {
1935
- message: string;
1936
- cause?: unknown;
1937
- });
1938
- static isInstance(error: unknown): error is HarnessError;
2048
+ export declare class HarnessError extends AISDKError {
2049
+ private readonly [symbol$3];
2050
+ constructor({ message, cause }: {
2051
+ message: string;
2052
+ cause?: unknown;
2053
+ });
2054
+ static isInstance(error: unknown): error is HarnessError;
1939
2055
  }
1940
-
1941
- declare const symbol$1: unique symbol;
2056
+ //#endregion
2057
+ //#region src/errors/harness-capability-unsupported-error.d.ts
2058
+ declare const symbol$2: unique symbol;
1942
2059
  /**
1943
2060
  * Thrown when a caller asks the harness to do something the adapter (or the
1944
2061
  * supplied sandbox) does not support, e.g. requesting manual compaction from
@@ -1948,17 +2065,42 @@ declare const symbol$1: unique symbol;
1948
2065
  * The caller supplies the full human-readable message. Optional `harnessId`
1949
2066
  * is recorded as structured context for tooling.
1950
2067
  */
1951
- declare class HarnessCapabilityUnsupportedError extends HarnessError {
1952
- private readonly [symbol$1];
1953
- readonly harnessId?: string;
1954
- constructor({ message, harnessId, cause, }: {
1955
- message: string;
1956
- harnessId?: string;
1957
- cause?: unknown;
1958
- });
1959
- static isInstance(error: unknown): error is HarnessCapabilityUnsupportedError;
2068
+ export declare class HarnessCapabilityUnsupportedError extends HarnessError {
2069
+ private readonly [symbol$2];
2070
+ readonly harnessId?: string;
2071
+ constructor({ message, harnessId, cause }: {
2072
+ message: string;
2073
+ harnessId?: string;
2074
+ cause?: unknown;
2075
+ });
2076
+ static isInstance(error: unknown): error is HarnessCapabilityUnsupportedError;
2077
+ }
2078
+ //#endregion
2079
+ //#region src/errors/harness-history-unavailable-error.d.ts
2080
+ declare const symbol$1: unique symbol;
2081
+ /**
2082
+ * Thrown by `readHistory` when the adapter supports history reads but cannot
2083
+ * reach the runtime's store from the current environment — for example the
2084
+ * store lives inside a remote sandbox, or the transcript directory is
2085
+ * missing or unreadable.
2086
+ *
2087
+ * Distinct from `HarnessCapabilityUnsupportedError` (the adapter does not
2088
+ * implement history reads at all) so hosts can retry or degrade differently.
2089
+ * A conversation with no recorded messages yet is not an error; it resolves
2090
+ * to an empty result instead.
2091
+ */
2092
+ export declare class HarnessHistoryUnavailableError extends HarnessError {
2093
+ private readonly [symbol$1];
2094
+ readonly harnessId?: string;
2095
+ constructor({ message, harnessId, cause }: {
2096
+ message: string;
2097
+ harnessId?: string;
2098
+ cause?: unknown;
2099
+ });
2100
+ static isInstance(error: unknown): error is HarnessHistoryUnavailableError;
1960
2101
  }
1961
-
2102
+ //#endregion
2103
+ //#region src/errors/harness-sandbox-authentication-error.d.ts
1962
2104
  declare const symbol: unique symbol;
1963
2105
  /**
1964
2106
  * Thrown when a sandbox provider cannot authenticate or authorize the
@@ -1966,15 +2108,16 @@ declare const symbol: unique symbol;
1966
2108
  * preserve the underlying SDK failure as `cause` and supply a message that
1967
2109
  * explains how the consumer can configure credentials.
1968
2110
  */
1969
- declare class HarnessSandboxAuthenticationError extends HarnessError {
1970
- private readonly [symbol];
1971
- readonly sandboxProviderId: string;
1972
- constructor({ message, sandboxProviderId, cause, }: {
1973
- message: string;
1974
- sandboxProviderId: string;
1975
- cause?: unknown;
1976
- });
1977
- static isInstance(error: unknown): error is HarnessSandboxAuthenticationError;
2111
+ export declare class HarnessSandboxAuthenticationError extends HarnessError {
2112
+ private readonly [symbol];
2113
+ readonly sandboxProviderId: string;
2114
+ constructor({ message, sandboxProviderId, cause }: {
2115
+ message: string;
2116
+ sandboxProviderId: string;
2117
+ cause?: unknown;
2118
+ });
2119
+ static isInstance(error: unknown): error is HarnessSandboxAuthenticationError;
1978
2120
  }
1979
-
1980
- export { type Experimental_HarnessV1BridgeUserMessageResponse, HARNESS_V1_BUILTIN_TOOLS, HARNESS_V1_BUILTIN_TOOL_NAMES, HarnessCapabilityUnsupportedError, HarnessError, HarnessSandboxAuthenticationError, type HarnessV1, type HarnessV1Authentication, type HarnessV1AuthenticationEnvironment, type HarnessV1Bootstrap, type HarnessV1BootstrapCommand, type HarnessV1BootstrapFile, type HarnessV1BridgeDebugEvent, type HarnessV1BridgeOutboundMessage, type HarnessV1BridgeReady, type HarnessV1BridgeSandboxLog, type HarnessV1BridgeToolWire, type HarnessV1BuiltinTool, type HarnessV1BuiltinToolFiltering, type HarnessV1BuiltinToolName, type HarnessV1BuiltinToolUseKind, type HarnessV1CallWarning, type HarnessV1ContinueTurnOptions, type HarnessV1ContinueTurnState, type HarnessV1CredentialForwarding, type HarnessV1DebugConfig, type HarnessV1DebugLevel, type HarnessV1Diagnostic, type HarnessV1JSONArray, type HarnessV1JSONObject, type HarnessV1JSONSchema, type HarnessV1JSONValue, type HarnessV1LifecycleState, type HarnessV1Metadata, type HarnessV1MintBridgeTokenCallback, type HarnessV1NetworkPolicy, type HarnessV1NetworkSandboxSession, type HarnessV1Observability, type HarnessV1PendingToolApproval, type HarnessV1PendingToolResult, type HarnessV1PermissionMode, type HarnessV1PortEndpoint, type HarnessV1Prompt, type HarnessV1PromptControl, type HarnessV1PromptTurnOptions, type HarnessV1QuestionsTool, type HarnessV1QuestionsToolInput, type HarnessV1QuestionsToolOutput, type HarnessV1RequestTransformation, type HarnessV1RequestTransformationSources, type HarnessV1ResponseFormat, type HarnessV1ResumeSessionState, type HarnessV1SandboxProvider, type HarnessV1SandboxSessionCreateOptions, type HarnessV1SandboxSessionResumeOptions, type HarnessV1SandboxTemplate, type HarnessV1Session, type HarnessV1Skill, type HarnessV1StartOptions, type HarnessV1StreamPart, type HarnessV1ToolSpec, type HarnessV1TurnSettings, commonTool, experimental_harnessV1BridgeUserMessageInboundSchema, experimental_harnessV1BridgeUserMessageResponseSchema, getHarnessV1BuiltinToolFilteringDenialReason, harnessSessionDataDirectoryPath, harnessStateDirectoryPath, harnessV1BridgeAbortInboundSchema, harnessV1BridgeBuiltinToolFilteringSchema, harnessV1BridgeDebugEventSchema, harnessV1BridgeDestroyInboundSchema, harnessV1BridgeHelloSchema, harnessV1BridgeInboundCommandSchemas, harnessV1BridgeOutboundMessageSchema, harnessV1BridgePermissionModeSchema, harnessV1BridgeReadySchema, harnessV1BridgeResponseFormatSchema, harnessV1BridgeResumeInboundSchema, harnessV1BridgeSandboxLogSchema, harnessV1BridgeStartBaseSchema, harnessV1BridgeStopInboundSchema, harnessV1BridgeStopSchema, harnessV1BridgeThreadSchema, harnessV1BridgeToolApprovalResponseInboundSchema, harnessV1BridgeToolResultInboundSchema, harnessV1BridgeToolWireSchema, harnessV1BridgeUserMessageInboundSchema, harnessV1DebugConfigSchema, harnessV1DebugLevelSchema, harnessV1DiagnosticFromBridgeFrame, harnessV1ErrorPartSchema, harnessV1FileChangePartSchema, harnessV1FinishPartSchema, harnessV1FinishStepPartSchema, harnessV1QuestionsToolInputSchema, harnessV1QuestionsToolOutputSchema, harnessV1RawPartSchema, harnessV1ReasoningDeltaPartSchema, harnessV1ReasoningEndPartSchema, harnessV1ReasoningStartPartSchema, harnessV1StreamPartSchema, harnessV1StreamStartPartSchema, harnessV1TextDeltaPartSchema, harnessV1TextEndPartSchema, harnessV1TextStartPartSchema, harnessV1ToolApprovalRequestPartSchema, harnessV1ToolCallPartSchema, harnessV1ToolResultPartSchema, isHarnessV1BuiltinToolIncluded };
2121
+ //#endregion
2122
+ export type { Experimental_HarnessV1BridgeUserMessageResponse, HarnessV1, HarnessV1AssistantMessage, HarnessV1Authentication, HarnessV1AuthenticationEnvironment, HarnessV1Bootstrap, HarnessV1BootstrapCommand, HarnessV1BootstrapFile, HarnessV1BridgeDebugEvent, HarnessV1BridgeOutboundMessage, HarnessV1BridgeReady, HarnessV1BridgeSandboxLog, HarnessV1BridgeToolWire, HarnessV1BuiltinTool, HarnessV1BuiltinToolFiltering, HarnessV1BuiltinToolName, HarnessV1BuiltinToolUseKind, HarnessV1CallWarning, HarnessV1ContinueTurnOptions, HarnessV1ContinueTurnState, HarnessV1CredentialForwarding, HarnessV1CustomPart, HarnessV1DebugConfig, HarnessV1DebugLevel, HarnessV1Diagnostic, HarnessV1FilePart, HarnessV1JSONArray, HarnessV1JSONObject, HarnessV1JSONSchema, HarnessV1JSONValue, HarnessV1LifecycleState, HarnessV1Message, HarnessV1MessagePart, HarnessV1Metadata, HarnessV1MintBridgeTokenCallback, HarnessV1NetworkPolicy, HarnessV1NetworkSandboxSession, HarnessV1Observability, HarnessV1PendingToolApproval, HarnessV1PendingToolResult, HarnessV1PermissionMode, HarnessV1PortEndpoint, HarnessV1Prompt, HarnessV1PromptControl, HarnessV1PromptTurnOptions, HarnessV1QuestionsTool, HarnessV1QuestionsToolInput, HarnessV1QuestionsToolOutput, HarnessV1ReadHistoryResult, HarnessV1ReasoningFilePart, HarnessV1ReasoningPart, HarnessV1RequestTransformation, HarnessV1RequestTransformationSources, HarnessV1ResponseFormat, HarnessV1ResumeSessionState, HarnessV1SandboxProvider, HarnessV1SandboxSessionCreateOptions, HarnessV1SandboxSessionResumeOptions, HarnessV1SandboxTemplate, HarnessV1Session, HarnessV1Skill, HarnessV1StartOptions, HarnessV1StreamPart, HarnessV1TextPart, HarnessV1ToolApprovalResponsePart, HarnessV1ToolCallPart, HarnessV1ToolMessage, HarnessV1ToolResultOutput, HarnessV1ToolResultPart, HarnessV1ToolSpec, HarnessV1TurnSettings, HarnessV1UserMessage };
2123
+ //# sourceMappingURL=index.d.ts.map