@linnlabs/linnkit 0.36.0 → 0.37.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/CHANGELOG.md +12 -1
- package/dist/cli.cjs +51 -21
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +51 -21
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.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 +1113 -1113
- package/dist/contracts/events.d.ts +1113 -1113
- package/dist/contracts/execution.d.cts +8 -8
- package/dist/contracts/execution.d.ts +8 -8
- package/dist/contracts/messages.d.cts +1178 -1178
- package/dist/contracts/messages.d.ts +1178 -1178
- package/dist/contracts/provider-continuation.d.cts +28 -28
- package/dist/contracts/provider-continuation.d.ts +28 -28
- package/dist/contracts/sse.d.cts +897 -897
- package/dist/contracts/sse.d.ts +897 -897
- 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 +46 -46
- package/dist/contracts/token-accounting.d.ts +46 -46
- package/dist/index.cjs +51 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -21
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +51 -21
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +51 -21
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/events/agentEvents.d.cts +172 -172
- package/dist/runtime-kernel/events/agentEvents.d.ts +172 -172
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.cts +1 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.ts +1 -0
- package/dist/runtime-kernel/graph-engine/types.d.cts +2 -0
- package/dist/runtime-kernel/graph-engine/types.d.ts +2 -0
- package/dist/runtime-kernel.cjs +51 -21
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +51 -21
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +51 -21
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +51 -21
- package/dist/testkit.js.map +1 -1
- package/docs/integration/persistence.md +9 -0
- package/package.json +2 -2
|
@@ -56,18 +56,18 @@ declare const ContextTokenComponent: z.ZodObject<{
|
|
|
56
56
|
profileId: z.ZodOptional<z.ZodString>;
|
|
57
57
|
estimatorVersion: z.ZodOptional<z.ZodString>;
|
|
58
58
|
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
59
60
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
60
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
61
61
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
62
62
|
componentId: string;
|
|
63
63
|
tokens: number;
|
|
64
|
+
role?: string | undefined;
|
|
64
65
|
resourceId?: string | undefined;
|
|
65
66
|
width?: number | undefined;
|
|
66
67
|
height?: number | undefined;
|
|
67
68
|
label?: string | undefined;
|
|
68
|
-
action?: string | undefined;
|
|
69
|
-
role?: string | undefined;
|
|
70
69
|
profileId?: string | undefined;
|
|
70
|
+
action?: string | undefined;
|
|
71
71
|
messageId?: string | undefined;
|
|
72
72
|
kept?: boolean | undefined;
|
|
73
73
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -78,18 +78,18 @@ declare const ContextTokenComponent: z.ZodObject<{
|
|
|
78
78
|
attachmentIndex?: number | undefined;
|
|
79
79
|
estimatorVersion?: string | undefined;
|
|
80
80
|
}, {
|
|
81
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
81
82
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
82
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
83
83
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
84
84
|
componentId: string;
|
|
85
85
|
tokens: number;
|
|
86
|
+
role?: string | undefined;
|
|
86
87
|
resourceId?: string | undefined;
|
|
87
88
|
width?: number | undefined;
|
|
88
89
|
height?: number | undefined;
|
|
89
90
|
label?: string | undefined;
|
|
90
|
-
action?: string | undefined;
|
|
91
|
-
role?: string | undefined;
|
|
92
91
|
profileId?: string | undefined;
|
|
92
|
+
action?: string | undefined;
|
|
93
93
|
messageId?: string | undefined;
|
|
94
94
|
kept?: boolean | undefined;
|
|
95
95
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -205,11 +205,12 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
205
205
|
totalTokens?: number | undefined;
|
|
206
206
|
rawUsage?: unknown;
|
|
207
207
|
};
|
|
208
|
+
conversationId?: string | undefined;
|
|
208
209
|
runId?: string | undefined;
|
|
209
210
|
parentRunId?: string | undefined;
|
|
210
|
-
conversationId?: string | undefined;
|
|
211
211
|
turnId?: string | undefined;
|
|
212
212
|
modelId?: string | undefined;
|
|
213
|
+
stepId?: string | undefined;
|
|
213
214
|
route?: {
|
|
214
215
|
modelId: string;
|
|
215
216
|
capabilityId: string;
|
|
@@ -222,7 +223,6 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
222
223
|
baseURL?: string | undefined;
|
|
223
224
|
endpointModelId?: string | undefined;
|
|
224
225
|
} | undefined;
|
|
225
|
-
stepId?: string | undefined;
|
|
226
226
|
createdAt?: number | undefined;
|
|
227
227
|
}, {
|
|
228
228
|
id: string;
|
|
@@ -239,11 +239,12 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
239
239
|
totalTokens?: number | undefined;
|
|
240
240
|
rawUsage?: unknown;
|
|
241
241
|
};
|
|
242
|
+
conversationId?: string | undefined;
|
|
242
243
|
runId?: string | undefined;
|
|
243
244
|
parentRunId?: string | undefined;
|
|
244
|
-
conversationId?: string | undefined;
|
|
245
245
|
turnId?: string | undefined;
|
|
246
246
|
modelId?: string | undefined;
|
|
247
|
+
stepId?: string | undefined;
|
|
247
248
|
route?: {
|
|
248
249
|
modelId: string;
|
|
249
250
|
capabilityId: string;
|
|
@@ -256,7 +257,6 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
256
257
|
baseURL?: string | undefined;
|
|
257
258
|
endpointModelId?: string | undefined;
|
|
258
259
|
} | undefined;
|
|
259
|
-
stepId?: string | undefined;
|
|
260
260
|
createdAt?: number | undefined;
|
|
261
261
|
}>;
|
|
262
262
|
type LlmUsageTokenLedgerEntry = z.infer<typeof LlmUsageTokenLedgerEntry>;
|
|
@@ -337,18 +337,18 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
337
337
|
profileId: z.ZodOptional<z.ZodString>;
|
|
338
338
|
estimatorVersion: z.ZodOptional<z.ZodString>;
|
|
339
339
|
}, "strip", z.ZodTypeAny, {
|
|
340
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
340
341
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
341
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
342
342
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
343
343
|
componentId: string;
|
|
344
344
|
tokens: number;
|
|
345
|
+
role?: string | undefined;
|
|
345
346
|
resourceId?: string | undefined;
|
|
346
347
|
width?: number | undefined;
|
|
347
348
|
height?: number | undefined;
|
|
348
349
|
label?: string | undefined;
|
|
349
|
-
action?: string | undefined;
|
|
350
|
-
role?: string | undefined;
|
|
351
350
|
profileId?: string | undefined;
|
|
351
|
+
action?: string | undefined;
|
|
352
352
|
messageId?: string | undefined;
|
|
353
353
|
kept?: boolean | undefined;
|
|
354
354
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -359,18 +359,18 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
359
359
|
attachmentIndex?: number | undefined;
|
|
360
360
|
estimatorVersion?: string | undefined;
|
|
361
361
|
}, {
|
|
362
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
362
363
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
363
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
364
364
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
365
365
|
componentId: string;
|
|
366
366
|
tokens: number;
|
|
367
|
+
role?: string | undefined;
|
|
367
368
|
resourceId?: string | undefined;
|
|
368
369
|
width?: number | undefined;
|
|
369
370
|
height?: number | undefined;
|
|
370
371
|
label?: string | undefined;
|
|
371
|
-
action?: string | undefined;
|
|
372
|
-
role?: string | undefined;
|
|
373
372
|
profileId?: string | undefined;
|
|
373
|
+
action?: string | undefined;
|
|
374
374
|
messageId?: string | undefined;
|
|
375
375
|
kept?: boolean | undefined;
|
|
376
376
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -386,18 +386,18 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
386
386
|
id: string;
|
|
387
387
|
kind: "context-component";
|
|
388
388
|
components: {
|
|
389
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
389
390
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
390
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
391
391
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
392
392
|
componentId: string;
|
|
393
393
|
tokens: number;
|
|
394
|
+
role?: string | undefined;
|
|
394
395
|
resourceId?: string | undefined;
|
|
395
396
|
width?: number | undefined;
|
|
396
397
|
height?: number | undefined;
|
|
397
398
|
label?: string | undefined;
|
|
398
|
-
action?: string | undefined;
|
|
399
|
-
role?: string | undefined;
|
|
400
399
|
profileId?: string | undefined;
|
|
400
|
+
action?: string | undefined;
|
|
401
401
|
messageId?: string | undefined;
|
|
402
402
|
kept?: boolean | undefined;
|
|
403
403
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -409,10 +409,11 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
409
409
|
estimatorVersion?: string | undefined;
|
|
410
410
|
}[];
|
|
411
411
|
totalTokens: number;
|
|
412
|
+
conversationId?: string | undefined;
|
|
412
413
|
runId?: string | undefined;
|
|
413
414
|
parentRunId?: string | undefined;
|
|
414
|
-
conversationId?: string | undefined;
|
|
415
415
|
turnId?: string | undefined;
|
|
416
|
+
stepId?: string | undefined;
|
|
416
417
|
route?: {
|
|
417
418
|
modelId: string;
|
|
418
419
|
capabilityId: string;
|
|
@@ -425,24 +426,23 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
425
426
|
baseURL?: string | undefined;
|
|
426
427
|
endpointModelId?: string | undefined;
|
|
427
428
|
} | undefined;
|
|
428
|
-
stepId?: string | undefined;
|
|
429
429
|
createdAt?: number | undefined;
|
|
430
430
|
}, {
|
|
431
431
|
id: string;
|
|
432
432
|
kind: "context-component";
|
|
433
433
|
components: {
|
|
434
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
434
435
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
435
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
436
436
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
437
437
|
componentId: string;
|
|
438
438
|
tokens: number;
|
|
439
|
+
role?: string | undefined;
|
|
439
440
|
resourceId?: string | undefined;
|
|
440
441
|
width?: number | undefined;
|
|
441
442
|
height?: number | undefined;
|
|
442
443
|
label?: string | undefined;
|
|
443
|
-
action?: string | undefined;
|
|
444
|
-
role?: string | undefined;
|
|
445
444
|
profileId?: string | undefined;
|
|
445
|
+
action?: string | undefined;
|
|
446
446
|
messageId?: string | undefined;
|
|
447
447
|
kept?: boolean | undefined;
|
|
448
448
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -454,10 +454,11 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
454
454
|
estimatorVersion?: string | undefined;
|
|
455
455
|
}[];
|
|
456
456
|
totalTokens: number;
|
|
457
|
+
conversationId?: string | undefined;
|
|
457
458
|
runId?: string | undefined;
|
|
458
459
|
parentRunId?: string | undefined;
|
|
459
|
-
conversationId?: string | undefined;
|
|
460
460
|
turnId?: string | undefined;
|
|
461
|
+
stepId?: string | undefined;
|
|
461
462
|
route?: {
|
|
462
463
|
modelId: string;
|
|
463
464
|
capabilityId: string;
|
|
@@ -470,7 +471,6 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
470
471
|
baseURL?: string | undefined;
|
|
471
472
|
endpointModelId?: string | undefined;
|
|
472
473
|
} | undefined;
|
|
473
|
-
stepId?: string | undefined;
|
|
474
474
|
createdAt?: number | undefined;
|
|
475
475
|
}>;
|
|
476
476
|
type ContextComponentTokenLedgerEntry = z.infer<typeof ContextComponentTokenLedgerEntry>;
|
|
@@ -578,11 +578,12 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
578
578
|
totalTokens?: number | undefined;
|
|
579
579
|
rawUsage?: unknown;
|
|
580
580
|
};
|
|
581
|
+
conversationId?: string | undefined;
|
|
581
582
|
runId?: string | undefined;
|
|
582
583
|
parentRunId?: string | undefined;
|
|
583
|
-
conversationId?: string | undefined;
|
|
584
584
|
turnId?: string | undefined;
|
|
585
585
|
modelId?: string | undefined;
|
|
586
|
+
stepId?: string | undefined;
|
|
586
587
|
route?: {
|
|
587
588
|
modelId: string;
|
|
588
589
|
capabilityId: string;
|
|
@@ -595,7 +596,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
595
596
|
baseURL?: string | undefined;
|
|
596
597
|
endpointModelId?: string | undefined;
|
|
597
598
|
} | undefined;
|
|
598
|
-
stepId?: string | undefined;
|
|
599
599
|
createdAt?: number | undefined;
|
|
600
600
|
}, {
|
|
601
601
|
id: string;
|
|
@@ -612,11 +612,12 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
612
612
|
totalTokens?: number | undefined;
|
|
613
613
|
rawUsage?: unknown;
|
|
614
614
|
};
|
|
615
|
+
conversationId?: string | undefined;
|
|
615
616
|
runId?: string | undefined;
|
|
616
617
|
parentRunId?: string | undefined;
|
|
617
|
-
conversationId?: string | undefined;
|
|
618
618
|
turnId?: string | undefined;
|
|
619
619
|
modelId?: string | undefined;
|
|
620
|
+
stepId?: string | undefined;
|
|
620
621
|
route?: {
|
|
621
622
|
modelId: string;
|
|
622
623
|
capabilityId: string;
|
|
@@ -629,7 +630,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
629
630
|
baseURL?: string | undefined;
|
|
630
631
|
endpointModelId?: string | undefined;
|
|
631
632
|
} | undefined;
|
|
632
|
-
stepId?: string | undefined;
|
|
633
633
|
createdAt?: number | undefined;
|
|
634
634
|
}>, z.ZodObject<{
|
|
635
635
|
id: z.ZodString;
|
|
@@ -708,18 +708,18 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
708
708
|
profileId: z.ZodOptional<z.ZodString>;
|
|
709
709
|
estimatorVersion: z.ZodOptional<z.ZodString>;
|
|
710
710
|
}, "strip", z.ZodTypeAny, {
|
|
711
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
711
712
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
712
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
713
713
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
714
714
|
componentId: string;
|
|
715
715
|
tokens: number;
|
|
716
|
+
role?: string | undefined;
|
|
716
717
|
resourceId?: string | undefined;
|
|
717
718
|
width?: number | undefined;
|
|
718
719
|
height?: number | undefined;
|
|
719
720
|
label?: string | undefined;
|
|
720
|
-
action?: string | undefined;
|
|
721
|
-
role?: string | undefined;
|
|
722
721
|
profileId?: string | undefined;
|
|
722
|
+
action?: string | undefined;
|
|
723
723
|
messageId?: string | undefined;
|
|
724
724
|
kept?: boolean | undefined;
|
|
725
725
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -730,18 +730,18 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
730
730
|
attachmentIndex?: number | undefined;
|
|
731
731
|
estimatorVersion?: string | undefined;
|
|
732
732
|
}, {
|
|
733
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
733
734
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
734
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
735
735
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
736
736
|
componentId: string;
|
|
737
737
|
tokens: number;
|
|
738
|
+
role?: string | undefined;
|
|
738
739
|
resourceId?: string | undefined;
|
|
739
740
|
width?: number | undefined;
|
|
740
741
|
height?: number | undefined;
|
|
741
742
|
label?: string | undefined;
|
|
742
|
-
action?: string | undefined;
|
|
743
|
-
role?: string | undefined;
|
|
744
743
|
profileId?: string | undefined;
|
|
744
|
+
action?: string | undefined;
|
|
745
745
|
messageId?: string | undefined;
|
|
746
746
|
kept?: boolean | undefined;
|
|
747
747
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -757,18 +757,18 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
757
757
|
id: string;
|
|
758
758
|
kind: "context-component";
|
|
759
759
|
components: {
|
|
760
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
760
761
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
761
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
762
762
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
763
763
|
componentId: string;
|
|
764
764
|
tokens: number;
|
|
765
|
+
role?: string | undefined;
|
|
765
766
|
resourceId?: string | undefined;
|
|
766
767
|
width?: number | undefined;
|
|
767
768
|
height?: number | undefined;
|
|
768
769
|
label?: string | undefined;
|
|
769
|
-
action?: string | undefined;
|
|
770
|
-
role?: string | undefined;
|
|
771
770
|
profileId?: string | undefined;
|
|
771
|
+
action?: string | undefined;
|
|
772
772
|
messageId?: string | undefined;
|
|
773
773
|
kept?: boolean | undefined;
|
|
774
774
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -780,10 +780,11 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
780
780
|
estimatorVersion?: string | undefined;
|
|
781
781
|
}[];
|
|
782
782
|
totalTokens: number;
|
|
783
|
+
conversationId?: string | undefined;
|
|
783
784
|
runId?: string | undefined;
|
|
784
785
|
parentRunId?: string | undefined;
|
|
785
|
-
conversationId?: string | undefined;
|
|
786
786
|
turnId?: string | undefined;
|
|
787
|
+
stepId?: string | undefined;
|
|
787
788
|
route?: {
|
|
788
789
|
modelId: string;
|
|
789
790
|
capabilityId: string;
|
|
@@ -796,24 +797,23 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
796
797
|
baseURL?: string | undefined;
|
|
797
798
|
endpointModelId?: string | undefined;
|
|
798
799
|
} | undefined;
|
|
799
|
-
stepId?: string | undefined;
|
|
800
800
|
createdAt?: number | undefined;
|
|
801
801
|
}, {
|
|
802
802
|
id: string;
|
|
803
803
|
kind: "context-component";
|
|
804
804
|
components: {
|
|
805
|
+
kind: "system" | "user" | "assistant" | "tool" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
805
806
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
806
|
-
kind: "user" | "system" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment" | "other";
|
|
807
807
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
808
808
|
componentId: string;
|
|
809
809
|
tokens: number;
|
|
810
|
+
role?: string | undefined;
|
|
810
811
|
resourceId?: string | undefined;
|
|
811
812
|
width?: number | undefined;
|
|
812
813
|
height?: number | undefined;
|
|
813
814
|
label?: string | undefined;
|
|
814
|
-
action?: string | undefined;
|
|
815
|
-
role?: string | undefined;
|
|
816
815
|
profileId?: string | undefined;
|
|
816
|
+
action?: string | undefined;
|
|
817
817
|
messageId?: string | undefined;
|
|
818
818
|
kept?: boolean | undefined;
|
|
819
819
|
truncatedAtExecution?: boolean | undefined;
|
|
@@ -825,10 +825,11 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
825
825
|
estimatorVersion?: string | undefined;
|
|
826
826
|
}[];
|
|
827
827
|
totalTokens: number;
|
|
828
|
+
conversationId?: string | undefined;
|
|
828
829
|
runId?: string | undefined;
|
|
829
830
|
parentRunId?: string | undefined;
|
|
830
|
-
conversationId?: string | undefined;
|
|
831
831
|
turnId?: string | undefined;
|
|
832
|
+
stepId?: string | undefined;
|
|
832
833
|
route?: {
|
|
833
834
|
modelId: string;
|
|
834
835
|
capabilityId: string;
|
|
@@ -841,7 +842,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
841
842
|
baseURL?: string | undefined;
|
|
842
843
|
endpointModelId?: string | undefined;
|
|
843
844
|
} | undefined;
|
|
844
|
-
stepId?: string | undefined;
|
|
845
845
|
createdAt?: number | undefined;
|
|
846
846
|
}>]>;
|
|
847
847
|
type TokenLedgerEntry = z.infer<typeof TokenLedgerEntry>;
|
package/dist/index.cjs
CHANGED
|
@@ -3901,6 +3901,26 @@ function resolveAssistantReplayParts(response) {
|
|
|
3901
3901
|
return response.assistant_replay_parts;
|
|
3902
3902
|
}
|
|
3903
3903
|
|
|
3904
|
+
// src/runtime-kernel/graph-engine/definitions/runContinuation.ts
|
|
3905
|
+
var RunRecoveryBlockedError = class extends Error {
|
|
3906
|
+
code = "RUN_RECOVERY_BLOCKED";
|
|
3907
|
+
constructor(message) {
|
|
3908
|
+
super(message);
|
|
3909
|
+
this.name = "RunRecoveryBlockedError";
|
|
3910
|
+
}
|
|
3911
|
+
};
|
|
3912
|
+
var RunPauseRequested = class extends Error {
|
|
3913
|
+
code = "RUN_PAUSE_REQUESTED";
|
|
3914
|
+
constructor(message = "Run paused by user") {
|
|
3915
|
+
super(message);
|
|
3916
|
+
this.name = "RunPauseRequested";
|
|
3917
|
+
}
|
|
3918
|
+
};
|
|
3919
|
+
function isRunPauseSignal(signal) {
|
|
3920
|
+
const reason = signal?.reason;
|
|
3921
|
+
return signal?.aborted === true && typeof reason === "object" && reason !== null && "code" in reason && reason.code === "RUN_PAUSE_REQUESTED";
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3904
3924
|
// src/runtime-kernel/graph-engine/engine.ts
|
|
3905
3925
|
var logger2 = new Logger("GraphExecutor");
|
|
3906
3926
|
function isRecord4(value) {
|
|
@@ -4210,6 +4230,7 @@ var GraphExecutor = class {
|
|
|
4210
4230
|
reportStepsUsed(stepCount);
|
|
4211
4231
|
const signalRaw = state.local?.signal;
|
|
4212
4232
|
if (isAbortSignal2(signalRaw) && signalRaw.aborted) {
|
|
4233
|
+
if (!isRunPauseSignal(signalRaw)) await this.nodes.get(state.nodeId)?.cancel?.(state);
|
|
4213
4234
|
logger2.warn("[GraphExecutor] \u6536\u5230 AbortSignal\uFF0C\u7ACB\u5373\u505C\u6B62\u63A8\u7406\u5FAA\u73AF");
|
|
4214
4235
|
this.ephemeralLocals.delete(checkpointKey);
|
|
4215
4236
|
throwAbortError();
|
|
@@ -4260,6 +4281,12 @@ var GraphExecutor = class {
|
|
|
4260
4281
|
allEvents.push(...stepResolution.events);
|
|
4261
4282
|
}
|
|
4262
4283
|
state = stepResolution.state;
|
|
4284
|
+
const completedSignal = state.local?.signal;
|
|
4285
|
+
if (isAbortSignal2(completedSignal) && completedSignal.aborted && !isRunPauseSignal(completedSignal)) {
|
|
4286
|
+
await this.nodes.get(state.nodeId)?.cancel?.(state);
|
|
4287
|
+
this.ephemeralLocals.delete(checkpointKey);
|
|
4288
|
+
throwAbortError();
|
|
4289
|
+
}
|
|
4263
4290
|
if (stepResolution.action.kind === "route") {
|
|
4264
4291
|
logger2.info("[GraphExecutor] \u8DEF\u7531\u5207\u6362", {
|
|
4265
4292
|
fromNodeId: stepResolution.action.fromNodeId,
|
|
@@ -9486,26 +9513,6 @@ function recordToolProtocolError(params) {
|
|
|
9486
9513
|
recorder?.recordToolProtocolError?.(params);
|
|
9487
9514
|
}
|
|
9488
9515
|
|
|
9489
|
-
// src/runtime-kernel/graph-engine/definitions/runContinuation.ts
|
|
9490
|
-
var RunRecoveryBlockedError = class extends Error {
|
|
9491
|
-
code = "RUN_RECOVERY_BLOCKED";
|
|
9492
|
-
constructor(message) {
|
|
9493
|
-
super(message);
|
|
9494
|
-
this.name = "RunRecoveryBlockedError";
|
|
9495
|
-
}
|
|
9496
|
-
};
|
|
9497
|
-
var RunPauseRequested = class extends Error {
|
|
9498
|
-
code = "RUN_PAUSE_REQUESTED";
|
|
9499
|
-
constructor(message = "Run paused by user") {
|
|
9500
|
-
super(message);
|
|
9501
|
-
this.name = "RunPauseRequested";
|
|
9502
|
-
}
|
|
9503
|
-
};
|
|
9504
|
-
function isRunPauseSignal(signal) {
|
|
9505
|
-
const reason = signal?.reason;
|
|
9506
|
-
return signal?.aborted === true && typeof reason === "object" && reason !== null && "code" in reason && reason.code === "RUN_PAUSE_REQUESTED";
|
|
9507
|
-
}
|
|
9508
|
-
|
|
9509
9516
|
// src/runtime-kernel/graph-engine/nodes/toolNode.recovery.ts
|
|
9510
9517
|
async function executeRecoverableTool(input) {
|
|
9511
9518
|
const local = input.state.local;
|
|
@@ -9707,7 +9714,22 @@ var ToolNode = class {
|
|
|
9707
9714
|
async run(state) {
|
|
9708
9715
|
const events = [];
|
|
9709
9716
|
while (true) {
|
|
9710
|
-
|
|
9717
|
+
let result;
|
|
9718
|
+
try {
|
|
9719
|
+
result = await this.runNextPendingToolCall(state);
|
|
9720
|
+
} catch (error) {
|
|
9721
|
+
if (isToolExecutionAbort(error) && !isRunPauseSignal(state.local?.signal)) {
|
|
9722
|
+
await this.cancel(state);
|
|
9723
|
+
}
|
|
9724
|
+
throw error;
|
|
9725
|
+
}
|
|
9726
|
+
const signal = state.local?.signal;
|
|
9727
|
+
if (isAbortSignal(signal) && signal.aborted && !isRunPauseSignal(signal)) {
|
|
9728
|
+
await this.cancel(state);
|
|
9729
|
+
const error = new Error("The user aborted a request.");
|
|
9730
|
+
error.name = "AbortError";
|
|
9731
|
+
throw error;
|
|
9732
|
+
}
|
|
9711
9733
|
await commitToolBoundary(state, result);
|
|
9712
9734
|
if (Array.isArray(result.events) && result.events.length > 0) {
|
|
9713
9735
|
events.push(...result.events);
|
|
@@ -9721,6 +9743,14 @@ var ToolNode = class {
|
|
|
9721
9743
|
};
|
|
9722
9744
|
}
|
|
9723
9745
|
}
|
|
9746
|
+
async cancel(state) {
|
|
9747
|
+
settlePendingToolCallsAfterAbort({
|
|
9748
|
+
state,
|
|
9749
|
+
calls: parsePendingToolCalls(state.local?.pendingToolCalls ?? []),
|
|
9750
|
+
toolCatalog: this.toolRuntime
|
|
9751
|
+
});
|
|
9752
|
+
await commitToolBoundary(state, { kind: "yield"});
|
|
9753
|
+
}
|
|
9724
9754
|
async runNextPendingToolCall(state) {
|
|
9725
9755
|
const calls = parsePendingToolCalls(state.local?.pendingToolCalls ?? []);
|
|
9726
9756
|
const signalRaw = state.local?.signal;
|