stitchkit 0.85.1 → 0.86.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/README.md +3 -0
  3. package/dist/agent-runtime/agent-tool.d.ts +25 -0
  4. package/dist/agent-runtime/agent-tool.d.ts.map +1 -0
  5. package/dist/agent-runtime/child-tools.d.ts +69 -0
  6. package/dist/agent-runtime/child-tools.d.ts.map +1 -0
  7. package/dist/agent-runtime/children.d.ts +113 -0
  8. package/dist/agent-runtime/children.d.ts.map +1 -0
  9. package/dist/agent-runtime/coding-tool-contract.d.ts +29 -0
  10. package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
  11. package/dist/agent-runtime/coding-tool-refusals.d.ts +2 -0
  12. package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
  13. package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
  14. package/dist/agent-runtime/coding-tools.d.ts +1 -0
  15. package/dist/agent-runtime/coding-tools.d.ts.map +1 -1
  16. package/dist/agent-runtime/control-schema.d.ts +17 -0
  17. package/dist/agent-runtime/control-schema.d.ts.map +1 -1
  18. package/dist/agent-runtime/event-schema.d.ts +34 -0
  19. package/dist/agent-runtime/event-schema.d.ts.map +1 -1
  20. package/dist/agent-runtime/event-search-tools.d.ts +53 -0
  21. package/dist/agent-runtime/event-search-tools.d.ts.map +1 -0
  22. package/dist/agent-runtime/event-search.d.ts +23 -0
  23. package/dist/agent-runtime/event-search.d.ts.map +1 -0
  24. package/dist/agent-runtime/fault-bench.d.ts +45 -0
  25. package/dist/agent-runtime/fault-bench.d.ts.map +1 -0
  26. package/dist/agent-runtime/observability.d.ts +6 -0
  27. package/dist/agent-runtime/observability.d.ts.map +1 -1
  28. package/dist/agent-runtime/projections.d.ts +69 -0
  29. package/dist/agent-runtime/projections.d.ts.map +1 -0
  30. package/dist/agent-runtime/provider-failure.d.ts +5 -1
  31. package/dist/agent-runtime/provider-failure.d.ts.map +1 -1
  32. package/dist/agent-runtime/provider-origin.d.ts +12 -0
  33. package/dist/agent-runtime/provider-origin.d.ts.map +1 -0
  34. package/dist/agent-runtime/retry-policy.d.ts +27 -0
  35. package/dist/agent-runtime/retry-policy.d.ts.map +1 -0
  36. package/dist/agent-runtime/run-execution.d.ts +0 -9
  37. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  38. package/dist/agent-runtime/run-mutation-queue.d.ts +21 -0
  39. package/dist/agent-runtime/run-mutation-queue.d.ts.map +1 -0
  40. package/dist/agent-runtime/run-operation-lifecycle.d.ts +3 -0
  41. package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -1
  42. package/dist/agent-runtime/runtime.d.ts +15 -0
  43. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  44. package/dist/agent-runtime/sandbox.d.ts +66 -0
  45. package/dist/agent-runtime/sandbox.d.ts.map +1 -0
  46. package/dist/agent-runtime/schedule-tools.d.ts +35 -0
  47. package/dist/agent-runtime/schedule-tools.d.ts.map +1 -0
  48. package/dist/agent-runtime/schedules.d.ts +63 -0
  49. package/dist/agent-runtime/schedules.d.ts.map +1 -0
  50. package/dist/agent-runtime/schemas.d.ts +9 -0
  51. package/dist/agent-runtime/schemas.d.ts.map +1 -1
  52. package/dist/agent-runtime/spill.d.ts +24 -0
  53. package/dist/agent-runtime/spill.d.ts.map +1 -0
  54. package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
  55. package/dist/agent-runtime/sqlite.d.ts +26 -0
  56. package/dist/agent-runtime/sqlite.d.ts.map +1 -1
  57. package/dist/agent-runtime/state-slots.d.ts +48 -0
  58. package/dist/agent-runtime/state-slots.d.ts.map +1 -0
  59. package/dist/agent-runtime/state-tools.d.ts +58 -0
  60. package/dist/agent-runtime/state-tools.d.ts.map +1 -0
  61. package/dist/agent-runtime/store-driver.d.ts +13 -0
  62. package/dist/agent-runtime/store-driver.d.ts.map +1 -1
  63. package/dist/agent-runtime/store-events.d.ts +829 -0
  64. package/dist/agent-runtime/store-events.d.ts.map +1 -0
  65. package/dist/agent-runtime/store-migrations/v1-to-v2.d.ts +6 -0
  66. package/dist/agent-runtime/store-migrations/v1-to-v2.d.ts.map +1 -0
  67. package/dist/agent-runtime/store.d.ts +45 -0
  68. package/dist/agent-runtime/store.d.ts.map +1 -1
  69. package/dist/agent-runtime/terminal-commit.d.ts +1 -1
  70. package/dist/agent-runtime-browser.js +5 -3
  71. package/dist/agent-runtime-coding-tools.js +144 -15
  72. package/dist/agent-runtime-harness.js +12 -10
  73. package/dist/agent-runtime-sqlite-bun.d.ts +1 -1
  74. package/dist/agent-runtime-sqlite-bun.d.ts.map +1 -1
  75. package/dist/agent-runtime-sqlite-bun.js +4 -3
  76. package/dist/agent-runtime-sqlite-node.d.ts +1 -1
  77. package/dist/agent-runtime-sqlite-node.d.ts.map +1 -1
  78. package/dist/agent-runtime-sqlite-node.js +4 -3
  79. package/dist/agent-runtime-testing.d.ts +3 -0
  80. package/dist/agent-runtime-testing.d.ts.map +1 -0
  81. package/dist/agent-runtime-testing.js +156 -0
  82. package/dist/agent-runtime.d.ts +16 -2
  83. package/dist/agent-runtime.d.ts.map +1 -1
  84. package/dist/agent-runtime.js +1591 -154
  85. package/dist/application.js +14 -14
  86. package/dist/cli.js +6 -6
  87. package/dist/{index-fwbkp2jn.js → index-0vfdh685.js} +2 -2
  88. package/dist/{index-5z8tezpx.js → index-0ydchz76.js} +3 -3
  89. package/dist/{index-3ds42w1w.js → index-1szetq6f.js} +33 -4
  90. package/dist/{index-jpp7jd1p.js → index-33xckd7h.js} +898 -425
  91. package/dist/{index-27487ay5.js → index-9hw9eq48.js} +4 -4
  92. package/dist/{index-66nxrgy0.js → index-b7qwhbzq.js} +428 -46
  93. package/dist/index-cnyk6te3.js +77 -0
  94. package/dist/index-gskm1k5a.js +50 -0
  95. package/dist/{index-fq492hg0.js → index-hber83mk.js} +254 -157
  96. package/dist/{index-4hk633vz.js → index-hkm6wysp.js} +9 -2
  97. package/dist/{index-dx9xehwt.js → index-kc6h6hg0.js} +1 -1
  98. package/dist/{index-x15ss2dx.js → index-p1b1y93x.js} +3 -0
  99. package/dist/{index-mgtxfe6b.js → index-r159gjwy.js} +8 -1
  100. package/dist/{index-s4ckmrac.js → index-rcgsnrr6.js} +3 -3
  101. package/dist/index-vfgb58nf.js +252 -0
  102. package/dist/{index-dggwnnjv.js → index-wn9cb82y.js} +1 -1
  103. package/dist/{index-ff0kcqvp.js → index-z2452tsw.js} +3 -3
  104. package/dist/testing/agent-store-conformance.d.ts.map +1 -1
  105. package/dist/testing.js +54 -80
  106. package/dist/tool-invoker.js +4 -4
  107. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  108. package/dist/tools/manifest.d.ts +16 -0
  109. package/dist/tools/manifest.d.ts.map +1 -1
  110. package/dist/tools.d.ts +1 -1
  111. package/dist/tools.d.ts.map +1 -1
  112. package/dist/tools.js +10 -8
  113. package/llms-full.txt +321 -13
  114. package/package.json +6 -1
@@ -0,0 +1,829 @@
1
+ import { z } from 'zod';
2
+ export declare const AgentStoreEventKindSchema: z.ZodEnum<{
3
+ "child/spawned": "child/spawned";
4
+ "child/state": "child/state";
5
+ "provider/message": "provider/message";
6
+ "provider/request": "provider/request";
7
+ "retry/scheduled": "retry/scheduled";
8
+ "retry/started": "retry/started";
9
+ "runtime/baseline": "runtime/baseline";
10
+ "runtime/transition": "runtime/transition";
11
+ "sandbox/probed": "sandbox/probed";
12
+ "schedule/cancelled": "schedule/cancelled";
13
+ "schedule/failed": "schedule/failed";
14
+ "schedule/fired": "schedule/fired";
15
+ "schedule/late": "schedule/late";
16
+ "schedule/set": "schedule/set";
17
+ "spill/created": "spill/created";
18
+ "spill/deleted": "spill/deleted";
19
+ "state/set": "state/set";
20
+ }>;
21
+ export type AgentStoreEventKind = z.infer<typeof AgentStoreEventKindSchema>;
22
+ export declare const AgentStoreTransitionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
23
+ type: z.ZodLiteral<"accept">;
24
+ input: z.ZodObject<{
25
+ idempotencyKey: z.ZodString;
26
+ expectedVersion: z.ZodOptional<z.ZodInt>;
27
+ input: z.ZodObject<{
28
+ schemaVersion: z.ZodLiteral<1>;
29
+ id: z.ZodString;
30
+ conversationId: z.ZodString;
31
+ runId: z.ZodOptional<z.ZodString>;
32
+ role: z.ZodEnum<{
33
+ assistant: "assistant";
34
+ summary: "summary";
35
+ system: "system";
36
+ tool: "tool";
37
+ user: "user";
38
+ }>;
39
+ status: z.ZodEnum<{
40
+ committed: "committed";
41
+ completed: "completed";
42
+ failed: "failed";
43
+ interrupted: "interrupted";
44
+ streaming: "streaming";
45
+ superseded: "superseded";
46
+ }>;
47
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ type: z.ZodLiteral<"text">;
49
+ text: z.ZodString;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ type: z.ZodLiteral<"reasoning">;
52
+ text: z.ZodString;
53
+ provider: z.ZodOptional<z.ZodObject<{
54
+ schemaVersion: z.ZodInt;
55
+ provider: z.ZodString;
56
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
57
+ }, z.core.$strip>>;
58
+ }, z.core.$strip>, z.ZodObject<{
59
+ type: z.ZodLiteral<"file">;
60
+ mediaType: z.ZodString;
61
+ reference: z.ZodString;
62
+ filename: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>, z.ZodObject<{
64
+ type: z.ZodLiteral<"source">;
65
+ sourceId: z.ZodString;
66
+ url: z.ZodOptional<z.ZodURL>;
67
+ title: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ type: z.ZodLiteral<"tool-call">;
70
+ callId: z.ZodString;
71
+ toolName: z.ZodString;
72
+ input: z.ZodJSONSchema;
73
+ provider: z.ZodOptional<z.ZodObject<{
74
+ schemaVersion: z.ZodInt;
75
+ provider: z.ZodString;
76
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
77
+ }, z.core.$strip>>;
78
+ }, z.core.$strip>, z.ZodObject<{
79
+ type: z.ZodLiteral<"tool-result">;
80
+ callId: z.ZodString;
81
+ toolName: z.ZodString;
82
+ outcome: z.ZodEnum<{
83
+ error: "error";
84
+ interrupted: "interrupted";
85
+ success: "success";
86
+ }>;
87
+ output: z.ZodOptional<z.ZodJSONSchema>;
88
+ }, z.core.$strip>, z.ZodObject<{
89
+ type: z.ZodLiteral<"tool-approval-request">;
90
+ approvalId: z.ZodString;
91
+ callId: z.ZodString;
92
+ isAutomatic: z.ZodOptional<z.ZodBoolean>;
93
+ signature: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ type: z.ZodLiteral<"tool-approval-response">;
96
+ approvalId: z.ZodString;
97
+ approved: z.ZodBoolean;
98
+ reason: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ type: z.ZodLiteral<"provider">;
101
+ envelope: z.ZodObject<{
102
+ schemaVersion: z.ZodInt;
103
+ provider: z.ZodString;
104
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
105
+ }, z.core.$strip>;
106
+ }, z.core.$strip>, z.ZodObject<{
107
+ type: z.ZodLiteral<"control">;
108
+ reason: z.ZodEnum<{
109
+ "run-interrupted": "run-interrupted";
110
+ "stale-run": "stale-run";
111
+ }>;
112
+ }, z.core.$strip>], "type">>;
113
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
114
+ createdAt: z.ZodISODateTime;
115
+ updatedAt: z.ZodISODateTime;
116
+ }, z.core.$strip>;
117
+ run: z.ZodObject<{
118
+ schemaVersion: z.ZodLiteral<1>;
119
+ id: z.ZodString;
120
+ conversationId: z.ZodString;
121
+ inputMessageIds: z.ZodArray<z.ZodString>;
122
+ assistantMessageId: z.ZodString;
123
+ state: z.ZodEnum<{
124
+ abandoned: "abandoned";
125
+ cancelled: "cancelled";
126
+ completed: "completed";
127
+ failed: "failed";
128
+ interrupt_requested: "interrupt_requested";
129
+ interrupted: "interrupted";
130
+ queued: "queued";
131
+ running: "running";
132
+ superseded: "superseded";
133
+ }>;
134
+ revision: z.ZodInt;
135
+ queuePriority: z.ZodOptional<z.ZodEnum<{
136
+ "interrupt-next": "interrupt-next";
137
+ }>>;
138
+ executionSequence: z.ZodOptional<z.ZodInt>;
139
+ ownerId: z.ZodOptional<z.ZodString>;
140
+ fencingToken: z.ZodOptional<z.ZodInt>;
141
+ terminalReason: z.ZodOptional<z.ZodEnum<{
142
+ abandoned: "abandoned";
143
+ absorbed: "absorbed";
144
+ cancelled: "cancelled";
145
+ context_overflow: "context_overflow";
146
+ interrupted: "interrupted";
147
+ output_rejected: "output_rejected";
148
+ policy_stop: "policy_stop";
149
+ provider_failure: "provider_failure";
150
+ provider_stop: "provider_stop";
151
+ runtime_failure: "runtime_failure";
152
+ shutdown: "shutdown";
153
+ storage_conflict: "storage_conflict";
154
+ success: "success";
155
+ superseded: "superseded";
156
+ timeout: "timeout";
157
+ }>>;
158
+ terminalPolicyName: z.ZodOptional<z.ZodString>;
159
+ absorbedIntoRunId: z.ZodOptional<z.ZodString>;
160
+ usage: z.ZodOptional<z.ZodObject<{
161
+ inputTokens: z.ZodObject<{
162
+ value: z.ZodOptional<z.ZodInt>;
163
+ provenance: z.ZodEnum<{
164
+ computed: "computed";
165
+ estimated: "estimated";
166
+ "provider-reported": "provider-reported";
167
+ unavailable: "unavailable";
168
+ }>;
169
+ }, z.core.$strip>;
170
+ outputTokens: z.ZodObject<{
171
+ value: z.ZodOptional<z.ZodInt>;
172
+ provenance: z.ZodEnum<{
173
+ computed: "computed";
174
+ estimated: "estimated";
175
+ "provider-reported": "provider-reported";
176
+ unavailable: "unavailable";
177
+ }>;
178
+ }, z.core.$strip>;
179
+ reasoningTokens: z.ZodOptional<z.ZodObject<{
180
+ value: z.ZodOptional<z.ZodInt>;
181
+ provenance: z.ZodEnum<{
182
+ computed: "computed";
183
+ estimated: "estimated";
184
+ "provider-reported": "provider-reported";
185
+ unavailable: "unavailable";
186
+ }>;
187
+ }, z.core.$strip>>;
188
+ cacheReadTokens: z.ZodOptional<z.ZodObject<{
189
+ value: z.ZodOptional<z.ZodInt>;
190
+ provenance: z.ZodEnum<{
191
+ computed: "computed";
192
+ estimated: "estimated";
193
+ "provider-reported": "provider-reported";
194
+ unavailable: "unavailable";
195
+ }>;
196
+ }, z.core.$strip>>;
197
+ cacheWriteTokens: z.ZodOptional<z.ZodObject<{
198
+ value: z.ZodOptional<z.ZodInt>;
199
+ provenance: z.ZodEnum<{
200
+ computed: "computed";
201
+ estimated: "estimated";
202
+ "provider-reported": "provider-reported";
203
+ unavailable: "unavailable";
204
+ }>;
205
+ }, z.core.$strip>>;
206
+ cost: z.ZodOptional<z.ZodObject<{
207
+ value: z.ZodOptional<z.ZodNumber>;
208
+ currency: z.ZodOptional<z.ZodString>;
209
+ provenance: z.ZodEnum<{
210
+ computed: "computed";
211
+ estimated: "estimated";
212
+ "provider-reported": "provider-reported";
213
+ unavailable: "unavailable";
214
+ }>;
215
+ }, z.core.$strip>>;
216
+ }, z.core.$strip>>;
217
+ lastOperation: z.ZodOptional<z.ZodObject<{
218
+ operationId: z.ZodString;
219
+ kind: z.ZodEnum<{
220
+ compaction: "compaction";
221
+ "model-request": "model-request";
222
+ }>;
223
+ phase: z.ZodEnum<{
224
+ cancelled: "cancelled";
225
+ completed: "completed";
226
+ failed: "failed";
227
+ "first-output": "first-output";
228
+ started: "started";
229
+ }>;
230
+ step: z.ZodOptional<z.ZodInt>;
231
+ startedAt: z.ZodISODateTime;
232
+ firstOutputAt: z.ZodOptional<z.ZodISODateTime>;
233
+ finishedAt: z.ZodOptional<z.ZodISODateTime>;
234
+ }, z.core.$strip>>;
235
+ createdAt: z.ZodISODateTime;
236
+ updatedAt: z.ZodISODateTime;
237
+ }, z.core.$strip>;
238
+ coalesceIntoRunId: z.ZodOptional<z.ZodString>;
239
+ }, z.core.$strip>;
240
+ }, z.core.$strict>, z.ZodObject<{
241
+ type: z.ZodLiteral<"acquire">;
242
+ input: z.ZodObject<{
243
+ conversationId: z.ZodString;
244
+ runId: z.ZodString;
245
+ expectedRevision: z.ZodInt;
246
+ ownerId: z.ZodString;
247
+ }, z.core.$strip>;
248
+ }, z.core.$strict>, z.ZodObject<{
249
+ type: z.ZodLiteral<"checkpoint">;
250
+ input: z.ZodObject<{
251
+ conversationId: z.ZodString;
252
+ runId: z.ZodString;
253
+ expectedRevision: z.ZodInt;
254
+ ownerId: z.ZodString;
255
+ fencingToken: z.ZodOptional<z.ZodInt>;
256
+ assistant: z.ZodObject<{
257
+ schemaVersion: z.ZodLiteral<1>;
258
+ id: z.ZodString;
259
+ conversationId: z.ZodString;
260
+ runId: z.ZodOptional<z.ZodString>;
261
+ role: z.ZodEnum<{
262
+ assistant: "assistant";
263
+ summary: "summary";
264
+ system: "system";
265
+ tool: "tool";
266
+ user: "user";
267
+ }>;
268
+ status: z.ZodEnum<{
269
+ committed: "committed";
270
+ completed: "completed";
271
+ failed: "failed";
272
+ interrupted: "interrupted";
273
+ streaming: "streaming";
274
+ superseded: "superseded";
275
+ }>;
276
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
277
+ type: z.ZodLiteral<"text">;
278
+ text: z.ZodString;
279
+ }, z.core.$strip>, z.ZodObject<{
280
+ type: z.ZodLiteral<"reasoning">;
281
+ text: z.ZodString;
282
+ provider: z.ZodOptional<z.ZodObject<{
283
+ schemaVersion: z.ZodInt;
284
+ provider: z.ZodString;
285
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
286
+ }, z.core.$strip>>;
287
+ }, z.core.$strip>, z.ZodObject<{
288
+ type: z.ZodLiteral<"file">;
289
+ mediaType: z.ZodString;
290
+ reference: z.ZodString;
291
+ filename: z.ZodOptional<z.ZodString>;
292
+ }, z.core.$strip>, z.ZodObject<{
293
+ type: z.ZodLiteral<"source">;
294
+ sourceId: z.ZodString;
295
+ url: z.ZodOptional<z.ZodURL>;
296
+ title: z.ZodOptional<z.ZodString>;
297
+ }, z.core.$strip>, z.ZodObject<{
298
+ type: z.ZodLiteral<"tool-call">;
299
+ callId: z.ZodString;
300
+ toolName: z.ZodString;
301
+ input: z.ZodJSONSchema;
302
+ provider: z.ZodOptional<z.ZodObject<{
303
+ schemaVersion: z.ZodInt;
304
+ provider: z.ZodString;
305
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
306
+ }, z.core.$strip>>;
307
+ }, z.core.$strip>, z.ZodObject<{
308
+ type: z.ZodLiteral<"tool-result">;
309
+ callId: z.ZodString;
310
+ toolName: z.ZodString;
311
+ outcome: z.ZodEnum<{
312
+ error: "error";
313
+ interrupted: "interrupted";
314
+ success: "success";
315
+ }>;
316
+ output: z.ZodOptional<z.ZodJSONSchema>;
317
+ }, z.core.$strip>, z.ZodObject<{
318
+ type: z.ZodLiteral<"tool-approval-request">;
319
+ approvalId: z.ZodString;
320
+ callId: z.ZodString;
321
+ isAutomatic: z.ZodOptional<z.ZodBoolean>;
322
+ signature: z.ZodOptional<z.ZodString>;
323
+ }, z.core.$strip>, z.ZodObject<{
324
+ type: z.ZodLiteral<"tool-approval-response">;
325
+ approvalId: z.ZodString;
326
+ approved: z.ZodBoolean;
327
+ reason: z.ZodOptional<z.ZodString>;
328
+ }, z.core.$strip>, z.ZodObject<{
329
+ type: z.ZodLiteral<"provider">;
330
+ envelope: z.ZodObject<{
331
+ schemaVersion: z.ZodInt;
332
+ provider: z.ZodString;
333
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
334
+ }, z.core.$strip>;
335
+ }, z.core.$strip>, z.ZodObject<{
336
+ type: z.ZodLiteral<"control">;
337
+ reason: z.ZodEnum<{
338
+ "run-interrupted": "run-interrupted";
339
+ "stale-run": "stale-run";
340
+ }>;
341
+ }, z.core.$strip>], "type">>;
342
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
343
+ createdAt: z.ZodISODateTime;
344
+ updatedAt: z.ZodISODateTime;
345
+ }, z.core.$strip>;
346
+ usage: z.ZodOptional<z.ZodObject<{
347
+ inputTokens: z.ZodObject<{
348
+ value: z.ZodOptional<z.ZodInt>;
349
+ provenance: z.ZodEnum<{
350
+ computed: "computed";
351
+ estimated: "estimated";
352
+ "provider-reported": "provider-reported";
353
+ unavailable: "unavailable";
354
+ }>;
355
+ }, z.core.$strip>;
356
+ outputTokens: z.ZodObject<{
357
+ value: z.ZodOptional<z.ZodInt>;
358
+ provenance: z.ZodEnum<{
359
+ computed: "computed";
360
+ estimated: "estimated";
361
+ "provider-reported": "provider-reported";
362
+ unavailable: "unavailable";
363
+ }>;
364
+ }, z.core.$strip>;
365
+ reasoningTokens: z.ZodOptional<z.ZodObject<{
366
+ value: z.ZodOptional<z.ZodInt>;
367
+ provenance: z.ZodEnum<{
368
+ computed: "computed";
369
+ estimated: "estimated";
370
+ "provider-reported": "provider-reported";
371
+ unavailable: "unavailable";
372
+ }>;
373
+ }, z.core.$strip>>;
374
+ cacheReadTokens: z.ZodOptional<z.ZodObject<{
375
+ value: z.ZodOptional<z.ZodInt>;
376
+ provenance: z.ZodEnum<{
377
+ computed: "computed";
378
+ estimated: "estimated";
379
+ "provider-reported": "provider-reported";
380
+ unavailable: "unavailable";
381
+ }>;
382
+ }, z.core.$strip>>;
383
+ cacheWriteTokens: z.ZodOptional<z.ZodObject<{
384
+ value: z.ZodOptional<z.ZodInt>;
385
+ provenance: z.ZodEnum<{
386
+ computed: "computed";
387
+ estimated: "estimated";
388
+ "provider-reported": "provider-reported";
389
+ unavailable: "unavailable";
390
+ }>;
391
+ }, z.core.$strip>>;
392
+ cost: z.ZodOptional<z.ZodObject<{
393
+ value: z.ZodOptional<z.ZodNumber>;
394
+ currency: z.ZodOptional<z.ZodString>;
395
+ provenance: z.ZodEnum<{
396
+ computed: "computed";
397
+ estimated: "estimated";
398
+ "provider-reported": "provider-reported";
399
+ unavailable: "unavailable";
400
+ }>;
401
+ }, z.core.$strip>>;
402
+ }, z.core.$strip>>;
403
+ }, z.core.$strip>;
404
+ }, z.core.$strict>, z.ZodObject<{
405
+ type: z.ZodLiteral<"operation">;
406
+ input: z.ZodObject<{
407
+ conversationId: z.ZodString;
408
+ runId: z.ZodString;
409
+ expectedRevision: z.ZodInt;
410
+ ownerId: z.ZodString;
411
+ fencingToken: z.ZodOptional<z.ZodInt>;
412
+ operation: z.ZodObject<{
413
+ operationId: z.ZodString;
414
+ kind: z.ZodEnum<{
415
+ compaction: "compaction";
416
+ "model-request": "model-request";
417
+ }>;
418
+ phase: z.ZodEnum<{
419
+ cancelled: "cancelled";
420
+ completed: "completed";
421
+ failed: "failed";
422
+ "first-output": "first-output";
423
+ started: "started";
424
+ }>;
425
+ step: z.ZodOptional<z.ZodInt>;
426
+ startedAt: z.ZodISODateTime;
427
+ firstOutputAt: z.ZodOptional<z.ZodISODateTime>;
428
+ finishedAt: z.ZodOptional<z.ZodISODateTime>;
429
+ }, z.core.$strip>;
430
+ }, z.core.$strip>;
431
+ }, z.core.$strict>, z.ZodObject<{
432
+ type: z.ZodLiteral<"interrupt">;
433
+ input: z.ZodObject<{
434
+ conversationId: z.ZodString;
435
+ runId: z.ZodString;
436
+ expectedRevision: z.ZodInt;
437
+ }, z.core.$strip>;
438
+ }, z.core.$strict>, z.ZodObject<{
439
+ type: z.ZodLiteral<"recover">;
440
+ input: z.ZodObject<{
441
+ conversationId: z.ZodString;
442
+ runId: z.ZodString;
443
+ expectedRevision: z.ZodInt;
444
+ action: z.ZodEnum<{
445
+ abandon: "abandon";
446
+ requeue: "requeue";
447
+ }>;
448
+ replaySafe: z.ZodOptional<z.ZodBoolean>;
449
+ }, z.core.$strip>;
450
+ }, z.core.$strict>, z.ZodObject<{
451
+ type: z.ZodLiteral<"terminal">;
452
+ input: z.ZodObject<{
453
+ conversationId: z.ZodString;
454
+ runId: z.ZodString;
455
+ expectedRevision: z.ZodInt;
456
+ ownerId: z.ZodString;
457
+ fencingToken: z.ZodOptional<z.ZodInt>;
458
+ assistant: z.ZodObject<{
459
+ schemaVersion: z.ZodLiteral<1>;
460
+ id: z.ZodString;
461
+ conversationId: z.ZodString;
462
+ runId: z.ZodOptional<z.ZodString>;
463
+ role: z.ZodEnum<{
464
+ assistant: "assistant";
465
+ summary: "summary";
466
+ system: "system";
467
+ tool: "tool";
468
+ user: "user";
469
+ }>;
470
+ status: z.ZodEnum<{
471
+ committed: "committed";
472
+ completed: "completed";
473
+ failed: "failed";
474
+ interrupted: "interrupted";
475
+ streaming: "streaming";
476
+ superseded: "superseded";
477
+ }>;
478
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
479
+ type: z.ZodLiteral<"text">;
480
+ text: z.ZodString;
481
+ }, z.core.$strip>, z.ZodObject<{
482
+ type: z.ZodLiteral<"reasoning">;
483
+ text: z.ZodString;
484
+ provider: z.ZodOptional<z.ZodObject<{
485
+ schemaVersion: z.ZodInt;
486
+ provider: z.ZodString;
487
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
488
+ }, z.core.$strip>>;
489
+ }, z.core.$strip>, z.ZodObject<{
490
+ type: z.ZodLiteral<"file">;
491
+ mediaType: z.ZodString;
492
+ reference: z.ZodString;
493
+ filename: z.ZodOptional<z.ZodString>;
494
+ }, z.core.$strip>, z.ZodObject<{
495
+ type: z.ZodLiteral<"source">;
496
+ sourceId: z.ZodString;
497
+ url: z.ZodOptional<z.ZodURL>;
498
+ title: z.ZodOptional<z.ZodString>;
499
+ }, z.core.$strip>, z.ZodObject<{
500
+ type: z.ZodLiteral<"tool-call">;
501
+ callId: z.ZodString;
502
+ toolName: z.ZodString;
503
+ input: z.ZodJSONSchema;
504
+ provider: z.ZodOptional<z.ZodObject<{
505
+ schemaVersion: z.ZodInt;
506
+ provider: z.ZodString;
507
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
508
+ }, z.core.$strip>>;
509
+ }, z.core.$strip>, z.ZodObject<{
510
+ type: z.ZodLiteral<"tool-result">;
511
+ callId: z.ZodString;
512
+ toolName: z.ZodString;
513
+ outcome: z.ZodEnum<{
514
+ error: "error";
515
+ interrupted: "interrupted";
516
+ success: "success";
517
+ }>;
518
+ output: z.ZodOptional<z.ZodJSONSchema>;
519
+ }, z.core.$strip>, z.ZodObject<{
520
+ type: z.ZodLiteral<"tool-approval-request">;
521
+ approvalId: z.ZodString;
522
+ callId: z.ZodString;
523
+ isAutomatic: z.ZodOptional<z.ZodBoolean>;
524
+ signature: z.ZodOptional<z.ZodString>;
525
+ }, z.core.$strip>, z.ZodObject<{
526
+ type: z.ZodLiteral<"tool-approval-response">;
527
+ approvalId: z.ZodString;
528
+ approved: z.ZodBoolean;
529
+ reason: z.ZodOptional<z.ZodString>;
530
+ }, z.core.$strip>, z.ZodObject<{
531
+ type: z.ZodLiteral<"provider">;
532
+ envelope: z.ZodObject<{
533
+ schemaVersion: z.ZodInt;
534
+ provider: z.ZodString;
535
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
536
+ }, z.core.$strip>;
537
+ }, z.core.$strip>, z.ZodObject<{
538
+ type: z.ZodLiteral<"control">;
539
+ reason: z.ZodEnum<{
540
+ "run-interrupted": "run-interrupted";
541
+ "stale-run": "stale-run";
542
+ }>;
543
+ }, z.core.$strip>], "type">>;
544
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
545
+ createdAt: z.ZodISODateTime;
546
+ updatedAt: z.ZodISODateTime;
547
+ }, z.core.$strip>;
548
+ reason: z.ZodEnum<{
549
+ abandoned: "abandoned";
550
+ absorbed: "absorbed";
551
+ cancelled: "cancelled";
552
+ context_overflow: "context_overflow";
553
+ interrupted: "interrupted";
554
+ output_rejected: "output_rejected";
555
+ policy_stop: "policy_stop";
556
+ provider_failure: "provider_failure";
557
+ provider_stop: "provider_stop";
558
+ runtime_failure: "runtime_failure";
559
+ shutdown: "shutdown";
560
+ storage_conflict: "storage_conflict";
561
+ success: "success";
562
+ superseded: "superseded";
563
+ timeout: "timeout";
564
+ }>;
565
+ policyName: z.ZodOptional<z.ZodString>;
566
+ usage: z.ZodOptional<z.ZodObject<{
567
+ inputTokens: z.ZodObject<{
568
+ value: z.ZodOptional<z.ZodInt>;
569
+ provenance: z.ZodEnum<{
570
+ computed: "computed";
571
+ estimated: "estimated";
572
+ "provider-reported": "provider-reported";
573
+ unavailable: "unavailable";
574
+ }>;
575
+ }, z.core.$strip>;
576
+ outputTokens: z.ZodObject<{
577
+ value: z.ZodOptional<z.ZodInt>;
578
+ provenance: z.ZodEnum<{
579
+ computed: "computed";
580
+ estimated: "estimated";
581
+ "provider-reported": "provider-reported";
582
+ unavailable: "unavailable";
583
+ }>;
584
+ }, z.core.$strip>;
585
+ reasoningTokens: z.ZodOptional<z.ZodObject<{
586
+ value: z.ZodOptional<z.ZodInt>;
587
+ provenance: z.ZodEnum<{
588
+ computed: "computed";
589
+ estimated: "estimated";
590
+ "provider-reported": "provider-reported";
591
+ unavailable: "unavailable";
592
+ }>;
593
+ }, z.core.$strip>>;
594
+ cacheReadTokens: z.ZodOptional<z.ZodObject<{
595
+ value: z.ZodOptional<z.ZodInt>;
596
+ provenance: z.ZodEnum<{
597
+ computed: "computed";
598
+ estimated: "estimated";
599
+ "provider-reported": "provider-reported";
600
+ unavailable: "unavailable";
601
+ }>;
602
+ }, z.core.$strip>>;
603
+ cacheWriteTokens: z.ZodOptional<z.ZodObject<{
604
+ value: z.ZodOptional<z.ZodInt>;
605
+ provenance: z.ZodEnum<{
606
+ computed: "computed";
607
+ estimated: "estimated";
608
+ "provider-reported": "provider-reported";
609
+ unavailable: "unavailable";
610
+ }>;
611
+ }, z.core.$strip>>;
612
+ cost: z.ZodOptional<z.ZodObject<{
613
+ value: z.ZodOptional<z.ZodNumber>;
614
+ currency: z.ZodOptional<z.ZodString>;
615
+ provenance: z.ZodEnum<{
616
+ computed: "computed";
617
+ estimated: "estimated";
618
+ "provider-reported": "provider-reported";
619
+ unavailable: "unavailable";
620
+ }>;
621
+ }, z.core.$strip>>;
622
+ }, z.core.$strip>>;
623
+ absorb: z.ZodOptional<z.ZodArray<z.ZodObject<{
624
+ runId: z.ZodString;
625
+ inputMessageIds: z.ZodArray<z.ZodString>;
626
+ }, z.core.$strip>>>;
627
+ }, z.core.$strip>;
628
+ }, z.core.$strict>, z.ZodObject<{
629
+ type: z.ZodLiteral<"compact">;
630
+ input: z.ZodObject<{
631
+ conversationId: z.ZodString;
632
+ expectedVersion: z.ZodInt;
633
+ replacedMessageIds: z.ZodArray<z.ZodString>;
634
+ summary: z.ZodObject<{
635
+ schemaVersion: z.ZodLiteral<1>;
636
+ id: z.ZodString;
637
+ conversationId: z.ZodString;
638
+ runId: z.ZodOptional<z.ZodString>;
639
+ role: z.ZodEnum<{
640
+ assistant: "assistant";
641
+ summary: "summary";
642
+ system: "system";
643
+ tool: "tool";
644
+ user: "user";
645
+ }>;
646
+ status: z.ZodEnum<{
647
+ committed: "committed";
648
+ completed: "completed";
649
+ failed: "failed";
650
+ interrupted: "interrupted";
651
+ streaming: "streaming";
652
+ superseded: "superseded";
653
+ }>;
654
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
655
+ type: z.ZodLiteral<"text">;
656
+ text: z.ZodString;
657
+ }, z.core.$strip>, z.ZodObject<{
658
+ type: z.ZodLiteral<"reasoning">;
659
+ text: z.ZodString;
660
+ provider: z.ZodOptional<z.ZodObject<{
661
+ schemaVersion: z.ZodInt;
662
+ provider: z.ZodString;
663
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
664
+ }, z.core.$strip>>;
665
+ }, z.core.$strip>, z.ZodObject<{
666
+ type: z.ZodLiteral<"file">;
667
+ mediaType: z.ZodString;
668
+ reference: z.ZodString;
669
+ filename: z.ZodOptional<z.ZodString>;
670
+ }, z.core.$strip>, z.ZodObject<{
671
+ type: z.ZodLiteral<"source">;
672
+ sourceId: z.ZodString;
673
+ url: z.ZodOptional<z.ZodURL>;
674
+ title: z.ZodOptional<z.ZodString>;
675
+ }, z.core.$strip>, z.ZodObject<{
676
+ type: z.ZodLiteral<"tool-call">;
677
+ callId: z.ZodString;
678
+ toolName: z.ZodString;
679
+ input: z.ZodJSONSchema;
680
+ provider: z.ZodOptional<z.ZodObject<{
681
+ schemaVersion: z.ZodInt;
682
+ provider: z.ZodString;
683
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
684
+ }, z.core.$strip>>;
685
+ }, z.core.$strip>, z.ZodObject<{
686
+ type: z.ZodLiteral<"tool-result">;
687
+ callId: z.ZodString;
688
+ toolName: z.ZodString;
689
+ outcome: z.ZodEnum<{
690
+ error: "error";
691
+ interrupted: "interrupted";
692
+ success: "success";
693
+ }>;
694
+ output: z.ZodOptional<z.ZodJSONSchema>;
695
+ }, z.core.$strip>, z.ZodObject<{
696
+ type: z.ZodLiteral<"tool-approval-request">;
697
+ approvalId: z.ZodString;
698
+ callId: z.ZodString;
699
+ isAutomatic: z.ZodOptional<z.ZodBoolean>;
700
+ signature: z.ZodOptional<z.ZodString>;
701
+ }, z.core.$strip>, z.ZodObject<{
702
+ type: z.ZodLiteral<"tool-approval-response">;
703
+ approvalId: z.ZodString;
704
+ approved: z.ZodBoolean;
705
+ reason: z.ZodOptional<z.ZodString>;
706
+ }, z.core.$strip>, z.ZodObject<{
707
+ type: z.ZodLiteral<"provider">;
708
+ envelope: z.ZodObject<{
709
+ schemaVersion: z.ZodInt;
710
+ provider: z.ZodString;
711
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
712
+ }, z.core.$strip>;
713
+ }, z.core.$strip>, z.ZodObject<{
714
+ type: z.ZodLiteral<"control">;
715
+ reason: z.ZodEnum<{
716
+ "run-interrupted": "run-interrupted";
717
+ "stale-run": "stale-run";
718
+ }>;
719
+ }, z.core.$strip>], "type">>;
720
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
721
+ createdAt: z.ZodISODateTime;
722
+ updatedAt: z.ZodISODateTime;
723
+ }, z.core.$strip>;
724
+ }, z.core.$strip>;
725
+ }, z.core.$strict>], "type">;
726
+ export type AgentStoreTransition = z.infer<typeof AgentStoreTransitionSchema>;
727
+ export declare const AgentStoreEventEnvelopeSchema: z.ZodObject<{
728
+ schemaVersion: z.ZodInt;
729
+ eventId: z.ZodString;
730
+ conversationId: z.ZodString;
731
+ seq: z.ZodInt;
732
+ kind: z.ZodString;
733
+ occurredAt: z.ZodISODateTime;
734
+ payload: z.ZodJSONSchema;
735
+ ignorable: z.ZodOptional<z.ZodLiteral<true>>;
736
+ }, z.core.$strict>;
737
+ export type AgentStoreEventEnvelope = z.infer<typeof AgentStoreEventEnvelopeSchema>;
738
+ export declare const AppendAgentStoreEventSchema: z.ZodObject<{
739
+ conversationId: z.ZodString;
740
+ kind: z.ZodEnum<{
741
+ "child/spawned": "child/spawned";
742
+ "child/state": "child/state";
743
+ "provider/message": "provider/message";
744
+ "provider/request": "provider/request";
745
+ "retry/scheduled": "retry/scheduled";
746
+ "retry/started": "retry/started";
747
+ "runtime/baseline": "runtime/baseline";
748
+ "runtime/transition": "runtime/transition";
749
+ "sandbox/probed": "sandbox/probed";
750
+ "schedule/cancelled": "schedule/cancelled";
751
+ "schedule/failed": "schedule/failed";
752
+ "schedule/fired": "schedule/fired";
753
+ "schedule/late": "schedule/late";
754
+ "schedule/set": "schedule/set";
755
+ "spill/created": "spill/created";
756
+ "spill/deleted": "spill/deleted";
757
+ "state/set": "state/set";
758
+ }>;
759
+ occurredAt: z.ZodOptional<z.ZodISODateTime>;
760
+ payload: z.ZodJSONSchema;
761
+ ignorable: z.ZodOptional<z.ZodLiteral<true>>;
762
+ }, z.core.$strict>;
763
+ export type AppendAgentStoreEvent = z.infer<typeof AppendAgentStoreEventSchema>;
764
+ export declare const ReadAgentStoreEventsSchema: z.ZodObject<{
765
+ conversationId: z.ZodString;
766
+ fromSeq: z.ZodOptional<z.ZodInt>;
767
+ toSeq: z.ZodOptional<z.ZodInt>;
768
+ limit: z.ZodDefault<z.ZodInt>;
769
+ }, z.core.$strict>;
770
+ export type ReadAgentStoreEvents = z.infer<typeof ReadAgentStoreEventsSchema>;
771
+ export declare const AgentStoreEventPageSchema: z.ZodObject<{
772
+ items: z.ZodArray<z.ZodObject<{
773
+ schemaVersion: z.ZodInt;
774
+ eventId: z.ZodString;
775
+ conversationId: z.ZodString;
776
+ seq: z.ZodInt;
777
+ kind: z.ZodString;
778
+ occurredAt: z.ZodISODateTime;
779
+ payload: z.ZodJSONSchema;
780
+ ignorable: z.ZodOptional<z.ZodLiteral<true>>;
781
+ }, z.core.$strict>>;
782
+ nextSeq: z.ZodOptional<z.ZodInt>;
783
+ }, z.core.$strict>;
784
+ export type AgentStoreEventPage = z.infer<typeof AgentStoreEventPageSchema>;
785
+ export type AgentStoreEventDraft = Omit<AgentStoreEventEnvelope, 'seq'>;
786
+ export interface AgentStoreEventDecodeAccepted {
787
+ outcome: 'accepted';
788
+ event: AgentStoreEventEnvelope;
789
+ }
790
+ export interface AgentStoreEventDecodeIgnored {
791
+ outcome: 'ignored';
792
+ eventId: string;
793
+ conversationId: string;
794
+ seq: number;
795
+ schemaVersion: number;
796
+ kind: string;
797
+ }
798
+ export type AgentStoreEventDecodeResult = AgentStoreEventDecodeAccepted | AgentStoreEventDecodeIgnored;
799
+ /**
800
+ * Validate one event without silently widening the vocabulary.
801
+ *
802
+ * `ignorable` applies to an unknown kind or envelope version as a whole. It
803
+ * never turns an extra field in a known envelope into accepted data.
804
+ */
805
+ export declare function decodeAgentStoreEvent(value: unknown): AgentStoreEventDecodeResult;
806
+ export declare function agentStoreEventDraft(input: AppendAgentStoreEvent): AgentStoreEventDraft;
807
+ /** Stable UTF-8 JSON used by archives, digests and byte-for-byte round trips. */
808
+ export declare function canonicalAgentJson(value: unknown): string;
809
+ export declare const AgentConversationArchiveSchema: z.ZodObject<{
810
+ format: z.ZodLiteral<"stitchkit.agent-conversation">;
811
+ formatVersion: z.ZodLiteral<1>;
812
+ conversationId: z.ZodString;
813
+ events: z.ZodArray<z.ZodObject<{
814
+ schemaVersion: z.ZodInt;
815
+ eventId: z.ZodString;
816
+ conversationId: z.ZodString;
817
+ seq: z.ZodInt;
818
+ kind: z.ZodString;
819
+ occurredAt: z.ZodISODateTime;
820
+ payload: z.ZodJSONSchema;
821
+ ignorable: z.ZodOptional<z.ZodLiteral<true>>;
822
+ }, z.core.$strict>>;
823
+ projections: z.ZodDefault<z.ZodArray<z.ZodJSONSchema>>;
824
+ spills: z.ZodDefault<z.ZodArray<z.ZodJSONSchema>>;
825
+ }, z.core.$strict>;
826
+ export type AgentConversationArchive = z.infer<typeof AgentConversationArchiveSchema>;
827
+ export declare function encodeAgentConversationArchive(archive: AgentConversationArchive): Uint8Array;
828
+ export declare function decodeAgentConversationArchive(bytes: Uint8Array): AgentConversationArchive;
829
+ //# sourceMappingURL=store-events.d.ts.map