stitchkit 0.56.5 → 0.58.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.
- package/dist/agent-runtime/compaction.d.ts +3 -0
- package/dist/agent-runtime/compaction.d.ts.map +1 -1
- package/dist/agent-runtime/events.d.ts +693 -0
- package/dist/agent-runtime/events.d.ts.map +1 -1
- package/dist/agent-runtime/history.d.ts +13 -0
- package/dist/agent-runtime/history.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +1 -0
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/models.d.ts +39 -3
- package/dist/agent-runtime/models.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +3 -0
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/prompt.d.ts +21 -0
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +43 -4
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts +75 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +409 -0
- package/dist/agent-runtime/store-driver.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +169 -2
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/testing.d.ts +10 -1
- package/dist/agent-runtime/testing.d.ts.map +1 -1
- package/dist/agent-runtime.d.ts +7 -6
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +1157 -511
- package/dist/index-vtjgx3vv.js +161 -0
- package/dist/server/error-hook.d.ts +8 -1
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/index.js +4 -2
- package/dist/testing/agent-store-conformance.d.ts +7 -0
- package/dist/testing/agent-store-conformance.d.ts.map +1 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +331 -0
- package/llms-full.txt +201 -28
- package/package.json +1 -1
|
@@ -1,4 +1,209 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { ObservabilitySinkStatus } from '../observability/status';
|
|
3
|
+
export declare const AgentAdmissionEventSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"admission">;
|
|
5
|
+
eventId: z.ZodString;
|
|
6
|
+
conversationId: z.ZodString;
|
|
7
|
+
runId: z.ZodString;
|
|
8
|
+
snapshotVersion: z.ZodInt;
|
|
9
|
+
input: z.ZodObject<{
|
|
10
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
conversationId: z.ZodString;
|
|
13
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
14
|
+
role: z.ZodEnum<{
|
|
15
|
+
assistant: "assistant";
|
|
16
|
+
summary: "summary";
|
|
17
|
+
system: "system";
|
|
18
|
+
user: "user";
|
|
19
|
+
}>;
|
|
20
|
+
status: z.ZodEnum<{
|
|
21
|
+
committed: "committed";
|
|
22
|
+
completed: "completed";
|
|
23
|
+
failed: "failed";
|
|
24
|
+
interrupted: "interrupted";
|
|
25
|
+
streaming: "streaming";
|
|
26
|
+
}>;
|
|
27
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"text">;
|
|
29
|
+
text: z.ZodString;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"reasoning">;
|
|
32
|
+
text: z.ZodString;
|
|
33
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
34
|
+
schemaVersion: z.ZodInt;
|
|
35
|
+
provider: z.ZodString;
|
|
36
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"file">;
|
|
40
|
+
mediaType: z.ZodString;
|
|
41
|
+
reference: z.ZodString;
|
|
42
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"source">;
|
|
45
|
+
sourceId: z.ZodString;
|
|
46
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
47
|
+
title: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"tool-call">;
|
|
50
|
+
callId: z.ZodString;
|
|
51
|
+
toolName: z.ZodString;
|
|
52
|
+
input: z.ZodJSONSchema;
|
|
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<"tool-result">;
|
|
60
|
+
callId: z.ZodString;
|
|
61
|
+
toolName: z.ZodString;
|
|
62
|
+
outcome: z.ZodEnum<{
|
|
63
|
+
error: "error";
|
|
64
|
+
interrupted: "interrupted";
|
|
65
|
+
success: "success";
|
|
66
|
+
}>;
|
|
67
|
+
output: z.ZodOptional<z.ZodJSONSchema>;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
type: z.ZodLiteral<"provider">;
|
|
70
|
+
envelope: z.ZodObject<{
|
|
71
|
+
schemaVersion: z.ZodInt;
|
|
72
|
+
provider: z.ZodString;
|
|
73
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<"control">;
|
|
77
|
+
reason: z.ZodEnum<{
|
|
78
|
+
"run-interrupted": "run-interrupted";
|
|
79
|
+
"stale-run": "stale-run";
|
|
80
|
+
}>;
|
|
81
|
+
}, z.core.$strip>], "type">>;
|
|
82
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
83
|
+
createdAt: z.ZodISODateTime;
|
|
84
|
+
updatedAt: z.ZodISODateTime;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
run: z.ZodObject<{
|
|
87
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
conversationId: z.ZodString;
|
|
90
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
91
|
+
assistantMessageId: z.ZodString;
|
|
92
|
+
state: z.ZodEnum<{
|
|
93
|
+
abandoned: "abandoned";
|
|
94
|
+
cancelled: "cancelled";
|
|
95
|
+
completed: "completed";
|
|
96
|
+
failed: "failed";
|
|
97
|
+
interrupt_requested: "interrupt_requested";
|
|
98
|
+
interrupted: "interrupted";
|
|
99
|
+
queued: "queued";
|
|
100
|
+
running: "running";
|
|
101
|
+
}>;
|
|
102
|
+
revision: z.ZodInt;
|
|
103
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
104
|
+
fencingToken: z.ZodOptional<z.ZodInt>;
|
|
105
|
+
terminalReason: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
abandoned: "abandoned";
|
|
107
|
+
cancelled: "cancelled";
|
|
108
|
+
interrupted: "interrupted";
|
|
109
|
+
policy_stop: "policy_stop";
|
|
110
|
+
provider_failure: "provider_failure";
|
|
111
|
+
shutdown: "shutdown";
|
|
112
|
+
success: "success";
|
|
113
|
+
timeout: "timeout";
|
|
114
|
+
tool_failure: "tool_failure";
|
|
115
|
+
}>>;
|
|
116
|
+
terminalPolicyName: z.ZodOptional<z.ZodString>;
|
|
117
|
+
createdAt: z.ZodISODateTime;
|
|
118
|
+
updatedAt: z.ZodISODateTime;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
assistant: z.ZodUnion<readonly [z.ZodObject<{
|
|
121
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
conversationId: z.ZodString;
|
|
124
|
+
runId: z.ZodString;
|
|
125
|
+
status: z.ZodLiteral<"pending">;
|
|
126
|
+
createdAt: z.ZodISODateTime;
|
|
127
|
+
updatedAt: z.ZodISODateTime;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
conversationId: z.ZodString;
|
|
132
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
133
|
+
role: z.ZodEnum<{
|
|
134
|
+
assistant: "assistant";
|
|
135
|
+
summary: "summary";
|
|
136
|
+
system: "system";
|
|
137
|
+
user: "user";
|
|
138
|
+
}>;
|
|
139
|
+
status: z.ZodEnum<{
|
|
140
|
+
committed: "committed";
|
|
141
|
+
completed: "completed";
|
|
142
|
+
failed: "failed";
|
|
143
|
+
interrupted: "interrupted";
|
|
144
|
+
streaming: "streaming";
|
|
145
|
+
}>;
|
|
146
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
147
|
+
type: z.ZodLiteral<"text">;
|
|
148
|
+
text: z.ZodString;
|
|
149
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
+
type: z.ZodLiteral<"reasoning">;
|
|
151
|
+
text: z.ZodString;
|
|
152
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
schemaVersion: z.ZodInt;
|
|
154
|
+
provider: z.ZodString;
|
|
155
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
158
|
+
type: z.ZodLiteral<"file">;
|
|
159
|
+
mediaType: z.ZodString;
|
|
160
|
+
reference: z.ZodString;
|
|
161
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"source">;
|
|
164
|
+
sourceId: z.ZodString;
|
|
165
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
166
|
+
title: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
168
|
+
type: z.ZodLiteral<"tool-call">;
|
|
169
|
+
callId: z.ZodString;
|
|
170
|
+
toolName: z.ZodString;
|
|
171
|
+
input: z.ZodJSONSchema;
|
|
172
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
173
|
+
schemaVersion: z.ZodInt;
|
|
174
|
+
provider: z.ZodString;
|
|
175
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
type: z.ZodLiteral<"tool-result">;
|
|
179
|
+
callId: z.ZodString;
|
|
180
|
+
toolName: z.ZodString;
|
|
181
|
+
outcome: z.ZodEnum<{
|
|
182
|
+
error: "error";
|
|
183
|
+
interrupted: "interrupted";
|
|
184
|
+
success: "success";
|
|
185
|
+
}>;
|
|
186
|
+
output: z.ZodOptional<z.ZodJSONSchema>;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
type: z.ZodLiteral<"provider">;
|
|
189
|
+
envelope: z.ZodObject<{
|
|
190
|
+
schemaVersion: z.ZodInt;
|
|
191
|
+
provider: z.ZodString;
|
|
192
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
195
|
+
type: z.ZodLiteral<"control">;
|
|
196
|
+
reason: z.ZodEnum<{
|
|
197
|
+
"run-interrupted": "run-interrupted";
|
|
198
|
+
"stale-run": "stale-run";
|
|
199
|
+
}>;
|
|
200
|
+
}, z.core.$strip>], "type">>;
|
|
201
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
202
|
+
createdAt: z.ZodISODateTime;
|
|
203
|
+
updatedAt: z.ZodISODateTime;
|
|
204
|
+
}, z.core.$strip>]>;
|
|
205
|
+
emittedAt: z.ZodISODateTime;
|
|
206
|
+
}, z.core.$strip>;
|
|
2
207
|
export declare const AgentTransientDeltaEventSchema: z.ZodObject<{
|
|
3
208
|
conversationId: z.ZodString;
|
|
4
209
|
runId: z.ZodString;
|
|
@@ -132,6 +337,68 @@ export declare const AgentCheckpointEventSchema: z.ZodObject<{
|
|
|
132
337
|
createdAt: z.ZodISODateTime;
|
|
133
338
|
updatedAt: z.ZodISODateTime;
|
|
134
339
|
}, z.core.$strip>;
|
|
340
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
341
|
+
partial: z.ZodBoolean;
|
|
342
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
343
|
+
inputTokens: z.ZodObject<{
|
|
344
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
345
|
+
provenance: z.ZodEnum<{
|
|
346
|
+
computed: "computed";
|
|
347
|
+
estimated: "estimated";
|
|
348
|
+
"provider-reported": "provider-reported";
|
|
349
|
+
unavailable: "unavailable";
|
|
350
|
+
}>;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
outputTokens: z.ZodObject<{
|
|
353
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
354
|
+
provenance: z.ZodEnum<{
|
|
355
|
+
computed: "computed";
|
|
356
|
+
estimated: "estimated";
|
|
357
|
+
"provider-reported": "provider-reported";
|
|
358
|
+
unavailable: "unavailable";
|
|
359
|
+
}>;
|
|
360
|
+
}, z.core.$strip>;
|
|
361
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
362
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
363
|
+
provenance: z.ZodEnum<{
|
|
364
|
+
computed: "computed";
|
|
365
|
+
estimated: "estimated";
|
|
366
|
+
"provider-reported": "provider-reported";
|
|
367
|
+
unavailable: "unavailable";
|
|
368
|
+
}>;
|
|
369
|
+
}, z.core.$strip>>;
|
|
370
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
371
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
372
|
+
provenance: z.ZodEnum<{
|
|
373
|
+
computed: "computed";
|
|
374
|
+
estimated: "estimated";
|
|
375
|
+
"provider-reported": "provider-reported";
|
|
376
|
+
unavailable: "unavailable";
|
|
377
|
+
}>;
|
|
378
|
+
}, z.core.$strip>>;
|
|
379
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
380
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
381
|
+
provenance: z.ZodEnum<{
|
|
382
|
+
computed: "computed";
|
|
383
|
+
estimated: "estimated";
|
|
384
|
+
"provider-reported": "provider-reported";
|
|
385
|
+
unavailable: "unavailable";
|
|
386
|
+
}>;
|
|
387
|
+
}, z.core.$strip>>;
|
|
388
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
389
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
390
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
391
|
+
provenance: z.ZodEnum<{
|
|
392
|
+
computed: "computed";
|
|
393
|
+
estimated: "estimated";
|
|
394
|
+
"provider-reported": "provider-reported";
|
|
395
|
+
unavailable: "unavailable";
|
|
396
|
+
}>;
|
|
397
|
+
}, z.core.$strip>>;
|
|
398
|
+
}, z.core.$strip>>;
|
|
399
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
400
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
401
|
+
}, z.core.$strip>>;
|
|
135
402
|
}, z.core.$strip>;
|
|
136
403
|
export declare const AgentRunStateEventSchema: z.ZodObject<{
|
|
137
404
|
conversationId: z.ZodString;
|
|
@@ -265,8 +532,273 @@ export declare const AgentTerminalEventSchema: z.ZodObject<{
|
|
|
265
532
|
createdAt: z.ZodISODateTime;
|
|
266
533
|
updatedAt: z.ZodISODateTime;
|
|
267
534
|
}, z.core.$strip>;
|
|
535
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
536
|
+
partial: z.ZodBoolean;
|
|
537
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
538
|
+
inputTokens: z.ZodObject<{
|
|
539
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
540
|
+
provenance: z.ZodEnum<{
|
|
541
|
+
computed: "computed";
|
|
542
|
+
estimated: "estimated";
|
|
543
|
+
"provider-reported": "provider-reported";
|
|
544
|
+
unavailable: "unavailable";
|
|
545
|
+
}>;
|
|
546
|
+
}, z.core.$strip>;
|
|
547
|
+
outputTokens: z.ZodObject<{
|
|
548
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
549
|
+
provenance: z.ZodEnum<{
|
|
550
|
+
computed: "computed";
|
|
551
|
+
estimated: "estimated";
|
|
552
|
+
"provider-reported": "provider-reported";
|
|
553
|
+
unavailable: "unavailable";
|
|
554
|
+
}>;
|
|
555
|
+
}, z.core.$strip>;
|
|
556
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
557
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
558
|
+
provenance: z.ZodEnum<{
|
|
559
|
+
computed: "computed";
|
|
560
|
+
estimated: "estimated";
|
|
561
|
+
"provider-reported": "provider-reported";
|
|
562
|
+
unavailable: "unavailable";
|
|
563
|
+
}>;
|
|
564
|
+
}, z.core.$strip>>;
|
|
565
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
566
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
567
|
+
provenance: z.ZodEnum<{
|
|
568
|
+
computed: "computed";
|
|
569
|
+
estimated: "estimated";
|
|
570
|
+
"provider-reported": "provider-reported";
|
|
571
|
+
unavailable: "unavailable";
|
|
572
|
+
}>;
|
|
573
|
+
}, z.core.$strip>>;
|
|
574
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
575
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
576
|
+
provenance: z.ZodEnum<{
|
|
577
|
+
computed: "computed";
|
|
578
|
+
estimated: "estimated";
|
|
579
|
+
"provider-reported": "provider-reported";
|
|
580
|
+
unavailable: "unavailable";
|
|
581
|
+
}>;
|
|
582
|
+
}, z.core.$strip>>;
|
|
583
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
584
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
585
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
586
|
+
provenance: z.ZodEnum<{
|
|
587
|
+
computed: "computed";
|
|
588
|
+
estimated: "estimated";
|
|
589
|
+
"provider-reported": "provider-reported";
|
|
590
|
+
unavailable: "unavailable";
|
|
591
|
+
}>;
|
|
592
|
+
}, z.core.$strip>>;
|
|
593
|
+
}, z.core.$strip>>;
|
|
594
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
595
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
596
|
+
}, z.core.$strip>>;
|
|
268
597
|
}, z.core.$strip>;
|
|
269
598
|
export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
599
|
+
type: z.ZodLiteral<"admission">;
|
|
600
|
+
eventId: z.ZodString;
|
|
601
|
+
conversationId: z.ZodString;
|
|
602
|
+
runId: z.ZodString;
|
|
603
|
+
snapshotVersion: z.ZodInt;
|
|
604
|
+
input: z.ZodObject<{
|
|
605
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
606
|
+
id: z.ZodString;
|
|
607
|
+
conversationId: z.ZodString;
|
|
608
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
609
|
+
role: z.ZodEnum<{
|
|
610
|
+
assistant: "assistant";
|
|
611
|
+
summary: "summary";
|
|
612
|
+
system: "system";
|
|
613
|
+
user: "user";
|
|
614
|
+
}>;
|
|
615
|
+
status: z.ZodEnum<{
|
|
616
|
+
committed: "committed";
|
|
617
|
+
completed: "completed";
|
|
618
|
+
failed: "failed";
|
|
619
|
+
interrupted: "interrupted";
|
|
620
|
+
streaming: "streaming";
|
|
621
|
+
}>;
|
|
622
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
623
|
+
type: z.ZodLiteral<"text">;
|
|
624
|
+
text: z.ZodString;
|
|
625
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
626
|
+
type: z.ZodLiteral<"reasoning">;
|
|
627
|
+
text: z.ZodString;
|
|
628
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
629
|
+
schemaVersion: z.ZodInt;
|
|
630
|
+
provider: z.ZodString;
|
|
631
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
632
|
+
}, z.core.$strip>>;
|
|
633
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
634
|
+
type: z.ZodLiteral<"file">;
|
|
635
|
+
mediaType: z.ZodString;
|
|
636
|
+
reference: z.ZodString;
|
|
637
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
638
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
639
|
+
type: z.ZodLiteral<"source">;
|
|
640
|
+
sourceId: z.ZodString;
|
|
641
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
642
|
+
title: z.ZodOptional<z.ZodString>;
|
|
643
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
644
|
+
type: z.ZodLiteral<"tool-call">;
|
|
645
|
+
callId: z.ZodString;
|
|
646
|
+
toolName: z.ZodString;
|
|
647
|
+
input: z.ZodJSONSchema;
|
|
648
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
649
|
+
schemaVersion: z.ZodInt;
|
|
650
|
+
provider: z.ZodString;
|
|
651
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
652
|
+
}, z.core.$strip>>;
|
|
653
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
654
|
+
type: z.ZodLiteral<"tool-result">;
|
|
655
|
+
callId: z.ZodString;
|
|
656
|
+
toolName: z.ZodString;
|
|
657
|
+
outcome: z.ZodEnum<{
|
|
658
|
+
error: "error";
|
|
659
|
+
interrupted: "interrupted";
|
|
660
|
+
success: "success";
|
|
661
|
+
}>;
|
|
662
|
+
output: z.ZodOptional<z.ZodJSONSchema>;
|
|
663
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
664
|
+
type: z.ZodLiteral<"provider">;
|
|
665
|
+
envelope: z.ZodObject<{
|
|
666
|
+
schemaVersion: z.ZodInt;
|
|
667
|
+
provider: z.ZodString;
|
|
668
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
669
|
+
}, z.core.$strip>;
|
|
670
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
671
|
+
type: z.ZodLiteral<"control">;
|
|
672
|
+
reason: z.ZodEnum<{
|
|
673
|
+
"run-interrupted": "run-interrupted";
|
|
674
|
+
"stale-run": "stale-run";
|
|
675
|
+
}>;
|
|
676
|
+
}, z.core.$strip>], "type">>;
|
|
677
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
678
|
+
createdAt: z.ZodISODateTime;
|
|
679
|
+
updatedAt: z.ZodISODateTime;
|
|
680
|
+
}, z.core.$strip>;
|
|
681
|
+
run: z.ZodObject<{
|
|
682
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
683
|
+
id: z.ZodString;
|
|
684
|
+
conversationId: z.ZodString;
|
|
685
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
686
|
+
assistantMessageId: z.ZodString;
|
|
687
|
+
state: z.ZodEnum<{
|
|
688
|
+
abandoned: "abandoned";
|
|
689
|
+
cancelled: "cancelled";
|
|
690
|
+
completed: "completed";
|
|
691
|
+
failed: "failed";
|
|
692
|
+
interrupt_requested: "interrupt_requested";
|
|
693
|
+
interrupted: "interrupted";
|
|
694
|
+
queued: "queued";
|
|
695
|
+
running: "running";
|
|
696
|
+
}>;
|
|
697
|
+
revision: z.ZodInt;
|
|
698
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
699
|
+
fencingToken: z.ZodOptional<z.ZodInt>;
|
|
700
|
+
terminalReason: z.ZodOptional<z.ZodEnum<{
|
|
701
|
+
abandoned: "abandoned";
|
|
702
|
+
cancelled: "cancelled";
|
|
703
|
+
interrupted: "interrupted";
|
|
704
|
+
policy_stop: "policy_stop";
|
|
705
|
+
provider_failure: "provider_failure";
|
|
706
|
+
shutdown: "shutdown";
|
|
707
|
+
success: "success";
|
|
708
|
+
timeout: "timeout";
|
|
709
|
+
tool_failure: "tool_failure";
|
|
710
|
+
}>>;
|
|
711
|
+
terminalPolicyName: z.ZodOptional<z.ZodString>;
|
|
712
|
+
createdAt: z.ZodISODateTime;
|
|
713
|
+
updatedAt: z.ZodISODateTime;
|
|
714
|
+
}, z.core.$strip>;
|
|
715
|
+
assistant: z.ZodUnion<readonly [z.ZodObject<{
|
|
716
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
717
|
+
id: z.ZodString;
|
|
718
|
+
conversationId: z.ZodString;
|
|
719
|
+
runId: z.ZodString;
|
|
720
|
+
status: z.ZodLiteral<"pending">;
|
|
721
|
+
createdAt: z.ZodISODateTime;
|
|
722
|
+
updatedAt: z.ZodISODateTime;
|
|
723
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
724
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
725
|
+
id: z.ZodString;
|
|
726
|
+
conversationId: z.ZodString;
|
|
727
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
728
|
+
role: z.ZodEnum<{
|
|
729
|
+
assistant: "assistant";
|
|
730
|
+
summary: "summary";
|
|
731
|
+
system: "system";
|
|
732
|
+
user: "user";
|
|
733
|
+
}>;
|
|
734
|
+
status: z.ZodEnum<{
|
|
735
|
+
committed: "committed";
|
|
736
|
+
completed: "completed";
|
|
737
|
+
failed: "failed";
|
|
738
|
+
interrupted: "interrupted";
|
|
739
|
+
streaming: "streaming";
|
|
740
|
+
}>;
|
|
741
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
742
|
+
type: z.ZodLiteral<"text">;
|
|
743
|
+
text: z.ZodString;
|
|
744
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
745
|
+
type: z.ZodLiteral<"reasoning">;
|
|
746
|
+
text: z.ZodString;
|
|
747
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
748
|
+
schemaVersion: z.ZodInt;
|
|
749
|
+
provider: z.ZodString;
|
|
750
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
751
|
+
}, z.core.$strip>>;
|
|
752
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
753
|
+
type: z.ZodLiteral<"file">;
|
|
754
|
+
mediaType: z.ZodString;
|
|
755
|
+
reference: z.ZodString;
|
|
756
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
757
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
758
|
+
type: z.ZodLiteral<"source">;
|
|
759
|
+
sourceId: z.ZodString;
|
|
760
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
761
|
+
title: z.ZodOptional<z.ZodString>;
|
|
762
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
763
|
+
type: z.ZodLiteral<"tool-call">;
|
|
764
|
+
callId: z.ZodString;
|
|
765
|
+
toolName: z.ZodString;
|
|
766
|
+
input: z.ZodJSONSchema;
|
|
767
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
768
|
+
schemaVersion: z.ZodInt;
|
|
769
|
+
provider: z.ZodString;
|
|
770
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
771
|
+
}, z.core.$strip>>;
|
|
772
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
773
|
+
type: z.ZodLiteral<"tool-result">;
|
|
774
|
+
callId: z.ZodString;
|
|
775
|
+
toolName: z.ZodString;
|
|
776
|
+
outcome: z.ZodEnum<{
|
|
777
|
+
error: "error";
|
|
778
|
+
interrupted: "interrupted";
|
|
779
|
+
success: "success";
|
|
780
|
+
}>;
|
|
781
|
+
output: z.ZodOptional<z.ZodJSONSchema>;
|
|
782
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
783
|
+
type: z.ZodLiteral<"provider">;
|
|
784
|
+
envelope: z.ZodObject<{
|
|
785
|
+
schemaVersion: z.ZodInt;
|
|
786
|
+
provider: z.ZodString;
|
|
787
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
788
|
+
}, z.core.$strip>;
|
|
789
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
790
|
+
type: z.ZodLiteral<"control">;
|
|
791
|
+
reason: z.ZodEnum<{
|
|
792
|
+
"run-interrupted": "run-interrupted";
|
|
793
|
+
"stale-run": "stale-run";
|
|
794
|
+
}>;
|
|
795
|
+
}, z.core.$strip>], "type">>;
|
|
796
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
797
|
+
createdAt: z.ZodISODateTime;
|
|
798
|
+
updatedAt: z.ZodISODateTime;
|
|
799
|
+
}, z.core.$strip>]>;
|
|
800
|
+
emittedAt: z.ZodISODateTime;
|
|
801
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
270
802
|
conversationId: z.ZodString;
|
|
271
803
|
runId: z.ZodString;
|
|
272
804
|
emittedAt: z.ZodISODateTime;
|
|
@@ -395,6 +927,68 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
395
927
|
createdAt: z.ZodISODateTime;
|
|
396
928
|
updatedAt: z.ZodISODateTime;
|
|
397
929
|
}, z.core.$strip>;
|
|
930
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
931
|
+
partial: z.ZodBoolean;
|
|
932
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
933
|
+
inputTokens: z.ZodObject<{
|
|
934
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
935
|
+
provenance: z.ZodEnum<{
|
|
936
|
+
computed: "computed";
|
|
937
|
+
estimated: "estimated";
|
|
938
|
+
"provider-reported": "provider-reported";
|
|
939
|
+
unavailable: "unavailable";
|
|
940
|
+
}>;
|
|
941
|
+
}, z.core.$strip>;
|
|
942
|
+
outputTokens: z.ZodObject<{
|
|
943
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
944
|
+
provenance: z.ZodEnum<{
|
|
945
|
+
computed: "computed";
|
|
946
|
+
estimated: "estimated";
|
|
947
|
+
"provider-reported": "provider-reported";
|
|
948
|
+
unavailable: "unavailable";
|
|
949
|
+
}>;
|
|
950
|
+
}, z.core.$strip>;
|
|
951
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
952
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
953
|
+
provenance: z.ZodEnum<{
|
|
954
|
+
computed: "computed";
|
|
955
|
+
estimated: "estimated";
|
|
956
|
+
"provider-reported": "provider-reported";
|
|
957
|
+
unavailable: "unavailable";
|
|
958
|
+
}>;
|
|
959
|
+
}, z.core.$strip>>;
|
|
960
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
961
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
962
|
+
provenance: z.ZodEnum<{
|
|
963
|
+
computed: "computed";
|
|
964
|
+
estimated: "estimated";
|
|
965
|
+
"provider-reported": "provider-reported";
|
|
966
|
+
unavailable: "unavailable";
|
|
967
|
+
}>;
|
|
968
|
+
}, z.core.$strip>>;
|
|
969
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
970
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
971
|
+
provenance: z.ZodEnum<{
|
|
972
|
+
computed: "computed";
|
|
973
|
+
estimated: "estimated";
|
|
974
|
+
"provider-reported": "provider-reported";
|
|
975
|
+
unavailable: "unavailable";
|
|
976
|
+
}>;
|
|
977
|
+
}, z.core.$strip>>;
|
|
978
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
979
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
980
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
981
|
+
provenance: z.ZodEnum<{
|
|
982
|
+
computed: "computed";
|
|
983
|
+
estimated: "estimated";
|
|
984
|
+
"provider-reported": "provider-reported";
|
|
985
|
+
unavailable: "unavailable";
|
|
986
|
+
}>;
|
|
987
|
+
}, z.core.$strip>>;
|
|
988
|
+
}, z.core.$strip>>;
|
|
989
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
990
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
991
|
+
}, z.core.$strip>>;
|
|
398
992
|
}, z.core.$strip>, z.ZodObject<{
|
|
399
993
|
conversationId: z.ZodString;
|
|
400
994
|
runId: z.ZodString;
|
|
@@ -525,7 +1119,106 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
525
1119
|
createdAt: z.ZodISODateTime;
|
|
526
1120
|
updatedAt: z.ZodISODateTime;
|
|
527
1121
|
}, z.core.$strip>;
|
|
1122
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
1123
|
+
partial: z.ZodBoolean;
|
|
1124
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
1125
|
+
inputTokens: z.ZodObject<{
|
|
1126
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
1127
|
+
provenance: z.ZodEnum<{
|
|
1128
|
+
computed: "computed";
|
|
1129
|
+
estimated: "estimated";
|
|
1130
|
+
"provider-reported": "provider-reported";
|
|
1131
|
+
unavailable: "unavailable";
|
|
1132
|
+
}>;
|
|
1133
|
+
}, z.core.$strip>;
|
|
1134
|
+
outputTokens: z.ZodObject<{
|
|
1135
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
1136
|
+
provenance: z.ZodEnum<{
|
|
1137
|
+
computed: "computed";
|
|
1138
|
+
estimated: "estimated";
|
|
1139
|
+
"provider-reported": "provider-reported";
|
|
1140
|
+
unavailable: "unavailable";
|
|
1141
|
+
}>;
|
|
1142
|
+
}, z.core.$strip>;
|
|
1143
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
1144
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
1145
|
+
provenance: z.ZodEnum<{
|
|
1146
|
+
computed: "computed";
|
|
1147
|
+
estimated: "estimated";
|
|
1148
|
+
"provider-reported": "provider-reported";
|
|
1149
|
+
unavailable: "unavailable";
|
|
1150
|
+
}>;
|
|
1151
|
+
}, z.core.$strip>>;
|
|
1152
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
1153
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
1154
|
+
provenance: z.ZodEnum<{
|
|
1155
|
+
computed: "computed";
|
|
1156
|
+
estimated: "estimated";
|
|
1157
|
+
"provider-reported": "provider-reported";
|
|
1158
|
+
unavailable: "unavailable";
|
|
1159
|
+
}>;
|
|
1160
|
+
}, z.core.$strip>>;
|
|
1161
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
1162
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
1163
|
+
provenance: z.ZodEnum<{
|
|
1164
|
+
computed: "computed";
|
|
1165
|
+
estimated: "estimated";
|
|
1166
|
+
"provider-reported": "provider-reported";
|
|
1167
|
+
unavailable: "unavailable";
|
|
1168
|
+
}>;
|
|
1169
|
+
}, z.core.$strip>>;
|
|
1170
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
1171
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
1172
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
1173
|
+
provenance: z.ZodEnum<{
|
|
1174
|
+
computed: "computed";
|
|
1175
|
+
estimated: "estimated";
|
|
1176
|
+
"provider-reported": "provider-reported";
|
|
1177
|
+
unavailable: "unavailable";
|
|
1178
|
+
}>;
|
|
1179
|
+
}, z.core.$strip>>;
|
|
1180
|
+
}, z.core.$strip>>;
|
|
1181
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
1182
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
1183
|
+
}, z.core.$strip>>;
|
|
528
1184
|
}, z.core.$strip>], "type">;
|
|
529
1185
|
export type AgentRuntimeEvent = z.infer<typeof AgentRuntimeEventSchema>;
|
|
530
1186
|
export type AgentRuntimePublisher = (event: AgentRuntimeEvent) => void | Promise<void>;
|
|
1187
|
+
export declare const AgentRuntimeEventCursorSchema: z.ZodObject<{
|
|
1188
|
+
snapshotVersion: z.ZodOptional<z.ZodInt>;
|
|
1189
|
+
durableEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1190
|
+
runtimeEpoch: z.ZodOptional<z.ZodString>;
|
|
1191
|
+
sequence: z.ZodOptional<z.ZodInt>;
|
|
1192
|
+
}, z.core.$strip>;
|
|
1193
|
+
export type AgentRuntimeEventCursor = z.infer<typeof AgentRuntimeEventCursorSchema>;
|
|
1194
|
+
export interface AgentRuntimeCursorAdvance {
|
|
1195
|
+
status: 'accepted' | 'duplicate' | 'gap';
|
|
1196
|
+
cursor: AgentRuntimeEventCursor;
|
|
1197
|
+
}
|
|
1198
|
+
/** Detect duplicate or missing delivery so reconnect can reload the durable snapshot. */
|
|
1199
|
+
export declare function advanceAgentRuntimeEventCursor(rawCursor: AgentRuntimeEventCursor, event: AgentRuntimeEvent): AgentRuntimeCursorAdvance;
|
|
1200
|
+
export interface AgentRuntimeEventSinkConfig {
|
|
1201
|
+
write(event: AgentRuntimeEvent): void | Promise<void>;
|
|
1202
|
+
project?(event: AgentRuntimeEvent): AgentRuntimeEvent | undefined;
|
|
1203
|
+
maxPending?: number;
|
|
1204
|
+
onSinkError?(input: {
|
|
1205
|
+
error: unknown;
|
|
1206
|
+
event?: AgentRuntimeEvent;
|
|
1207
|
+
}): void | Promise<void>;
|
|
1208
|
+
onDrop?(input: {
|
|
1209
|
+
reason: 'capacity' | 'closed';
|
|
1210
|
+
event: AgentRuntimeEvent;
|
|
1211
|
+
pending: number;
|
|
1212
|
+
}): void | Promise<void>;
|
|
1213
|
+
}
|
|
1214
|
+
export interface AgentRuntimeEventSink {
|
|
1215
|
+
publish: AgentRuntimePublisher;
|
|
1216
|
+
flush(): Promise<void>;
|
|
1217
|
+
getStatus(): ObservabilitySinkStatus;
|
|
1218
|
+
close(): Promise<ObservabilitySinkStatus>;
|
|
1219
|
+
}
|
|
1220
|
+
/** Bounded, failure-isolated transport-neutral delivery lifecycle. */
|
|
1221
|
+
export declare function createAgentRuntimeEventSink(config: AgentRuntimeEventSinkConfig): AgentRuntimeEventSink;
|
|
1222
|
+
/** Stable identity for a post-CAS event; safe for outbox/dedup keys. */
|
|
1223
|
+
export declare function agentDurableEventId(type: 'admission' | 'assistant-checkpoint' | 'run-state' | 'terminal', runId: string, snapshotVersion: number): string;
|
|
531
1224
|
//# sourceMappingURL=events.d.ts.map
|