@linnlabs/linnkit 0.37.4 → 0.38.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/cli.cjs +347 -179
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +347 -179
  5. package/dist/cli.js.map +1 -1
  6. package/dist/context-manager.cjs +55 -11
  7. package/dist/context-manager.cjs.map +1 -1
  8. package/dist/context-manager.js +55 -11
  9. package/dist/context-manager.js.map +1 -1
  10. package/dist/contracts/audit.d.cts +6 -6
  11. package/dist/contracts/audit.d.ts +6 -6
  12. package/dist/contracts/events.d.cts +532 -50
  13. package/dist/contracts/events.d.ts +532 -50
  14. package/dist/contracts/llm-retry.d.cts +47 -0
  15. package/dist/contracts/llm-retry.d.ts +47 -0
  16. package/dist/contracts/messages.d.cts +2 -2
  17. package/dist/contracts/messages.d.ts +2 -2
  18. package/dist/contracts/runtime-error.d.cts +26 -0
  19. package/dist/contracts/runtime-error.d.ts +26 -0
  20. package/dist/contracts/sse.d.cts +571 -55
  21. package/dist/contracts/sse.d.ts +571 -55
  22. package/dist/contracts/sub-run-trace-payload.d.cts +102 -6
  23. package/dist/contracts/sub-run-trace-payload.d.ts +102 -6
  24. package/dist/contracts/token-accounting.d.cts +18 -18
  25. package/dist/contracts/token-accounting.d.ts +18 -18
  26. package/dist/contracts.cjs +65 -10
  27. package/dist/contracts.cjs.map +1 -1
  28. package/dist/contracts.d.cts +4 -2
  29. package/dist/contracts.d.ts +4 -2
  30. package/dist/contracts.js +62 -11
  31. package/dist/contracts.js.map +1 -1
  32. package/dist/index.cjs +506 -286
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.js +506 -286
  35. package/dist/index.js.map +1 -1
  36. package/dist/ports/canonical-inference.d.cts +3 -0
  37. package/dist/ports/canonical-inference.d.ts +3 -0
  38. package/dist/ports/llm-call.d.cts +4 -0
  39. package/dist/ports/llm-call.d.ts +4 -0
  40. package/dist/quickstart.cjs +347 -179
  41. package/dist/quickstart.cjs.map +1 -1
  42. package/dist/quickstart.js +347 -179
  43. package/dist/quickstart.js.map +1 -1
  44. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.cts +8 -0
  45. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.ts +8 -0
  46. package/dist/runtime-kernel/events/agentEvents.d.cts +85 -4
  47. package/dist/runtime-kernel/events/agentEvents.d.ts +85 -4
  48. package/dist/runtime-kernel/events/eventGovernance.d.cts +1 -1
  49. package/dist/runtime-kernel/events/eventGovernance.d.ts +1 -1
  50. package/dist/runtime-kernel/events.cjs +55 -11
  51. package/dist/runtime-kernel/events.cjs.map +1 -1
  52. package/dist/runtime-kernel/events.js +55 -11
  53. package/dist/runtime-kernel/events.js.map +1 -1
  54. package/dist/runtime-kernel/llm/request-builder.d.cts +2 -0
  55. package/dist/runtime-kernel/llm/request-builder.d.ts +2 -0
  56. package/dist/runtime-kernel.cjs +468 -271
  57. package/dist/runtime-kernel.cjs.map +1 -1
  58. package/dist/runtime-kernel.js +468 -271
  59. package/dist/runtime-kernel.js.map +1 -1
  60. package/dist/shared/errorClassifier.d.cts +5 -0
  61. package/dist/shared/errorClassifier.d.ts +5 -0
  62. package/dist/testkit.cjs +466 -269
  63. package/dist/testkit.cjs.map +1 -1
  64. package/dist/testkit.js +466 -269
  65. package/dist/testkit.js.map +1 -1
  66. package/docs/integration/llm-provider.md +24 -0
  67. package/docs/integration/realtime.md +29 -0
  68. package/package.json +2 -2
@@ -57,7 +57,7 @@ declare const ContextTokenComponent: z.ZodObject<{
57
57
  estimatorVersion: z.ZodOptional<z.ZodString>;
58
58
  }, "strip", z.ZodTypeAny, {
59
59
  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";
60
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
61
61
  confidence: "estimate" | "provider-estimate" | "actual";
62
62
  componentId: string;
63
63
  tokens: number;
@@ -79,7 +79,7 @@ declare const ContextTokenComponent: z.ZodObject<{
79
79
  estimatorVersion?: string | undefined;
80
80
  }, {
81
81
  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";
82
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
83
83
  confidence: "estimate" | "provider-estimate" | "actual";
84
84
  componentId: string;
85
85
  tokens: number;
@@ -210,7 +210,6 @@ declare const LlmUsageTokenLedgerEntry: z.ZodObject<{
210
210
  conversationId?: 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
  conversationId?: 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>;
@@ -338,7 +338,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
338
338
  estimatorVersion: z.ZodOptional<z.ZodString>;
339
339
  }, "strip", z.ZodTypeAny, {
340
340
  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";
341
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
342
342
  confidence: "estimate" | "provider-estimate" | "actual";
343
343
  componentId: string;
344
344
  tokens: number;
@@ -360,7 +360,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
360
360
  estimatorVersion?: string | undefined;
361
361
  }, {
362
362
  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";
363
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
364
364
  confidence: "estimate" | "provider-estimate" | "actual";
365
365
  componentId: string;
366
366
  tokens: number;
@@ -387,7 +387,7 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
387
387
  kind: "context-component";
388
388
  components: {
389
389
  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";
390
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
391
391
  confidence: "estimate" | "provider-estimate" | "actual";
392
392
  componentId: string;
393
393
  tokens: number;
@@ -413,7 +413,6 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
413
413
  parentRunId?: string | undefined;
414
414
  conversationId?: string | undefined;
415
415
  turnId?: string | undefined;
416
- stepId?: string | undefined;
417
416
  route?: {
418
417
  modelId: string;
419
418
  capabilityId: string;
@@ -426,13 +425,14 @@ 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
434
  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";
435
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
436
436
  confidence: "estimate" | "provider-estimate" | "actual";
437
437
  componentId: string;
438
438
  tokens: number;
@@ -458,7 +458,6 @@ declare const ContextComponentTokenLedgerEntry: z.ZodObject<{
458
458
  parentRunId?: string | undefined;
459
459
  conversationId?: 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
  conversationId?: 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
  conversationId?: 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;
@@ -709,7 +709,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
709
709
  estimatorVersion: z.ZodOptional<z.ZodString>;
710
710
  }, "strip", z.ZodTypeAny, {
711
711
  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";
712
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
713
713
  confidence: "estimate" | "provider-estimate" | "actual";
714
714
  componentId: string;
715
715
  tokens: number;
@@ -731,7 +731,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
731
731
  estimatorVersion?: string | undefined;
732
732
  }, {
733
733
  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";
734
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
735
735
  confidence: "estimate" | "provider-estimate" | "actual";
736
736
  componentId: string;
737
737
  tokens: number;
@@ -758,7 +758,7 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
758
758
  kind: "context-component";
759
759
  components: {
760
760
  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";
761
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
762
762
  confidence: "estimate" | "provider-estimate" | "actual";
763
763
  componentId: string;
764
764
  tokens: number;
@@ -784,7 +784,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
784
784
  parentRunId?: string | undefined;
785
785
  conversationId?: string | undefined;
786
786
  turnId?: string | undefined;
787
- stepId?: string | undefined;
788
787
  route?: {
789
788
  modelId: string;
790
789
  capabilityId: string;
@@ -797,13 +796,14 @@ 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
805
  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";
806
+ kind: "user" | "system" | "other" | "tool" | "assistant" | "context-injection" | "history-summary" | "working-memory" | "fence" | "system-reminder" | "image-attachment";
807
807
  confidence: "estimate" | "provider-estimate" | "actual";
808
808
  componentId: string;
809
809
  tokens: number;
@@ -829,7 +829,6 @@ declare const TokenLedgerEntry: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
829
829
  parentRunId?: string | undefined;
830
830
  conversationId?: 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>;
@@ -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
- error: zod.z.string(),
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
- error: zod.z.string(),
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;