@tangle-network/agent-interface 0.45.0 → 0.46.1
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/README.md +1 -1
- package/dist/agent-candidate-profile-schema.d.ts +2 -2
- package/dist/agent-candidate-promotion-schema.d.ts +22 -22
- package/dist/agent-candidate-schema-common.js +1 -1
- package/dist/agent-candidate-schema.d.ts +2 -2
- package/dist/agent-execution-preparation.d.ts +26 -26
- package/dist/agent-profile.d.ts +10 -3
- package/dist/agent-profile.js +45 -22
- package/dist/backend-message.d.ts +14 -0
- package/dist/backend-message.js +1 -0
- package/dist/contract-limits.d.ts +26 -0
- package/dist/contract-limits.js +175 -0
- package/dist/environment-exact-process.d.ts +161 -0
- package/dist/environment-exact-process.js +1 -0
- package/dist/environment-profile-capabilities.d.ts +26 -0
- package/dist/environment-profile-capabilities.js +34 -0
- package/dist/environment-provider.d.ts +3 -730
- package/dist/environment-provider.js +3 -245
- package/dist/environment-requests.d.ts +70 -0
- package/dist/environment-requests.js +1 -0
- package/dist/environment-runtime.d.ts +834 -0
- package/dist/environment-runtime.js +228 -0
- package/dist/execution-types.d.ts +50 -0
- package/dist/execution-types.js +1 -0
- package/dist/host-services.d.ts +91 -0
- package/dist/host-services.js +1 -0
- package/dist/index.d.ts +10 -617
- package/dist/index.js +10 -125
- package/dist/interaction-answer-validation.d.ts +13 -0
- package/dist/interaction-answer-validation.js +149 -0
- package/dist/interaction-data.d.ts +22 -0
- package/dist/interaction-data.js +46 -0
- package/dist/interaction-envelope.d.ts +267 -0
- package/dist/interaction-envelope.js +247 -0
- package/dist/interaction-fields.d.ts +130 -0
- package/dist/interaction-fields.js +227 -0
- package/dist/interaction-permissions.d.ts +28 -0
- package/dist/interaction-permissions.js +57 -0
- package/dist/interaction-resolution-validation.d.ts +9 -0
- package/dist/interaction-resolution-validation.js +50 -0
- package/dist/interaction-response-validation.d.ts +17 -0
- package/dist/interaction-response-validation.js +102 -0
- package/dist/interaction.d.ts +6 -397
- package/dist/interaction.js +6 -603
- package/dist/mcp.d.ts +38 -0
- package/dist/mcp.js +1 -0
- package/dist/parts.d.ts +104 -0
- package/dist/parts.js +55 -0
- package/dist/portable-context-base.d.ts +82 -0
- package/dist/portable-context-base.js +63 -0
- package/dist/portable-context-continuation.d.ts +168 -0
- package/dist/portable-context-continuation.js +194 -0
- package/dist/portable-context-plan-request.d.ts +86 -0
- package/dist/portable-context-plan-request.js +102 -0
- package/dist/portable-context-plan.d.ts +229 -0
- package/dist/portable-context-plan.js +241 -0
- package/dist/portable-context-shared.d.ts +36 -0
- package/dist/portable-context-shared.js +46 -0
- package/dist/portable-context-transfer.d.ts +319 -0
- package/dist/portable-context-transfer.js +206 -0
- package/dist/portable-context.d.ts +5 -753
- package/dist/portable-context.js +5 -754
- package/dist/profile-diff.js +56 -47
- package/dist/provider-adapter.d.ts +45 -0
- package/dist/provider-adapter.js +1 -0
- package/dist/provider-config.d.ts +58 -0
- package/dist/provider-config.js +42 -0
- package/dist/runtime-control.d.ts +87 -10
- package/dist/runtime-control.js +159 -38
- package/dist/stream-events.d.ts +55 -0
- package/dist/stream-events.js +1 -0
- package/dist/workspace-branching-shared.d.ts +7 -0
- package/dist/workspace-branching-shared.js +20 -0
- package/dist/workspace-branching.d.ts +4 -254
- package/dist/workspace-branching.js +4 -400
- package/dist/workspace-checkpoint.d.ts +99 -0
- package/dist/workspace-checkpoint.js +169 -0
- package/dist/workspace-cleanup.d.ts +85 -0
- package/dist/workspace-cleanup.js +156 -0
- package/dist/workspace-confidentiality.d.ts +59 -0
- package/dist/workspace-confidentiality.js +123 -0
- package/dist/workspace-fork.d.ts +182 -0
- package/dist/workspace-fork.js +267 -0
- package/package.json +1 -1
package/dist/runtime-control.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { canonicalCandidateDigest, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
|
|
3
|
+
import { boundedIdentifierSchema, boundedJsonRecordSchema, boundedJsonSchema, boundedStringSchema, } from "./contract-limits.js";
|
|
3
4
|
import { InteractionRequestSchema } from "./interaction.js";
|
|
4
5
|
import { DurablePlanSchema } from "./plan.js";
|
|
5
|
-
const stableIdSchema =
|
|
6
|
-
.string()
|
|
7
|
-
.min(1)
|
|
8
|
-
.max(512)
|
|
9
|
-
.refine((value) => value.trim() === value, "identifier cannot have outer whitespace");
|
|
6
|
+
const stableIdSchema = boundedIdentifierSchema;
|
|
10
7
|
export const AgentRunControlRefSchema = z.strictObject({
|
|
11
8
|
runId: stableIdSchema,
|
|
12
9
|
provider: stableIdSchema,
|
|
@@ -15,22 +12,32 @@ export const AgentRunControlRefSchema = z.strictObject({
|
|
|
15
12
|
executionId: stableIdSchema.optional(),
|
|
16
13
|
requestDigest: sha256DigestSchema.optional(),
|
|
17
14
|
});
|
|
15
|
+
export const AgentExactRunControlRefSchema = AgentRunControlRefSchema.extend({
|
|
16
|
+
sessionId: stableIdSchema,
|
|
17
|
+
executionId: stableIdSchema,
|
|
18
|
+
requestDigest: sha256DigestSchema,
|
|
19
|
+
});
|
|
18
20
|
export function agentRunCancellationRequestDigest(request) {
|
|
21
|
+
const parsed = AgentRunCancellationRequestMaterialSchema.parse(request);
|
|
19
22
|
return canonicalCandidateDigest({
|
|
20
|
-
operationId:
|
|
21
|
-
run:
|
|
22
|
-
...(
|
|
23
|
+
operationId: parsed.operationId,
|
|
24
|
+
run: parsed.run,
|
|
25
|
+
...(parsed.reason === undefined ? {} : { reason: parsed.reason }),
|
|
23
26
|
});
|
|
24
27
|
}
|
|
28
|
+
const AgentRunCancellationRequestMaterialSchema = z.strictObject({
|
|
29
|
+
operationId: stableIdSchema,
|
|
30
|
+
run: AgentExactRunControlRefSchema,
|
|
31
|
+
reason: boundedStringSchema.min(1).max(2_048).optional(),
|
|
32
|
+
});
|
|
25
33
|
export const AgentRunCancellationRequestSchema = z
|
|
26
34
|
.strictObject({
|
|
27
|
-
|
|
35
|
+
...AgentRunCancellationRequestMaterialSchema.shape,
|
|
28
36
|
requestDigest: sha256DigestSchema,
|
|
29
|
-
run: AgentRunControlRefSchema,
|
|
30
|
-
reason: z.string().min(1).max(2_048).optional(),
|
|
31
37
|
})
|
|
32
38
|
.superRefine((request, refinement) => {
|
|
33
|
-
|
|
39
|
+
const { requestDigest: _requestDigest, ...material } = request;
|
|
40
|
+
if (request.requestDigest !== agentRunCancellationRequestDigest(material)) {
|
|
34
41
|
refinement.addIssue({
|
|
35
42
|
code: "custom",
|
|
36
43
|
path: ["requestDigest"],
|
|
@@ -42,22 +49,59 @@ export const AgentRunCancellationAcknowledgementSchema = z
|
|
|
42
49
|
.strictObject({
|
|
43
50
|
operationId: stableIdSchema,
|
|
44
51
|
requestDigest: sha256DigestSchema,
|
|
45
|
-
run:
|
|
52
|
+
run: AgentExactRunControlRefSchema,
|
|
46
53
|
status: z.enum(["accepted", "replayed", "conflict", "unknown"]),
|
|
47
54
|
effect: z.enum(["cancel_requested", "cancelled", "not_live", "unknown"]),
|
|
48
|
-
message:
|
|
55
|
+
message: boundedStringSchema.min(1).optional(),
|
|
49
56
|
retryable: z.boolean().optional(),
|
|
57
|
+
existingRequestDigest: sha256DigestSchema.optional(),
|
|
50
58
|
})
|
|
51
59
|
.superRefine((acknowledgement, refinement) => {
|
|
52
60
|
const known = acknowledgement.effect !== "unknown";
|
|
53
|
-
if (((acknowledgement.status === "accepted" ||
|
|
54
|
-
|
|
61
|
+
if (((acknowledgement.status === "accepted" ||
|
|
62
|
+
acknowledgement.status === "replayed") &&
|
|
63
|
+
!known) ||
|
|
64
|
+
((acknowledgement.status === "conflict" ||
|
|
65
|
+
acknowledgement.status === "unknown") &&
|
|
66
|
+
known)) {
|
|
55
67
|
refinement.addIssue({
|
|
56
68
|
code: "custom",
|
|
57
69
|
path: ["effect"],
|
|
58
70
|
message: "cancellation status and effect certainty do not agree",
|
|
59
71
|
});
|
|
60
72
|
}
|
|
73
|
+
if (acknowledgement.status === "conflict" &&
|
|
74
|
+
acknowledgement.existingRequestDigest === undefined) {
|
|
75
|
+
refinement.addIssue({
|
|
76
|
+
code: "custom",
|
|
77
|
+
path: ["existingRequestDigest"],
|
|
78
|
+
message: "a cancellation conflict must include the existing digest",
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (acknowledgement.status === "conflict" &&
|
|
82
|
+
acknowledgement.existingRequestDigest === acknowledgement.requestDigest) {
|
|
83
|
+
refinement.addIssue({
|
|
84
|
+
code: "custom",
|
|
85
|
+
path: ["existingRequestDigest"],
|
|
86
|
+
message: "a cancellation conflict must identify a different request",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (acknowledgement.status !== "conflict" &&
|
|
90
|
+
acknowledgement.existingRequestDigest !== undefined) {
|
|
91
|
+
refinement.addIssue({
|
|
92
|
+
code: "custom",
|
|
93
|
+
path: ["existingRequestDigest"],
|
|
94
|
+
message: "only a cancellation conflict may include an existing digest",
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (acknowledgement.status === "unknown" &&
|
|
98
|
+
(acknowledgement.message === undefined || acknowledgement.retryable !== false)) {
|
|
99
|
+
refinement.addIssue({
|
|
100
|
+
code: "custom",
|
|
101
|
+
path: ["retryable"],
|
|
102
|
+
message: "an unknown cancellation outcome must be explicit and non-repeatable",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
61
105
|
});
|
|
62
106
|
export function agentRunCancellationAcknowledgementMatchesRequest(request, acknowledgement) {
|
|
63
107
|
const exactRequest = AgentRunCancellationRequestSchema.safeParse(request);
|
|
@@ -69,7 +113,84 @@ export function agentRunCancellationAcknowledgementMatchesRequest(request, ackno
|
|
|
69
113
|
canonicalCandidateDigest(exactAcknowledgement.data.run) ===
|
|
70
114
|
canonicalCandidateDigest(exactRequest.data.run));
|
|
71
115
|
}
|
|
72
|
-
|
|
116
|
+
export function agentRunControlRequestDigest(request) {
|
|
117
|
+
const parsed = AgentRunControlRequestMaterialSchema.parse(request);
|
|
118
|
+
return canonicalCandidateDigest({
|
|
119
|
+
operationId: parsed.operationId,
|
|
120
|
+
action: parsed.action,
|
|
121
|
+
run: parsed.run,
|
|
122
|
+
...(parsed.payload === undefined ? {} : { payload: parsed.payload }),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const AgentRunControlRequestMaterialSchema = z.strictObject({
|
|
126
|
+
operationId: stableIdSchema,
|
|
127
|
+
action: z.enum(["steer", "cancel", "status", "reconnect"]),
|
|
128
|
+
run: AgentExactRunControlRefSchema,
|
|
129
|
+
payload: boundedJsonRecordSchema.optional(),
|
|
130
|
+
});
|
|
131
|
+
export const AgentRunControlRequestSchema = z
|
|
132
|
+
.strictObject({
|
|
133
|
+
...AgentRunControlRequestMaterialSchema.shape,
|
|
134
|
+
requestDigest: sha256DigestSchema,
|
|
135
|
+
})
|
|
136
|
+
.superRefine((request, refinement) => {
|
|
137
|
+
const { requestDigest: _requestDigest, ...material } = request;
|
|
138
|
+
if (request.requestDigest !== agentRunControlRequestDigest(material)) {
|
|
139
|
+
refinement.addIssue({
|
|
140
|
+
code: "custom",
|
|
141
|
+
path: ["requestDigest"],
|
|
142
|
+
message: "run control request digest does not match its content",
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
export const AgentRunControlAcknowledgementSchema = z
|
|
147
|
+
.strictObject({
|
|
148
|
+
operationId: stableIdSchema,
|
|
149
|
+
requestDigest: sha256DigestSchema,
|
|
150
|
+
run: AgentExactRunControlRefSchema,
|
|
151
|
+
status: z.enum(["accepted", "replayed", "conflict", "unknown"]),
|
|
152
|
+
message: boundedStringSchema.min(1).optional(),
|
|
153
|
+
retryable: z.boolean().optional(),
|
|
154
|
+
existingRequestDigest: sha256DigestSchema.optional(),
|
|
155
|
+
})
|
|
156
|
+
.superRefine((acknowledgement, refinement) => {
|
|
157
|
+
if (acknowledgement.status === "conflict" &&
|
|
158
|
+
(acknowledgement.existingRequestDigest === undefined ||
|
|
159
|
+
acknowledgement.existingRequestDigest === acknowledgement.requestDigest)) {
|
|
160
|
+
refinement.addIssue({
|
|
161
|
+
code: "custom",
|
|
162
|
+
path: ["existingRequestDigest"],
|
|
163
|
+
message: "a control conflict must identify a different existing request",
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (acknowledgement.status !== "conflict" &&
|
|
167
|
+
acknowledgement.existingRequestDigest !== undefined) {
|
|
168
|
+
refinement.addIssue({
|
|
169
|
+
code: "custom",
|
|
170
|
+
path: ["existingRequestDigest"],
|
|
171
|
+
message: "only a control conflict may include an existing digest",
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (acknowledgement.status === "unknown" &&
|
|
175
|
+
(acknowledgement.message === undefined || acknowledgement.retryable !== false)) {
|
|
176
|
+
refinement.addIssue({
|
|
177
|
+
code: "custom",
|
|
178
|
+
path: ["retryable"],
|
|
179
|
+
message: "an unknown control outcome must be explicit and non-repeatable",
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
export function agentRunControlAcknowledgementMatchesRequest(request, acknowledgement) {
|
|
184
|
+
const exactRequest = AgentRunControlRequestSchema.safeParse(request);
|
|
185
|
+
const exactAcknowledgement = AgentRunControlAcknowledgementSchema.safeParse(acknowledgement);
|
|
186
|
+
if (!exactRequest.success || !exactAcknowledgement.success)
|
|
187
|
+
return false;
|
|
188
|
+
return (exactAcknowledgement.data.operationId === exactRequest.data.operationId &&
|
|
189
|
+
exactAcknowledgement.data.requestDigest === exactRequest.data.requestDigest &&
|
|
190
|
+
canonicalCandidateDigest(exactAcknowledgement.data.run) ===
|
|
191
|
+
canonicalCandidateDigest(exactRequest.data.run));
|
|
192
|
+
}
|
|
193
|
+
const unknownRecordSchema = boundedJsonRecordSchema;
|
|
73
194
|
const partBase = {
|
|
74
195
|
id: stableIdSchema,
|
|
75
196
|
sessionID: stableIdSchema,
|
|
@@ -83,20 +204,20 @@ const toolStateSchema = z.discriminatedUnion("status", [
|
|
|
83
204
|
z.strictObject({
|
|
84
205
|
status: z.literal("pending"),
|
|
85
206
|
input: unknownRecordSchema,
|
|
86
|
-
raw:
|
|
207
|
+
raw: boundedStringSchema.optional(),
|
|
87
208
|
}),
|
|
88
209
|
z.strictObject({
|
|
89
210
|
status: z.literal("running"),
|
|
90
211
|
input: unknownRecordSchema,
|
|
91
|
-
title:
|
|
212
|
+
title: boundedStringSchema.optional(),
|
|
92
213
|
metadata: unknownRecordSchema.optional(),
|
|
93
214
|
time: z.strictObject({ start: z.number().finite() }).optional(),
|
|
94
215
|
}),
|
|
95
216
|
z.strictObject({
|
|
96
217
|
status: z.literal("completed"),
|
|
97
218
|
input: unknownRecordSchema,
|
|
98
|
-
output:
|
|
99
|
-
title:
|
|
219
|
+
output: boundedJsonSchema,
|
|
220
|
+
title: boundedStringSchema.optional(),
|
|
100
221
|
metadata: unknownRecordSchema.optional(),
|
|
101
222
|
time: z.strictObject({
|
|
102
223
|
start: z.number().finite(),
|
|
@@ -106,14 +227,14 @@ const toolStateSchema = z.discriminatedUnion("status", [
|
|
|
106
227
|
z.strictObject({
|
|
107
228
|
status: z.enum(["error", "failed"]),
|
|
108
229
|
input: unknownRecordSchema,
|
|
109
|
-
error:
|
|
110
|
-
output:
|
|
230
|
+
error: boundedStringSchema.optional(),
|
|
231
|
+
output: boundedJsonSchema.optional(),
|
|
111
232
|
metadata: unknownRecordSchema.optional(),
|
|
112
233
|
time: toolTimeSchema.optional(),
|
|
113
234
|
}),
|
|
114
235
|
]);
|
|
115
236
|
const partSchema = z.discriminatedUnion("type", [
|
|
116
|
-
z.strictObject({ ...partBase, type: z.literal("text"), text:
|
|
237
|
+
z.strictObject({ ...partBase, type: z.literal("text"), text: boundedStringSchema }),
|
|
117
238
|
z.strictObject({
|
|
118
239
|
...partBase,
|
|
119
240
|
type: z.literal("tool"),
|
|
@@ -125,20 +246,20 @@ const partSchema = z.discriminatedUnion("type", [
|
|
|
125
246
|
z.strictObject({
|
|
126
247
|
...partBase,
|
|
127
248
|
type: z.literal("reasoning"),
|
|
128
|
-
text:
|
|
249
|
+
text: boundedStringSchema,
|
|
129
250
|
}),
|
|
130
251
|
z.strictObject({
|
|
131
252
|
...partBase,
|
|
132
253
|
type: z.literal("file"),
|
|
133
|
-
filename:
|
|
134
|
-
mediaType:
|
|
135
|
-
url:
|
|
254
|
+
filename: boundedStringSchema.optional(),
|
|
255
|
+
mediaType: boundedStringSchema.optional(),
|
|
256
|
+
url: boundedStringSchema.optional(),
|
|
136
257
|
}),
|
|
137
258
|
z.strictObject({
|
|
138
259
|
...partBase,
|
|
139
260
|
type: z.literal("subtask"),
|
|
140
|
-
prompt:
|
|
141
|
-
description:
|
|
261
|
+
prompt: boundedStringSchema,
|
|
262
|
+
description: boundedStringSchema,
|
|
142
263
|
agent: stableIdSchema,
|
|
143
264
|
}),
|
|
144
265
|
]);
|
|
@@ -147,7 +268,7 @@ export const CanonicalStreamEventSchema = z.discriminatedUnion("type", [
|
|
|
147
268
|
z.strictObject({
|
|
148
269
|
type: z.literal("message.part.updated"),
|
|
149
270
|
part: partSchema,
|
|
150
|
-
delta:
|
|
271
|
+
delta: boundedStringSchema.optional(),
|
|
151
272
|
}),
|
|
152
273
|
z.strictObject({
|
|
153
274
|
type: z.literal("tool-heartbeat"),
|
|
@@ -171,22 +292,22 @@ export const CanonicalStreamEventSchema = z.discriminatedUnion("type", [
|
|
|
171
292
|
z.strictObject({
|
|
172
293
|
type: z.literal("status"),
|
|
173
294
|
status: z.enum(["started", "processing", "completed", "failed"]),
|
|
174
|
-
detail:
|
|
295
|
+
detail: boundedStringSchema.optional(),
|
|
175
296
|
}),
|
|
176
297
|
z.strictObject({
|
|
177
298
|
type: z.literal("warning"),
|
|
178
299
|
code: stableIdSchema,
|
|
179
|
-
message:
|
|
300
|
+
message: boundedStringSchema,
|
|
180
301
|
}),
|
|
181
302
|
z.strictObject({
|
|
182
303
|
type: z.literal("raw"),
|
|
183
304
|
backend: stableIdSchema,
|
|
184
|
-
event:
|
|
305
|
+
event: boundedJsonSchema,
|
|
185
306
|
}),
|
|
186
307
|
z.strictObject({
|
|
187
308
|
type: z.literal("session.updated"),
|
|
188
309
|
sessionId: stableIdSchema,
|
|
189
|
-
title:
|
|
310
|
+
title: boundedStringSchema.optional(),
|
|
190
311
|
time: z.strictObject({
|
|
191
312
|
created: z.number().finite().optional(),
|
|
192
313
|
updated: z.number().finite().optional(),
|
|
@@ -199,7 +320,7 @@ export const CanonicalStreamEventSchema = z.discriminatedUnion("type", [
|
|
|
199
320
|
z.strictObject({
|
|
200
321
|
type: z.literal("interaction.cancel"),
|
|
201
322
|
id: stableIdSchema,
|
|
202
|
-
reason:
|
|
323
|
+
reason: boundedStringSchema.optional(),
|
|
203
324
|
}),
|
|
204
325
|
z.strictObject({
|
|
205
326
|
type: z.literal("plan.submitted"),
|
|
@@ -211,7 +332,7 @@ export const RuntimeEventEnvelopeSchema = z.strictObject({
|
|
|
211
332
|
eventId: stableIdSchema,
|
|
212
333
|
sequence: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
213
334
|
cursor: stableIdSchema.optional(),
|
|
214
|
-
occurredAt: z.iso.datetime().optional(),
|
|
215
|
-
receivedAt: z.iso.datetime(),
|
|
335
|
+
occurredAt: z.iso.datetime().max(64).optional(),
|
|
336
|
+
receivedAt: z.iso.datetime().max(64),
|
|
216
337
|
event: CanonicalStreamEventSchema,
|
|
217
338
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { InteractionRequest } from "./interaction.js";
|
|
2
|
+
import type { DurablePlan } from "./plan.js";
|
|
3
|
+
import type { Part } from "./parts.js";
|
|
4
|
+
export type MessagePartUpdatedEvent = {
|
|
5
|
+
type: "message.part.updated";
|
|
6
|
+
part: Part;
|
|
7
|
+
delta?: string;
|
|
8
|
+
};
|
|
9
|
+
export type StreamEvent = MessagePartUpdatedEvent | {
|
|
10
|
+
type: "tool-heartbeat";
|
|
11
|
+
toolName: string;
|
|
12
|
+
partId: string;
|
|
13
|
+
elapsedMs: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: "tool-slow";
|
|
16
|
+
toolName: string;
|
|
17
|
+
partId: string;
|
|
18
|
+
elapsedMs: number;
|
|
19
|
+
thresholdMs: number;
|
|
20
|
+
} | {
|
|
21
|
+
type: "model-processing";
|
|
22
|
+
phase: "tool-result" | "generating" | "thinking";
|
|
23
|
+
toolName?: string;
|
|
24
|
+
elapsedMs?: number;
|
|
25
|
+
} | {
|
|
26
|
+
type: "status";
|
|
27
|
+
status: "started" | "processing" | "completed" | "failed";
|
|
28
|
+
detail?: string;
|
|
29
|
+
} | {
|
|
30
|
+
type: "warning";
|
|
31
|
+
code: string;
|
|
32
|
+
message: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: "raw";
|
|
35
|
+
backend: string;
|
|
36
|
+
event: unknown;
|
|
37
|
+
} | {
|
|
38
|
+
type: "session.updated";
|
|
39
|
+
sessionId: string;
|
|
40
|
+
title?: string;
|
|
41
|
+
time?: {
|
|
42
|
+
created?: number;
|
|
43
|
+
updated?: number;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
type: "interaction";
|
|
47
|
+
request: InteractionRequest;
|
|
48
|
+
} | {
|
|
49
|
+
type: "interaction.cancel";
|
|
50
|
+
id: string;
|
|
51
|
+
reason?: string;
|
|
52
|
+
} | {
|
|
53
|
+
type: "plan.submitted";
|
|
54
|
+
plan: DurablePlan;
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Sha256Digest } from "./agent-candidate.js";
|
|
2
|
+
import { sha256DigestSchema } from "./agent-candidate-schema-common.js";
|
|
3
|
+
export { sha256DigestSchema };
|
|
4
|
+
export declare const idSchema: import("zod").ZodString;
|
|
5
|
+
export declare const jsonRecordSchema: import("zod").ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
6
|
+
export declare function wireDigest(value: unknown): Sha256Digest;
|
|
7
|
+
export declare function sameOptionalWireValue(left: unknown, right: unknown): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { canonicalCandidateDigest, sha256DigestSchema } from "./agent-candidate-schema-common.js";
|
|
2
|
+
import { assertBoundedSerializedJson, boundedIdentifierSchema, boundedJsonRecordSchema, isBoundedJsonMaterial, } from "./contract-limits.js";
|
|
3
|
+
export { sha256DigestSchema };
|
|
4
|
+
export const idSchema = boundedIdentifierSchema;
|
|
5
|
+
export const jsonRecordSchema = boundedJsonRecordSchema;
|
|
6
|
+
export function wireDigest(value) {
|
|
7
|
+
if (!isBoundedJsonMaterial(value)) {
|
|
8
|
+
throw new Error("operation material exceeds the contract bounds");
|
|
9
|
+
}
|
|
10
|
+
const serialized = JSON.stringify(value);
|
|
11
|
+
if (serialized === undefined)
|
|
12
|
+
throw new Error("operation material must be JSON serializable");
|
|
13
|
+
assertBoundedSerializedJson(serialized);
|
|
14
|
+
return canonicalCandidateDigest(JSON.parse(serialized));
|
|
15
|
+
}
|
|
16
|
+
export function sameOptionalWireValue(left, right) {
|
|
17
|
+
if (left === undefined || right === undefined)
|
|
18
|
+
return left === right;
|
|
19
|
+
return wireDigest(left) === wireDigest(right);
|
|
20
|
+
}
|
|
@@ -1,254 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface WorkspaceCheckpointMaterial {
|
|
6
|
-
source: AgentRunControlRef;
|
|
7
|
-
name?: string;
|
|
8
|
-
metadata?: Record<string, unknown>;
|
|
9
|
-
}
|
|
10
|
-
export interface WorkspaceCheckpointRequest extends WorkspaceCheckpointMaterial {
|
|
11
|
-
idempotencyKey: string;
|
|
12
|
-
requestDigest: Sha256Digest;
|
|
13
|
-
}
|
|
14
|
-
export declare function workspaceCheckpointRequestDigest(material: WorkspaceCheckpointMaterial): Sha256Digest;
|
|
15
|
-
export declare const WorkspaceCheckpointRequestSchema: z.ZodObject<{
|
|
16
|
-
source: z.ZodObject<{
|
|
17
|
-
runId: z.ZodString;
|
|
18
|
-
provider: z.ZodString;
|
|
19
|
-
environmentId: z.ZodString;
|
|
20
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
21
|
-
executionId: z.ZodOptional<z.ZodString>;
|
|
22
|
-
requestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
23
|
-
}, z.core.$strict>;
|
|
24
|
-
name: z.ZodOptional<z.ZodString>;
|
|
25
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
26
|
-
idempotencyKey: z.ZodString;
|
|
27
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
28
|
-
}, z.core.$strict>;
|
|
29
|
-
export interface WorkspaceCheckpointRef {
|
|
30
|
-
checkpointId: string;
|
|
31
|
-
provider: string;
|
|
32
|
-
source: AgentRunControlRef;
|
|
33
|
-
idempotencyKey: string;
|
|
34
|
-
requestDigest: Sha256Digest;
|
|
35
|
-
createdAt: string;
|
|
36
|
-
metadata?: Record<string, unknown>;
|
|
37
|
-
}
|
|
38
|
-
export declare const WorkspaceCheckpointRefSchema: z.ZodObject<{
|
|
39
|
-
checkpointId: z.ZodString;
|
|
40
|
-
provider: z.ZodString;
|
|
41
|
-
source: z.ZodObject<{
|
|
42
|
-
runId: z.ZodString;
|
|
43
|
-
provider: z.ZodString;
|
|
44
|
-
environmentId: z.ZodString;
|
|
45
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
46
|
-
executionId: z.ZodOptional<z.ZodString>;
|
|
47
|
-
requestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
|
-
idempotencyKey: z.ZodString;
|
|
50
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
51
|
-
createdAt: z.ZodISODateTime;
|
|
52
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
53
|
-
}, z.core.$strict>;
|
|
54
|
-
export type WorkspaceCheckpointResult = {
|
|
55
|
-
status: "created" | "replayed";
|
|
56
|
-
idempotencyKey: string;
|
|
57
|
-
requestDigest: Sha256Digest;
|
|
58
|
-
checkpoint: WorkspaceCheckpointRef;
|
|
59
|
-
} | {
|
|
60
|
-
status: "conflict";
|
|
61
|
-
idempotencyKey: string;
|
|
62
|
-
requestDigest: Sha256Digest;
|
|
63
|
-
existingRequestDigest: Sha256Digest;
|
|
64
|
-
} | {
|
|
65
|
-
status: "unknown";
|
|
66
|
-
idempotencyKey: string;
|
|
67
|
-
requestDigest: Sha256Digest;
|
|
68
|
-
message: string;
|
|
69
|
-
retryable: boolean;
|
|
70
|
-
};
|
|
71
|
-
export declare const WorkspaceCheckpointResultSchema: z.ZodType<WorkspaceCheckpointResult>;
|
|
72
|
-
export declare const WorkspaceOperationLookupRequestSchema: z.ZodObject<{
|
|
73
|
-
idempotencyKey: z.ZodString;
|
|
74
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
75
|
-
}, z.core.$strict>;
|
|
76
|
-
export type WorkspaceOperationLookupRequest = z.infer<typeof WorkspaceOperationLookupRequestSchema>;
|
|
77
|
-
export type WorkspaceCheckpointLookupResult = {
|
|
78
|
-
status: "found";
|
|
79
|
-
idempotencyKey: string;
|
|
80
|
-
requestDigest: Sha256Digest;
|
|
81
|
-
checkpoint: WorkspaceCheckpointRef;
|
|
82
|
-
} | {
|
|
83
|
-
status: "not_found";
|
|
84
|
-
idempotencyKey: string;
|
|
85
|
-
requestDigest: Sha256Digest;
|
|
86
|
-
} | {
|
|
87
|
-
status: "conflict";
|
|
88
|
-
idempotencyKey: string;
|
|
89
|
-
requestDigest: Sha256Digest;
|
|
90
|
-
existingRequestDigest: Sha256Digest;
|
|
91
|
-
} | {
|
|
92
|
-
status: "unknown";
|
|
93
|
-
idempotencyKey: string;
|
|
94
|
-
requestDigest: Sha256Digest;
|
|
95
|
-
message: string;
|
|
96
|
-
retryable: boolean;
|
|
97
|
-
};
|
|
98
|
-
export declare const WorkspaceCheckpointLookupResultSchema: z.ZodType<WorkspaceCheckpointLookupResult>;
|
|
99
|
-
export interface WorkspaceForkMaterial {
|
|
100
|
-
checkpoint: WorkspaceCheckpointRef;
|
|
101
|
-
name?: string;
|
|
102
|
-
metadata?: Record<string, unknown>;
|
|
103
|
-
}
|
|
104
|
-
export interface WorkspaceForkRequest extends WorkspaceForkMaterial {
|
|
105
|
-
idempotencyKey: string;
|
|
106
|
-
requestDigest: Sha256Digest;
|
|
107
|
-
}
|
|
108
|
-
export declare function workspaceForkRequestDigest(material: WorkspaceForkMaterial): Sha256Digest;
|
|
109
|
-
export declare const WorkspaceForkRequestSchema: z.ZodObject<{
|
|
110
|
-
checkpoint: z.ZodObject<{
|
|
111
|
-
checkpointId: z.ZodString;
|
|
112
|
-
provider: z.ZodString;
|
|
113
|
-
source: z.ZodObject<{
|
|
114
|
-
runId: z.ZodString;
|
|
115
|
-
provider: z.ZodString;
|
|
116
|
-
environmentId: z.ZodString;
|
|
117
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
118
|
-
executionId: z.ZodOptional<z.ZodString>;
|
|
119
|
-
requestDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
|
|
120
|
-
}, z.core.$strict>;
|
|
121
|
-
idempotencyKey: z.ZodString;
|
|
122
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
123
|
-
createdAt: z.ZodISODateTime;
|
|
124
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
125
|
-
}, z.core.$strict>;
|
|
126
|
-
name: z.ZodOptional<z.ZodString>;
|
|
127
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
128
|
-
idempotencyKey: z.ZodString;
|
|
129
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
130
|
-
}, z.core.$strict>;
|
|
131
|
-
export interface ForkedEnvironmentRef {
|
|
132
|
-
provider: string;
|
|
133
|
-
environmentId: string;
|
|
134
|
-
sourceCheckpointId: string;
|
|
135
|
-
idempotencyKey: string;
|
|
136
|
-
requestDigest: Sha256Digest;
|
|
137
|
-
createdAt: string;
|
|
138
|
-
placement?: PlacementInfo;
|
|
139
|
-
confidential: boolean;
|
|
140
|
-
metadata?: Record<string, unknown>;
|
|
141
|
-
}
|
|
142
|
-
export declare const ForkedEnvironmentRefSchema: z.ZodObject<{
|
|
143
|
-
provider: z.ZodString;
|
|
144
|
-
environmentId: z.ZodString;
|
|
145
|
-
sourceCheckpointId: z.ZodString;
|
|
146
|
-
idempotencyKey: z.ZodString;
|
|
147
|
-
requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
148
|
-
createdAt: z.ZodISODateTime;
|
|
149
|
-
placement: z.ZodOptional<z.ZodObject<{
|
|
150
|
-
kind: z.ZodEnum<{
|
|
151
|
-
provider: "provider";
|
|
152
|
-
local: "local";
|
|
153
|
-
sandbox: "sandbox";
|
|
154
|
-
fleet: "fleet";
|
|
155
|
-
}>;
|
|
156
|
-
sandboxId: z.ZodOptional<z.ZodString>;
|
|
157
|
-
fleetId: z.ZodOptional<z.ZodString>;
|
|
158
|
-
machineId: z.ZodOptional<z.ZodString>;
|
|
159
|
-
region: z.ZodOptional<z.ZodString>;
|
|
160
|
-
providerMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
161
|
-
}, z.core.$strict>>;
|
|
162
|
-
confidential: z.ZodBoolean;
|
|
163
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
164
|
-
}, z.core.$strict>;
|
|
165
|
-
export type WorkspaceForkResult = {
|
|
166
|
-
status: "created" | "replayed";
|
|
167
|
-
idempotencyKey: string;
|
|
168
|
-
requestDigest: Sha256Digest;
|
|
169
|
-
environment: ForkedEnvironmentRef;
|
|
170
|
-
} | {
|
|
171
|
-
status: "conflict";
|
|
172
|
-
idempotencyKey: string;
|
|
173
|
-
requestDigest: Sha256Digest;
|
|
174
|
-
existingRequestDigest: Sha256Digest;
|
|
175
|
-
} | {
|
|
176
|
-
status: "unknown";
|
|
177
|
-
idempotencyKey: string;
|
|
178
|
-
requestDigest: Sha256Digest;
|
|
179
|
-
message: string;
|
|
180
|
-
retryable: boolean;
|
|
181
|
-
};
|
|
182
|
-
export declare const WorkspaceForkResultSchema: z.ZodType<WorkspaceForkResult>;
|
|
183
|
-
export type WorkspaceForkLookupResult = {
|
|
184
|
-
status: "found";
|
|
185
|
-
idempotencyKey: string;
|
|
186
|
-
requestDigest: Sha256Digest;
|
|
187
|
-
environment: ForkedEnvironmentRef;
|
|
188
|
-
} | {
|
|
189
|
-
status: "not_found";
|
|
190
|
-
idempotencyKey: string;
|
|
191
|
-
requestDigest: Sha256Digest;
|
|
192
|
-
} | {
|
|
193
|
-
status: "conflict";
|
|
194
|
-
idempotencyKey: string;
|
|
195
|
-
requestDigest: Sha256Digest;
|
|
196
|
-
existingRequestDigest: Sha256Digest;
|
|
197
|
-
} | {
|
|
198
|
-
status: "unknown";
|
|
199
|
-
idempotencyKey: string;
|
|
200
|
-
requestDigest: Sha256Digest;
|
|
201
|
-
message: string;
|
|
202
|
-
retryable: boolean;
|
|
203
|
-
};
|
|
204
|
-
export declare const WorkspaceForkLookupResultSchema: z.ZodType<WorkspaceForkLookupResult>;
|
|
205
|
-
export declare const WorkspaceCleanupRequestSchema: z.ZodObject<{
|
|
206
|
-
operationId: z.ZodString;
|
|
207
|
-
targetId: z.ZodString;
|
|
208
|
-
provider: z.ZodString;
|
|
209
|
-
}, z.core.$strict>;
|
|
210
|
-
export type WorkspaceCleanupRequest = z.infer<typeof WorkspaceCleanupRequestSchema>;
|
|
211
|
-
export declare const WorkspaceCleanupAcknowledgementSchema: z.ZodObject<{
|
|
212
|
-
operationId: z.ZodString;
|
|
213
|
-
targetId: z.ZodString;
|
|
214
|
-
provider: z.ZodString;
|
|
215
|
-
status: z.ZodEnum<{
|
|
216
|
-
unknown: "unknown";
|
|
217
|
-
conflict: "conflict";
|
|
218
|
-
transport_failure: "transport_failure";
|
|
219
|
-
deleted: "deleted";
|
|
220
|
-
already_absent: "already_absent";
|
|
221
|
-
in_use: "in_use";
|
|
222
|
-
}>;
|
|
223
|
-
message: z.ZodOptional<z.ZodString>;
|
|
224
|
-
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
225
|
-
blockingTargetIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
226
|
-
}, z.core.$strict>;
|
|
227
|
-
export type WorkspaceCleanupAcknowledgement = z.infer<typeof WorkspaceCleanupAcknowledgementSchema>;
|
|
228
|
-
/** Optional durable workspace branch operations implemented by capable providers. */
|
|
229
|
-
export interface AgentWorkspaceBranching {
|
|
230
|
-
checkpoint(request: WorkspaceCheckpointRequest, options?: {
|
|
231
|
-
signal?: AbortSignal;
|
|
232
|
-
}): Promise<WorkspaceCheckpointResult>;
|
|
233
|
-
lookupCheckpoint(request: WorkspaceOperationLookupRequest, options?: {
|
|
234
|
-
signal?: AbortSignal;
|
|
235
|
-
}): Promise<WorkspaceCheckpointLookupResult>;
|
|
236
|
-
deleteCheckpoint(request: WorkspaceCleanupRequest, options?: {
|
|
237
|
-
signal?: AbortSignal;
|
|
238
|
-
}): Promise<WorkspaceCleanupAcknowledgement>;
|
|
239
|
-
fork(request: WorkspaceForkRequest, options?: {
|
|
240
|
-
signal?: AbortSignal;
|
|
241
|
-
}): Promise<WorkspaceForkResult>;
|
|
242
|
-
lookupFork(request: WorkspaceOperationLookupRequest, options?: {
|
|
243
|
-
signal?: AbortSignal;
|
|
244
|
-
}): Promise<WorkspaceForkLookupResult>;
|
|
245
|
-
destroyFork(request: WorkspaceCleanupRequest, options?: {
|
|
246
|
-
signal?: AbortSignal;
|
|
247
|
-
}): Promise<WorkspaceCleanupAcknowledgement>;
|
|
248
|
-
}
|
|
249
|
-
/** Bind a checkpoint result to the exact request before using the resource. */
|
|
250
|
-
export declare function workspaceCheckpointResultMatchesRequest(request: WorkspaceCheckpointRequest, result: WorkspaceCheckpointResult | WorkspaceCheckpointLookupResult): boolean;
|
|
251
|
-
/** Bind a fork result to the exact checkpoint request before using it. */
|
|
252
|
-
export declare function workspaceForkResultMatchesRequest(request: WorkspaceForkRequest, result: WorkspaceForkResult | WorkspaceForkLookupResult): boolean;
|
|
253
|
-
/** Bind cleanup confirmation to the exact provider resource and operation. */
|
|
254
|
-
export declare function workspaceCleanupAcknowledgementMatches(request: WorkspaceCleanupRequest, acknowledgement: WorkspaceCleanupAcknowledgement): boolean;
|
|
1
|
+
export * from "./workspace-confidentiality.js";
|
|
2
|
+
export * from "./workspace-checkpoint.js";
|
|
3
|
+
export * from "./workspace-fork.js";
|
|
4
|
+
export * from "./workspace-cleanup.js";
|