@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/CHANGELOG.md +24 -0
- package/dist/agent/index.d.ts +1581 -1432
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +4419 -4997
- package/dist/agent/index.js.map +1 -1
- package/dist/bridge/index.d.ts +141 -139
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +579 -650
- package/dist/bridge/index.js.map +1 -1
- package/dist/index.d.ts +1498 -1355
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +703 -645
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +551 -521
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +1910 -2457
- package/dist/utils/index.js.map +1 -1
- package/package.json +9 -9
- package/src/agent/harness-agent-session.ts +46 -14
- package/src/agent/internal/run-prompt.ts +93 -62
- package/src/bridge/index.ts +1 -1
- package/src/errors/harness-history-unavailable-error.ts +41 -0
- package/src/index.ts +1 -0
- package/src/utils/credential-forwarding.ts +15 -1
- package/src/utils/index.ts +1 -1
- package/src/v1/harness-v1-message.ts +150 -0
- package/src/v1/harness-v1-session.ts +38 -0
- package/src/v1/index.ts +17 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
57
|
-
|
|
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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
187
|
+
mode: 'allow-all';
|
|
189
188
|
} | {
|
|
190
|
-
|
|
189
|
+
mode: 'deny-all';
|
|
191
190
|
} | {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
mode: 'custom';
|
|
192
|
+
allowedHosts: ReadonlyArray<string>;
|
|
193
|
+
allowedCIDRs?: ReadonlyArray<string>;
|
|
194
|
+
deniedCIDRs?: ReadonlyArray<string>;
|
|
196
195
|
} | {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
196
|
+
mode: 'custom';
|
|
197
|
+
allowedHosts?: ReadonlyArray<string>;
|
|
198
|
+
allowedCIDRs: ReadonlyArray<string>;
|
|
199
|
+
deniedCIDRs?: ReadonlyArray<string>;
|
|
201
200
|
};
|
|
202
201
|
type HarnessV1RequestTransformationPathMatcher = {
|
|
203
|
-
|
|
202
|
+
exact: string;
|
|
204
203
|
} | {
|
|
205
|
-
|
|
204
|
+
startsWith: string;
|
|
206
205
|
} | {
|
|
207
|
-
|
|
206
|
+
regex: string;
|
|
208
207
|
};
|
|
209
208
|
type HarnessV1RequestTransformationKeyValuePartMatcher = {
|
|
210
|
-
|
|
209
|
+
exact: string;
|
|
211
210
|
} | {
|
|
212
|
-
|
|
211
|
+
startsWith: string;
|
|
213
212
|
} | {
|
|
214
|
-
|
|
213
|
+
regex: string;
|
|
215
214
|
};
|
|
216
215
|
type HarnessV1RequestTransformationKeyValueMatcher = {
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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
|
-
|
|
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
|
-
|
|
402
|
+
readonly type: 'text';
|
|
399
403
|
} | {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
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
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
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
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
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
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
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
|
-
|
|
584
|
-
|
|
585
|
-
|
|
591
|
+
type: 'unsupported-setting';
|
|
592
|
+
setting: string;
|
|
593
|
+
details?: string;
|
|
586
594
|
} | {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
595
|
+
type: 'unsupported-tool';
|
|
596
|
+
tool: string;
|
|
597
|
+
details?: string;
|
|
590
598
|
} | {
|
|
591
|
-
|
|
592
|
-
|
|
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
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
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
|
-
|
|
633
|
-
|
|
634
|
-
|
|
642
|
+
type: 'text-start';
|
|
643
|
+
id: string;
|
|
644
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
635
645
|
} | {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
646
|
+
type: 'text-delta';
|
|
647
|
+
id: string;
|
|
648
|
+
delta: string;
|
|
649
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
640
650
|
} | {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
651
|
+
type: 'text-end';
|
|
652
|
+
id: string;
|
|
653
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
644
654
|
} | {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
655
|
+
type: 'reasoning-start';
|
|
656
|
+
id: string;
|
|
657
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
648
658
|
} | {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
659
|
+
type: 'reasoning-delta';
|
|
660
|
+
id: string;
|
|
661
|
+
delta: string;
|
|
662
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
653
663
|
} | {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
664
|
+
type: 'reasoning-end';
|
|
665
|
+
id: string;
|
|
666
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
657
667
|
} | Extract<LanguageModelV4StreamPart, {
|
|
658
|
-
|
|
668
|
+
type: 'tool-input-start';
|
|
659
669
|
}> | Extract<LanguageModelV4StreamPart, {
|
|
660
|
-
|
|
670
|
+
type: 'tool-input-delta';
|
|
661
671
|
}> | Extract<LanguageModelV4StreamPart, {
|
|
662
|
-
|
|
672
|
+
type: 'tool-input-end';
|
|
663
673
|
}> | (LanguageModelV4ToolCall & {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
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
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
681
|
+
type: 'finish-step';
|
|
682
|
+
finishReason: LanguageModelV4FinishReason;
|
|
683
|
+
usage: LanguageModelV4Usage;
|
|
684
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
675
685
|
} | {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
686
|
+
type: 'finish';
|
|
687
|
+
finishReason: LanguageModelV4FinishReason;
|
|
688
|
+
totalUsage: LanguageModelV4Usage;
|
|
689
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
680
690
|
} | {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
691
|
+
type: 'file-change';
|
|
692
|
+
event: 'create' | 'modify' | 'delete';
|
|
693
|
+
path: string;
|
|
694
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
685
695
|
} | {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
696
|
+
type: 'compaction';
|
|
697
|
+
trigger: 'manual' | 'auto';
|
|
698
|
+
summary: string;
|
|
699
|
+
tokensBefore?: number;
|
|
700
|
+
tokensAfter?: number;
|
|
701
|
+
harnessMetadata?: HarnessV1Metadata;
|
|
692
702
|
} | {
|
|
693
|
-
|
|
694
|
-
|
|
703
|
+
type: 'error';
|
|
704
|
+
error: unknown;
|
|
695
705
|
} | {
|
|
696
|
-
|
|
697
|
-
|
|
706
|
+
type: 'raw';
|
|
707
|
+
rawValue: unknown;
|
|
698
708
|
};
|
|
699
|
-
declare const harnessV1StreamStartPartSchema: z.ZodObject<{
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
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
|
-
|
|
706
|
-
|
|
707
|
-
|
|
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
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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
|
-
|
|
722
|
-
|
|
723
|
-
|
|
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
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
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
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
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
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
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
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
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
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
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
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
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
|
-
|
|
787
|
-
|
|
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
|
-
|
|
791
|
-
|
|
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
|
-
|
|
801
|
-
|
|
802
|
-
|
|
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
|
-
|
|
805
|
-
|
|
806
|
-
|
|
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
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
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
|
-
|
|
814
|
-
|
|
815
|
-
|
|
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
|
-
|
|
818
|
-
|
|
819
|
-
|
|
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
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
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
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
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
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
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
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
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
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
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
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
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
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
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
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
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
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
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
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
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
|
-
|
|
901
|
-
|
|
910
|
+
type: z.ZodLiteral<"error">;
|
|
911
|
+
error: z.ZodUnknown;
|
|
902
912
|
}, z.core.$strip>, z.ZodObject<{
|
|
903
|
-
|
|
904
|
-
|
|
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
|
-
|
|
909
|
-
|
|
980
|
+
mode: 'allow';
|
|
981
|
+
toolNames: string[];
|
|
910
982
|
} | {
|
|
911
|
-
|
|
912
|
-
|
|
983
|
+
mode: 'deny';
|
|
984
|
+
toolNames: string[];
|
|
913
985
|
};
|
|
914
|
-
declare function isHarnessV1BuiltinToolIncluded(input: {
|
|
915
|
-
|
|
916
|
-
|
|
986
|
+
export declare function isHarnessV1BuiltinToolIncluded(input: {
|
|
987
|
+
toolName: string;
|
|
988
|
+
toolFiltering: HarnessV1BuiltinToolFiltering | undefined;
|
|
917
989
|
}): boolean;
|
|
918
|
-
declare function getHarnessV1BuiltinToolFilteringDenialReason(input: {
|
|
919
|
-
|
|
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
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
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
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
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
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
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
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
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
|
-
|
|
1233
|
-
|
|
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
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
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
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
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
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
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
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
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
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
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
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
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
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
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
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
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
|
-
|
|
1523
|
+
action: z.ZodLiteral<"declined">;
|
|
1415
1524
|
}, z.core.$strip>, z.ZodObject<{
|
|
1416
|
-
|
|
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
|
-
|
|
1432
|
-
|
|
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
|
-
*
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1476
|
-
*
|
|
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
|
-
*
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
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
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
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
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
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
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
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
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
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
|
-
|
|
1524
|
-
|
|
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
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
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
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
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
|
-
|
|
1545
|
-
|
|
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
|
-
|
|
1548
|
-
|
|
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
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
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
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
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
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
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
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
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
|
-
|
|
1624
|
-
|
|
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
|
-
|
|
1632
|
-
|
|
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
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
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
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
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
|
-
|
|
1664
|
-
|
|
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
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
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
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
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
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
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
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
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
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
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
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
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
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
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
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
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
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
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
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
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
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
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
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
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
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
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
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
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
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
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
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
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
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
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
|
-
|
|
1777
|
-
|
|
1891
|
+
type: z.ZodLiteral<"error">;
|
|
1892
|
+
error: z.ZodUnknown;
|
|
1778
1893
|
}, z.core.$strip>, z.ZodObject<{
|
|
1779
|
-
|
|
1780
|
-
|
|
1894
|
+
type: z.ZodLiteral<"raw">;
|
|
1895
|
+
rawValue: z.ZodUnknown;
|
|
1781
1896
|
}, z.core.$strip>, z.ZodObject<{
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
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
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
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
|
-
|
|
1797
|
-
|
|
1911
|
+
type: z.ZodLiteral<"bridge-stop">;
|
|
1912
|
+
data: z.ZodUnknown;
|
|
1798
1913
|
}, z.core.$strip>, z.ZodObject<{
|
|
1799
|
-
|
|
1800
|
-
|
|
1914
|
+
type: z.ZodLiteral<"bridge-thread">;
|
|
1915
|
+
threadId: z.ZodString;
|
|
1801
1916
|
}, z.core.$strip>, z.ZodObject<{
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
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
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
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
|
-
|
|
1821
|
-
|
|
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
|
-
|
|
1840
|
-
|
|
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
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
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
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
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
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
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
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
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
|
-
|
|
1980
|
+
export declare const harnessV1BridgeAbortInboundSchema: z.ZodObject<{
|
|
1981
|
+
type: z.ZodLiteral<"abort">;
|
|
1867
1982
|
}, z.core.$strip>;
|
|
1868
|
-
declare const harnessV1BridgeDestroyInboundSchema: z.ZodObject<{
|
|
1869
|
-
|
|
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
|
-
|
|
1877
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
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
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
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
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
2018
|
+
type: z.ZodLiteral<"user-message">;
|
|
2019
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
2020
|
+
text: z.ZodString;
|
|
1906
2021
|
}, z.core.$strip>, z.ZodObject<{
|
|
1907
|
-
|
|
2022
|
+
type: z.ZodLiteral<"abort">;
|
|
1908
2023
|
}, z.core.$strip>, z.ZodObject<{
|
|
1909
|
-
|
|
2024
|
+
type: z.ZodLiteral<"destroy">;
|
|
1910
2025
|
}, z.core.$strip>, z.ZodObject<{
|
|
1911
|
-
|
|
1912
|
-
|
|
2026
|
+
type: z.ZodLiteral<"resume">;
|
|
2027
|
+
lastSeenEventId: z.ZodNumber;
|
|
1913
2028
|
}, z.core.$strip>, z.ZodObject<{
|
|
1914
|
-
|
|
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
|
-
|
|
1922
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
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
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
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 {
|
|
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
|