@linnlabs/linnkit 0.32.1 → 0.32.2
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/CHANGELOG.md +6 -0
- package/dist/cli.cjs +35 -14
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +35 -14
- package/dist/cli.js.map +1 -1
- package/dist/contracts/agentSpec.d.cts +30 -30
- package/dist/contracts/agentSpec.d.ts +30 -30
- package/dist/contracts/audit.d.cts +32 -32
- package/dist/contracts/audit.d.ts +32 -32
- package/dist/contracts/contextPolicy.d.cts +36 -36
- package/dist/contracts/contextPolicy.d.ts +36 -36
- package/dist/contracts/events.d.cts +963 -963
- package/dist/contracts/events.d.ts +963 -963
- package/dist/contracts/execution.d.cts +8 -8
- package/dist/contracts/execution.d.ts +8 -8
- package/dist/contracts/messages.d.cts +204 -204
- package/dist/contracts/messages.d.ts +204 -204
- package/dist/contracts/sse.d.cts +889 -889
- package/dist/contracts/sse.d.ts +889 -889
- package/dist/contracts/sub-run-trace-payload.d.cts +26 -26
- package/dist/contracts/sub-run-trace-payload.d.ts +26 -26
- package/dist/contracts/token-accounting.d.cts +28 -28
- package/dist/contracts/token-accounting.d.ts +28 -28
- package/dist/index.cjs +35 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -14
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +35 -14
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +35 -14
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/events/agentEvents.d.cts +98 -98
- package/dist/runtime-kernel/events/agentEvents.d.ts +98 -98
- package/dist/runtime-kernel.cjs +35 -14
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +35 -14
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +35 -14
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +35 -14
- package/dist/testkit.js.map +1 -1
- package/package.json +2 -2
|
@@ -12,19 +12,19 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
12
12
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
13
13
|
thought_message_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
14
14
|
}, "strict", z.ZodTypeAny, {
|
|
15
|
-
type: "thought";
|
|
16
15
|
id: string;
|
|
17
|
-
|
|
16
|
+
type: "thought";
|
|
18
17
|
content: string;
|
|
18
|
+
timestamp: number;
|
|
19
19
|
is_complete: boolean;
|
|
20
20
|
thought_message_id?: string | undefined;
|
|
21
21
|
delta?: string | undefined;
|
|
22
22
|
meta?: Record<string, unknown> | undefined;
|
|
23
23
|
}, {
|
|
24
|
-
type: "thought";
|
|
25
24
|
id: string;
|
|
26
|
-
|
|
25
|
+
type: "thought";
|
|
27
26
|
content: string;
|
|
27
|
+
timestamp: number;
|
|
28
28
|
is_complete: boolean;
|
|
29
29
|
thought_message_id?: string | undefined;
|
|
30
30
|
delta?: string | undefined;
|
|
@@ -329,7 +329,6 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
329
329
|
}[] | undefined;
|
|
330
330
|
}>]>, "many">>;
|
|
331
331
|
}, "strict", z.ZodTypeAny, {
|
|
332
|
-
args?: Record<string, unknown> | undefined;
|
|
333
332
|
tool_calls?: unknown[] | undefined;
|
|
334
333
|
provider_continuations?: {
|
|
335
334
|
kind: string;
|
|
@@ -389,8 +388,8 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
389
388
|
payload: SerializableJsonValue;
|
|
390
389
|
}[] | undefined;
|
|
391
390
|
})[] | undefined;
|
|
392
|
-
}, {
|
|
393
391
|
args?: Record<string, unknown> | undefined;
|
|
392
|
+
}, {
|
|
394
393
|
tool_calls?: unknown[] | undefined;
|
|
395
394
|
provider_continuations?: {
|
|
396
395
|
kind: string;
|
|
@@ -450,19 +449,19 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
450
449
|
payload: SerializableJsonValue;
|
|
451
450
|
}[] | undefined;
|
|
452
451
|
})[] | undefined;
|
|
452
|
+
args?: Record<string, unknown> | undefined;
|
|
453
453
|
}>>;
|
|
454
454
|
}, "strict", z.ZodTypeAny, {
|
|
455
|
-
type: "tool_call_decision";
|
|
456
455
|
id: string;
|
|
457
|
-
timestamp: number;
|
|
458
456
|
status: "error" | "loading" | "success";
|
|
459
|
-
|
|
457
|
+
type: "tool_call_decision";
|
|
460
458
|
tool_call_id: string & z.BRAND<"ToolCallId">;
|
|
461
|
-
|
|
459
|
+
tool_name: string;
|
|
460
|
+
timestamp: number;
|
|
461
|
+
phase: "error" | "start" | "update" | "complete";
|
|
462
462
|
tool_args: Record<string, unknown>;
|
|
463
463
|
tool_calls?: unknown[] | undefined;
|
|
464
464
|
payload?: {
|
|
465
|
-
args?: Record<string, unknown> | undefined;
|
|
466
465
|
tool_calls?: unknown[] | undefined;
|
|
467
466
|
provider_continuations?: {
|
|
468
467
|
kind: string;
|
|
@@ -522,20 +521,20 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
522
521
|
payload: SerializableJsonValue;
|
|
523
522
|
}[] | undefined;
|
|
524
523
|
})[] | undefined;
|
|
524
|
+
args?: Record<string, unknown> | undefined;
|
|
525
525
|
} | undefined;
|
|
526
526
|
meta?: Record<string, unknown> | undefined;
|
|
527
527
|
}, {
|
|
528
|
-
type: "tool_call_decision";
|
|
529
528
|
id: string;
|
|
530
|
-
timestamp: number;
|
|
531
529
|
status: "error" | "loading" | "success";
|
|
532
|
-
|
|
530
|
+
type: "tool_call_decision";
|
|
533
531
|
tool_call_id: string;
|
|
534
|
-
|
|
532
|
+
tool_name: string;
|
|
533
|
+
timestamp: number;
|
|
534
|
+
phase: "error" | "start" | "update" | "complete";
|
|
535
535
|
tool_args: Record<string, unknown>;
|
|
536
536
|
tool_calls?: unknown[] | undefined;
|
|
537
537
|
payload?: {
|
|
538
|
-
args?: Record<string, unknown> | undefined;
|
|
539
538
|
tool_calls?: unknown[] | undefined;
|
|
540
539
|
provider_continuations?: {
|
|
541
540
|
kind: string;
|
|
@@ -595,6 +594,7 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
595
594
|
payload: SerializableJsonValue;
|
|
596
595
|
}[] | undefined;
|
|
597
596
|
})[] | undefined;
|
|
597
|
+
args?: Record<string, unknown> | undefined;
|
|
598
598
|
} | undefined;
|
|
599
599
|
meta?: Record<string, unknown> | undefined;
|
|
600
600
|
}>, z.ZodObject<{
|
|
@@ -611,25 +611,25 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
611
611
|
} & {
|
|
612
612
|
type: z.ZodLiteral<"tool_process">;
|
|
613
613
|
}, "strict", z.ZodTypeAny, {
|
|
614
|
-
type: "tool_process";
|
|
615
614
|
id: string;
|
|
616
|
-
timestamp: number;
|
|
617
615
|
status: "error" | "loading" | "success";
|
|
618
|
-
|
|
616
|
+
type: "tool_process";
|
|
619
617
|
tool_call_id: string & z.BRAND<"ToolCallId">;
|
|
620
|
-
|
|
618
|
+
tool_name: string;
|
|
619
|
+
timestamp: number;
|
|
620
|
+
phase: "error" | "start" | "update" | "complete";
|
|
621
621
|
tool_args: Record<string, unknown>;
|
|
622
622
|
tool_calls?: unknown[] | undefined;
|
|
623
623
|
payload?: Record<string, unknown> | undefined;
|
|
624
624
|
meta?: Record<string, unknown> | undefined;
|
|
625
625
|
}, {
|
|
626
|
-
type: "tool_process";
|
|
627
626
|
id: string;
|
|
628
|
-
timestamp: number;
|
|
629
627
|
status: "error" | "loading" | "success";
|
|
630
|
-
|
|
628
|
+
type: "tool_process";
|
|
631
629
|
tool_call_id: string;
|
|
632
|
-
|
|
630
|
+
tool_name: string;
|
|
631
|
+
timestamp: number;
|
|
632
|
+
phase: "error" | "start" | "update" | "complete";
|
|
633
633
|
tool_args: Record<string, unknown>;
|
|
634
634
|
tool_calls?: unknown[] | undefined;
|
|
635
635
|
payload?: Record<string, unknown> | undefined;
|
|
@@ -682,13 +682,15 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
682
682
|
label?: string | undefined;
|
|
683
683
|
}>, "many">>;
|
|
684
684
|
}, "strict", z.ZodTypeAny, {
|
|
685
|
-
type: "observation";
|
|
686
685
|
id: string;
|
|
687
|
-
|
|
688
|
-
tool_name: string;
|
|
686
|
+
type: "observation";
|
|
689
687
|
tool_call_id: string & z.BRAND<"ToolCallId">;
|
|
688
|
+
tool_name: string;
|
|
689
|
+
timestamp: number;
|
|
690
690
|
success: boolean;
|
|
691
691
|
observation: string;
|
|
692
|
+
data?: unknown;
|
|
693
|
+
error?: string | undefined;
|
|
692
694
|
attachments?: {
|
|
693
695
|
id: string;
|
|
694
696
|
kind: "image";
|
|
@@ -701,18 +703,18 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
701
703
|
fileName?: string | undefined;
|
|
702
704
|
label?: string | undefined;
|
|
703
705
|
}[] | undefined;
|
|
704
|
-
error?: string | undefined;
|
|
705
|
-
data?: unknown;
|
|
706
706
|
error_code?: string | undefined;
|
|
707
707
|
duration_ms?: number | undefined;
|
|
708
708
|
}, {
|
|
709
|
-
type: "observation";
|
|
710
709
|
id: string;
|
|
711
|
-
|
|
712
|
-
tool_name: string;
|
|
710
|
+
type: "observation";
|
|
713
711
|
tool_call_id: string;
|
|
712
|
+
tool_name: string;
|
|
713
|
+
timestamp: number;
|
|
714
714
|
success: boolean;
|
|
715
715
|
observation: string;
|
|
716
|
+
data?: unknown;
|
|
717
|
+
error?: string | undefined;
|
|
716
718
|
attachments?: {
|
|
717
719
|
id: string;
|
|
718
720
|
kind: "image";
|
|
@@ -725,8 +727,6 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
725
727
|
fileName?: string | undefined;
|
|
726
728
|
label?: string | undefined;
|
|
727
729
|
}[] | undefined;
|
|
728
|
-
error?: string | undefined;
|
|
729
|
-
data?: unknown;
|
|
730
730
|
error_code?: string | undefined;
|
|
731
731
|
duration_ms?: number | undefined;
|
|
732
732
|
}>, z.ZodObject<{
|
|
@@ -1023,11 +1023,11 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1023
1023
|
}>]>, "many">>;
|
|
1024
1024
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1025
1025
|
}, "strict", z.ZodTypeAny, {
|
|
1026
|
-
type: "final_answer";
|
|
1027
1026
|
id: string;
|
|
1027
|
+
type: "final_answer";
|
|
1028
|
+
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1028
1029
|
timestamp: number;
|
|
1029
1030
|
answer_id: string;
|
|
1030
|
-
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1031
1031
|
answer: string;
|
|
1032
1032
|
provider_continuations?: {
|
|
1033
1033
|
kind: string;
|
|
@@ -1089,11 +1089,11 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1089
1089
|
})[] | undefined;
|
|
1090
1090
|
meta?: Record<string, unknown> | undefined;
|
|
1091
1091
|
}, {
|
|
1092
|
-
type: "final_answer";
|
|
1093
1092
|
id: string;
|
|
1093
|
+
type: "final_answer";
|
|
1094
|
+
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1094
1095
|
timestamp: number;
|
|
1095
1096
|
answer_id: string;
|
|
1096
|
-
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1097
1097
|
answer: string;
|
|
1098
1098
|
provider_continuations?: {
|
|
1099
1099
|
kind: string;
|
|
@@ -1164,18 +1164,18 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1164
1164
|
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
1165
1165
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1166
1166
|
}, "strict", z.ZodTypeAny, {
|
|
1167
|
-
type: "error";
|
|
1168
1167
|
id: string;
|
|
1169
|
-
|
|
1168
|
+
type: "error";
|
|
1170
1169
|
error: string;
|
|
1170
|
+
timestamp: number;
|
|
1171
1171
|
error_code?: string | undefined;
|
|
1172
1172
|
details?: Record<string, unknown> | undefined;
|
|
1173
1173
|
retryable?: boolean | undefined;
|
|
1174
1174
|
}, {
|
|
1175
|
-
type: "error";
|
|
1176
1175
|
id: string;
|
|
1177
|
-
|
|
1176
|
+
type: "error";
|
|
1178
1177
|
error: string;
|
|
1178
|
+
timestamp: number;
|
|
1179
1179
|
error_code?: string | undefined;
|
|
1180
1180
|
details?: Record<string, unknown> | undefined;
|
|
1181
1181
|
retryable?: boolean | undefined;
|
|
@@ -1189,18 +1189,18 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1189
1189
|
seq: z.ZodNumber;
|
|
1190
1190
|
is_last: z.ZodOptional<z.ZodBoolean>;
|
|
1191
1191
|
}, "strict", z.ZodTypeAny, {
|
|
1192
|
-
type: "stream_chunk";
|
|
1193
1192
|
id: string;
|
|
1194
|
-
|
|
1193
|
+
type: "stream_chunk";
|
|
1195
1194
|
content: string;
|
|
1195
|
+
timestamp: number;
|
|
1196
1196
|
answer_id: string;
|
|
1197
1197
|
seq: number;
|
|
1198
1198
|
is_last?: boolean | undefined;
|
|
1199
1199
|
}, {
|
|
1200
|
-
type: "stream_chunk";
|
|
1201
1200
|
id: string;
|
|
1202
|
-
|
|
1201
|
+
type: "stream_chunk";
|
|
1203
1202
|
content: string;
|
|
1203
|
+
timestamp: number;
|
|
1204
1204
|
answer_id: string;
|
|
1205
1205
|
seq: number;
|
|
1206
1206
|
is_last?: boolean | undefined;
|
|
@@ -1212,14 +1212,14 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1212
1212
|
answer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
1213
1213
|
thought_message_ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
1214
1214
|
}, "strict", z.ZodTypeAny, {
|
|
1215
|
-
type: "stream_reset";
|
|
1216
1215
|
id: string;
|
|
1216
|
+
type: "stream_reset";
|
|
1217
1217
|
timestamp: number;
|
|
1218
1218
|
answer_id?: string | undefined;
|
|
1219
1219
|
thought_message_ids?: string[] | undefined;
|
|
1220
1220
|
}, {
|
|
1221
|
-
type: "stream_reset";
|
|
1222
1221
|
id: string;
|
|
1222
|
+
type: "stream_reset";
|
|
1223
1223
|
timestamp: number;
|
|
1224
1224
|
answer_id?: string | undefined;
|
|
1225
1225
|
thought_message_ids?: string[] | undefined;
|
|
@@ -1275,8 +1275,8 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1275
1275
|
payload: SerializableJsonValue;
|
|
1276
1276
|
}>, "many">;
|
|
1277
1277
|
}, "strict", z.ZodTypeAny, {
|
|
1278
|
-
type: "provider_continuation";
|
|
1279
1278
|
id: string;
|
|
1279
|
+
type: "provider_continuation";
|
|
1280
1280
|
timestamp: number;
|
|
1281
1281
|
continuations: {
|
|
1282
1282
|
kind: string;
|
|
@@ -1291,8 +1291,8 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1291
1291
|
payload: SerializableJsonValue;
|
|
1292
1292
|
}[];
|
|
1293
1293
|
}, {
|
|
1294
|
-
type: "provider_continuation";
|
|
1295
1294
|
id: string;
|
|
1295
|
+
type: "provider_continuation";
|
|
1296
1296
|
timestamp: number;
|
|
1297
1297
|
continuations: {
|
|
1298
1298
|
kind: string;
|
|
@@ -1307,26 +1307,25 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1307
1307
|
payload: SerializableJsonValue;
|
|
1308
1308
|
}[];
|
|
1309
1309
|
}>]>, {
|
|
1310
|
-
type: "thought";
|
|
1311
1310
|
id: string;
|
|
1312
|
-
|
|
1311
|
+
type: "thought";
|
|
1313
1312
|
content: string;
|
|
1313
|
+
timestamp: number;
|
|
1314
1314
|
is_complete: boolean;
|
|
1315
1315
|
thought_message_id?: string | undefined;
|
|
1316
1316
|
delta?: string | undefined;
|
|
1317
1317
|
meta?: Record<string, unknown> | undefined;
|
|
1318
1318
|
} | {
|
|
1319
|
-
type: "tool_call_decision";
|
|
1320
1319
|
id: string;
|
|
1321
|
-
timestamp: number;
|
|
1322
1320
|
status: "error" | "loading" | "success";
|
|
1323
|
-
|
|
1321
|
+
type: "tool_call_decision";
|
|
1324
1322
|
tool_call_id: string & z.BRAND<"ToolCallId">;
|
|
1325
|
-
|
|
1323
|
+
tool_name: string;
|
|
1324
|
+
timestamp: number;
|
|
1325
|
+
phase: "error" | "start" | "update" | "complete";
|
|
1326
1326
|
tool_args: Record<string, unknown>;
|
|
1327
1327
|
tool_calls?: unknown[] | undefined;
|
|
1328
1328
|
payload?: {
|
|
1329
|
-
args?: Record<string, unknown> | undefined;
|
|
1330
1329
|
tool_calls?: unknown[] | undefined;
|
|
1331
1330
|
provider_continuations?: {
|
|
1332
1331
|
kind: string;
|
|
@@ -1386,28 +1385,31 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1386
1385
|
payload: SerializableJsonValue;
|
|
1387
1386
|
}[] | undefined;
|
|
1388
1387
|
})[] | undefined;
|
|
1388
|
+
args?: Record<string, unknown> | undefined;
|
|
1389
1389
|
} | undefined;
|
|
1390
1390
|
meta?: Record<string, unknown> | undefined;
|
|
1391
1391
|
} | {
|
|
1392
|
-
type: "tool_process";
|
|
1393
1392
|
id: string;
|
|
1394
|
-
timestamp: number;
|
|
1395
1393
|
status: "error" | "loading" | "success";
|
|
1396
|
-
|
|
1394
|
+
type: "tool_process";
|
|
1397
1395
|
tool_call_id: string & z.BRAND<"ToolCallId">;
|
|
1398
|
-
|
|
1396
|
+
tool_name: string;
|
|
1397
|
+
timestamp: number;
|
|
1398
|
+
phase: "error" | "start" | "update" | "complete";
|
|
1399
1399
|
tool_args: Record<string, unknown>;
|
|
1400
1400
|
tool_calls?: unknown[] | undefined;
|
|
1401
1401
|
payload?: Record<string, unknown> | undefined;
|
|
1402
1402
|
meta?: Record<string, unknown> | undefined;
|
|
1403
1403
|
} | {
|
|
1404
|
-
type: "observation";
|
|
1405
1404
|
id: string;
|
|
1406
|
-
|
|
1407
|
-
tool_name: string;
|
|
1405
|
+
type: "observation";
|
|
1408
1406
|
tool_call_id: string & z.BRAND<"ToolCallId">;
|
|
1407
|
+
tool_name: string;
|
|
1408
|
+
timestamp: number;
|
|
1409
1409
|
success: boolean;
|
|
1410
1410
|
observation: string;
|
|
1411
|
+
data?: unknown;
|
|
1412
|
+
error?: string | undefined;
|
|
1411
1413
|
attachments?: {
|
|
1412
1414
|
id: string;
|
|
1413
1415
|
kind: "image";
|
|
@@ -1420,16 +1422,14 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1420
1422
|
fileName?: string | undefined;
|
|
1421
1423
|
label?: string | undefined;
|
|
1422
1424
|
}[] | undefined;
|
|
1423
|
-
error?: string | undefined;
|
|
1424
|
-
data?: unknown;
|
|
1425
1425
|
error_code?: string | undefined;
|
|
1426
1426
|
duration_ms?: number | undefined;
|
|
1427
1427
|
} | {
|
|
1428
|
-
type: "final_answer";
|
|
1429
1428
|
id: string;
|
|
1429
|
+
type: "final_answer";
|
|
1430
|
+
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1430
1431
|
timestamp: number;
|
|
1431
1432
|
answer_id: string;
|
|
1432
|
-
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1433
1433
|
answer: string;
|
|
1434
1434
|
provider_continuations?: {
|
|
1435
1435
|
kind: string;
|
|
@@ -1491,30 +1491,30 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1491
1491
|
})[] | undefined;
|
|
1492
1492
|
meta?: Record<string, unknown> | undefined;
|
|
1493
1493
|
} | {
|
|
1494
|
-
type: "error";
|
|
1495
1494
|
id: string;
|
|
1496
|
-
|
|
1495
|
+
type: "error";
|
|
1497
1496
|
error: string;
|
|
1497
|
+
timestamp: number;
|
|
1498
1498
|
error_code?: string | undefined;
|
|
1499
1499
|
details?: Record<string, unknown> | undefined;
|
|
1500
1500
|
retryable?: boolean | undefined;
|
|
1501
1501
|
} | {
|
|
1502
|
-
type: "stream_chunk";
|
|
1503
1502
|
id: string;
|
|
1504
|
-
|
|
1503
|
+
type: "stream_chunk";
|
|
1505
1504
|
content: string;
|
|
1505
|
+
timestamp: number;
|
|
1506
1506
|
answer_id: string;
|
|
1507
1507
|
seq: number;
|
|
1508
1508
|
is_last?: boolean | undefined;
|
|
1509
1509
|
} | {
|
|
1510
|
-
type: "stream_reset";
|
|
1511
1510
|
id: string;
|
|
1511
|
+
type: "stream_reset";
|
|
1512
1512
|
timestamp: number;
|
|
1513
1513
|
answer_id?: string | undefined;
|
|
1514
1514
|
thought_message_ids?: string[] | undefined;
|
|
1515
1515
|
} | {
|
|
1516
|
-
type: "provider_continuation";
|
|
1517
1516
|
id: string;
|
|
1517
|
+
type: "provider_continuation";
|
|
1518
1518
|
timestamp: number;
|
|
1519
1519
|
continuations: {
|
|
1520
1520
|
kind: string;
|
|
@@ -1529,26 +1529,25 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1529
1529
|
payload: SerializableJsonValue;
|
|
1530
1530
|
}[];
|
|
1531
1531
|
}, {
|
|
1532
|
-
type: "thought";
|
|
1533
1532
|
id: string;
|
|
1534
|
-
|
|
1533
|
+
type: "thought";
|
|
1535
1534
|
content: string;
|
|
1535
|
+
timestamp: number;
|
|
1536
1536
|
is_complete: boolean;
|
|
1537
1537
|
thought_message_id?: string | undefined;
|
|
1538
1538
|
delta?: string | undefined;
|
|
1539
1539
|
meta?: Record<string, unknown> | undefined;
|
|
1540
1540
|
} | {
|
|
1541
|
-
type: "tool_call_decision";
|
|
1542
1541
|
id: string;
|
|
1543
|
-
timestamp: number;
|
|
1544
1542
|
status: "error" | "loading" | "success";
|
|
1545
|
-
|
|
1543
|
+
type: "tool_call_decision";
|
|
1546
1544
|
tool_call_id: string;
|
|
1547
|
-
|
|
1545
|
+
tool_name: string;
|
|
1546
|
+
timestamp: number;
|
|
1547
|
+
phase: "error" | "start" | "update" | "complete";
|
|
1548
1548
|
tool_args: Record<string, unknown>;
|
|
1549
1549
|
tool_calls?: unknown[] | undefined;
|
|
1550
1550
|
payload?: {
|
|
1551
|
-
args?: Record<string, unknown> | undefined;
|
|
1552
1551
|
tool_calls?: unknown[] | undefined;
|
|
1553
1552
|
provider_continuations?: {
|
|
1554
1553
|
kind: string;
|
|
@@ -1608,28 +1607,31 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1608
1607
|
payload: SerializableJsonValue;
|
|
1609
1608
|
}[] | undefined;
|
|
1610
1609
|
})[] | undefined;
|
|
1610
|
+
args?: Record<string, unknown> | undefined;
|
|
1611
1611
|
} | undefined;
|
|
1612
1612
|
meta?: Record<string, unknown> | undefined;
|
|
1613
1613
|
} | {
|
|
1614
|
-
type: "tool_process";
|
|
1615
1614
|
id: string;
|
|
1616
|
-
timestamp: number;
|
|
1617
1615
|
status: "error" | "loading" | "success";
|
|
1618
|
-
|
|
1616
|
+
type: "tool_process";
|
|
1619
1617
|
tool_call_id: string;
|
|
1620
|
-
|
|
1618
|
+
tool_name: string;
|
|
1619
|
+
timestamp: number;
|
|
1620
|
+
phase: "error" | "start" | "update" | "complete";
|
|
1621
1621
|
tool_args: Record<string, unknown>;
|
|
1622
1622
|
tool_calls?: unknown[] | undefined;
|
|
1623
1623
|
payload?: Record<string, unknown> | undefined;
|
|
1624
1624
|
meta?: Record<string, unknown> | undefined;
|
|
1625
1625
|
} | {
|
|
1626
|
-
type: "observation";
|
|
1627
1626
|
id: string;
|
|
1628
|
-
|
|
1629
|
-
tool_name: string;
|
|
1627
|
+
type: "observation";
|
|
1630
1628
|
tool_call_id: string;
|
|
1629
|
+
tool_name: string;
|
|
1630
|
+
timestamp: number;
|
|
1631
1631
|
success: boolean;
|
|
1632
1632
|
observation: string;
|
|
1633
|
+
data?: unknown;
|
|
1634
|
+
error?: string | undefined;
|
|
1633
1635
|
attachments?: {
|
|
1634
1636
|
id: string;
|
|
1635
1637
|
kind: "image";
|
|
@@ -1642,16 +1644,14 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1642
1644
|
fileName?: string | undefined;
|
|
1643
1645
|
label?: string | undefined;
|
|
1644
1646
|
}[] | undefined;
|
|
1645
|
-
error?: string | undefined;
|
|
1646
|
-
data?: unknown;
|
|
1647
1647
|
error_code?: string | undefined;
|
|
1648
1648
|
duration_ms?: number | undefined;
|
|
1649
1649
|
} | {
|
|
1650
|
-
type: "final_answer";
|
|
1651
1650
|
id: string;
|
|
1651
|
+
type: "final_answer";
|
|
1652
|
+
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1652
1653
|
timestamp: number;
|
|
1653
1654
|
answer_id: string;
|
|
1654
|
-
completion_reason: "tool_call" | "terminal" | "interrupted";
|
|
1655
1655
|
answer: string;
|
|
1656
1656
|
provider_continuations?: {
|
|
1657
1657
|
kind: string;
|
|
@@ -1713,30 +1713,30 @@ declare const AgentEventSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.
|
|
|
1713
1713
|
})[] | undefined;
|
|
1714
1714
|
meta?: Record<string, unknown> | undefined;
|
|
1715
1715
|
} | {
|
|
1716
|
-
type: "error";
|
|
1717
1716
|
id: string;
|
|
1718
|
-
|
|
1717
|
+
type: "error";
|
|
1719
1718
|
error: string;
|
|
1719
|
+
timestamp: number;
|
|
1720
1720
|
error_code?: string | undefined;
|
|
1721
1721
|
details?: Record<string, unknown> | undefined;
|
|
1722
1722
|
retryable?: boolean | undefined;
|
|
1723
1723
|
} | {
|
|
1724
|
-
type: "stream_chunk";
|
|
1725
1724
|
id: string;
|
|
1726
|
-
|
|
1725
|
+
type: "stream_chunk";
|
|
1727
1726
|
content: string;
|
|
1727
|
+
timestamp: number;
|
|
1728
1728
|
answer_id: string;
|
|
1729
1729
|
seq: number;
|
|
1730
1730
|
is_last?: boolean | undefined;
|
|
1731
1731
|
} | {
|
|
1732
|
-
type: "stream_reset";
|
|
1733
1732
|
id: string;
|
|
1733
|
+
type: "stream_reset";
|
|
1734
1734
|
timestamp: number;
|
|
1735
1735
|
answer_id?: string | undefined;
|
|
1736
1736
|
thought_message_ids?: string[] | undefined;
|
|
1737
1737
|
} | {
|
|
1738
|
-
type: "provider_continuation";
|
|
1739
1738
|
id: string;
|
|
1739
|
+
type: "provider_continuation";
|
|
1740
1740
|
timestamp: number;
|
|
1741
1741
|
continuations: {
|
|
1742
1742
|
kind: string;
|
package/dist/runtime-kernel.cjs
CHANGED
|
@@ -6270,16 +6270,21 @@ var GraphAgentExecutor = class {
|
|
|
6270
6270
|
};
|
|
6271
6271
|
|
|
6272
6272
|
// src/runtime-kernel/graph-engine/nodes/llmNode.state.ts
|
|
6273
|
+
function assertLlmNodeStreamChunkSequence(state, answerId, seq) {
|
|
6274
|
+
const answerChanged = state.answerId !== answerId;
|
|
6275
|
+
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6276
|
+
if (seq !== expectedSeq) {
|
|
6277
|
+
throw new Error(
|
|
6278
|
+
`final_answer_chunk sequence mismatch: answer=${answerId}, expected=${expectedSeq}, actual=${seq}`
|
|
6279
|
+
);
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6273
6282
|
function llmNodeReducer(state, action) {
|
|
6274
6283
|
switch (action.type) {
|
|
6275
6284
|
case "STREAM_CHUNK_RECEIVED": {
|
|
6285
|
+
assertLlmNodeStreamChunkSequence(state, action.answerId, action.seq);
|
|
6276
6286
|
const answerChanged = state.answerId !== action.answerId;
|
|
6277
6287
|
const expectedSeq = answerChanged ? 0 : state.chunkSeq;
|
|
6278
|
-
if (action.seq !== expectedSeq) {
|
|
6279
|
-
throw new Error(
|
|
6280
|
-
`final_answer_chunk sequence mismatch: answer=${action.answerId}, expected=${expectedSeq}, actual=${action.seq}`
|
|
6281
|
-
);
|
|
6282
|
-
}
|
|
6283
6288
|
return {
|
|
6284
6289
|
...state,
|
|
6285
6290
|
answerId: action.answerId,
|
|
@@ -6970,12 +6975,21 @@ var LlmNodeEventBridge = class {
|
|
|
6970
6975
|
throw new Error("final_answer did not map to a final_answer RuntimeEvent.");
|
|
6971
6976
|
}
|
|
6972
6977
|
const liveChunk = createStandaloneFinalAnswerChunk(finalAnswer);
|
|
6978
|
+
assertLlmNodeStreamChunkSequence(
|
|
6979
|
+
this.deps.getState(),
|
|
6980
|
+
liveChunk.answer_id,
|
|
6981
|
+
liveChunk.seq
|
|
6982
|
+
);
|
|
6983
|
+
const publishedChunk = this.publish(liveChunk, "LlmNode.final_answer_chunk.standalone");
|
|
6984
|
+
if (publishedChunk.type !== "final_answer_chunk") {
|
|
6985
|
+
throw new Error("RuntimeEvent sink changed standalone final_answer_chunk type.");
|
|
6986
|
+
}
|
|
6973
6987
|
this.deps.dispatch({
|
|
6974
6988
|
type: "STREAM_CHUNK_RECEIVED",
|
|
6975
|
-
answerId:
|
|
6976
|
-
seq:
|
|
6989
|
+
answerId: publishedChunk.answer_id,
|
|
6990
|
+
seq: publishedChunk.seq
|
|
6977
6991
|
});
|
|
6978
|
-
this.buffer(
|
|
6992
|
+
this.buffer(publishedChunk);
|
|
6979
6993
|
this.buffer(this.publish(finalAnswer, "LlmNode.final_answer"));
|
|
6980
6994
|
}
|
|
6981
6995
|
this.deps.dispatch({ type: "FINAL_ANSWER_RECEIVED" });
|
|
@@ -6999,15 +7013,20 @@ var LlmNodeEventBridge = class {
|
|
|
6999
7013
|
if (!runtimeEvent || runtimeEvent.type !== "final_answer_chunk") {
|
|
7000
7014
|
throw new Error("stream_chunk did not map to final_answer_chunk.");
|
|
7001
7015
|
}
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7016
|
+
assertLlmNodeStreamChunkSequence(
|
|
7017
|
+
this.deps.getState(),
|
|
7018
|
+
runtimeEvent.answer_id,
|
|
7019
|
+
runtimeEvent.seq
|
|
7020
|
+
);
|
|
7007
7021
|
const published = this.publish(runtimeEvent, "LlmNode.final_answer_chunk");
|
|
7008
7022
|
if (published.type !== "final_answer_chunk") {
|
|
7009
7023
|
throw new Error("RuntimeEvent sink changed final_answer_chunk type.");
|
|
7010
7024
|
}
|
|
7025
|
+
this.deps.dispatch({
|
|
7026
|
+
type: "STREAM_CHUNK_RECEIVED",
|
|
7027
|
+
answerId: published.answer_id,
|
|
7028
|
+
seq: published.seq
|
|
7029
|
+
});
|
|
7011
7030
|
this.assembler.push(published);
|
|
7012
7031
|
this.buffer(published);
|
|
7013
7032
|
}
|
|
@@ -10842,14 +10861,16 @@ async function callLlmStream(params) {
|
|
|
10842
10861
|
case "answer_delta":
|
|
10843
10862
|
emitThoughtComplete(thoughtSegmenter.onBoundary());
|
|
10844
10863
|
fullResponse += event.text;
|
|
10864
|
+
const seq = streamChunkSeq;
|
|
10845
10865
|
emit({
|
|
10846
10866
|
type: "stream_chunk",
|
|
10847
10867
|
timestamp: Date.now(),
|
|
10848
10868
|
content: event.text,
|
|
10849
10869
|
id: generateRuntimeEventId(),
|
|
10850
10870
|
answer_id: streamAnswerId,
|
|
10851
|
-
seq
|
|
10871
|
+
seq
|
|
10852
10872
|
});
|
|
10873
|
+
streamChunkSeq += 1;
|
|
10853
10874
|
return;
|
|
10854
10875
|
case "thought_delta": {
|
|
10855
10876
|
const delta = thoughtSegmenter.onThoughtDelta(event.text);
|