@yaklabs-ai/plugin-sdk 0.45.0 → 0.46.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,956 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Everything a capture resolved BEFORE the mutation's own target/revision/digest was known -
5
+ * opaque, JSON-safe, and carryable across a URI dispatch boundary as-is. Missing `artifacts[]`
6
+ * only; {@link finalizeArtifactProvenanceEnvelope} supplies that once the owning store knows it.
7
+ */
8
+ export declare interface ArtifactProvenanceCaptureContext {
9
+ readonly operation: ArtifactProvenanceOperation;
10
+ readonly sessions: readonly ArtifactProvenanceSession[];
11
+ readonly subjects: readonly ArtifactProvenanceReference[];
12
+ readonly evidence: readonly ArtifactProvenanceReference[];
13
+ readonly gaps: readonly ArtifactProvenanceGap[];
14
+ }
15
+
16
+ /**
17
+ * The part of an envelope the host captures BEFORE the artifact's own target/revision is
18
+ * known - everything but `version` and `artifacts`. A store that received this opaque value
19
+ * across the dispatch boundary parses it here, then hands it to
20
+ * `finalizeArtifactProvenanceEnvelope` (`artifact-provenance-capture.ts`) once it knows its
21
+ * own `artifacts[]`.
22
+ *
23
+ * Deliberately a bare structural parse, NOT the envelope's cross-field `superRefine`: the
24
+ * capture is an intermediate, and its final invariants (target <-> operation binding, session
25
+ * graph closure, gap coverage) are only decidable at finalization. Validating them here would
26
+ * reject a capture for a target the store has not supplied yet.
27
+ */
28
+ declare const ArtifactProvenanceCaptureContextSchema: z.ZodObject<{
29
+ operation: z.ZodObject<{
30
+ id: z.ZodNullable<z.ZodString>;
31
+ at: z.ZodNullable<z.ZodISODateTime>;
32
+ name: z.ZodString;
33
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ kind: z.ZodLiteral<"session">;
35
+ sessionId: z.ZodString;
36
+ runId: z.ZodNullable<z.ZodString>;
37
+ }, z.core.$strict>, z.ZodObject<{
38
+ kind: z.ZodLiteral<"human">;
39
+ userId: z.ZodOptional<z.ZodString>;
40
+ surface: z.ZodString;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ kind: z.ZodLiteral<"plugin">;
43
+ pluginId: z.ZodString;
44
+ capability: z.ZodString;
45
+ }, z.core.$strict>, z.ZodObject<{
46
+ kind: z.ZodLiteral<"host">;
47
+ capability: z.ZodString;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ kind: z.ZodLiteral<"import">;
50
+ source: z.ZodString;
51
+ }, z.core.$strict>, z.ZodObject<{
52
+ kind: z.ZodLiteral<"unknown">;
53
+ }, z.core.$strict>], "kind">;
54
+ invocation: z.ZodNullable<z.ZodObject<{
55
+ tool: z.ZodString;
56
+ toolCallId: z.ZodNullable<z.ZodString>;
57
+ origin: z.ZodEnum<{
58
+ host: "host";
59
+ model: "model";
60
+ }>;
61
+ }, z.core.$strict>>;
62
+ causes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
63
+ kind: z.ZodLiteral<"session">;
64
+ sessionId: z.ZodString;
65
+ runId: z.ZodNullable<z.ZodString>;
66
+ }, z.core.$strict>, z.ZodObject<{
67
+ kind: z.ZodLiteral<"session-event">;
68
+ sessionId: z.ZodString;
69
+ cause: z.ZodObject<{
70
+ handler: z.ZodString;
71
+ kind: z.ZodOptional<z.ZodEnum<{
72
+ "session-event": "session-event";
73
+ backfill: "backfill";
74
+ }>>;
75
+ event: z.ZodOptional<z.ZodObject<{
76
+ type: z.ZodEnum<{
77
+ "turn-settled": "turn-settled";
78
+ "phase-shift": "phase-shift";
79
+ "human-message": "human-message";
80
+ "assistant-message": "assistant-message";
81
+ "ui-action": "ui-action";
82
+ }>;
83
+ entryId: z.ZodString;
84
+ runId: z.ZodOptional<z.ZodString>;
85
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
+ }, z.core.$strict>>;
87
+ dedupeKey: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strict>;
89
+ }, z.core.$strict>, z.ZodObject<{
90
+ kind: z.ZodLiteral<"automation">;
91
+ automationId: z.ZodString;
92
+ runId: z.ZodNullable<z.ZodString>;
93
+ }, z.core.$strict>, z.ZodObject<{
94
+ kind: z.ZodLiteral<"operation">;
95
+ operationId: z.ZodString;
96
+ }, z.core.$strict>], "kind">>;
97
+ }, z.core.$strict>;
98
+ sessions: z.ZodArray<z.ZodObject<{
99
+ sessionId: z.ZodString;
100
+ basis: z.ZodEnum<{
101
+ "legacy-derived": "legacy-derived";
102
+ "unverified-index": "unverified-index";
103
+ recorded: "recorded";
104
+ missing: "missing";
105
+ }>;
106
+ record: z.ZodNullable<z.ZodObject<{
107
+ relationships: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
108
+ kind: z.ZodLiteral<"child-of">;
109
+ sessionId: z.ZodString;
110
+ }, z.core.$strict>, z.ZodObject<{
111
+ kind: z.ZodLiteral<"forked-from">;
112
+ sessionId: z.ZodString;
113
+ atEntryId: z.ZodOptional<z.ZodString>;
114
+ }, z.core.$strict>], "kind">>;
115
+ createdBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ kind: z.ZodLiteral<"human">;
117
+ surface: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strict>, z.ZodObject<{
119
+ kind: z.ZodLiteral<"agent">;
120
+ sessionId: z.ZodString;
121
+ tool: z.ZodString;
122
+ runId: z.ZodOptional<z.ZodString>;
123
+ toolCallId: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strict>, z.ZodObject<{
125
+ kind: z.ZodLiteral<"plugin">;
126
+ pluginId: z.ZodString;
127
+ door: z.ZodEnum<{
128
+ "sessions.create": "sessions.create";
129
+ "sessions.run": "sessions.run";
130
+ "hindsight.runFollowup": "hindsight.runFollowup";
131
+ "agents.run": "agents.run";
132
+ }>;
133
+ callerSessionId: z.ZodOptional<z.ZodString>;
134
+ }, z.core.$strict>, z.ZodObject<{
135
+ kind: z.ZodLiteral<"trigger">;
136
+ automationId: z.ZodString;
137
+ runId: z.ZodOptional<z.ZodString>;
138
+ bindingName: z.ZodString;
139
+ triggerKind: z.ZodEnum<{
140
+ time: "time";
141
+ cron: "cron";
142
+ occurrence: "occurrence";
143
+ "uri-change": "uri-change";
144
+ "plugin-event": "plugin-event";
145
+ manual: "manual";
146
+ }>;
147
+ }, z.core.$strict>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"daemon">;
149
+ capability: z.ZodString;
150
+ }, z.core.$strict>], "kind">;
151
+ definedBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
152
+ layer: z.ZodLiteral<"plugin">;
153
+ pluginId: z.ZodString;
154
+ capability: z.ZodString;
155
+ version: z.ZodOptional<z.ZodString>;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ layer: z.ZodLiteral<"host">;
158
+ capability: z.ZodString;
159
+ }, z.core.$strict>], "layer">;
160
+ intent: z.ZodEnum<{
161
+ interactive: "interactive";
162
+ headless: "headless";
163
+ }>;
164
+ causedByEvent: z.ZodOptional<z.ZodObject<{
165
+ handler: z.ZodString;
166
+ kind: z.ZodOptional<z.ZodEnum<{
167
+ "session-event": "session-event";
168
+ backfill: "backfill";
169
+ }>>;
170
+ event: z.ZodOptional<z.ZodObject<{
171
+ type: z.ZodEnum<{
172
+ "turn-settled": "turn-settled";
173
+ "phase-shift": "phase-shift";
174
+ "human-message": "human-message";
175
+ "assistant-message": "assistant-message";
176
+ "ui-action": "ui-action";
177
+ }>;
178
+ entryId: z.ZodString;
179
+ runId: z.ZodOptional<z.ZodString>;
180
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
+ }, z.core.$strict>>;
182
+ dedupeKey: z.ZodOptional<z.ZodString>;
183
+ }, z.core.$strict>>;
184
+ }, z.core.$strict>>;
185
+ }, z.core.$strict>>;
186
+ subjects: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
187
+ kind: z.ZodLiteral<"session">;
188
+ sessionId: z.ZodString;
189
+ runId: z.ZodOptional<z.ZodString>;
190
+ }, z.core.$strict>, z.ZodObject<{
191
+ kind: z.ZodLiteral<"artifact">;
192
+ revision: z.ZodObject<{
193
+ storeId: z.ZodString;
194
+ artifactId: z.ZodString;
195
+ uri: z.ZodOptional<z.ZodString>;
196
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
197
+ kind: z.ZodLiteral<"enclosing-commit">;
198
+ }, z.core.$strict>, z.ZodNull]>;
199
+ operationId: z.ZodNullable<z.ZodString>;
200
+ digest: z.ZodOptional<z.ZodObject<{
201
+ algorithm: z.ZodString;
202
+ value: z.ZodString;
203
+ }, z.core.$strict>>;
204
+ }, z.core.$strict>;
205
+ }, z.core.$strict>, z.ZodObject<{
206
+ kind: z.ZodLiteral<"resource">;
207
+ uri: z.ZodString;
208
+ revision: z.ZodNullable<z.ZodString>;
209
+ }, z.core.$strict>], "kind">>;
210
+ evidence: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
211
+ kind: z.ZodLiteral<"session">;
212
+ sessionId: z.ZodString;
213
+ runId: z.ZodOptional<z.ZodString>;
214
+ }, z.core.$strict>, z.ZodObject<{
215
+ kind: z.ZodLiteral<"artifact">;
216
+ revision: z.ZodObject<{
217
+ storeId: z.ZodString;
218
+ artifactId: z.ZodString;
219
+ uri: z.ZodOptional<z.ZodString>;
220
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
221
+ kind: z.ZodLiteral<"enclosing-commit">;
222
+ }, z.core.$strict>, z.ZodNull]>;
223
+ operationId: z.ZodNullable<z.ZodString>;
224
+ digest: z.ZodOptional<z.ZodObject<{
225
+ algorithm: z.ZodString;
226
+ value: z.ZodString;
227
+ }, z.core.$strict>>;
228
+ }, z.core.$strict>;
229
+ }, z.core.$strict>, z.ZodObject<{
230
+ kind: z.ZodLiteral<"resource">;
231
+ uri: z.ZodString;
232
+ revision: z.ZodNullable<z.ZodString>;
233
+ }, z.core.$strict>], "kind">>;
234
+ gaps: z.ZodArray<z.ZodObject<{
235
+ code: z.ZodEnum<{
236
+ unknown: "unknown";
237
+ "capture-failed": "capture-failed";
238
+ "legacy-derived": "legacy-derived";
239
+ "ambiguous-predecessor": "ambiguous-predecessor";
240
+ "unverified-index": "unverified-index";
241
+ "missing-ancestor": "missing-ancestor";
242
+ cycle: "cycle";
243
+ truncated: "truncated";
244
+ "metadata-write-failed": "metadata-write-failed";
245
+ "invalid-record": "invalid-record";
246
+ }>;
247
+ at: z.ZodString;
248
+ detail: z.ZodOptional<z.ZodString>;
249
+ }, z.core.$strict>>;
250
+ }, z.core.$strict>;
251
+
252
+ declare type ArtifactProvenanceCaptureContextShape = z.infer<typeof ArtifactProvenanceCaptureContextSchema>;
253
+
254
+ /**
255
+ * A host-captured mutation snapshot, not a claim accepted from model arguments.
256
+ * Parsing checks internal consistency, not authenticity: only the host can verify
257
+ * the stored creation records, execution frame, source revisions and evidence.
258
+ * Any gap means partial coverage; no field asserts global completeness.
259
+ */
260
+ export declare const ArtifactProvenanceEnvelopeV1: z.ZodPipe<z.ZodUnknown, z.ZodObject<{
261
+ version: z.ZodLiteral<"kay.artifact-provenance.v1">;
262
+ operation: z.ZodObject<{
263
+ id: z.ZodNullable<z.ZodString>;
264
+ at: z.ZodNullable<z.ZodISODateTime>;
265
+ name: z.ZodString;
266
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
267
+ kind: z.ZodLiteral<"session">;
268
+ sessionId: z.ZodString;
269
+ runId: z.ZodNullable<z.ZodString>;
270
+ }, z.core.$strict>, z.ZodObject<{
271
+ kind: z.ZodLiteral<"human">;
272
+ userId: z.ZodOptional<z.ZodString>;
273
+ surface: z.ZodString;
274
+ }, z.core.$strict>, z.ZodObject<{
275
+ kind: z.ZodLiteral<"plugin">;
276
+ pluginId: z.ZodString;
277
+ capability: z.ZodString;
278
+ }, z.core.$strict>, z.ZodObject<{
279
+ kind: z.ZodLiteral<"host">;
280
+ capability: z.ZodString;
281
+ }, z.core.$strict>, z.ZodObject<{
282
+ kind: z.ZodLiteral<"import">;
283
+ source: z.ZodString;
284
+ }, z.core.$strict>, z.ZodObject<{
285
+ kind: z.ZodLiteral<"unknown">;
286
+ }, z.core.$strict>], "kind">;
287
+ invocation: z.ZodNullable<z.ZodObject<{
288
+ tool: z.ZodString;
289
+ toolCallId: z.ZodNullable<z.ZodString>;
290
+ origin: z.ZodEnum<{
291
+ host: "host";
292
+ model: "model";
293
+ }>;
294
+ }, z.core.$strict>>;
295
+ causes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
296
+ kind: z.ZodLiteral<"session">;
297
+ sessionId: z.ZodString;
298
+ runId: z.ZodNullable<z.ZodString>;
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ kind: z.ZodLiteral<"session-event">;
301
+ sessionId: z.ZodString;
302
+ cause: z.ZodObject<{
303
+ handler: z.ZodString;
304
+ kind: z.ZodOptional<z.ZodEnum<{
305
+ "session-event": "session-event";
306
+ backfill: "backfill";
307
+ }>>;
308
+ event: z.ZodOptional<z.ZodObject<{
309
+ type: z.ZodEnum<{
310
+ "turn-settled": "turn-settled";
311
+ "phase-shift": "phase-shift";
312
+ "human-message": "human-message";
313
+ "assistant-message": "assistant-message";
314
+ "ui-action": "ui-action";
315
+ }>;
316
+ entryId: z.ZodString;
317
+ runId: z.ZodOptional<z.ZodString>;
318
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
319
+ }, z.core.$strict>>;
320
+ dedupeKey: z.ZodOptional<z.ZodString>;
321
+ }, z.core.$strict>;
322
+ }, z.core.$strict>, z.ZodObject<{
323
+ kind: z.ZodLiteral<"automation">;
324
+ automationId: z.ZodString;
325
+ runId: z.ZodNullable<z.ZodString>;
326
+ }, z.core.$strict>, z.ZodObject<{
327
+ kind: z.ZodLiteral<"operation">;
328
+ operationId: z.ZodString;
329
+ }, z.core.$strict>], "kind">>;
330
+ }, z.core.$strict>;
331
+ artifacts: z.ZodArray<z.ZodObject<{
332
+ kind: z.ZodEnum<{
333
+ delete: "delete";
334
+ import: "import";
335
+ create: "create";
336
+ update: "update";
337
+ copy: "copy";
338
+ harvest: "harvest";
339
+ restore: "restore";
340
+ accept: "accept";
341
+ }>;
342
+ target: z.ZodObject<{
343
+ storeId: z.ZodString;
344
+ artifactId: z.ZodString;
345
+ uri: z.ZodOptional<z.ZodString>;
346
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
347
+ kind: z.ZodLiteral<"enclosing-commit">;
348
+ }, z.core.$strict>, z.ZodNull]>;
349
+ operationId: z.ZodNullable<z.ZodString>;
350
+ digest: z.ZodOptional<z.ZodObject<{
351
+ algorithm: z.ZodString;
352
+ value: z.ZodString;
353
+ }, z.core.$strict>>;
354
+ }, z.core.$strict>;
355
+ producer: z.ZodObject<{
356
+ id: z.ZodNullable<z.ZodString>;
357
+ at: z.ZodNullable<z.ZodISODateTime>;
358
+ name: z.ZodString;
359
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
360
+ kind: z.ZodLiteral<"session">;
361
+ sessionId: z.ZodString;
362
+ runId: z.ZodNullable<z.ZodString>;
363
+ }, z.core.$strict>, z.ZodObject<{
364
+ kind: z.ZodLiteral<"human">;
365
+ userId: z.ZodOptional<z.ZodString>;
366
+ surface: z.ZodString;
367
+ }, z.core.$strict>, z.ZodObject<{
368
+ kind: z.ZodLiteral<"plugin">;
369
+ pluginId: z.ZodString;
370
+ capability: z.ZodString;
371
+ }, z.core.$strict>, z.ZodObject<{
372
+ kind: z.ZodLiteral<"host">;
373
+ capability: z.ZodString;
374
+ }, z.core.$strict>, z.ZodObject<{
375
+ kind: z.ZodLiteral<"import">;
376
+ source: z.ZodString;
377
+ }, z.core.$strict>, z.ZodObject<{
378
+ kind: z.ZodLiteral<"unknown">;
379
+ }, z.core.$strict>], "kind">;
380
+ invocation: z.ZodNullable<z.ZodObject<{
381
+ tool: z.ZodString;
382
+ toolCallId: z.ZodNullable<z.ZodString>;
383
+ origin: z.ZodEnum<{
384
+ host: "host";
385
+ model: "model";
386
+ }>;
387
+ }, z.core.$strict>>;
388
+ causes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
389
+ kind: z.ZodLiteral<"session">;
390
+ sessionId: z.ZodString;
391
+ runId: z.ZodNullable<z.ZodString>;
392
+ }, z.core.$strict>, z.ZodObject<{
393
+ kind: z.ZodLiteral<"session-event">;
394
+ sessionId: z.ZodString;
395
+ cause: z.ZodObject<{
396
+ handler: z.ZodString;
397
+ kind: z.ZodOptional<z.ZodEnum<{
398
+ "session-event": "session-event";
399
+ backfill: "backfill";
400
+ }>>;
401
+ event: z.ZodOptional<z.ZodObject<{
402
+ type: z.ZodEnum<{
403
+ "turn-settled": "turn-settled";
404
+ "phase-shift": "phase-shift";
405
+ "human-message": "human-message";
406
+ "assistant-message": "assistant-message";
407
+ "ui-action": "ui-action";
408
+ }>;
409
+ entryId: z.ZodString;
410
+ runId: z.ZodOptional<z.ZodString>;
411
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
412
+ }, z.core.$strict>>;
413
+ dedupeKey: z.ZodOptional<z.ZodString>;
414
+ }, z.core.$strict>;
415
+ }, z.core.$strict>, z.ZodObject<{
416
+ kind: z.ZodLiteral<"automation">;
417
+ automationId: z.ZodString;
418
+ runId: z.ZodNullable<z.ZodString>;
419
+ }, z.core.$strict>, z.ZodObject<{
420
+ kind: z.ZodLiteral<"operation">;
421
+ operationId: z.ZodString;
422
+ }, z.core.$strict>], "kind">>;
423
+ }, z.core.$strict>;
424
+ sources: z.ZodArray<z.ZodObject<{
425
+ relationship: z.ZodEnum<{
426
+ "revision-of": "revision-of";
427
+ "copied-from": "copied-from";
428
+ "harvested-from": "harvested-from";
429
+ "restored-from": "restored-from";
430
+ "accepted-from": "accepted-from";
431
+ "imported-from": "imported-from";
432
+ }>;
433
+ revision: z.ZodObject<{
434
+ storeId: z.ZodString;
435
+ artifactId: z.ZodString;
436
+ uri: z.ZodOptional<z.ZodString>;
437
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
438
+ kind: z.ZodLiteral<"enclosing-commit">;
439
+ }, z.core.$strict>, z.ZodNull]>;
440
+ operationId: z.ZodNullable<z.ZodString>;
441
+ digest: z.ZodOptional<z.ZodObject<{
442
+ algorithm: z.ZodString;
443
+ value: z.ZodString;
444
+ }, z.core.$strict>>;
445
+ }, z.core.$strict>;
446
+ }, z.core.$strict>>;
447
+ }, z.core.$strict>>;
448
+ sessions: z.ZodArray<z.ZodObject<{
449
+ sessionId: z.ZodString;
450
+ basis: z.ZodEnum<{
451
+ "legacy-derived": "legacy-derived";
452
+ "unverified-index": "unverified-index";
453
+ recorded: "recorded";
454
+ missing: "missing";
455
+ }>;
456
+ record: z.ZodNullable<z.ZodObject<{
457
+ relationships: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
458
+ kind: z.ZodLiteral<"child-of">;
459
+ sessionId: z.ZodString;
460
+ }, z.core.$strict>, z.ZodObject<{
461
+ kind: z.ZodLiteral<"forked-from">;
462
+ sessionId: z.ZodString;
463
+ atEntryId: z.ZodOptional<z.ZodString>;
464
+ }, z.core.$strict>], "kind">>;
465
+ createdBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
466
+ kind: z.ZodLiteral<"human">;
467
+ surface: z.ZodOptional<z.ZodString>;
468
+ }, z.core.$strict>, z.ZodObject<{
469
+ kind: z.ZodLiteral<"agent">;
470
+ sessionId: z.ZodString;
471
+ tool: z.ZodString;
472
+ runId: z.ZodOptional<z.ZodString>;
473
+ toolCallId: z.ZodOptional<z.ZodString>;
474
+ }, z.core.$strict>, z.ZodObject<{
475
+ kind: z.ZodLiteral<"plugin">;
476
+ pluginId: z.ZodString;
477
+ door: z.ZodEnum<{
478
+ "sessions.create": "sessions.create";
479
+ "sessions.run": "sessions.run";
480
+ "hindsight.runFollowup": "hindsight.runFollowup";
481
+ "agents.run": "agents.run";
482
+ }>;
483
+ callerSessionId: z.ZodOptional<z.ZodString>;
484
+ }, z.core.$strict>, z.ZodObject<{
485
+ kind: z.ZodLiteral<"trigger">;
486
+ automationId: z.ZodString;
487
+ runId: z.ZodOptional<z.ZodString>;
488
+ bindingName: z.ZodString;
489
+ triggerKind: z.ZodEnum<{
490
+ time: "time";
491
+ cron: "cron";
492
+ occurrence: "occurrence";
493
+ "uri-change": "uri-change";
494
+ "plugin-event": "plugin-event";
495
+ manual: "manual";
496
+ }>;
497
+ }, z.core.$strict>, z.ZodObject<{
498
+ kind: z.ZodLiteral<"daemon">;
499
+ capability: z.ZodString;
500
+ }, z.core.$strict>], "kind">;
501
+ definedBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
502
+ layer: z.ZodLiteral<"plugin">;
503
+ pluginId: z.ZodString;
504
+ capability: z.ZodString;
505
+ version: z.ZodOptional<z.ZodString>;
506
+ }, z.core.$strict>, z.ZodObject<{
507
+ layer: z.ZodLiteral<"host">;
508
+ capability: z.ZodString;
509
+ }, z.core.$strict>], "layer">;
510
+ intent: z.ZodEnum<{
511
+ interactive: "interactive";
512
+ headless: "headless";
513
+ }>;
514
+ causedByEvent: z.ZodOptional<z.ZodObject<{
515
+ handler: z.ZodString;
516
+ kind: z.ZodOptional<z.ZodEnum<{
517
+ "session-event": "session-event";
518
+ backfill: "backfill";
519
+ }>>;
520
+ event: z.ZodOptional<z.ZodObject<{
521
+ type: z.ZodEnum<{
522
+ "turn-settled": "turn-settled";
523
+ "phase-shift": "phase-shift";
524
+ "human-message": "human-message";
525
+ "assistant-message": "assistant-message";
526
+ "ui-action": "ui-action";
527
+ }>;
528
+ entryId: z.ZodString;
529
+ runId: z.ZodOptional<z.ZodString>;
530
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
531
+ }, z.core.$strict>>;
532
+ dedupeKey: z.ZodOptional<z.ZodString>;
533
+ }, z.core.$strict>>;
534
+ }, z.core.$strict>>;
535
+ }, z.core.$strict>>;
536
+ subjects: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
537
+ kind: z.ZodLiteral<"session">;
538
+ sessionId: z.ZodString;
539
+ runId: z.ZodOptional<z.ZodString>;
540
+ }, z.core.$strict>, z.ZodObject<{
541
+ kind: z.ZodLiteral<"artifact">;
542
+ revision: z.ZodObject<{
543
+ storeId: z.ZodString;
544
+ artifactId: z.ZodString;
545
+ uri: z.ZodOptional<z.ZodString>;
546
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
547
+ kind: z.ZodLiteral<"enclosing-commit">;
548
+ }, z.core.$strict>, z.ZodNull]>;
549
+ operationId: z.ZodNullable<z.ZodString>;
550
+ digest: z.ZodOptional<z.ZodObject<{
551
+ algorithm: z.ZodString;
552
+ value: z.ZodString;
553
+ }, z.core.$strict>>;
554
+ }, z.core.$strict>;
555
+ }, z.core.$strict>, z.ZodObject<{
556
+ kind: z.ZodLiteral<"resource">;
557
+ uri: z.ZodString;
558
+ revision: z.ZodNullable<z.ZodString>;
559
+ }, z.core.$strict>], "kind">>;
560
+ evidence: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
561
+ kind: z.ZodLiteral<"session">;
562
+ sessionId: z.ZodString;
563
+ runId: z.ZodOptional<z.ZodString>;
564
+ }, z.core.$strict>, z.ZodObject<{
565
+ kind: z.ZodLiteral<"artifact">;
566
+ revision: z.ZodObject<{
567
+ storeId: z.ZodString;
568
+ artifactId: z.ZodString;
569
+ uri: z.ZodOptional<z.ZodString>;
570
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
571
+ kind: z.ZodLiteral<"enclosing-commit">;
572
+ }, z.core.$strict>, z.ZodNull]>;
573
+ operationId: z.ZodNullable<z.ZodString>;
574
+ digest: z.ZodOptional<z.ZodObject<{
575
+ algorithm: z.ZodString;
576
+ value: z.ZodString;
577
+ }, z.core.$strict>>;
578
+ }, z.core.$strict>;
579
+ }, z.core.$strict>, z.ZodObject<{
580
+ kind: z.ZodLiteral<"resource">;
581
+ uri: z.ZodString;
582
+ revision: z.ZodNullable<z.ZodString>;
583
+ }, z.core.$strict>], "kind">>;
584
+ gaps: z.ZodArray<z.ZodObject<{
585
+ code: z.ZodEnum<{
586
+ unknown: "unknown";
587
+ "capture-failed": "capture-failed";
588
+ "legacy-derived": "legacy-derived";
589
+ "ambiguous-predecessor": "ambiguous-predecessor";
590
+ "unverified-index": "unverified-index";
591
+ "missing-ancestor": "missing-ancestor";
592
+ cycle: "cycle";
593
+ truncated: "truncated";
594
+ "metadata-write-failed": "metadata-write-failed";
595
+ "invalid-record": "invalid-record";
596
+ }>;
597
+ at: z.ZodString;
598
+ detail: z.ZodOptional<z.ZodString>;
599
+ }, z.core.$strict>>;
600
+ }, z.core.$strict>>;
601
+
602
+ export declare type ArtifactProvenanceEnvelopeV1 = z.infer<typeof ArtifactProvenanceEnvelopeV1>;
603
+
604
+ declare const ArtifactProvenanceGap: z.ZodObject<{
605
+ code: z.ZodEnum<{
606
+ unknown: "unknown";
607
+ "capture-failed": "capture-failed";
608
+ "legacy-derived": "legacy-derived";
609
+ "ambiguous-predecessor": "ambiguous-predecessor";
610
+ "unverified-index": "unverified-index";
611
+ "missing-ancestor": "missing-ancestor";
612
+ cycle: "cycle";
613
+ truncated: "truncated";
614
+ "metadata-write-failed": "metadata-write-failed";
615
+ "invalid-record": "invalid-record";
616
+ }>;
617
+ at: z.ZodString;
618
+ detail: z.ZodOptional<z.ZodString>;
619
+ }, z.core.$strict>;
620
+
621
+ declare type ArtifactProvenanceGap = z.infer<typeof ArtifactProvenanceGap>;
622
+
623
+ declare const ArtifactProvenanceMutation: z.ZodObject<{
624
+ kind: z.ZodEnum<{
625
+ delete: "delete";
626
+ import: "import";
627
+ create: "create";
628
+ update: "update";
629
+ copy: "copy";
630
+ harvest: "harvest";
631
+ restore: "restore";
632
+ accept: "accept";
633
+ }>;
634
+ target: z.ZodObject<{
635
+ storeId: z.ZodString;
636
+ artifactId: z.ZodString;
637
+ uri: z.ZodOptional<z.ZodString>;
638
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
639
+ kind: z.ZodLiteral<"enclosing-commit">;
640
+ }, z.core.$strict>, z.ZodNull]>;
641
+ operationId: z.ZodNullable<z.ZodString>;
642
+ digest: z.ZodOptional<z.ZodObject<{
643
+ algorithm: z.ZodString;
644
+ value: z.ZodString;
645
+ }, z.core.$strict>>;
646
+ }, z.core.$strict>;
647
+ producer: z.ZodObject<{
648
+ id: z.ZodNullable<z.ZodString>;
649
+ at: z.ZodNullable<z.ZodISODateTime>;
650
+ name: z.ZodString;
651
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
652
+ kind: z.ZodLiteral<"session">;
653
+ sessionId: z.ZodString;
654
+ runId: z.ZodNullable<z.ZodString>;
655
+ }, z.core.$strict>, z.ZodObject<{
656
+ kind: z.ZodLiteral<"human">;
657
+ userId: z.ZodOptional<z.ZodString>;
658
+ surface: z.ZodString;
659
+ }, z.core.$strict>, z.ZodObject<{
660
+ kind: z.ZodLiteral<"plugin">;
661
+ pluginId: z.ZodString;
662
+ capability: z.ZodString;
663
+ }, z.core.$strict>, z.ZodObject<{
664
+ kind: z.ZodLiteral<"host">;
665
+ capability: z.ZodString;
666
+ }, z.core.$strict>, z.ZodObject<{
667
+ kind: z.ZodLiteral<"import">;
668
+ source: z.ZodString;
669
+ }, z.core.$strict>, z.ZodObject<{
670
+ kind: z.ZodLiteral<"unknown">;
671
+ }, z.core.$strict>], "kind">;
672
+ invocation: z.ZodNullable<z.ZodObject<{
673
+ tool: z.ZodString;
674
+ toolCallId: z.ZodNullable<z.ZodString>;
675
+ origin: z.ZodEnum<{
676
+ host: "host";
677
+ model: "model";
678
+ }>;
679
+ }, z.core.$strict>>;
680
+ causes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
681
+ kind: z.ZodLiteral<"session">;
682
+ sessionId: z.ZodString;
683
+ runId: z.ZodNullable<z.ZodString>;
684
+ }, z.core.$strict>, z.ZodObject<{
685
+ kind: z.ZodLiteral<"session-event">;
686
+ sessionId: z.ZodString;
687
+ cause: z.ZodObject<{
688
+ handler: z.ZodString;
689
+ kind: z.ZodOptional<z.ZodEnum<{
690
+ "session-event": "session-event";
691
+ backfill: "backfill";
692
+ }>>;
693
+ event: z.ZodOptional<z.ZodObject<{
694
+ type: z.ZodEnum<{
695
+ "turn-settled": "turn-settled";
696
+ "phase-shift": "phase-shift";
697
+ "human-message": "human-message";
698
+ "assistant-message": "assistant-message";
699
+ "ui-action": "ui-action";
700
+ }>;
701
+ entryId: z.ZodString;
702
+ runId: z.ZodOptional<z.ZodString>;
703
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
704
+ }, z.core.$strict>>;
705
+ dedupeKey: z.ZodOptional<z.ZodString>;
706
+ }, z.core.$strict>;
707
+ }, z.core.$strict>, z.ZodObject<{
708
+ kind: z.ZodLiteral<"automation">;
709
+ automationId: z.ZodString;
710
+ runId: z.ZodNullable<z.ZodString>;
711
+ }, z.core.$strict>, z.ZodObject<{
712
+ kind: z.ZodLiteral<"operation">;
713
+ operationId: z.ZodString;
714
+ }, z.core.$strict>], "kind">>;
715
+ }, z.core.$strict>;
716
+ sources: z.ZodArray<z.ZodObject<{
717
+ relationship: z.ZodEnum<{
718
+ "revision-of": "revision-of";
719
+ "copied-from": "copied-from";
720
+ "harvested-from": "harvested-from";
721
+ "restored-from": "restored-from";
722
+ "accepted-from": "accepted-from";
723
+ "imported-from": "imported-from";
724
+ }>;
725
+ revision: z.ZodObject<{
726
+ storeId: z.ZodString;
727
+ artifactId: z.ZodString;
728
+ uri: z.ZodOptional<z.ZodString>;
729
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
730
+ kind: z.ZodLiteral<"enclosing-commit">;
731
+ }, z.core.$strict>, z.ZodNull]>;
732
+ operationId: z.ZodNullable<z.ZodString>;
733
+ digest: z.ZodOptional<z.ZodObject<{
734
+ algorithm: z.ZodString;
735
+ value: z.ZodString;
736
+ }, z.core.$strict>>;
737
+ }, z.core.$strict>;
738
+ }, z.core.$strict>>;
739
+ }, z.core.$strict>;
740
+
741
+ declare type ArtifactProvenanceMutation = z.infer<typeof ArtifactProvenanceMutation>;
742
+
743
+ /** Capture anew per mutation. A reused session never reuses its creation run as its current run. */
744
+ declare const ArtifactProvenanceOperation: z.ZodObject<{
745
+ id: z.ZodNullable<z.ZodString>;
746
+ at: z.ZodNullable<z.ZodISODateTime>;
747
+ name: z.ZodString;
748
+ actor: z.ZodDiscriminatedUnion<[z.ZodObject<{
749
+ kind: z.ZodLiteral<"session">;
750
+ sessionId: z.ZodString;
751
+ runId: z.ZodNullable<z.ZodString>;
752
+ }, z.core.$strict>, z.ZodObject<{
753
+ kind: z.ZodLiteral<"human">;
754
+ userId: z.ZodOptional<z.ZodString>;
755
+ surface: z.ZodString;
756
+ }, z.core.$strict>, z.ZodObject<{
757
+ kind: z.ZodLiteral<"plugin">;
758
+ pluginId: z.ZodString;
759
+ capability: z.ZodString;
760
+ }, z.core.$strict>, z.ZodObject<{
761
+ kind: z.ZodLiteral<"host">;
762
+ capability: z.ZodString;
763
+ }, z.core.$strict>, z.ZodObject<{
764
+ kind: z.ZodLiteral<"import">;
765
+ source: z.ZodString;
766
+ }, z.core.$strict>, z.ZodObject<{
767
+ kind: z.ZodLiteral<"unknown">;
768
+ }, z.core.$strict>], "kind">;
769
+ invocation: z.ZodNullable<z.ZodObject<{
770
+ tool: z.ZodString;
771
+ toolCallId: z.ZodNullable<z.ZodString>;
772
+ origin: z.ZodEnum<{
773
+ host: "host";
774
+ model: "model";
775
+ }>;
776
+ }, z.core.$strict>>;
777
+ causes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
778
+ kind: z.ZodLiteral<"session">;
779
+ sessionId: z.ZodString;
780
+ runId: z.ZodNullable<z.ZodString>;
781
+ }, z.core.$strict>, z.ZodObject<{
782
+ kind: z.ZodLiteral<"session-event">;
783
+ sessionId: z.ZodString;
784
+ cause: z.ZodObject<{
785
+ handler: z.ZodString;
786
+ kind: z.ZodOptional<z.ZodEnum<{
787
+ "session-event": "session-event";
788
+ backfill: "backfill";
789
+ }>>;
790
+ event: z.ZodOptional<z.ZodObject<{
791
+ type: z.ZodEnum<{
792
+ "turn-settled": "turn-settled";
793
+ "phase-shift": "phase-shift";
794
+ "human-message": "human-message";
795
+ "assistant-message": "assistant-message";
796
+ "ui-action": "ui-action";
797
+ }>;
798
+ entryId: z.ZodString;
799
+ runId: z.ZodOptional<z.ZodString>;
800
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
801
+ }, z.core.$strict>>;
802
+ dedupeKey: z.ZodOptional<z.ZodString>;
803
+ }, z.core.$strict>;
804
+ }, z.core.$strict>, z.ZodObject<{
805
+ kind: z.ZodLiteral<"automation">;
806
+ automationId: z.ZodString;
807
+ runId: z.ZodNullable<z.ZodString>;
808
+ }, z.core.$strict>, z.ZodObject<{
809
+ kind: z.ZodLiteral<"operation">;
810
+ operationId: z.ZodString;
811
+ }, z.core.$strict>], "kind">>;
812
+ }, z.core.$strict>;
813
+
814
+ declare type ArtifactProvenanceOperation = z.infer<typeof ArtifactProvenanceOperation>;
815
+
816
+ declare const ArtifactProvenanceReference: z.ZodDiscriminatedUnion<[z.ZodObject<{
817
+ kind: z.ZodLiteral<"session">;
818
+ sessionId: z.ZodString;
819
+ runId: z.ZodOptional<z.ZodString>;
820
+ }, z.core.$strict>, z.ZodObject<{
821
+ kind: z.ZodLiteral<"artifact">;
822
+ revision: z.ZodObject<{
823
+ storeId: z.ZodString;
824
+ artifactId: z.ZodString;
825
+ uri: z.ZodOptional<z.ZodString>;
826
+ revision: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
827
+ kind: z.ZodLiteral<"enclosing-commit">;
828
+ }, z.core.$strict>, z.ZodNull]>;
829
+ operationId: z.ZodNullable<z.ZodString>;
830
+ digest: z.ZodOptional<z.ZodObject<{
831
+ algorithm: z.ZodString;
832
+ value: z.ZodString;
833
+ }, z.core.$strict>>;
834
+ }, z.core.$strict>;
835
+ }, z.core.$strict>, z.ZodObject<{
836
+ kind: z.ZodLiteral<"resource">;
837
+ uri: z.ZodString;
838
+ revision: z.ZodNullable<z.ZodString>;
839
+ }, z.core.$strict>], "kind">;
840
+
841
+ declare type ArtifactProvenanceReference = z.infer<typeof ArtifactProvenanceReference>;
842
+
843
+ /** One canonical creation record per session, never an expanded recursive ancestry record. */
844
+ declare const ArtifactProvenanceSession: z.ZodObject<{
845
+ sessionId: z.ZodString;
846
+ basis: z.ZodEnum<{
847
+ "legacy-derived": "legacy-derived";
848
+ "unverified-index": "unverified-index";
849
+ recorded: "recorded";
850
+ missing: "missing";
851
+ }>;
852
+ record: z.ZodNullable<z.ZodObject<{
853
+ relationships: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
854
+ kind: z.ZodLiteral<"child-of">;
855
+ sessionId: z.ZodString;
856
+ }, z.core.$strict>, z.ZodObject<{
857
+ kind: z.ZodLiteral<"forked-from">;
858
+ sessionId: z.ZodString;
859
+ atEntryId: z.ZodOptional<z.ZodString>;
860
+ }, z.core.$strict>], "kind">>;
861
+ createdBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
862
+ kind: z.ZodLiteral<"human">;
863
+ surface: z.ZodOptional<z.ZodString>;
864
+ }, z.core.$strict>, z.ZodObject<{
865
+ kind: z.ZodLiteral<"agent">;
866
+ sessionId: z.ZodString;
867
+ tool: z.ZodString;
868
+ runId: z.ZodOptional<z.ZodString>;
869
+ toolCallId: z.ZodOptional<z.ZodString>;
870
+ }, z.core.$strict>, z.ZodObject<{
871
+ kind: z.ZodLiteral<"plugin">;
872
+ pluginId: z.ZodString;
873
+ door: z.ZodEnum<{
874
+ "sessions.create": "sessions.create";
875
+ "sessions.run": "sessions.run";
876
+ "hindsight.runFollowup": "hindsight.runFollowup";
877
+ "agents.run": "agents.run";
878
+ }>;
879
+ callerSessionId: z.ZodOptional<z.ZodString>;
880
+ }, z.core.$strict>, z.ZodObject<{
881
+ kind: z.ZodLiteral<"trigger">;
882
+ automationId: z.ZodString;
883
+ runId: z.ZodOptional<z.ZodString>;
884
+ bindingName: z.ZodString;
885
+ triggerKind: z.ZodEnum<{
886
+ time: "time";
887
+ cron: "cron";
888
+ occurrence: "occurrence";
889
+ "uri-change": "uri-change";
890
+ "plugin-event": "plugin-event";
891
+ manual: "manual";
892
+ }>;
893
+ }, z.core.$strict>, z.ZodObject<{
894
+ kind: z.ZodLiteral<"daemon">;
895
+ capability: z.ZodString;
896
+ }, z.core.$strict>], "kind">;
897
+ definedBy: z.ZodDiscriminatedUnion<[z.ZodObject<{
898
+ layer: z.ZodLiteral<"plugin">;
899
+ pluginId: z.ZodString;
900
+ capability: z.ZodString;
901
+ version: z.ZodOptional<z.ZodString>;
902
+ }, z.core.$strict>, z.ZodObject<{
903
+ layer: z.ZodLiteral<"host">;
904
+ capability: z.ZodString;
905
+ }, z.core.$strict>], "layer">;
906
+ intent: z.ZodEnum<{
907
+ interactive: "interactive";
908
+ headless: "headless";
909
+ }>;
910
+ causedByEvent: z.ZodOptional<z.ZodObject<{
911
+ handler: z.ZodString;
912
+ kind: z.ZodOptional<z.ZodEnum<{
913
+ "session-event": "session-event";
914
+ backfill: "backfill";
915
+ }>>;
916
+ event: z.ZodOptional<z.ZodObject<{
917
+ type: z.ZodEnum<{
918
+ "turn-settled": "turn-settled";
919
+ "phase-shift": "phase-shift";
920
+ "human-message": "human-message";
921
+ "assistant-message": "assistant-message";
922
+ "ui-action": "ui-action";
923
+ }>;
924
+ entryId: z.ZodString;
925
+ runId: z.ZodOptional<z.ZodString>;
926
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
927
+ }, z.core.$strict>>;
928
+ dedupeKey: z.ZodOptional<z.ZodString>;
929
+ }, z.core.$strict>>;
930
+ }, z.core.$strict>>;
931
+ }, z.core.$strict>;
932
+
933
+ declare type ArtifactProvenanceSession = z.infer<typeof ArtifactProvenanceSession>;
934
+
935
+ /**
936
+ * Assemble a capture plus the store's own `artifacts[]` mutation(s) into a validated envelope.
937
+ * Throws (via {@link parseArtifactProvenanceEnvelope}) on a genuinely invalid construction - a
938
+ * bug in the capture or in the store's own `artifacts[]`, never a reason to write a corrupted
939
+ * record. A store that cannot trust its own inputs enough to risk that should capture a
940
+ * {@link captureFailedContext} instead, which always validates.
941
+ *
942
+ * The artifact-level gaps this function adds are the ones the CAPTURE could not know, because
943
+ * they name the store's own target: a null target revision is a real, honest "revision unknown"
944
+ * (a hand-edited or non-content-addressed store), and the envelope's own `checkRevision` rule
945
+ * requires an explicit gap for it. The caller supplies only the mutation; the paths follow from
946
+ * `artifacts`' own order, exactly as `checkRevision` reads them.
947
+ */
948
+ export declare function finalizeArtifactProvenanceEnvelope(capture: ArtifactProvenanceCaptureContext, artifacts: readonly ArtifactProvenanceMutation[]): ArtifactProvenanceEnvelopeV1;
949
+
950
+ /** Parse a host-captured context; throws when it is not a well-formed capture context. */
951
+ export declare function parseArtifactProvenanceCaptureContext(input: unknown): ArtifactProvenanceCaptureContextShape;
952
+
953
+ /** Returns an owned value snapshot; callers must not attach live session references. */
954
+ export declare function parseArtifactProvenanceEnvelope(input: unknown): ArtifactProvenanceEnvelopeV1;
955
+
956
+ export { }