stitchkit 0.63.0 → 0.65.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/coordinator.d.ts +6 -7
- package/dist/agent-runtime/coordinator.d.ts.map +1 -1
- package/dist/agent-runtime/events.d.ts +12 -18
- 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/observability.d.ts +327 -14
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/prompt.d.ts +3 -1
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts +0 -4
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +11 -1
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts +24 -10
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +15 -10
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime/store.d.ts +8 -43
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +2 -3
- package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +109 -181
- package/dist/{index-b1k33127.js → index-sbkyvacf.js} +54 -6
- package/dist/testing/agent-store-conformance.d.ts.map +1 -1
- package/dist/testing.js +64 -3
- package/llms-full.txt +207 -47
- package/package.json +1 -1
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* `queue` finishes the run first. `interrupt` and `supersede` both end it, and
|
|
5
5
|
* differ in one thing only: what becomes of what it produced. An interrupted
|
|
6
6
|
* run's partial answer stays part of the conversation; a superseded run's does
|
|
7
|
-
* not reach the model again.
|
|
8
|
-
* new input at its next step boundary and keeps going, which is right when the
|
|
9
|
-
* input refines rather than redirects and the work so far is still valid.
|
|
7
|
+
* not reach the model again.
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* A fourth behaviour — hand the input to the loop between tool calls and let the
|
|
10
|
+
* run continue — shipped as `inject` in 0.63.0 and was withdrawn in 0.65.0. It
|
|
11
|
+
* committed the absorption durably before the answer existed, which left an
|
|
12
|
+
* accepted input that no path could answer. The redesign is tracked separately.
|
|
14
13
|
*
|
|
15
14
|
* The runtime cannot decide that on its own, because the fact it turns on —
|
|
16
15
|
* whether anyone saw the partial answer — belongs to the delivery surface. A
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
* `inputPolicy` accepting a function of the input: one application can hold
|
|
20
19
|
* both surfaces.
|
|
21
20
|
*/
|
|
22
|
-
export type AgentInputPolicy = 'queue' | 'interrupt' | 'supersede'
|
|
21
|
+
export type AgentInputPolicy = 'queue' | 'interrupt' | 'supersede';
|
|
23
22
|
export type AgentStopReason = 'user-interrupt' | 'supersede' | 'timeout' | 'shutdown';
|
|
24
23
|
export interface AgentCoordinatedRun<RESULT> {
|
|
25
24
|
runId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coordinator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;AACnE,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAEtF,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,KAAK,EAAE,MAAM,CAAC;IACd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,7 +92,6 @@ export declare const AgentAdmissionEventSchema: z.ZodObject<{
|
|
|
92
92
|
assistantMessageId: z.ZodString;
|
|
93
93
|
state: z.ZodEnum<{
|
|
94
94
|
abandoned: "abandoned";
|
|
95
|
-
absorbed: "absorbed";
|
|
96
95
|
cancelled: "cancelled";
|
|
97
96
|
completed: "completed";
|
|
98
97
|
failed: "failed";
|
|
@@ -108,6 +107,7 @@ export declare const AgentAdmissionEventSchema: z.ZodObject<{
|
|
|
108
107
|
terminalReason: z.ZodOptional<z.ZodEnum<{
|
|
109
108
|
abandoned: "abandoned";
|
|
110
109
|
cancelled: "cancelled";
|
|
110
|
+
context_overflow: "context_overflow";
|
|
111
111
|
interrupted: "interrupted";
|
|
112
112
|
policy_stop: "policy_stop";
|
|
113
113
|
provider_failure: "provider_failure";
|
|
@@ -116,10 +116,8 @@ export declare const AgentAdmissionEventSchema: z.ZodObject<{
|
|
|
116
116
|
success: "success";
|
|
117
117
|
superseded: "superseded";
|
|
118
118
|
timeout: "timeout";
|
|
119
|
-
tool_failure: "tool_failure";
|
|
120
119
|
}>>;
|
|
121
120
|
terminalPolicyName: z.ZodOptional<z.ZodString>;
|
|
122
|
-
absorbedIntoRunId: z.ZodOptional<z.ZodString>;
|
|
123
121
|
usage: z.ZodOptional<z.ZodObject<{
|
|
124
122
|
inputTokens: z.ZodObject<{
|
|
125
123
|
value: z.ZodOptional<z.ZodNumber>;
|
|
@@ -411,7 +409,7 @@ export declare const AgentCheckpointEventSchema: z.ZodObject<{
|
|
|
411
409
|
}, z.core.$strip>;
|
|
412
410
|
metrics: z.ZodOptional<z.ZodObject<{
|
|
413
411
|
partial: z.ZodBoolean;
|
|
414
|
-
usage: z.
|
|
412
|
+
usage: z.ZodObject<{
|
|
415
413
|
inputTokens: z.ZodObject<{
|
|
416
414
|
value: z.ZodOptional<z.ZodNumber>;
|
|
417
415
|
provenance: z.ZodEnum<{
|
|
@@ -467,7 +465,7 @@ export declare const AgentCheckpointEventSchema: z.ZodObject<{
|
|
|
467
465
|
unavailable: "unavailable";
|
|
468
466
|
}>;
|
|
469
467
|
}, z.core.$strip>>;
|
|
470
|
-
}, z.core.$strip
|
|
468
|
+
}, z.core.$strip>;
|
|
471
469
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
472
470
|
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
473
471
|
}, z.core.$strip>>;
|
|
@@ -481,7 +479,6 @@ export declare const AgentRunStateEventSchema: z.ZodObject<{
|
|
|
481
479
|
snapshotVersion: z.ZodInt;
|
|
482
480
|
state: z.ZodEnum<{
|
|
483
481
|
abandoned: "abandoned";
|
|
484
|
-
absorbed: "absorbed";
|
|
485
482
|
cancelled: "cancelled";
|
|
486
483
|
completed: "completed";
|
|
487
484
|
failed: "failed";
|
|
@@ -520,6 +517,7 @@ export declare const AgentTerminalEventSchema: z.ZodObject<{
|
|
|
520
517
|
reason: z.ZodEnum<{
|
|
521
518
|
abandoned: "abandoned";
|
|
522
519
|
cancelled: "cancelled";
|
|
520
|
+
context_overflow: "context_overflow";
|
|
523
521
|
interrupted: "interrupted";
|
|
524
522
|
policy_stop: "policy_stop";
|
|
525
523
|
provider_failure: "provider_failure";
|
|
@@ -528,7 +526,6 @@ export declare const AgentTerminalEventSchema: z.ZodObject<{
|
|
|
528
526
|
success: "success";
|
|
529
527
|
superseded: "superseded";
|
|
530
528
|
timeout: "timeout";
|
|
531
|
-
tool_failure: "tool_failure";
|
|
532
529
|
}>;
|
|
533
530
|
policyName: z.ZodOptional<z.ZodString>;
|
|
534
531
|
message: z.ZodObject<{
|
|
@@ -611,7 +608,7 @@ export declare const AgentTerminalEventSchema: z.ZodObject<{
|
|
|
611
608
|
}, z.core.$strip>;
|
|
612
609
|
metrics: z.ZodOptional<z.ZodObject<{
|
|
613
610
|
partial: z.ZodBoolean;
|
|
614
|
-
usage: z.
|
|
611
|
+
usage: z.ZodObject<{
|
|
615
612
|
inputTokens: z.ZodObject<{
|
|
616
613
|
value: z.ZodOptional<z.ZodNumber>;
|
|
617
614
|
provenance: z.ZodEnum<{
|
|
@@ -667,7 +664,7 @@ export declare const AgentTerminalEventSchema: z.ZodObject<{
|
|
|
667
664
|
unavailable: "unavailable";
|
|
668
665
|
}>;
|
|
669
666
|
}, z.core.$strip>>;
|
|
670
|
-
}, z.core.$strip
|
|
667
|
+
}, z.core.$strip>;
|
|
671
668
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
672
669
|
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
673
670
|
}, z.core.$strip>>;
|
|
@@ -764,7 +761,6 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
764
761
|
assistantMessageId: z.ZodString;
|
|
765
762
|
state: z.ZodEnum<{
|
|
766
763
|
abandoned: "abandoned";
|
|
767
|
-
absorbed: "absorbed";
|
|
768
764
|
cancelled: "cancelled";
|
|
769
765
|
completed: "completed";
|
|
770
766
|
failed: "failed";
|
|
@@ -780,6 +776,7 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
780
776
|
terminalReason: z.ZodOptional<z.ZodEnum<{
|
|
781
777
|
abandoned: "abandoned";
|
|
782
778
|
cancelled: "cancelled";
|
|
779
|
+
context_overflow: "context_overflow";
|
|
783
780
|
interrupted: "interrupted";
|
|
784
781
|
policy_stop: "policy_stop";
|
|
785
782
|
provider_failure: "provider_failure";
|
|
@@ -788,10 +785,8 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
788
785
|
success: "success";
|
|
789
786
|
superseded: "superseded";
|
|
790
787
|
timeout: "timeout";
|
|
791
|
-
tool_failure: "tool_failure";
|
|
792
788
|
}>>;
|
|
793
789
|
terminalPolicyName: z.ZodOptional<z.ZodString>;
|
|
794
|
-
absorbedIntoRunId: z.ZodOptional<z.ZodString>;
|
|
795
790
|
usage: z.ZodOptional<z.ZodObject<{
|
|
796
791
|
inputTokens: z.ZodObject<{
|
|
797
792
|
value: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1071,7 +1066,7 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1071
1066
|
}, z.core.$strip>;
|
|
1072
1067
|
metrics: z.ZodOptional<z.ZodObject<{
|
|
1073
1068
|
partial: z.ZodBoolean;
|
|
1074
|
-
usage: z.
|
|
1069
|
+
usage: z.ZodObject<{
|
|
1075
1070
|
inputTokens: z.ZodObject<{
|
|
1076
1071
|
value: z.ZodOptional<z.ZodNumber>;
|
|
1077
1072
|
provenance: z.ZodEnum<{
|
|
@@ -1127,7 +1122,7 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1127
1122
|
unavailable: "unavailable";
|
|
1128
1123
|
}>;
|
|
1129
1124
|
}, z.core.$strip>>;
|
|
1130
|
-
}, z.core.$strip
|
|
1125
|
+
}, z.core.$strip>;
|
|
1131
1126
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
1132
1127
|
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
1133
1128
|
}, z.core.$strip>>;
|
|
@@ -1140,7 +1135,6 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1140
1135
|
snapshotVersion: z.ZodInt;
|
|
1141
1136
|
state: z.ZodEnum<{
|
|
1142
1137
|
abandoned: "abandoned";
|
|
1143
|
-
absorbed: "absorbed";
|
|
1144
1138
|
cancelled: "cancelled";
|
|
1145
1139
|
completed: "completed";
|
|
1146
1140
|
failed: "failed";
|
|
@@ -1177,6 +1171,7 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1177
1171
|
reason: z.ZodEnum<{
|
|
1178
1172
|
abandoned: "abandoned";
|
|
1179
1173
|
cancelled: "cancelled";
|
|
1174
|
+
context_overflow: "context_overflow";
|
|
1180
1175
|
interrupted: "interrupted";
|
|
1181
1176
|
policy_stop: "policy_stop";
|
|
1182
1177
|
provider_failure: "provider_failure";
|
|
@@ -1185,7 +1180,6 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1185
1180
|
success: "success";
|
|
1186
1181
|
superseded: "superseded";
|
|
1187
1182
|
timeout: "timeout";
|
|
1188
|
-
tool_failure: "tool_failure";
|
|
1189
1183
|
}>;
|
|
1190
1184
|
policyName: z.ZodOptional<z.ZodString>;
|
|
1191
1185
|
message: z.ZodObject<{
|
|
@@ -1268,7 +1262,7 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1268
1262
|
}, z.core.$strip>;
|
|
1269
1263
|
metrics: z.ZodOptional<z.ZodObject<{
|
|
1270
1264
|
partial: z.ZodBoolean;
|
|
1271
|
-
usage: z.
|
|
1265
|
+
usage: z.ZodObject<{
|
|
1272
1266
|
inputTokens: z.ZodObject<{
|
|
1273
1267
|
value: z.ZodOptional<z.ZodNumber>;
|
|
1274
1268
|
provenance: z.ZodEnum<{
|
|
@@ -1324,7 +1318,7 @@ export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
1324
1318
|
unavailable: "unavailable";
|
|
1325
1319
|
}>;
|
|
1326
1320
|
}, z.core.$strip>>;
|
|
1327
|
-
}, z.core.$strip
|
|
1321
|
+
}, z.core.$strip>;
|
|
1328
1322
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
1329
1323
|
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
1330
1324
|
}, z.core.$strip>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAcvE,eAAO,MAAM,yBAA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,UAAU,EACrE,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,GACtB,MAAM,CAER"}
|
|
@@ -60,6 +60,19 @@ export interface AgentHistoryProjectionDecision {
|
|
|
60
60
|
export interface AgentHistoryProjectionResult {
|
|
61
61
|
messages: readonly ModelMessage[];
|
|
62
62
|
decisions: readonly AgentHistoryProjectionDecision[];
|
|
63
|
+
/**
|
|
64
|
+
* System and summary content, in order, for the provider's **instructions**
|
|
65
|
+
* channel — never for `messages`.
|
|
66
|
+
*
|
|
67
|
+
* `ai` refuses a system-role entry inside `messages` outright: *"System
|
|
68
|
+
* messages are not allowed in the prompt or messages fields. Use the
|
|
69
|
+
* instructions option instead."* This projection used to put them there, so a
|
|
70
|
+
* conversation that had ever been compacted failed **every** subsequent run
|
|
71
|
+
* with `provider_failure`, and the `system-note` form of an interrupted turn
|
|
72
|
+
* did the same. Both shipped, and the whole suite stayed green because the
|
|
73
|
+
* tests asserted the projection's *shape* and never handed it to a provider.
|
|
74
|
+
*/
|
|
75
|
+
system: readonly string[];
|
|
63
76
|
}
|
|
64
77
|
/** Project history and retain a decision for every canonical record. */
|
|
65
78
|
export declare function projectAgentHistoryDetailed(messages: readonly AgentMessage[], options?: AgentHistoryProjectionOptions): Promise<AgentHistoryProjectionResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAsB,MAAM,IAAI,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAyB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAsB,MAAM,IAAI,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY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4BAA4B,CAAC,CAsFvC;AAED,4EAA4E;AAC5E,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,YAAY,EAAE,CAAC,CAEzB"}
|
|
@@ -1,13 +1,116 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { ObservabilitySinkStatus } from '../observability/status';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const AgentRunStartedEventSchema: z.ZodObject<{
|
|
4
4
|
schemaVersion: z.ZodLiteral<1>;
|
|
5
5
|
eventId: z.ZodString;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
conversationId: z.ZodString;
|
|
7
|
+
runId: z.ZodString;
|
|
8
|
+
traceId: z.ZodString;
|
|
9
|
+
spanId: z.ZodString;
|
|
10
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
state: z.ZodEnum<{
|
|
12
|
+
abandoned: "abandoned";
|
|
13
|
+
cancelled: "cancelled";
|
|
14
|
+
completed: "completed";
|
|
15
|
+
failed: "failed";
|
|
16
|
+
interrupt_requested: "interrupt_requested";
|
|
17
|
+
interrupted: "interrupted";
|
|
18
|
+
queued: "queued";
|
|
19
|
+
running: "running";
|
|
20
|
+
superseded: "superseded";
|
|
10
21
|
}>;
|
|
22
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
emittedAt: z.ZodISODateTime;
|
|
25
|
+
type: z.ZodLiteral<"run-started">;
|
|
26
|
+
queueWaitMs: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const AgentStepFinishedEventSchema: z.ZodObject<{
|
|
29
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
30
|
+
eventId: z.ZodString;
|
|
31
|
+
conversationId: z.ZodString;
|
|
32
|
+
runId: z.ZodString;
|
|
33
|
+
traceId: z.ZodString;
|
|
34
|
+
spanId: z.ZodString;
|
|
35
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
36
|
+
state: z.ZodEnum<{
|
|
37
|
+
abandoned: "abandoned";
|
|
38
|
+
cancelled: "cancelled";
|
|
39
|
+
completed: "completed";
|
|
40
|
+
failed: "failed";
|
|
41
|
+
interrupt_requested: "interrupt_requested";
|
|
42
|
+
interrupted: "interrupted";
|
|
43
|
+
queued: "queued";
|
|
44
|
+
running: "running";
|
|
45
|
+
superseded: "superseded";
|
|
46
|
+
}>;
|
|
47
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
48
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
emittedAt: z.ZodISODateTime;
|
|
50
|
+
type: z.ZodLiteral<"step-finished">;
|
|
51
|
+
step: z.ZodInt;
|
|
52
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
usage: z.ZodObject<{
|
|
54
|
+
inputTokens: z.ZodObject<{
|
|
55
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
provenance: z.ZodEnum<{
|
|
57
|
+
computed: "computed";
|
|
58
|
+
estimated: "estimated";
|
|
59
|
+
"provider-reported": "provider-reported";
|
|
60
|
+
unavailable: "unavailable";
|
|
61
|
+
}>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
outputTokens: z.ZodObject<{
|
|
64
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
provenance: z.ZodEnum<{
|
|
66
|
+
computed: "computed";
|
|
67
|
+
estimated: "estimated";
|
|
68
|
+
"provider-reported": "provider-reported";
|
|
69
|
+
unavailable: "unavailable";
|
|
70
|
+
}>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
73
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
provenance: z.ZodEnum<{
|
|
75
|
+
computed: "computed";
|
|
76
|
+
estimated: "estimated";
|
|
77
|
+
"provider-reported": "provider-reported";
|
|
78
|
+
unavailable: "unavailable";
|
|
79
|
+
}>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
provenance: z.ZodEnum<{
|
|
84
|
+
computed: "computed";
|
|
85
|
+
estimated: "estimated";
|
|
86
|
+
"provider-reported": "provider-reported";
|
|
87
|
+
unavailable: "unavailable";
|
|
88
|
+
}>;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
provenance: z.ZodEnum<{
|
|
93
|
+
computed: "computed";
|
|
94
|
+
estimated: "estimated";
|
|
95
|
+
"provider-reported": "provider-reported";
|
|
96
|
+
unavailable: "unavailable";
|
|
97
|
+
}>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
102
|
+
provenance: z.ZodEnum<{
|
|
103
|
+
computed: "computed";
|
|
104
|
+
estimated: "estimated";
|
|
105
|
+
"provider-reported": "provider-reported";
|
|
106
|
+
unavailable: "unavailable";
|
|
107
|
+
}>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export declare const AgentRunTerminalEventSchema: z.ZodObject<{
|
|
112
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
113
|
+
eventId: z.ZodString;
|
|
11
114
|
conversationId: z.ZodString;
|
|
12
115
|
runId: z.ZodString;
|
|
13
116
|
traceId: z.ZodString;
|
|
@@ -15,7 +118,6 @@ export declare const AgentRunEventSchema: z.ZodObject<{
|
|
|
15
118
|
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
16
119
|
state: z.ZodEnum<{
|
|
17
120
|
abandoned: "abandoned";
|
|
18
|
-
absorbed: "absorbed";
|
|
19
121
|
cancelled: "cancelled";
|
|
20
122
|
completed: "completed";
|
|
21
123
|
failed: "failed";
|
|
@@ -25,9 +127,14 @@ export declare const AgentRunEventSchema: z.ZodObject<{
|
|
|
25
127
|
running: "running";
|
|
26
128
|
superseded: "superseded";
|
|
27
129
|
}>;
|
|
28
|
-
|
|
130
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
131
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
emittedAt: z.ZodISODateTime;
|
|
133
|
+
type: z.ZodLiteral<"run-terminal">;
|
|
134
|
+
terminalReason: z.ZodEnum<{
|
|
29
135
|
abandoned: "abandoned";
|
|
30
136
|
cancelled: "cancelled";
|
|
137
|
+
context_overflow: "context_overflow";
|
|
31
138
|
interrupted: "interrupted";
|
|
32
139
|
policy_stop: "policy_stop";
|
|
33
140
|
provider_failure: "provider_failure";
|
|
@@ -36,14 +143,124 @@ export declare const AgentRunEventSchema: z.ZodObject<{
|
|
|
36
143
|
success: "success";
|
|
37
144
|
superseded: "superseded";
|
|
38
145
|
timeout: "timeout";
|
|
39
|
-
|
|
40
|
-
|
|
146
|
+
}>;
|
|
147
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
internalCause: z.ZodOptional<z.ZodUnknown>;
|
|
149
|
+
usage: z.ZodObject<{
|
|
150
|
+
inputTokens: z.ZodObject<{
|
|
151
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
provenance: z.ZodEnum<{
|
|
153
|
+
computed: "computed";
|
|
154
|
+
estimated: "estimated";
|
|
155
|
+
"provider-reported": "provider-reported";
|
|
156
|
+
unavailable: "unavailable";
|
|
157
|
+
}>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
outputTokens: z.ZodObject<{
|
|
160
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
provenance: z.ZodEnum<{
|
|
162
|
+
computed: "computed";
|
|
163
|
+
estimated: "estimated";
|
|
164
|
+
"provider-reported": "provider-reported";
|
|
165
|
+
unavailable: "unavailable";
|
|
166
|
+
}>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
169
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
170
|
+
provenance: z.ZodEnum<{
|
|
171
|
+
computed: "computed";
|
|
172
|
+
estimated: "estimated";
|
|
173
|
+
"provider-reported": "provider-reported";
|
|
174
|
+
unavailable: "unavailable";
|
|
175
|
+
}>;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
provenance: z.ZodEnum<{
|
|
180
|
+
computed: "computed";
|
|
181
|
+
estimated: "estimated";
|
|
182
|
+
"provider-reported": "provider-reported";
|
|
183
|
+
unavailable: "unavailable";
|
|
184
|
+
}>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
187
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
provenance: z.ZodEnum<{
|
|
189
|
+
computed: "computed";
|
|
190
|
+
estimated: "estimated";
|
|
191
|
+
"provider-reported": "provider-reported";
|
|
192
|
+
unavailable: "unavailable";
|
|
193
|
+
}>;
|
|
194
|
+
}, z.core.$strip>>;
|
|
195
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
196
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
198
|
+
provenance: z.ZodEnum<{
|
|
199
|
+
computed: "computed";
|
|
200
|
+
estimated: "estimated";
|
|
201
|
+
"provider-reported": "provider-reported";
|
|
202
|
+
unavailable: "unavailable";
|
|
203
|
+
}>;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
/**
|
|
208
|
+
* One operator event, discriminated by what kind of thing happened.
|
|
209
|
+
*
|
|
210
|
+
* The fields were flat and every one of them optional, so nothing could say
|
|
211
|
+
* that a step always has a step number, that only a terminal has a terminal
|
|
212
|
+
* reason, or that a terminal always states what it spent.
|
|
213
|
+
*/
|
|
214
|
+
export declare const AgentRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
215
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
216
|
+
eventId: z.ZodString;
|
|
217
|
+
conversationId: z.ZodString;
|
|
218
|
+
runId: z.ZodString;
|
|
219
|
+
traceId: z.ZodString;
|
|
220
|
+
spanId: z.ZodString;
|
|
221
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
222
|
+
state: z.ZodEnum<{
|
|
223
|
+
abandoned: "abandoned";
|
|
224
|
+
cancelled: "cancelled";
|
|
225
|
+
completed: "completed";
|
|
226
|
+
failed: "failed";
|
|
227
|
+
interrupt_requested: "interrupt_requested";
|
|
228
|
+
interrupted: "interrupted";
|
|
229
|
+
queued: "queued";
|
|
230
|
+
running: "running";
|
|
231
|
+
superseded: "superseded";
|
|
232
|
+
}>;
|
|
41
233
|
modelId: z.ZodOptional<z.ZodString>;
|
|
42
|
-
|
|
234
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
235
|
+
emittedAt: z.ZodISODateTime;
|
|
236
|
+
type: z.ZodLiteral<"run-started">;
|
|
43
237
|
queueWaitMs: z.ZodOptional<z.ZodNumber>;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
240
|
+
eventId: z.ZodString;
|
|
241
|
+
conversationId: z.ZodString;
|
|
242
|
+
runId: z.ZodString;
|
|
243
|
+
traceId: z.ZodString;
|
|
244
|
+
spanId: z.ZodString;
|
|
245
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
246
|
+
state: z.ZodEnum<{
|
|
247
|
+
abandoned: "abandoned";
|
|
248
|
+
cancelled: "cancelled";
|
|
249
|
+
completed: "completed";
|
|
250
|
+
failed: "failed";
|
|
251
|
+
interrupt_requested: "interrupt_requested";
|
|
252
|
+
interrupted: "interrupted";
|
|
253
|
+
queued: "queued";
|
|
254
|
+
running: "running";
|
|
255
|
+
superseded: "superseded";
|
|
256
|
+
}>;
|
|
257
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
44
258
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
259
|
+
emittedAt: z.ZodISODateTime;
|
|
260
|
+
type: z.ZodLiteral<"step-finished">;
|
|
261
|
+
step: z.ZodInt;
|
|
45
262
|
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
46
|
-
usage: z.
|
|
263
|
+
usage: z.ZodObject<{
|
|
47
264
|
inputTokens: z.ZodObject<{
|
|
48
265
|
value: z.ZodOptional<z.ZodNumber>;
|
|
49
266
|
provenance: z.ZodEnum<{
|
|
@@ -99,10 +316,106 @@ export declare const AgentRunEventSchema: z.ZodObject<{
|
|
|
99
316
|
unavailable: "unavailable";
|
|
100
317
|
}>;
|
|
101
318
|
}, z.core.$strip>>;
|
|
102
|
-
}, z.core.$strip
|
|
103
|
-
|
|
319
|
+
}, z.core.$strip>;
|
|
320
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
321
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
322
|
+
eventId: z.ZodString;
|
|
323
|
+
conversationId: z.ZodString;
|
|
324
|
+
runId: z.ZodString;
|
|
325
|
+
traceId: z.ZodString;
|
|
326
|
+
spanId: z.ZodString;
|
|
327
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
328
|
+
state: z.ZodEnum<{
|
|
329
|
+
abandoned: "abandoned";
|
|
330
|
+
cancelled: "cancelled";
|
|
331
|
+
completed: "completed";
|
|
332
|
+
failed: "failed";
|
|
333
|
+
interrupt_requested: "interrupt_requested";
|
|
334
|
+
interrupted: "interrupted";
|
|
335
|
+
queued: "queued";
|
|
336
|
+
running: "running";
|
|
337
|
+
superseded: "superseded";
|
|
338
|
+
}>;
|
|
339
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
340
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
104
341
|
emittedAt: z.ZodISODateTime;
|
|
105
|
-
|
|
342
|
+
type: z.ZodLiteral<"run-terminal">;
|
|
343
|
+
terminalReason: z.ZodEnum<{
|
|
344
|
+
abandoned: "abandoned";
|
|
345
|
+
cancelled: "cancelled";
|
|
346
|
+
context_overflow: "context_overflow";
|
|
347
|
+
interrupted: "interrupted";
|
|
348
|
+
policy_stop: "policy_stop";
|
|
349
|
+
provider_failure: "provider_failure";
|
|
350
|
+
provider_stop: "provider_stop";
|
|
351
|
+
shutdown: "shutdown";
|
|
352
|
+
success: "success";
|
|
353
|
+
superseded: "superseded";
|
|
354
|
+
timeout: "timeout";
|
|
355
|
+
}>;
|
|
356
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
357
|
+
internalCause: z.ZodOptional<z.ZodUnknown>;
|
|
358
|
+
usage: z.ZodObject<{
|
|
359
|
+
inputTokens: z.ZodObject<{
|
|
360
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
361
|
+
provenance: z.ZodEnum<{
|
|
362
|
+
computed: "computed";
|
|
363
|
+
estimated: "estimated";
|
|
364
|
+
"provider-reported": "provider-reported";
|
|
365
|
+
unavailable: "unavailable";
|
|
366
|
+
}>;
|
|
367
|
+
}, z.core.$strip>;
|
|
368
|
+
outputTokens: z.ZodObject<{
|
|
369
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
370
|
+
provenance: z.ZodEnum<{
|
|
371
|
+
computed: "computed";
|
|
372
|
+
estimated: "estimated";
|
|
373
|
+
"provider-reported": "provider-reported";
|
|
374
|
+
unavailable: "unavailable";
|
|
375
|
+
}>;
|
|
376
|
+
}, z.core.$strip>;
|
|
377
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
378
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
379
|
+
provenance: z.ZodEnum<{
|
|
380
|
+
computed: "computed";
|
|
381
|
+
estimated: "estimated";
|
|
382
|
+
"provider-reported": "provider-reported";
|
|
383
|
+
unavailable: "unavailable";
|
|
384
|
+
}>;
|
|
385
|
+
}, z.core.$strip>>;
|
|
386
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
387
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
388
|
+
provenance: z.ZodEnum<{
|
|
389
|
+
computed: "computed";
|
|
390
|
+
estimated: "estimated";
|
|
391
|
+
"provider-reported": "provider-reported";
|
|
392
|
+
unavailable: "unavailable";
|
|
393
|
+
}>;
|
|
394
|
+
}, z.core.$strip>>;
|
|
395
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
396
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
397
|
+
provenance: z.ZodEnum<{
|
|
398
|
+
computed: "computed";
|
|
399
|
+
estimated: "estimated";
|
|
400
|
+
"provider-reported": "provider-reported";
|
|
401
|
+
unavailable: "unavailable";
|
|
402
|
+
}>;
|
|
403
|
+
}, z.core.$strip>>;
|
|
404
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
405
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
406
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
407
|
+
provenance: z.ZodEnum<{
|
|
408
|
+
computed: "computed";
|
|
409
|
+
estimated: "estimated";
|
|
410
|
+
"provider-reported": "provider-reported";
|
|
411
|
+
unavailable: "unavailable";
|
|
412
|
+
}>;
|
|
413
|
+
}, z.core.$strip>>;
|
|
414
|
+
}, z.core.$strip>;
|
|
415
|
+
}, z.core.$strip>], "type">;
|
|
416
|
+
export type AgentRunStartedEvent = z.infer<typeof AgentRunStartedEventSchema>;
|
|
417
|
+
export type AgentStepFinishedEvent = z.infer<typeof AgentStepFinishedEventSchema>;
|
|
418
|
+
export type AgentRunTerminalEvent = z.infer<typeof AgentRunTerminalEventSchema>;
|
|
106
419
|
export type AgentRunEvent = z.infer<typeof AgentRunEventSchema>;
|
|
107
420
|
export interface AgentRunSinkError {
|
|
108
421
|
error: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/observability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/observability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AA2BvE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;iBAIrC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMvC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBtC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAE,MAAM,CAAA;KAAE,GAAG;QACvD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,SAAS,IAAI,uBAAuB,CAAC;IACrC,KAAK,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC3C;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAkDvF"}
|
|
@@ -41,7 +41,9 @@ export interface ComposedAgentPrompt {
|
|
|
41
41
|
export interface AgentHistoryBudgetDecision {
|
|
42
42
|
messageId: string;
|
|
43
43
|
action: 'kept' | 'removed';
|
|
44
|
-
reason: 'within-budget' | 'protected-system' | 'protected-recent-turn' | 'protected-incomplete-turn' | 'oldest-eligible-turn' | 'token-count-unavailable'
|
|
44
|
+
reason: 'within-budget' | 'protected-system' | 'protected-recent-turn' | 'protected-incomplete-turn' | 'oldest-eligible-turn' | 'token-count-unavailable'
|
|
45
|
+
/** The model never hears this record, so the budget does not count it. */
|
|
46
|
+
| 'unspeakable';
|
|
45
47
|
tokens: AgentTokenCount;
|
|
46
48
|
}
|
|
47
49
|
export interface AgentHistoryBudgetResult {
|