@linnlabs/linnkit 0.37.5 → 0.38.1
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 +36 -1
- package/dist/cli.cjs +346 -178
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +346 -178
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs +55 -11
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.js +55 -11
- package/dist/context-manager.js.map +1 -1
- package/dist/contracts/events.d.cts +517 -35
- package/dist/contracts/events.d.ts +517 -35
- package/dist/contracts/llm-retry.d.cts +47 -0
- package/dist/contracts/llm-retry.d.ts +47 -0
- package/dist/contracts/runtime-error.d.cts +26 -0
- package/dist/contracts/runtime-error.d.ts +26 -0
- package/dist/contracts/sse.d.cts +555 -39
- package/dist/contracts/sse.d.ts +555 -39
- package/dist/contracts/sub-run-trace-payload.d.cts +102 -6
- package/dist/contracts/sub-run-trace-payload.d.ts +102 -6
- package/dist/contracts/token-accounting.d.cts +18 -18
- package/dist/contracts/token-accounting.d.ts +18 -18
- package/dist/contracts.cjs +65 -10
- package/dist/contracts.cjs.map +1 -1
- package/dist/contracts.d.cts +4 -2
- package/dist/contracts.d.ts +4 -2
- package/dist/contracts.js +62 -11
- package/dist/contracts.js.map +1 -1
- package/dist/index.cjs +551 -286
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +551 -286
- package/dist/index.js.map +1 -1
- package/dist/ports/canonical-inference.d.cts +3 -0
- package/dist/ports/canonical-inference.d.ts +3 -0
- package/dist/ports/llm-call.d.cts +4 -0
- package/dist/ports/llm-call.d.ts +4 -0
- package/dist/quickstart.cjs +346 -178
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +346 -178
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.cts +8 -0
- package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.ts +8 -0
- package/dist/runtime-kernel/events/agentEvents.d.cts +85 -4
- package/dist/runtime-kernel/events/agentEvents.d.ts +85 -4
- package/dist/runtime-kernel/events/eventGovernance.d.cts +1 -1
- package/dist/runtime-kernel/events/eventGovernance.d.ts +1 -1
- package/dist/runtime-kernel/events.cjs +55 -11
- package/dist/runtime-kernel/events.cjs.map +1 -1
- package/dist/runtime-kernel/events.js +55 -11
- package/dist/runtime-kernel/events.js.map +1 -1
- package/dist/runtime-kernel/llm/request-builder.d.cts +2 -0
- package/dist/runtime-kernel/llm/request-builder.d.ts +2 -0
- package/dist/runtime-kernel.cjs +513 -271
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +513 -271
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/shared/errorClassifier.d.cts +5 -0
- package/dist/shared/errorClassifier.d.ts +5 -0
- package/dist/testkit.cjs +511 -269
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +511 -269
- package/dist/testkit.js.map +1 -1
- package/docs/integration/llm-provider.md +24 -5
- package/docs/integration/realtime.md +29 -0
- package/docs/integration/tools.md +4 -0
- package/package.json +2 -2
|
@@ -56,7 +56,7 @@ 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"
|
|
59
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
60
60
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
61
61
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
62
62
|
componentId: string;
|
|
@@ -78,7 +78,7 @@ 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"
|
|
81
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
82
82
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
83
83
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
84
84
|
componentId: string;
|
|
@@ -210,7 +210,6 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
210
210
|
parentRunId?: string | undefined;
|
|
211
211
|
turnId?: string | undefined;
|
|
212
212
|
modelId?: string | undefined;
|
|
213
|
-
stepId?: string | undefined;
|
|
214
213
|
route?: {
|
|
215
214
|
modelId: string;
|
|
216
215
|
capabilityId: string;
|
|
@@ -223,6 +222,7 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
223
222
|
baseURL?: string | undefined;
|
|
224
223
|
endpointModelId?: string | undefined;
|
|
225
224
|
} | undefined;
|
|
225
|
+
stepId?: string | undefined;
|
|
226
226
|
createdAt?: number | undefined;
|
|
227
227
|
}, {
|
|
228
228
|
id: string;
|
|
@@ -244,7 +244,6 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
244
244
|
parentRunId?: string | undefined;
|
|
245
245
|
turnId?: string | undefined;
|
|
246
246
|
modelId?: string | undefined;
|
|
247
|
-
stepId?: string | undefined;
|
|
248
247
|
route?: {
|
|
249
248
|
modelId: string;
|
|
250
249
|
capabilityId: string;
|
|
@@ -257,6 +256,7 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
|
|
|
257
256
|
baseURL?: string | undefined;
|
|
258
257
|
endpointModelId?: string | undefined;
|
|
259
258
|
} | undefined;
|
|
259
|
+
stepId?: string | undefined;
|
|
260
260
|
createdAt?: number | undefined;
|
|
261
261
|
}>;
|
|
262
262
|
type LlmUsageTokenLedgerEntry = z.infer<typeof LlmUsageTokenLedgerEntry>;
|
|
@@ -337,7 +337,7 @@ 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"
|
|
340
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
341
341
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
342
342
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
343
343
|
componentId: string;
|
|
@@ -359,7 +359,7 @@ 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"
|
|
362
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
363
363
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
364
364
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
365
365
|
componentId: string;
|
|
@@ -386,7 +386,7 @@ 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"
|
|
389
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
390
390
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
391
391
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
392
392
|
componentId: string;
|
|
@@ -413,7 +413,6 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
413
413
|
runId?: string | undefined;
|
|
414
414
|
parentRunId?: string | undefined;
|
|
415
415
|
turnId?: string | undefined;
|
|
416
|
-
stepId?: string | undefined;
|
|
417
416
|
route?: {
|
|
418
417
|
modelId: string;
|
|
419
418
|
capabilityId: string;
|
|
@@ -426,12 +425,13 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
426
425
|
baseURL?: string | undefined;
|
|
427
426
|
endpointModelId?: string | undefined;
|
|
428
427
|
} | 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"
|
|
434
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
435
435
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
436
436
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
437
437
|
componentId: string;
|
|
@@ -458,7 +458,6 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
458
458
|
runId?: string | undefined;
|
|
459
459
|
parentRunId?: string | undefined;
|
|
460
460
|
turnId?: string | undefined;
|
|
461
|
-
stepId?: string | undefined;
|
|
462
461
|
route?: {
|
|
463
462
|
modelId: string;
|
|
464
463
|
capabilityId: string;
|
|
@@ -471,6 +470,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
|
|
|
471
470
|
baseURL?: string | undefined;
|
|
472
471
|
endpointModelId?: string | undefined;
|
|
473
472
|
} | undefined;
|
|
473
|
+
stepId?: string | undefined;
|
|
474
474
|
createdAt?: number | undefined;
|
|
475
475
|
}>;
|
|
476
476
|
type ContextComponentTokenLedgerEntry = z.infer<typeof ContextComponentTokenLedgerEntry>;
|
|
@@ -583,7 +583,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
583
583
|
parentRunId?: string | undefined;
|
|
584
584
|
turnId?: string | undefined;
|
|
585
585
|
modelId?: string | undefined;
|
|
586
|
-
stepId?: string | undefined;
|
|
587
586
|
route?: {
|
|
588
587
|
modelId: string;
|
|
589
588
|
capabilityId: string;
|
|
@@ -596,6 +595,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
596
595
|
baseURL?: string | undefined;
|
|
597
596
|
endpointModelId?: string | undefined;
|
|
598
597
|
} | undefined;
|
|
598
|
+
stepId?: string | undefined;
|
|
599
599
|
createdAt?: number | undefined;
|
|
600
600
|
}, {
|
|
601
601
|
id: string;
|
|
@@ -617,7 +617,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
617
617
|
parentRunId?: string | undefined;
|
|
618
618
|
turnId?: string | undefined;
|
|
619
619
|
modelId?: string | undefined;
|
|
620
|
-
stepId?: string | undefined;
|
|
621
620
|
route?: {
|
|
622
621
|
modelId: string;
|
|
623
622
|
capabilityId: string;
|
|
@@ -630,6 +629,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
630
629
|
baseURL?: string | undefined;
|
|
631
630
|
endpointModelId?: string | undefined;
|
|
632
631
|
} | undefined;
|
|
632
|
+
stepId?: string | undefined;
|
|
633
633
|
createdAt?: number | undefined;
|
|
634
634
|
}>, z.ZodObject<{
|
|
635
635
|
id: z.ZodString;
|
|
@@ -708,7 +708,7 @@ 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"
|
|
711
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
712
712
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
713
713
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
714
714
|
componentId: string;
|
|
@@ -730,7 +730,7 @@ 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"
|
|
733
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
734
734
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
735
735
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
736
736
|
componentId: string;
|
|
@@ -757,7 +757,7 @@ 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"
|
|
760
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
761
761
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
762
762
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
763
763
|
componentId: string;
|
|
@@ -784,7 +784,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
784
784
|
runId?: string | undefined;
|
|
785
785
|
parentRunId?: string | undefined;
|
|
786
786
|
turnId?: string | undefined;
|
|
787
|
-
stepId?: string | undefined;
|
|
788
787
|
route?: {
|
|
789
788
|
modelId: string;
|
|
790
789
|
capabilityId: string;
|
|
@@ -797,12 +796,13 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
797
796
|
baseURL?: string | undefined;
|
|
798
797
|
endpointModelId?: string | undefined;
|
|
799
798
|
} | 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"
|
|
805
|
+
kind: "system" | "user" | "assistant" | "tool" | "other" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
|
|
806
806
|
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
807
807
|
confidence: "estimate" | "provider-estimate" | "actual";
|
|
808
808
|
componentId: string;
|
|
@@ -829,7 +829,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
829
829
|
runId?: string | undefined;
|
|
830
830
|
parentRunId?: string | undefined;
|
|
831
831
|
turnId?: string | undefined;
|
|
832
|
-
stepId?: string | undefined;
|
|
833
832
|
route?: {
|
|
834
833
|
modelId: string;
|
|
835
834
|
capabilityId: string;
|
|
@@ -842,6 +841,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
842
841
|
baseURL?: string | undefined;
|
|
843
842
|
endpointModelId?: string | undefined;
|
|
844
843
|
} | undefined;
|
|
844
|
+
stepId?: string | undefined;
|
|
845
845
|
createdAt?: number | undefined;
|
|
846
846
|
}>]>;
|
|
847
847
|
type TokenLedgerEntry = z.infer<typeof TokenLedgerEntry>;
|
package/dist/contracts.cjs
CHANGED
|
@@ -822,6 +822,28 @@ var AuditEnvelope = zod.z.object({
|
|
|
822
822
|
costDelta: AuditCostDelta.optional(),
|
|
823
823
|
scope: AuditScope.optional()
|
|
824
824
|
});
|
|
825
|
+
var LlmRetryCategory = zod.z.enum(["transport", "output", "rate_limit", "other"]);
|
|
826
|
+
var LlmRetryState = zod.z.object({
|
|
827
|
+
retry_id: TraceIdSchema,
|
|
828
|
+
status: zod.z.enum(["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]),
|
|
829
|
+
category: LlmRetryCategory,
|
|
830
|
+
attempt: zod.z.number().int().nonnegative(),
|
|
831
|
+
max_retries: zod.z.number().int().nonnegative(),
|
|
832
|
+
total_attempts: zod.z.number().int().positive(),
|
|
833
|
+
started_at: zod.z.number().finite(),
|
|
834
|
+
delay_ms: zod.z.number().finite().nonnegative(),
|
|
835
|
+
next_retry_at: zod.z.number().finite().optional(),
|
|
836
|
+
/** 安全分类说明;不得放入供应商响应正文。 */
|
|
837
|
+
error: zod.z.string(),
|
|
838
|
+
error_code: zod.z.string().min(1)
|
|
839
|
+
}).strict();
|
|
840
|
+
var RuntimeErrorState = zod.z.object({
|
|
841
|
+
error: zod.z.string(),
|
|
842
|
+
error_code: zod.z.string().optional(),
|
|
843
|
+
retryable: zod.z.boolean().optional(),
|
|
844
|
+
retry_id: TraceIdSchema.optional(),
|
|
845
|
+
details: SerializableJsonValue.optional()
|
|
846
|
+
}).strict();
|
|
825
847
|
var ToolCallPhase = zod.z.enum(["start", "update", "complete", "error"]);
|
|
826
848
|
var Status = zod.z.enum(["loading", "success", "error"]);
|
|
827
849
|
var SubRunTraceKind = zod.z.enum([
|
|
@@ -832,7 +854,9 @@ var SubRunTraceKind = zod.z.enum([
|
|
|
832
854
|
"tool_output",
|
|
833
855
|
"final_answer_chunk",
|
|
834
856
|
"final_answer",
|
|
835
|
-
"history_summary"
|
|
857
|
+
"history_summary",
|
|
858
|
+
"llm_retry",
|
|
859
|
+
"error"
|
|
836
860
|
]);
|
|
837
861
|
var SubRunTraceToolCallDecision = zod.z.object({
|
|
838
862
|
tool_call_id: ToolCallIdSchema,
|
|
@@ -845,6 +869,8 @@ var SubRunTracePayload = zod.z.object({
|
|
|
845
869
|
subrun_parent_id: SubrunIdSchema.optional(),
|
|
846
870
|
source_event_id: SourceEventIdSchema,
|
|
847
871
|
kind: SubRunTraceKind,
|
|
872
|
+
retry: LlmRetryState.optional(),
|
|
873
|
+
failure: RuntimeErrorState.optional(),
|
|
848
874
|
delta: zod.z.string().optional(),
|
|
849
875
|
content: zod.z.string().optional(),
|
|
850
876
|
answer_id: AnswerSegmentIdSchema.optional(),
|
|
@@ -867,6 +893,12 @@ var SubRunTracePayload = zod.z.object({
|
|
|
867
893
|
meta: SerializableJsonRecord.optional()
|
|
868
894
|
});
|
|
869
895
|
function validateSubRunTracePayloadSemantics(payload, ctx) {
|
|
896
|
+
if (payload.kind === "llm_retry" !== (payload.retry !== void 0)) {
|
|
897
|
+
ctx.addIssue({ code: zod.z.ZodIssueCode.custom, path: ["retry"], message: "retry is required only for llm_retry trace" });
|
|
898
|
+
}
|
|
899
|
+
if (payload.kind === "error" !== (payload.failure !== void 0)) {
|
|
900
|
+
ctx.addIssue({ code: zod.z.ZodIssueCode.custom, path: ["failure"], message: "failure is required only for error trace" });
|
|
901
|
+
}
|
|
870
902
|
if (payload.kind === "thought_delta" && payload.delta === void 0) {
|
|
871
903
|
ctx.addIssue({ code: zod.z.ZodIssueCode.custom, path: ["delta"], message: "thought_delta requires delta" });
|
|
872
904
|
}
|
|
@@ -1220,12 +1252,10 @@ var RuntimeEventShape = zod.z.discriminatedUnion("type", [
|
|
|
1220
1252
|
compression_ratio: zod.z.number().min(0).max(1).optional(),
|
|
1221
1253
|
included_old_summary: zod.z.boolean().optional()
|
|
1222
1254
|
}),
|
|
1255
|
+
BaseEvent.extend({ type: zod.z.literal("llm_retry"), ...LlmRetryState.shape }),
|
|
1223
1256
|
BaseEvent.extend({
|
|
1224
1257
|
type: zod.z.literal("error"),
|
|
1225
|
-
|
|
1226
|
-
details: SerializableJsonValue.optional(),
|
|
1227
|
-
error_code: zod.z.string().optional(),
|
|
1228
|
-
retryable: zod.z.boolean().optional()
|
|
1258
|
+
...RuntimeErrorState.shape
|
|
1229
1259
|
}),
|
|
1230
1260
|
BaseEvent.extend({
|
|
1231
1261
|
type: zod.z.literal("control"),
|
|
@@ -1691,12 +1721,13 @@ var SSERequiresUserInteractionEvent = BaseSSEEvent.extend({
|
|
|
1691
1721
|
resume_token: ResumeTokenSchema,
|
|
1692
1722
|
interaction_status: zod.z.literal("pending")
|
|
1693
1723
|
});
|
|
1724
|
+
var SSELlmRetryEvent = BaseSSEEvent.extend({
|
|
1725
|
+
type: zod.z.literal("llm_retry"),
|
|
1726
|
+
...LlmRetryState.shape
|
|
1727
|
+
});
|
|
1694
1728
|
var SSEErrorEvent = BaseSSEEvent.extend({
|
|
1695
1729
|
type: zod.z.literal("error"),
|
|
1696
|
-
|
|
1697
|
-
details: SerializableJsonValue.optional(),
|
|
1698
|
-
error_code: zod.z.string().optional(),
|
|
1699
|
-
retryable: zod.z.boolean().optional()
|
|
1730
|
+
...RuntimeErrorState.shape
|
|
1700
1731
|
});
|
|
1701
1732
|
var SSETransportErrorEvent = BaseSSEEvent.extend({
|
|
1702
1733
|
type: zod.z.literal("transport_error"),
|
|
@@ -1779,6 +1810,7 @@ var SSEEvent = zod.z.discriminatedUnion("type", [
|
|
|
1779
1810
|
SSEToolOutputEvent,
|
|
1780
1811
|
SSESubRunTraceEvent,
|
|
1781
1812
|
SSERequiresUserInteractionEvent,
|
|
1813
|
+
SSELlmRetryEvent,
|
|
1782
1814
|
SSEErrorEvent,
|
|
1783
1815
|
SSETransportErrorEvent,
|
|
1784
1816
|
SSEContextUsageSnapshotEvent,
|
|
@@ -1898,6 +1930,8 @@ function runtimeEventToSSEEvent(event) {
|
|
|
1898
1930
|
subrun_parent_id: event.subrun_parent_id,
|
|
1899
1931
|
source_event_id: event.source_event_id,
|
|
1900
1932
|
kind: event.kind,
|
|
1933
|
+
retry: event.retry,
|
|
1934
|
+
failure: event.failure,
|
|
1901
1935
|
delta: event.delta,
|
|
1902
1936
|
content: event.content,
|
|
1903
1937
|
answer_id: event.answer_id,
|
|
@@ -1970,6 +2004,22 @@ function runtimeEventToSSEEvent(event) {
|
|
|
1970
2004
|
compression_ratio: event.compression_ratio,
|
|
1971
2005
|
included_old_summary: event.included_old_summary
|
|
1972
2006
|
};
|
|
2007
|
+
case "llm_retry":
|
|
2008
|
+
return {
|
|
2009
|
+
...base,
|
|
2010
|
+
type: "llm_retry",
|
|
2011
|
+
retry_id: event.retry_id,
|
|
2012
|
+
status: event.status,
|
|
2013
|
+
category: event.category,
|
|
2014
|
+
attempt: event.attempt,
|
|
2015
|
+
max_retries: event.max_retries,
|
|
2016
|
+
total_attempts: event.total_attempts,
|
|
2017
|
+
started_at: event.started_at,
|
|
2018
|
+
delay_ms: event.delay_ms,
|
|
2019
|
+
next_retry_at: event.next_retry_at,
|
|
2020
|
+
error: event.error,
|
|
2021
|
+
error_code: event.error_code
|
|
2022
|
+
};
|
|
1973
2023
|
case "error":
|
|
1974
2024
|
return {
|
|
1975
2025
|
...base,
|
|
@@ -1977,7 +2027,8 @@ function runtimeEventToSSEEvent(event) {
|
|
|
1977
2027
|
error: event.error,
|
|
1978
2028
|
details: event.details,
|
|
1979
2029
|
error_code: event.error_code,
|
|
1980
|
-
retryable: event.retryable
|
|
2030
|
+
retryable: event.retryable,
|
|
2031
|
+
retry_id: event.retry_id
|
|
1981
2032
|
};
|
|
1982
2033
|
case "context_usage_snapshot":
|
|
1983
2034
|
return {
|
|
@@ -2466,6 +2517,8 @@ exports.FinalAnswerCompletionReason = FinalAnswerCompletionReason;
|
|
|
2466
2517
|
exports.HistoryMessageReferenceIdSchema = HistoryMessageReferenceIdSchema;
|
|
2467
2518
|
exports.HistorySummaryMeta = HistorySummaryMeta;
|
|
2468
2519
|
exports.InteractionIdSchema = InteractionIdSchema;
|
|
2520
|
+
exports.LlmRetryCategory = LlmRetryCategory;
|
|
2521
|
+
exports.LlmRetryState = LlmRetryState;
|
|
2469
2522
|
exports.LlmUsageTokenLedgerEntry = LlmUsageTokenLedgerEntry;
|
|
2470
2523
|
exports.ObservationTruncationMeta = ObservationTruncationMeta;
|
|
2471
2524
|
exports.PersistentMetadata = PersistentMetadata;
|
|
@@ -2479,6 +2532,7 @@ exports.RunExecutionOutcome = RunExecutionOutcome;
|
|
|
2479
2532
|
exports.RunIdSchema = RunIdSchema;
|
|
2480
2533
|
exports.RunResumeClaimIdSchema = RunResumeClaimIdSchema;
|
|
2481
2534
|
exports.RunTokenUsageAggregate = RunTokenUsageAggregate;
|
|
2535
|
+
exports.RuntimeErrorState = RuntimeErrorState;
|
|
2482
2536
|
exports.RuntimeEvent = RuntimeEvent;
|
|
2483
2537
|
exports.RuntimeEventIdSchema = RuntimeEventIdSchema;
|
|
2484
2538
|
exports.RuntimeEventRoutingIdentity = RuntimeEventRoutingIdentity;
|
|
@@ -2495,6 +2549,7 @@ exports.SSEFinalAnswerChunkEvent = SSEFinalAnswerChunkEvent;
|
|
|
2495
2549
|
exports.SSEFinalAnswerEvent = SSEFinalAnswerEvent;
|
|
2496
2550
|
exports.SSEFinalAnswerResetEvent = SSEFinalAnswerResetEvent;
|
|
2497
2551
|
exports.SSEHistorySummaryEvent = SSEHistorySummaryEvent;
|
|
2552
|
+
exports.SSELlmRetryEvent = SSELlmRetryEvent;
|
|
2498
2553
|
exports.SSEMarkdownChunkEvent = SSEMarkdownChunkEvent;
|
|
2499
2554
|
exports.SSERequiresUserInteractionEvent = SSERequiresUserInteractionEvent;
|
|
2500
2555
|
exports.SSERunExecutionMetricsEvent = SSERunExecutionMetricsEvent;
|