@tangle-network/agent-interface 0.19.0 → 0.21.0

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.
@@ -0,0 +1,498 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Structural parser for a frozen candidate.
4
+ *
5
+ * This does not verify any carried digest or fetch any artifact. The runtime
6
+ * verifier removes only the top-level `digest` field, serializes the remaining
7
+ * object with RFC 8785 to UTF-8 bytes, hashes those bytes with SHA-256, and
8
+ * compares lowercase `sha256:<hex>` identities before materialization.
9
+ */
10
+ export declare const agentCandidateBundleSchema: z.ZodObject<{
11
+ schemaVersion: z.ZodLiteral<1>;
12
+ kind: z.ZodLiteral<"agent-candidate-bundle">;
13
+ digestAlgorithm: z.ZodLiteral<"rfc8785-sha256">;
14
+ profile: z.ZodObject<{
15
+ name: z.ZodOptional<z.ZodString>;
16
+ description: z.ZodOptional<z.ZodString>;
17
+ version: z.ZodOptional<z.ZodString>;
18
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ prompt: z.ZodOptional<z.ZodObject<{
20
+ systemPrompt: z.ZodOptional<z.ZodString>;
21
+ instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
+ }, z.core.$strict>>;
23
+ model: z.ZodOptional<z.ZodObject<{
24
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
25
+ none: "none";
26
+ minimal: "minimal";
27
+ low: "low";
28
+ medium: "medium";
29
+ high: "high";
30
+ xhigh: "xhigh";
31
+ ultracode: "ultracode";
32
+ }>>;
33
+ default: z.ZodOptional<z.ZodString>;
34
+ small: z.ZodOptional<z.ZodString>;
35
+ provider: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strict>>;
37
+ harness: z.ZodOptional<z.ZodEnum<{
38
+ "claude-code": "claude-code";
39
+ claude: "claude";
40
+ claudish: "claudish";
41
+ nanoclaw: "nanoclaw";
42
+ codex: "codex";
43
+ opencode: "opencode";
44
+ "kimi-code": "kimi-code";
45
+ kimi: "kimi";
46
+ pi: "pi";
47
+ gemini: "gemini";
48
+ hermes: "hermes";
49
+ openclaw: "openclaw";
50
+ amp: "amp";
51
+ "factory-droids": "factory-droids";
52
+ acp: "acp";
53
+ "cli-base": "cli-base";
54
+ }>>;
55
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
56
+ allow: "allow";
57
+ ask: "ask";
58
+ deny: "deny";
59
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
60
+ allow: "allow";
61
+ ask: "ask";
62
+ deny: "deny";
63
+ }>>]>>>;
64
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
65
+ mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
66
+ transport: z.ZodOptional<z.ZodLiteral<"stdio">>;
67
+ command: z.ZodOptional<z.ZodString>;
68
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
69
+ kind: z.ZodLiteral<"public">;
70
+ value: z.ZodString;
71
+ }, z.core.$strict>>>;
72
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
73
+ kind: z.ZodLiteral<"public">;
74
+ value: z.ZodString;
75
+ }, z.core.$strict>>>;
76
+ cwd: z.ZodOptional<z.ZodString>;
77
+ enabled: z.ZodOptional<z.ZodBoolean>;
78
+ }, z.core.$strict>>>;
79
+ subagents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
80
+ prompt: z.ZodOptional<z.ZodString>;
81
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
82
+ allow: "allow";
83
+ ask: "ask";
84
+ deny: "deny";
85
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
86
+ allow: "allow";
87
+ ask: "ask";
88
+ deny: "deny";
89
+ }>>]>>>;
90
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
91
+ description: z.ZodOptional<z.ZodString>;
92
+ model: z.ZodOptional<z.ZodString>;
93
+ maxSteps: z.ZodOptional<z.ZodNumber>;
94
+ }, z.core.$strict>>>;
95
+ resources: z.ZodOptional<z.ZodObject<{
96
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
97
+ path: z.ZodString;
98
+ resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
99
+ kind: z.ZodLiteral<"inline">;
100
+ name: z.ZodString;
101
+ content: z.ZodString;
102
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
103
+ byteLength: z.ZodNumber;
104
+ }, z.core.$strict>, z.ZodObject<{
105
+ kind: z.ZodLiteral<"github">;
106
+ repository: z.ZodObject<{
107
+ kind: z.ZodLiteral<"github">;
108
+ owner: z.ZodString;
109
+ repo: z.ZodString;
110
+ }, z.core.$strict>;
111
+ path: z.ZodString;
112
+ commit: z.ZodString;
113
+ name: z.ZodOptional<z.ZodString>;
114
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
115
+ byteLength: z.ZodNumber;
116
+ }, z.core.$strict>], "kind">;
117
+ executable: z.ZodOptional<z.ZodBoolean>;
118
+ }, z.core.$strict>>>;
119
+ tools: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ kind: z.ZodLiteral<"inline">;
121
+ name: z.ZodString;
122
+ content: z.ZodString;
123
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
124
+ byteLength: z.ZodNumber;
125
+ }, z.core.$strict>, z.ZodObject<{
126
+ kind: z.ZodLiteral<"github">;
127
+ repository: z.ZodObject<{
128
+ kind: z.ZodLiteral<"github">;
129
+ owner: z.ZodString;
130
+ repo: z.ZodString;
131
+ }, z.core.$strict>;
132
+ path: z.ZodString;
133
+ commit: z.ZodString;
134
+ name: z.ZodOptional<z.ZodString>;
135
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
136
+ byteLength: z.ZodNumber;
137
+ }, z.core.$strict>], "kind">>>;
138
+ skills: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
139
+ kind: z.ZodLiteral<"inline">;
140
+ name: z.ZodString;
141
+ content: z.ZodString;
142
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
143
+ byteLength: z.ZodNumber;
144
+ }, z.core.$strict>, z.ZodObject<{
145
+ kind: z.ZodLiteral<"github">;
146
+ repository: z.ZodObject<{
147
+ kind: z.ZodLiteral<"github">;
148
+ owner: z.ZodString;
149
+ repo: z.ZodString;
150
+ }, z.core.$strict>;
151
+ path: z.ZodString;
152
+ commit: z.ZodString;
153
+ name: z.ZodOptional<z.ZodString>;
154
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
155
+ byteLength: z.ZodNumber;
156
+ }, z.core.$strict>], "kind">>>;
157
+ agents: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
158
+ kind: z.ZodLiteral<"inline">;
159
+ name: z.ZodString;
160
+ content: z.ZodString;
161
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
162
+ byteLength: z.ZodNumber;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ kind: z.ZodLiteral<"github">;
165
+ repository: z.ZodObject<{
166
+ kind: z.ZodLiteral<"github">;
167
+ owner: z.ZodString;
168
+ repo: z.ZodString;
169
+ }, z.core.$strict>;
170
+ path: z.ZodString;
171
+ commit: z.ZodString;
172
+ name: z.ZodOptional<z.ZodString>;
173
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
174
+ byteLength: z.ZodNumber;
175
+ }, z.core.$strict>], "kind">>>;
176
+ commands: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
177
+ kind: z.ZodLiteral<"inline">;
178
+ name: z.ZodString;
179
+ content: z.ZodString;
180
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
181
+ byteLength: z.ZodNumber;
182
+ }, z.core.$strict>, z.ZodObject<{
183
+ kind: z.ZodLiteral<"github">;
184
+ repository: z.ZodObject<{
185
+ kind: z.ZodLiteral<"github">;
186
+ owner: z.ZodString;
187
+ repo: z.ZodString;
188
+ }, z.core.$strict>;
189
+ path: z.ZodString;
190
+ commit: z.ZodString;
191
+ name: z.ZodOptional<z.ZodString>;
192
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
193
+ byteLength: z.ZodNumber;
194
+ }, z.core.$strict>], "kind">>>;
195
+ instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
196
+ kind: z.ZodLiteral<"inline">;
197
+ name: z.ZodString;
198
+ content: z.ZodString;
199
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
200
+ byteLength: z.ZodNumber;
201
+ }, z.core.$strict>, z.ZodObject<{
202
+ kind: z.ZodLiteral<"github">;
203
+ repository: z.ZodObject<{
204
+ kind: z.ZodLiteral<"github">;
205
+ owner: z.ZodString;
206
+ repo: z.ZodString;
207
+ }, z.core.$strict>;
208
+ path: z.ZodString;
209
+ commit: z.ZodString;
210
+ name: z.ZodOptional<z.ZodString>;
211
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
212
+ byteLength: z.ZodNumber;
213
+ }, z.core.$strict>], "kind">]>>;
214
+ failOnError: z.ZodLiteral<true>;
215
+ }, z.core.$strict>>;
216
+ hooks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
217
+ executable: z.ZodString;
218
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
219
+ kind: z.ZodLiteral<"public">;
220
+ value: z.ZodString;
221
+ }, z.core.$strict>>>;
222
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
223
+ blocking: z.ZodOptional<z.ZodBoolean>;
224
+ matcher: z.ZodOptional<z.ZodString>;
225
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
226
+ kind: z.ZodLiteral<"public">;
227
+ value: z.ZodString;
228
+ }, z.core.$strict>>>;
229
+ }, z.core.$strict>>>>;
230
+ modes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
231
+ prompt: z.ZodOptional<z.ZodString>;
232
+ permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
233
+ allow: "allow";
234
+ ask: "ask";
235
+ deny: "deny";
236
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
237
+ allow: "allow";
238
+ ask: "ask";
239
+ deny: "deny";
240
+ }>>]>>>;
241
+ tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
242
+ description: z.ZodOptional<z.ZodString>;
243
+ model: z.ZodOptional<z.ZodString>;
244
+ }, z.core.$strict>>>;
245
+ confidential: z.ZodOptional<z.ZodObject<{
246
+ tee: z.ZodOptional<z.ZodString>;
247
+ attestationNonce: z.ZodOptional<z.ZodString>;
248
+ sealed: z.ZodOptional<z.ZodBoolean>;
249
+ attestationRefresh: z.ZodOptional<z.ZodBoolean>;
250
+ }, z.core.$strict>>;
251
+ }, z.core.$strict>;
252
+ code: z.ZodDiscriminatedUnion<[z.ZodObject<{
253
+ kind: z.ZodLiteral<"disabled">;
254
+ reason: z.ZodEnum<{
255
+ control: "control";
256
+ "not-applicable": "not-applicable";
257
+ }>;
258
+ }, z.core.$strict>, z.ZodObject<{
259
+ kind: z.ZodLiteral<"no-op">;
260
+ reason: z.ZodLiteral<"proposer-no-change">;
261
+ repository: z.ZodObject<{
262
+ kind: z.ZodLiteral<"github">;
263
+ owner: z.ZodString;
264
+ repo: z.ZodString;
265
+ }, z.core.$strict>;
266
+ baseCommit: z.ZodString;
267
+ baseTree: z.ZodString;
268
+ }, z.core.$strict>, z.ZodObject<{
269
+ kind: z.ZodLiteral<"git-patch">;
270
+ repository: z.ZodObject<{
271
+ kind: z.ZodLiteral<"github">;
272
+ owner: z.ZodString;
273
+ repo: z.ZodString;
274
+ }, z.core.$strict>;
275
+ baseCommit: z.ZodString;
276
+ baseTree: z.ZodString;
277
+ candidateTree: z.ZodString;
278
+ patch: z.ZodObject<{
279
+ format: z.ZodLiteral<"git-diff-binary">;
280
+ artifact: z.ZodObject<{
281
+ encoding: z.ZodLiteral<"base64">;
282
+ content: z.ZodString;
283
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
284
+ byteLength: z.ZodNumber;
285
+ }, z.core.$strict>;
286
+ }, z.core.$strict>;
287
+ }, z.core.$strict>], "kind">;
288
+ execution: z.ZodObject<{
289
+ harness: z.ZodEnum<{
290
+ "claude-code": "claude-code";
291
+ claude: "claude";
292
+ claudish: "claudish";
293
+ nanoclaw: "nanoclaw";
294
+ codex: "codex";
295
+ opencode: "opencode";
296
+ "kimi-code": "kimi-code";
297
+ kimi: "kimi";
298
+ pi: "pi";
299
+ gemini: "gemini";
300
+ hermes: "hermes";
301
+ openclaw: "openclaw";
302
+ amp: "amp";
303
+ "factory-droids": "factory-droids";
304
+ acp: "acp";
305
+ "cli-base": "cli-base";
306
+ }>;
307
+ harnessVersion: z.ZodString;
308
+ launch: z.ZodDiscriminatedUnion<[z.ZodObject<{
309
+ kind: z.ZodLiteral<"container-command">;
310
+ executable: z.ZodString;
311
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
312
+ kind: z.ZodLiteral<"public">;
313
+ value: z.ZodString;
314
+ }, z.core.$strict>>>;
315
+ }, z.core.$strict>, z.ZodObject<{
316
+ kind: z.ZodLiteral<"candidate-entrypoint">;
317
+ entrypoint: z.ZodString;
318
+ interpreter: z.ZodOptional<z.ZodEnum<{
319
+ node: "node";
320
+ python: "python";
321
+ python3: "python3";
322
+ bun: "bun";
323
+ deno: "deno";
324
+ tsx: "tsx";
325
+ uv: "uv";
326
+ }>>;
327
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
328
+ kind: z.ZodLiteral<"public">;
329
+ value: z.ZodString;
330
+ }, z.core.$strict>>>;
331
+ }, z.core.$strict>], "kind">;
332
+ instructionDelivery: z.ZodDiscriminatedUnion<[z.ZodObject<{
333
+ kind: z.ZodLiteral<"argv-append">;
334
+ }, z.core.$strict>, z.ZodObject<{
335
+ kind: z.ZodLiteral<"stdin-utf8">;
336
+ }, z.core.$strict>, z.ZodObject<{
337
+ kind: z.ZodLiteral<"utf8-file">;
338
+ env: z.ZodLiteral<"TANGLE_CANDIDATE_TASK_PATH">;
339
+ path: z.ZodLiteral<"/tangle/input/task.txt">;
340
+ }, z.core.$strict>], "kind">;
341
+ cwd: z.ZodObject<{
342
+ workspace: z.ZodEnum<{
343
+ candidate: "candidate";
344
+ task: "task";
345
+ }>;
346
+ path: z.ZodString;
347
+ }, z.core.$strict>;
348
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
349
+ kind: z.ZodLiteral<"public">;
350
+ value: z.ZodString;
351
+ }, z.core.$strict>>>;
352
+ environment: z.ZodDiscriminatedUnion<[z.ZodObject<{
353
+ kind: z.ZodLiteral<"pinned-container">;
354
+ container: z.ZodObject<{
355
+ image: z.ZodString;
356
+ indexDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
357
+ }, z.core.$strict>;
358
+ }, z.core.$strict>, z.ZodObject<{
359
+ kind: z.ZodLiteral<"evaluator-task-container">;
360
+ }, z.core.$strict>], "kind">;
361
+ workspace: z.ZodOptional<z.ZodObject<{
362
+ schemaVersion: z.ZodLiteral<1>;
363
+ kind: z.ZodLiteral<"agent-candidate-workspace-snapshot">;
364
+ digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
365
+ material: z.ZodObject<{
366
+ schemaVersion: z.ZodLiteral<1>;
367
+ kind: z.ZodLiteral<"agent-candidate-workspace-manifest">;
368
+ files: z.ZodArray<z.ZodObject<{
369
+ path: z.ZodString;
370
+ mode: z.ZodUnion<readonly [z.ZodLiteral<420>, z.ZodLiteral<493>]>;
371
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
372
+ byteLength: z.ZodNumber;
373
+ }, z.core.$strict>>;
374
+ }, z.core.$strict>;
375
+ manifest: z.ZodUnion<readonly [z.ZodObject<{
376
+ locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
377
+ kind: z.ZodLiteral<"s3">;
378
+ bucket: z.ZodString;
379
+ key: z.ZodString;
380
+ region: z.ZodOptional<z.ZodString>;
381
+ }, z.core.$strict>, z.ZodObject<{
382
+ kind: z.ZodLiteral<"ipfs">;
383
+ cid: z.ZodString;
384
+ path: z.ZodOptional<z.ZodString>;
385
+ }, z.core.$strict>], "kind">;
386
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
387
+ byteLength: z.ZodNumber;
388
+ }, z.core.$strict>, z.ZodObject<{
389
+ encoding: z.ZodLiteral<"base64">;
390
+ content: z.ZodString;
391
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
392
+ byteLength: z.ZodNumber;
393
+ }, z.core.$strict>]>;
394
+ archive: z.ZodUnion<readonly [z.ZodObject<{
395
+ locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
396
+ kind: z.ZodLiteral<"s3">;
397
+ bucket: z.ZodString;
398
+ key: z.ZodString;
399
+ region: z.ZodOptional<z.ZodString>;
400
+ }, z.core.$strict>, z.ZodObject<{
401
+ kind: z.ZodLiteral<"ipfs">;
402
+ cid: z.ZodString;
403
+ path: z.ZodOptional<z.ZodString>;
404
+ }, z.core.$strict>], "kind">;
405
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
406
+ byteLength: z.ZodNumber;
407
+ }, z.core.$strict>, z.ZodObject<{
408
+ encoding: z.ZodLiteral<"base64">;
409
+ content: z.ZodString;
410
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
411
+ byteLength: z.ZodNumber;
412
+ }, z.core.$strict>]>;
413
+ }, z.core.$strict>>;
414
+ isolation: z.ZodObject<{
415
+ network: z.ZodLiteral<"disabled">;
416
+ remoteIntegrations: z.ZodLiteral<"disabled">;
417
+ candidateSecrets: z.ZodLiteral<"disabled">;
418
+ }, z.core.$strict>;
419
+ }, z.core.$strict>;
420
+ knowledge: z.ZodOptional<z.ZodObject<{
421
+ snapshotId: z.ZodString;
422
+ manifest: z.ZodObject<{
423
+ locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
424
+ kind: z.ZodLiteral<"s3">;
425
+ bucket: z.ZodString;
426
+ key: z.ZodString;
427
+ region: z.ZodOptional<z.ZodString>;
428
+ }, z.core.$strict>, z.ZodObject<{
429
+ kind: z.ZodLiteral<"ipfs">;
430
+ cid: z.ZodString;
431
+ path: z.ZodOptional<z.ZodString>;
432
+ }, z.core.$strict>], "kind">;
433
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
434
+ byteLength: z.ZodNumber;
435
+ }, z.core.$strict>;
436
+ }, z.core.$strict>>;
437
+ memory: z.ZodDiscriminatedUnion<[z.ZodObject<{
438
+ mode: z.ZodLiteral<"disabled">;
439
+ }, z.core.$strict>, z.ZodObject<{
440
+ mode: z.ZodLiteral<"isolated">;
441
+ scope: z.ZodLiteral<"task">;
442
+ seed: z.ZodOptional<z.ZodObject<{
443
+ locator: z.ZodDiscriminatedUnion<[z.ZodObject<{
444
+ kind: z.ZodLiteral<"s3">;
445
+ bucket: z.ZodString;
446
+ key: z.ZodString;
447
+ region: z.ZodOptional<z.ZodString>;
448
+ }, z.core.$strict>, z.ZodObject<{
449
+ kind: z.ZodLiteral<"ipfs">;
450
+ cid: z.ZodString;
451
+ path: z.ZodOptional<z.ZodString>;
452
+ }, z.core.$strict>], "kind">;
453
+ sha256: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
454
+ byteLength: z.ZodNumber;
455
+ }, z.core.$strict>>;
456
+ }, z.core.$strict>], "mode">;
457
+ lineage: z.ZodObject<{
458
+ source: z.ZodEnum<{
459
+ optimizer: "optimizer";
460
+ human: "human";
461
+ import: "import";
462
+ compound: "compound";
463
+ }>;
464
+ parentDigests: z.ZodOptional<z.ZodArray<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>>;
465
+ runIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
466
+ profileDiffIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
467
+ modelSnapshots: z.ZodOptional<z.ZodArray<z.ZodString>>;
468
+ benchmark: z.ZodOptional<z.ZodObject<{
469
+ name: z.ZodString;
470
+ version: z.ZodString;
471
+ splitDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
472
+ }, z.core.$strict>>;
473
+ spend: z.ZodOptional<z.ZodObject<{
474
+ proposal: z.ZodObject<{
475
+ costUsd: z.ZodNumber;
476
+ inputTokens: z.ZodNumber;
477
+ outputTokens: z.ZodNumber;
478
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
479
+ modelCalls: z.ZodNumber;
480
+ }, z.core.$strict>;
481
+ evaluation: z.ZodObject<{
482
+ costUsd: z.ZodNumber;
483
+ inputTokens: z.ZodNumber;
484
+ outputTokens: z.ZodNumber;
485
+ cachedInputTokens: z.ZodOptional<z.ZodNumber>;
486
+ modelCalls: z.ZodNumber;
487
+ }, z.core.$strict>;
488
+ }, z.core.$strict>>;
489
+ }, z.core.$strict>;
490
+ digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
491
+ }, z.core.$strict>;
492
+ export * from "./agent-candidate-artifact-schema.js";
493
+ export * from "./agent-candidate-code-schema.js";
494
+ export * from "./agent-candidate-execution-plan-schema.js";
495
+ export * from "./agent-candidate-lineage-schema.js";
496
+ export * from "./agent-candidate-profile-schema.js";
497
+ export * from "./agent-candidate-receipt-schema.js";
498
+ export { sha256DigestSchema } from "./agent-candidate-schema-common.js";
@@ -0,0 +1,144 @@
1
+ import { z } from "zod";
2
+ import { agentCandidateCodeSchema, agentCandidateExecutionSchema } from "./agent-candidate-code-schema.js";
3
+ import { agentCandidateProfileSchema } from "./agent-candidate-profile-schema.js";
4
+ import { agentCandidateKnowledgeSchema, agentCandidateLineageSchema, agentCandidateMemoryPolicySchema, } from "./agent-candidate-lineage-schema.js";
5
+ import { isCanonicalJsonValue, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
6
+ import { canonicalizeHarness } from "./harness.js";
7
+ /**
8
+ * Structural parser for a frozen candidate.
9
+ *
10
+ * This does not verify any carried digest or fetch any artifact. The runtime
11
+ * verifier removes only the top-level `digest` field, serializes the remaining
12
+ * object with RFC 8785 to UTF-8 bytes, hashes those bytes with SHA-256, and
13
+ * compares lowercase `sha256:<hex>` identities before materialization.
14
+ */
15
+ export const agentCandidateBundleSchema = z
16
+ .object({
17
+ schemaVersion: z.literal(1),
18
+ kind: z.literal("agent-candidate-bundle"),
19
+ digestAlgorithm: z.literal("rfc8785-sha256"),
20
+ profile: agentCandidateProfileSchema,
21
+ code: agentCandidateCodeSchema,
22
+ execution: agentCandidateExecutionSchema,
23
+ knowledge: agentCandidateKnowledgeSchema.optional(),
24
+ memory: agentCandidateMemoryPolicySchema,
25
+ lineage: agentCandidateLineageSchema,
26
+ digest: sha256DigestSchema,
27
+ })
28
+ .strict()
29
+ .superRefine((bundle, ctx) => {
30
+ if (!isCanonicalJsonValue(bundle)) {
31
+ ctx.addIssue({
32
+ code: "custom",
33
+ message: "candidate bundle must contain only finite, acyclic RFC 8785 JSON values",
34
+ });
35
+ }
36
+ if (bundle.profile.harness !== undefined &&
37
+ canonicalizeHarness(bundle.profile.harness) !==
38
+ canonicalizeHarness(bundle.execution.harness)) {
39
+ ctx.addIssue({
40
+ code: "custom",
41
+ path: ["execution", "harness"],
42
+ message: "execution harness must match the candidate profile preference",
43
+ });
44
+ }
45
+ if (bundle.lineage.parentDigests?.includes(bundle.digest)) {
46
+ ctx.addIssue({
47
+ code: "custom",
48
+ path: ["lineage", "parentDigests"],
49
+ message: "a candidate cannot name itself as a parent",
50
+ });
51
+ }
52
+ if (bundle.code.kind === "disabled") {
53
+ if (bundle.execution.cwd.workspace !== "task") {
54
+ ctx.addIssue({
55
+ code: "custom",
56
+ path: ["execution", "cwd", "workspace"],
57
+ message: "disabled code controls must execute in the task workspace",
58
+ });
59
+ }
60
+ if (bundle.execution.launch.kind !== "container-command") {
61
+ ctx.addIssue({
62
+ code: "custom",
63
+ path: ["execution", "launch"],
64
+ message: "disabled code controls must use a container command",
65
+ });
66
+ }
67
+ if (bundle.execution.workspace !== undefined) {
68
+ ctx.addIssue({
69
+ code: "custom",
70
+ path: ["execution", "workspace"],
71
+ message: "disabled code cannot carry a candidate workspace",
72
+ });
73
+ }
74
+ if (bundle.code.reason === "control" &&
75
+ (bundle.lineage.source === "optimizer" ||
76
+ bundle.lineage.source === "compound")) {
77
+ ctx.addIssue({
78
+ code: "custom",
79
+ path: ["lineage", "source"],
80
+ message: "fixed controls cannot claim proposer lineage",
81
+ });
82
+ }
83
+ }
84
+ else {
85
+ const launch = bundle.execution.launch;
86
+ if (launch.kind !== "candidate-entrypoint") {
87
+ ctx.addIssue({
88
+ code: "custom",
89
+ path: ["execution", "launch"],
90
+ message: "an active code surface must launch its candidate entrypoint",
91
+ });
92
+ }
93
+ if (bundle.execution.workspace === undefined) {
94
+ ctx.addIssue({
95
+ code: "custom",
96
+ path: ["execution", "workspace"],
97
+ message: "active code requires a complete candidate workspace",
98
+ });
99
+ }
100
+ else if (bundle.execution.workspace.material.files.length === 0) {
101
+ ctx.addIssue({
102
+ code: "custom",
103
+ path: ["execution", "workspace", "material", "files"],
104
+ message: "active candidate workspaces cannot be empty",
105
+ });
106
+ }
107
+ else if (launch.kind === "candidate-entrypoint" &&
108
+ !bundle.execution.workspace.material.files.some((file) => file.path === launch.entrypoint)) {
109
+ ctx.addIssue({
110
+ code: "custom",
111
+ path: ["execution", "launch", "entrypoint"],
112
+ message: "candidate entrypoint must exist in the pinned workspace manifest",
113
+ });
114
+ }
115
+ else if (launch.kind === "candidate-entrypoint") {
116
+ const entrypoint = bundle.execution.workspace.material.files.find((file) => file.path === launch.entrypoint);
117
+ if (launch.interpreter === undefined && entrypoint?.mode !== 0o755) {
118
+ ctx.addIssue({
119
+ code: "custom",
120
+ path: ["execution", "launch", "entrypoint"],
121
+ message: "a directly launched candidate entrypoint must be executable",
122
+ });
123
+ }
124
+ }
125
+ if (bundle.code.kind === "no-op" &&
126
+ bundle.lineage.source !== "optimizer" &&
127
+ bundle.lineage.source !== "compound") {
128
+ ctx.addIssue({
129
+ code: "custom",
130
+ path: ["lineage", "source"],
131
+ message: "proposer no-op candidates require optimizer or compound lineage",
132
+ });
133
+ }
134
+ }
135
+ });
136
+ const _bundleSchemaMatchesType = true;
137
+ void _bundleSchemaMatchesType;
138
+ export * from "./agent-candidate-artifact-schema.js";
139
+ export * from "./agent-candidate-code-schema.js";
140
+ export * from "./agent-candidate-execution-plan-schema.js";
141
+ export * from "./agent-candidate-lineage-schema.js";
142
+ export * from "./agent-candidate-profile-schema.js";
143
+ export * from "./agent-candidate-receipt-schema.js";
144
+ export { sha256DigestSchema } from "./agent-candidate-schema-common.js";