@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.
Files changed (65) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/cli.cjs +346 -178
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +346 -178
  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/events.d.cts +517 -35
  11. package/dist/contracts/events.d.ts +517 -35
  12. package/dist/contracts/llm-retry.d.cts +47 -0
  13. package/dist/contracts/llm-retry.d.ts +47 -0
  14. package/dist/contracts/runtime-error.d.cts +26 -0
  15. package/dist/contracts/runtime-error.d.ts +26 -0
  16. package/dist/contracts/sse.d.cts +555 -39
  17. package/dist/contracts/sse.d.ts +555 -39
  18. package/dist/contracts/sub-run-trace-payload.d.cts +102 -6
  19. package/dist/contracts/sub-run-trace-payload.d.ts +102 -6
  20. package/dist/contracts/token-accounting.d.cts +18 -18
  21. package/dist/contracts/token-accounting.d.ts +18 -18
  22. package/dist/contracts.cjs +65 -10
  23. package/dist/contracts.cjs.map +1 -1
  24. package/dist/contracts.d.cts +4 -2
  25. package/dist/contracts.d.ts +4 -2
  26. package/dist/contracts.js +62 -11
  27. package/dist/contracts.js.map +1 -1
  28. package/dist/index.cjs +551 -286
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.js +551 -286
  31. package/dist/index.js.map +1 -1
  32. package/dist/ports/canonical-inference.d.cts +3 -0
  33. package/dist/ports/canonical-inference.d.ts +3 -0
  34. package/dist/ports/llm-call.d.cts +4 -0
  35. package/dist/ports/llm-call.d.ts +4 -0
  36. package/dist/quickstart.cjs +346 -178
  37. package/dist/quickstart.cjs.map +1 -1
  38. package/dist/quickstart.js +346 -178
  39. package/dist/quickstart.js.map +1 -1
  40. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.cts +8 -0
  41. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.ts +8 -0
  42. package/dist/runtime-kernel/events/agentEvents.d.cts +85 -4
  43. package/dist/runtime-kernel/events/agentEvents.d.ts +85 -4
  44. package/dist/runtime-kernel/events/eventGovernance.d.cts +1 -1
  45. package/dist/runtime-kernel/events/eventGovernance.d.ts +1 -1
  46. package/dist/runtime-kernel/events.cjs +55 -11
  47. package/dist/runtime-kernel/events.cjs.map +1 -1
  48. package/dist/runtime-kernel/events.js +55 -11
  49. package/dist/runtime-kernel/events.js.map +1 -1
  50. package/dist/runtime-kernel/llm/request-builder.d.cts +2 -0
  51. package/dist/runtime-kernel/llm/request-builder.d.ts +2 -0
  52. package/dist/runtime-kernel.cjs +513 -271
  53. package/dist/runtime-kernel.cjs.map +1 -1
  54. package/dist/runtime-kernel.js +513 -271
  55. package/dist/runtime-kernel.js.map +1 -1
  56. package/dist/shared/errorClassifier.d.cts +5 -0
  57. package/dist/shared/errorClassifier.d.ts +5 -0
  58. package/dist/testkit.cjs +511 -269
  59. package/dist/testkit.cjs.map +1 -1
  60. package/dist/testkit.js +511 -269
  61. package/dist/testkit.js.map +1 -1
  62. package/docs/integration/llm-provider.md +24 -5
  63. package/docs/integration/realtime.md +29 -0
  64. package/docs/integration/tools.md +4 -0
  65. package/package.json +2 -2
@@ -562,7 +562,63 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
562
562
  subrun_id: z.ZodEffects<z.ZodString, string, string>;
563
563
  subrun_parent_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
564
564
  source_event_id: z.ZodEffects<z.ZodString, string, string>;
565
- kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
565
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
566
+ retry: z.ZodOptional<z.ZodObject<{
567
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
568
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
569
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
570
+ attempt: z.ZodNumber;
571
+ max_retries: z.ZodNumber;
572
+ total_attempts: z.ZodNumber;
573
+ started_at: z.ZodNumber;
574
+ delay_ms: z.ZodNumber;
575
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
576
+ error: z.ZodString;
577
+ error_code: z.ZodString;
578
+ }, "strict", z.ZodTypeAny, {
579
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
580
+ error: string;
581
+ error_code: string;
582
+ retry_id: string;
583
+ category: "transport" | "output" | "rate_limit" | "other";
584
+ attempt: number;
585
+ max_retries: number;
586
+ total_attempts: number;
587
+ started_at: number;
588
+ delay_ms: number;
589
+ next_retry_at?: number | undefined;
590
+ }, {
591
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
592
+ error: string;
593
+ error_code: string;
594
+ retry_id: string;
595
+ category: "transport" | "output" | "rate_limit" | "other";
596
+ attempt: number;
597
+ max_retries: number;
598
+ total_attempts: number;
599
+ started_at: number;
600
+ delay_ms: number;
601
+ next_retry_at?: number | undefined;
602
+ }>>;
603
+ failure: z.ZodOptional<z.ZodObject<{
604
+ error: z.ZodString;
605
+ error_code: z.ZodOptional<z.ZodString>;
606
+ retryable: z.ZodOptional<z.ZodBoolean>;
607
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
608
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
609
+ }, "strict", z.ZodTypeAny, {
610
+ error: string;
611
+ error_code?: string | undefined;
612
+ retry_id?: string | undefined;
613
+ retryable?: boolean | undefined;
614
+ details?: SerializableJsonValue | undefined;
615
+ }, {
616
+ error: string;
617
+ error_code?: string | undefined;
618
+ retry_id?: string | undefined;
619
+ retryable?: boolean | undefined;
620
+ details?: SerializableJsonValue | undefined;
621
+ }>>;
566
622
  delta: z.ZodOptional<z.ZodString>;
567
623
  content: z.ZodOptional<z.ZodString>;
568
624
  answer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -632,7 +688,7 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
632
688
  }, "strip", z.ZodTypeAny, {
633
689
  id: string;
634
690
  type: "subrun_trace";
635
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
691
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
636
692
  timestamp: number;
637
693
  conversation_id: string;
638
694
  turn_id: string;
@@ -663,6 +719,19 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
663
719
  fileName?: string | undefined;
664
720
  label?: string | undefined;
665
721
  }[] | undefined;
722
+ retry?: {
723
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
724
+ error: string;
725
+ error_code: string;
726
+ retry_id: string;
727
+ category: "transport" | "output" | "rate_limit" | "other";
728
+ attempt: number;
729
+ max_retries: number;
730
+ total_attempts: number;
731
+ started_at: number;
732
+ delay_ms: number;
733
+ next_retry_at?: number | undefined;
734
+ } | undefined;
666
735
  run_id?: (string & z.BRAND<"RunId">) | undefined;
667
736
  lane?: "foreground" | "auxiliary" | "child" | undefined;
668
737
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -671,10 +740,17 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
671
740
  meta?: Record<string, SerializableJsonValue> | undefined;
672
741
  duration_ms?: number | undefined;
673
742
  subrun_parent_id?: string | undefined;
743
+ output?: SerializableJsonValue | undefined;
744
+ failure?: {
745
+ error: string;
746
+ error_code?: string | undefined;
747
+ retry_id?: string | undefined;
748
+ retryable?: boolean | undefined;
749
+ details?: SerializableJsonValue | undefined;
750
+ } | undefined;
674
751
  answer_id?: string | undefined;
675
752
  seq?: number | undefined;
676
753
  is_last?: boolean | undefined;
677
- output?: SerializableJsonValue | undefined;
678
754
  original_message_count?: number | undefined;
679
755
  compression_ratio?: number | undefined;
680
756
  included_old_summary?: boolean | undefined;
@@ -684,7 +760,7 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
684
760
  }, {
685
761
  id: string;
686
762
  type: "subrun_trace";
687
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
763
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
688
764
  timestamp: number;
689
765
  conversation_id: string;
690
766
  turn_id: string;
@@ -715,6 +791,19 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
715
791
  fileName?: string | undefined;
716
792
  label?: string | undefined;
717
793
  }[] | undefined;
794
+ retry?: {
795
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
796
+ error: string;
797
+ error_code: string;
798
+ retry_id: string;
799
+ category: "transport" | "output" | "rate_limit" | "other";
800
+ attempt: number;
801
+ max_retries: number;
802
+ total_attempts: number;
803
+ started_at: number;
804
+ delay_ms: number;
805
+ next_retry_at?: number | undefined;
806
+ } | undefined;
718
807
  run_id?: string | undefined;
719
808
  lane?: "foreground" | "auxiliary" | "child" | undefined;
720
809
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -723,10 +812,17 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
723
812
  meta?: Record<string, SerializableJsonValue> | undefined;
724
813
  duration_ms?: number | undefined;
725
814
  subrun_parent_id?: string | undefined;
815
+ output?: SerializableJsonValue | undefined;
816
+ failure?: {
817
+ error: string;
818
+ error_code?: string | undefined;
819
+ retry_id?: string | undefined;
820
+ retryable?: boolean | undefined;
821
+ details?: SerializableJsonValue | undefined;
822
+ } | undefined;
726
823
  answer_id?: string | undefined;
727
824
  seq?: number | undefined;
728
825
  is_last?: boolean | undefined;
729
- output?: SerializableJsonValue | undefined;
730
826
  original_message_count?: number | undefined;
731
827
  compression_ratio?: number | undefined;
732
828
  included_old_summary?: boolean | undefined;
@@ -798,6 +894,78 @@ declare const SSERequiresUserInteractionEvent: z.ZodObject<{
798
894
  execution_seq?: number | undefined;
799
895
  }>;
800
896
  type SSERequiresUserInteractionEvent = z.infer<typeof SSERequiresUserInteractionEvent>;
897
+ declare const SSELlmRetryEvent: z.ZodObject<{
898
+ id: z.ZodEffects<z.ZodString, string, string>;
899
+ timestamp: z.ZodNumber;
900
+ conversation_id: z.ZodEffects<z.ZodString, string, string>;
901
+ turn_id: z.ZodEffects<z.ZodString, string, string>;
902
+ run_id: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "RunId">>;
903
+ execution_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
904
+ lane: z.ZodOptional<z.ZodEnum<["foreground", "auxiliary", "child"]>>;
905
+ visibility: z.ZodOptional<z.ZodEnum<["conversation", "parent-trace", "none"]>>;
906
+ execution_seq: z.ZodOptional<z.ZodNumber>;
907
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
908
+ } & {
909
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
910
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
911
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
912
+ attempt: z.ZodNumber;
913
+ max_retries: z.ZodNumber;
914
+ total_attempts: z.ZodNumber;
915
+ started_at: z.ZodNumber;
916
+ delay_ms: z.ZodNumber;
917
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
918
+ error: z.ZodString;
919
+ error_code: z.ZodString;
920
+ type: z.ZodLiteral<"llm_retry">;
921
+ }, "strip", z.ZodTypeAny, {
922
+ id: string;
923
+ type: "llm_retry";
924
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
925
+ error: string;
926
+ timestamp: number;
927
+ conversation_id: string;
928
+ turn_id: string;
929
+ error_code: string;
930
+ retry_id: string;
931
+ category: "transport" | "output" | "rate_limit" | "other";
932
+ attempt: number;
933
+ max_retries: number;
934
+ total_attempts: number;
935
+ started_at: number;
936
+ delay_ms: number;
937
+ metadata?: Record<string, SerializableJsonValue> | undefined;
938
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
939
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
940
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
941
+ next_retry_at?: number | undefined;
942
+ execution_id?: string | undefined;
943
+ execution_seq?: number | undefined;
944
+ }, {
945
+ id: string;
946
+ type: "llm_retry";
947
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
948
+ error: string;
949
+ timestamp: number;
950
+ conversation_id: string;
951
+ turn_id: string;
952
+ error_code: string;
953
+ retry_id: string;
954
+ category: "transport" | "output" | "rate_limit" | "other";
955
+ attempt: number;
956
+ max_retries: number;
957
+ total_attempts: number;
958
+ started_at: number;
959
+ delay_ms: number;
960
+ metadata?: Record<string, SerializableJsonValue> | undefined;
961
+ run_id?: string | undefined;
962
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
963
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
964
+ next_retry_at?: number | undefined;
965
+ execution_id?: string | undefined;
966
+ execution_seq?: number | undefined;
967
+ }>;
968
+ type SSELlmRetryEvent = z.infer<typeof SSELlmRetryEvent>;
801
969
  declare const SSEErrorEvent: z.ZodObject<{
802
970
  id: z.ZodEffects<z.ZodString, string, string>;
803
971
  timestamp: z.ZodNumber;
@@ -810,11 +978,12 @@ declare const SSEErrorEvent: z.ZodObject<{
810
978
  execution_seq: z.ZodOptional<z.ZodNumber>;
811
979
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
812
980
  } & {
813
- type: z.ZodLiteral<"error">;
814
981
  error: z.ZodString;
815
- details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
816
982
  error_code: z.ZodOptional<z.ZodString>;
817
983
  retryable: z.ZodOptional<z.ZodBoolean>;
984
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
985
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
986
+ type: z.ZodLiteral<"error">;
818
987
  }, "strip", z.ZodTypeAny, {
819
988
  id: string;
820
989
  type: "error";
@@ -827,8 +996,9 @@ declare const SSEErrorEvent: z.ZodObject<{
827
996
  lane?: "foreground" | "auxiliary" | "child" | undefined;
828
997
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
829
998
  error_code?: string | undefined;
830
- details?: SerializableJsonValue | undefined;
999
+ retry_id?: string | undefined;
831
1000
  retryable?: boolean | undefined;
1001
+ details?: SerializableJsonValue | undefined;
832
1002
  execution_id?: string | undefined;
833
1003
  execution_seq?: number | undefined;
834
1004
  }, {
@@ -843,8 +1013,9 @@ declare const SSEErrorEvent: z.ZodObject<{
843
1013
  lane?: "foreground" | "auxiliary" | "child" | undefined;
844
1014
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
845
1015
  error_code?: string | undefined;
846
- details?: SerializableJsonValue | undefined;
1016
+ retry_id?: string | undefined;
847
1017
  retryable?: boolean | undefined;
1018
+ details?: SerializableJsonValue | undefined;
848
1019
  execution_id?: string | undefined;
849
1020
  execution_seq?: number | undefined;
850
1021
  }>;
@@ -884,8 +1055,8 @@ declare const SSETransportErrorEvent: z.ZodObject<{
884
1055
  lane?: "foreground" | "auxiliary" | "child" | undefined;
885
1056
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
886
1057
  error_code?: string | undefined;
887
- details?: SerializableJsonValue | undefined;
888
1058
  retryable?: boolean | undefined;
1059
+ details?: SerializableJsonValue | undefined;
889
1060
  execution_seq?: number | undefined;
890
1061
  }, {
891
1062
  id: string;
@@ -900,8 +1071,8 @@ declare const SSETransportErrorEvent: z.ZodObject<{
900
1071
  lane?: "foreground" | "auxiliary" | "child" | undefined;
901
1072
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
902
1073
  error_code?: string | undefined;
903
- details?: SerializableJsonValue | undefined;
904
1074
  retryable?: boolean | undefined;
1075
+ details?: SerializableJsonValue | undefined;
905
1076
  execution_seq?: number | undefined;
906
1077
  }>;
907
1078
  type SSETransportErrorEvent = z.infer<typeof SSETransportErrorEvent>;
@@ -2036,7 +2207,63 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2036
2207
  subrun_id: z.ZodEffects<z.ZodString, string, string>;
2037
2208
  subrun_parent_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2038
2209
  source_event_id: z.ZodEffects<z.ZodString, string, string>;
2039
- kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
2210
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
2211
+ retry: z.ZodOptional<z.ZodObject<{
2212
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
2213
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
2214
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
2215
+ attempt: z.ZodNumber;
2216
+ max_retries: z.ZodNumber;
2217
+ total_attempts: z.ZodNumber;
2218
+ started_at: z.ZodNumber;
2219
+ delay_ms: z.ZodNumber;
2220
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
2221
+ error: z.ZodString;
2222
+ error_code: z.ZodString;
2223
+ }, "strict", z.ZodTypeAny, {
2224
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2225
+ error: string;
2226
+ error_code: string;
2227
+ retry_id: string;
2228
+ category: "transport" | "output" | "rate_limit" | "other";
2229
+ attempt: number;
2230
+ max_retries: number;
2231
+ total_attempts: number;
2232
+ started_at: number;
2233
+ delay_ms: number;
2234
+ next_retry_at?: number | undefined;
2235
+ }, {
2236
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2237
+ error: string;
2238
+ error_code: string;
2239
+ retry_id: string;
2240
+ category: "transport" | "output" | "rate_limit" | "other";
2241
+ attempt: number;
2242
+ max_retries: number;
2243
+ total_attempts: number;
2244
+ started_at: number;
2245
+ delay_ms: number;
2246
+ next_retry_at?: number | undefined;
2247
+ }>>;
2248
+ failure: z.ZodOptional<z.ZodObject<{
2249
+ error: z.ZodString;
2250
+ error_code: z.ZodOptional<z.ZodString>;
2251
+ retryable: z.ZodOptional<z.ZodBoolean>;
2252
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2253
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
2254
+ }, "strict", z.ZodTypeAny, {
2255
+ error: string;
2256
+ error_code?: string | undefined;
2257
+ retry_id?: string | undefined;
2258
+ retryable?: boolean | undefined;
2259
+ details?: SerializableJsonValue | undefined;
2260
+ }, {
2261
+ error: string;
2262
+ error_code?: string | undefined;
2263
+ retry_id?: string | undefined;
2264
+ retryable?: boolean | undefined;
2265
+ details?: SerializableJsonValue | undefined;
2266
+ }>>;
2040
2267
  delta: z.ZodOptional<z.ZodString>;
2041
2268
  content: z.ZodOptional<z.ZodString>;
2042
2269
  answer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -2106,7 +2333,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2106
2333
  }, "strip", z.ZodTypeAny, {
2107
2334
  id: string;
2108
2335
  type: "subrun_trace";
2109
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
2336
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
2110
2337
  timestamp: number;
2111
2338
  conversation_id: string;
2112
2339
  turn_id: string;
@@ -2137,6 +2364,19 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2137
2364
  fileName?: string | undefined;
2138
2365
  label?: string | undefined;
2139
2366
  }[] | undefined;
2367
+ retry?: {
2368
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2369
+ error: string;
2370
+ error_code: string;
2371
+ retry_id: string;
2372
+ category: "transport" | "output" | "rate_limit" | "other";
2373
+ attempt: number;
2374
+ max_retries: number;
2375
+ total_attempts: number;
2376
+ started_at: number;
2377
+ delay_ms: number;
2378
+ next_retry_at?: number | undefined;
2379
+ } | undefined;
2140
2380
  run_id?: (string & z.BRAND<"RunId">) | undefined;
2141
2381
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2142
2382
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -2145,10 +2385,17 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2145
2385
  meta?: Record<string, SerializableJsonValue> | undefined;
2146
2386
  duration_ms?: number | undefined;
2147
2387
  subrun_parent_id?: string | undefined;
2388
+ output?: SerializableJsonValue | undefined;
2389
+ failure?: {
2390
+ error: string;
2391
+ error_code?: string | undefined;
2392
+ retry_id?: string | undefined;
2393
+ retryable?: boolean | undefined;
2394
+ details?: SerializableJsonValue | undefined;
2395
+ } | undefined;
2148
2396
  answer_id?: string | undefined;
2149
2397
  seq?: number | undefined;
2150
2398
  is_last?: boolean | undefined;
2151
- output?: SerializableJsonValue | undefined;
2152
2399
  original_message_count?: number | undefined;
2153
2400
  compression_ratio?: number | undefined;
2154
2401
  included_old_summary?: boolean | undefined;
@@ -2158,7 +2405,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2158
2405
  }, {
2159
2406
  id: string;
2160
2407
  type: "subrun_trace";
2161
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
2408
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
2162
2409
  timestamp: number;
2163
2410
  conversation_id: string;
2164
2411
  turn_id: string;
@@ -2189,6 +2436,19 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2189
2436
  fileName?: string | undefined;
2190
2437
  label?: string | undefined;
2191
2438
  }[] | undefined;
2439
+ retry?: {
2440
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2441
+ error: string;
2442
+ error_code: string;
2443
+ retry_id: string;
2444
+ category: "transport" | "output" | "rate_limit" | "other";
2445
+ attempt: number;
2446
+ max_retries: number;
2447
+ total_attempts: number;
2448
+ started_at: number;
2449
+ delay_ms: number;
2450
+ next_retry_at?: number | undefined;
2451
+ } | undefined;
2192
2452
  run_id?: string | undefined;
2193
2453
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2194
2454
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -2197,10 +2457,17 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2197
2457
  meta?: Record<string, SerializableJsonValue> | undefined;
2198
2458
  duration_ms?: number | undefined;
2199
2459
  subrun_parent_id?: string | undefined;
2460
+ output?: SerializableJsonValue | undefined;
2461
+ failure?: {
2462
+ error: string;
2463
+ error_code?: string | undefined;
2464
+ retry_id?: string | undefined;
2465
+ retryable?: boolean | undefined;
2466
+ details?: SerializableJsonValue | undefined;
2467
+ } | undefined;
2200
2468
  answer_id?: string | undefined;
2201
2469
  seq?: number | undefined;
2202
2470
  is_last?: boolean | undefined;
2203
- output?: SerializableJsonValue | undefined;
2204
2471
  original_message_count?: number | undefined;
2205
2472
  compression_ratio?: number | undefined;
2206
2473
  included_old_summary?: boolean | undefined;
@@ -2280,11 +2547,82 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2280
2547
  execution_seq: z.ZodOptional<z.ZodNumber>;
2281
2548
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
2282
2549
  } & {
2283
- type: z.ZodLiteral<"error">;
2550
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
2551
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
2552
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
2553
+ attempt: z.ZodNumber;
2554
+ max_retries: z.ZodNumber;
2555
+ total_attempts: z.ZodNumber;
2556
+ started_at: z.ZodNumber;
2557
+ delay_ms: z.ZodNumber;
2558
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
2559
+ error: z.ZodString;
2560
+ error_code: z.ZodString;
2561
+ type: z.ZodLiteral<"llm_retry">;
2562
+ }, "strip", z.ZodTypeAny, {
2563
+ id: string;
2564
+ type: "llm_retry";
2565
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2566
+ error: string;
2567
+ timestamp: number;
2568
+ conversation_id: string;
2569
+ turn_id: string;
2570
+ error_code: string;
2571
+ retry_id: string;
2572
+ category: "transport" | "output" | "rate_limit" | "other";
2573
+ attempt: number;
2574
+ max_retries: number;
2575
+ total_attempts: number;
2576
+ started_at: number;
2577
+ delay_ms: number;
2578
+ metadata?: Record<string, SerializableJsonValue> | undefined;
2579
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
2580
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
2581
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
2582
+ next_retry_at?: number | undefined;
2583
+ execution_id?: string | undefined;
2584
+ execution_seq?: number | undefined;
2585
+ }, {
2586
+ id: string;
2587
+ type: "llm_retry";
2588
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2589
+ error: string;
2590
+ timestamp: number;
2591
+ conversation_id: string;
2592
+ turn_id: string;
2593
+ error_code: string;
2594
+ retry_id: string;
2595
+ category: "transport" | "output" | "rate_limit" | "other";
2596
+ attempt: number;
2597
+ max_retries: number;
2598
+ total_attempts: number;
2599
+ started_at: number;
2600
+ delay_ms: number;
2601
+ metadata?: Record<string, SerializableJsonValue> | undefined;
2602
+ run_id?: string | undefined;
2603
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
2604
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
2605
+ next_retry_at?: number | undefined;
2606
+ execution_id?: string | undefined;
2607
+ execution_seq?: number | undefined;
2608
+ }>, z.ZodObject<{
2609
+ id: z.ZodEffects<z.ZodString, string, string>;
2610
+ timestamp: z.ZodNumber;
2611
+ conversation_id: z.ZodEffects<z.ZodString, string, string>;
2612
+ turn_id: z.ZodEffects<z.ZodString, string, string>;
2613
+ run_id: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "RunId">>;
2614
+ execution_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2615
+ lane: z.ZodOptional<z.ZodEnum<["foreground", "auxiliary", "child"]>>;
2616
+ visibility: z.ZodOptional<z.ZodEnum<["conversation", "parent-trace", "none"]>>;
2617
+ execution_seq: z.ZodOptional<z.ZodNumber>;
2618
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
2619
+ } & {
2284
2620
  error: z.ZodString;
2285
- details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
2286
2621
  error_code: z.ZodOptional<z.ZodString>;
2287
2622
  retryable: z.ZodOptional<z.ZodBoolean>;
2623
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2624
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
2625
+ type: z.ZodLiteral<"error">;
2288
2626
  }, "strip", z.ZodTypeAny, {
2289
2627
  id: string;
2290
2628
  type: "error";
@@ -2297,8 +2635,9 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2297
2635
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2298
2636
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
2299
2637
  error_code?: string | undefined;
2300
- details?: SerializableJsonValue | undefined;
2638
+ retry_id?: string | undefined;
2301
2639
  retryable?: boolean | undefined;
2640
+ details?: SerializableJsonValue | undefined;
2302
2641
  execution_id?: string | undefined;
2303
2642
  execution_seq?: number | undefined;
2304
2643
  }, {
@@ -2313,8 +2652,9 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2313
2652
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2314
2653
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
2315
2654
  error_code?: string | undefined;
2316
- details?: SerializableJsonValue | undefined;
2655
+ retry_id?: string | undefined;
2317
2656
  retryable?: boolean | undefined;
2657
+ details?: SerializableJsonValue | undefined;
2318
2658
  execution_id?: string | undefined;
2319
2659
  execution_seq?: number | undefined;
2320
2660
  }>, z.ZodObject<{
@@ -2347,8 +2687,8 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2347
2687
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2348
2688
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
2349
2689
  error_code?: string | undefined;
2350
- details?: SerializableJsonValue | undefined;
2351
2690
  retryable?: boolean | undefined;
2691
+ details?: SerializableJsonValue | undefined;
2352
2692
  execution_seq?: number | undefined;
2353
2693
  }, {
2354
2694
  id: string;
@@ -2363,8 +2703,8 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2363
2703
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2364
2704
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
2365
2705
  error_code?: string | undefined;
2366
- details?: SerializableJsonValue | undefined;
2367
2706
  retryable?: boolean | undefined;
2707
+ details?: SerializableJsonValue | undefined;
2368
2708
  execution_seq?: number | undefined;
2369
2709
  }>, z.ZodObject<{
2370
2710
  id: z.ZodEffects<z.ZodString, string, string>;
@@ -3142,7 +3482,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3142
3482
  } | {
3143
3483
  id: string;
3144
3484
  type: "subrun_trace";
3145
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
3485
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
3146
3486
  timestamp: number;
3147
3487
  conversation_id: string;
3148
3488
  turn_id: string;
@@ -3173,6 +3513,19 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3173
3513
  fileName?: string | undefined;
3174
3514
  label?: string | undefined;
3175
3515
  }[] | undefined;
3516
+ retry?: {
3517
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
3518
+ error: string;
3519
+ error_code: string;
3520
+ retry_id: string;
3521
+ category: "transport" | "output" | "rate_limit" | "other";
3522
+ attempt: number;
3523
+ max_retries: number;
3524
+ total_attempts: number;
3525
+ started_at: number;
3526
+ delay_ms: number;
3527
+ next_retry_at?: number | undefined;
3528
+ } | undefined;
3176
3529
  run_id?: (string & z.BRAND<"RunId">) | undefined;
3177
3530
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3178
3531
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -3181,10 +3534,17 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3181
3534
  meta?: Record<string, SerializableJsonValue> | undefined;
3182
3535
  duration_ms?: number | undefined;
3183
3536
  subrun_parent_id?: string | undefined;
3537
+ output?: SerializableJsonValue | undefined;
3538
+ failure?: {
3539
+ error: string;
3540
+ error_code?: string | undefined;
3541
+ retry_id?: string | undefined;
3542
+ retryable?: boolean | undefined;
3543
+ details?: SerializableJsonValue | undefined;
3544
+ } | undefined;
3184
3545
  answer_id?: string | undefined;
3185
3546
  seq?: number | undefined;
3186
3547
  is_last?: boolean | undefined;
3187
- output?: SerializableJsonValue | undefined;
3188
3548
  original_message_count?: number | undefined;
3189
3549
  compression_ratio?: number | undefined;
3190
3550
  included_old_summary?: boolean | undefined;
@@ -3211,6 +3571,29 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3211
3571
  prompt?: string | undefined;
3212
3572
  execution_id?: string | undefined;
3213
3573
  execution_seq?: number | undefined;
3574
+ } | {
3575
+ id: string;
3576
+ type: "llm_retry";
3577
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
3578
+ error: string;
3579
+ timestamp: number;
3580
+ conversation_id: string;
3581
+ turn_id: string;
3582
+ error_code: string;
3583
+ retry_id: string;
3584
+ category: "transport" | "output" | "rate_limit" | "other";
3585
+ attempt: number;
3586
+ max_retries: number;
3587
+ total_attempts: number;
3588
+ started_at: number;
3589
+ delay_ms: number;
3590
+ metadata?: Record<string, SerializableJsonValue> | undefined;
3591
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
3592
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
3593
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
3594
+ next_retry_at?: number | undefined;
3595
+ execution_id?: string | undefined;
3596
+ execution_seq?: number | undefined;
3214
3597
  } | {
3215
3598
  id: string;
3216
3599
  type: "error";
@@ -3223,8 +3606,9 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3223
3606
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3224
3607
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
3225
3608
  error_code?: string | undefined;
3226
- details?: SerializableJsonValue | undefined;
3609
+ retry_id?: string | undefined;
3227
3610
  retryable?: boolean | undefined;
3611
+ details?: SerializableJsonValue | undefined;
3228
3612
  execution_id?: string | undefined;
3229
3613
  execution_seq?: number | undefined;
3230
3614
  } | {
@@ -3240,8 +3624,8 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3240
3624
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3241
3625
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
3242
3626
  error_code?: string | undefined;
3243
- details?: SerializableJsonValue | undefined;
3244
3627
  retryable?: boolean | undefined;
3628
+ details?: SerializableJsonValue | undefined;
3245
3629
  execution_seq?: number | undefined;
3246
3630
  } | {
3247
3631
  id: string;
@@ -3548,7 +3932,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3548
3932
  } | {
3549
3933
  id: string;
3550
3934
  type: "subrun_trace";
3551
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
3935
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
3552
3936
  timestamp: number;
3553
3937
  conversation_id: string;
3554
3938
  turn_id: string;
@@ -3579,6 +3963,19 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3579
3963
  fileName?: string | undefined;
3580
3964
  label?: string | undefined;
3581
3965
  }[] | undefined;
3966
+ retry?: {
3967
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
3968
+ error: string;
3969
+ error_code: string;
3970
+ retry_id: string;
3971
+ category: "transport" | "output" | "rate_limit" | "other";
3972
+ attempt: number;
3973
+ max_retries: number;
3974
+ total_attempts: number;
3975
+ started_at: number;
3976
+ delay_ms: number;
3977
+ next_retry_at?: number | undefined;
3978
+ } | undefined;
3582
3979
  run_id?: string | undefined;
3583
3980
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3584
3981
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -3587,10 +3984,17 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3587
3984
  meta?: Record<string, SerializableJsonValue> | undefined;
3588
3985
  duration_ms?: number | undefined;
3589
3986
  subrun_parent_id?: string | undefined;
3987
+ output?: SerializableJsonValue | undefined;
3988
+ failure?: {
3989
+ error: string;
3990
+ error_code?: string | undefined;
3991
+ retry_id?: string | undefined;
3992
+ retryable?: boolean | undefined;
3993
+ details?: SerializableJsonValue | undefined;
3994
+ } | undefined;
3590
3995
  answer_id?: string | undefined;
3591
3996
  seq?: number | undefined;
3592
3997
  is_last?: boolean | undefined;
3593
- output?: SerializableJsonValue | undefined;
3594
3998
  original_message_count?: number | undefined;
3595
3999
  compression_ratio?: number | undefined;
3596
4000
  included_old_summary?: boolean | undefined;
@@ -3617,6 +4021,29 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3617
4021
  prompt?: string | undefined;
3618
4022
  execution_id?: string | undefined;
3619
4023
  execution_seq?: number | undefined;
4024
+ } | {
4025
+ id: string;
4026
+ type: "llm_retry";
4027
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
4028
+ error: string;
4029
+ timestamp: number;
4030
+ conversation_id: string;
4031
+ turn_id: string;
4032
+ error_code: string;
4033
+ retry_id: string;
4034
+ category: "transport" | "output" | "rate_limit" | "other";
4035
+ attempt: number;
4036
+ max_retries: number;
4037
+ total_attempts: number;
4038
+ started_at: number;
4039
+ delay_ms: number;
4040
+ metadata?: Record<string, SerializableJsonValue> | undefined;
4041
+ run_id?: string | undefined;
4042
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
4043
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
4044
+ next_retry_at?: number | undefined;
4045
+ execution_id?: string | undefined;
4046
+ execution_seq?: number | undefined;
3620
4047
  } | {
3621
4048
  id: string;
3622
4049
  type: "error";
@@ -3629,8 +4056,9 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3629
4056
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3630
4057
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
3631
4058
  error_code?: string | undefined;
3632
- details?: SerializableJsonValue | undefined;
4059
+ retry_id?: string | undefined;
3633
4060
  retryable?: boolean | undefined;
4061
+ details?: SerializableJsonValue | undefined;
3634
4062
  execution_id?: string | undefined;
3635
4063
  execution_seq?: number | undefined;
3636
4064
  } | {
@@ -3646,8 +4074,8 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3646
4074
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3647
4075
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
3648
4076
  error_code?: string | undefined;
3649
- details?: SerializableJsonValue | undefined;
3650
4077
  retryable?: boolean | undefined;
4078
+ details?: SerializableJsonValue | undefined;
3651
4079
  execution_seq?: number | undefined;
3652
4080
  } | {
3653
4081
  id: string;
@@ -3958,7 +4386,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
3958
4386
  } | {
3959
4387
  id: string;
3960
4388
  type: "subrun_trace";
3961
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
4389
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
3962
4390
  timestamp: number;
3963
4391
  conversation_id: string;
3964
4392
  turn_id: string;
@@ -3989,6 +4417,19 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
3989
4417
  fileName?: string | undefined;
3990
4418
  label?: string | undefined;
3991
4419
  }[] | undefined;
4420
+ retry?: {
4421
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
4422
+ error: string;
4423
+ error_code: string;
4424
+ retry_id: string;
4425
+ category: "transport" | "output" | "rate_limit" | "other";
4426
+ attempt: number;
4427
+ max_retries: number;
4428
+ total_attempts: number;
4429
+ started_at: number;
4430
+ delay_ms: number;
4431
+ next_retry_at?: number | undefined;
4432
+ } | undefined;
3992
4433
  run_id?: string | undefined;
3993
4434
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3994
4435
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -3997,10 +4438,17 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
3997
4438
  meta?: Record<string, SerializableJsonValue> | undefined;
3998
4439
  duration_ms?: number | undefined;
3999
4440
  subrun_parent_id?: string | undefined;
4441
+ output?: SerializableJsonValue | undefined;
4442
+ failure?: {
4443
+ error: string;
4444
+ error_code?: string | undefined;
4445
+ retry_id?: string | undefined;
4446
+ retryable?: boolean | undefined;
4447
+ details?: SerializableJsonValue | undefined;
4448
+ } | undefined;
4000
4449
  answer_id?: string | undefined;
4001
4450
  seq?: number | undefined;
4002
4451
  is_last?: boolean | undefined;
4003
- output?: SerializableJsonValue | undefined;
4004
4452
  original_message_count?: number | undefined;
4005
4453
  compression_ratio?: number | undefined;
4006
4454
  included_old_summary?: boolean | undefined;
@@ -4027,6 +4475,29 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4027
4475
  prompt?: string | undefined;
4028
4476
  execution_id?: string | undefined;
4029
4477
  execution_seq?: number | undefined;
4478
+ } | {
4479
+ id: string;
4480
+ type: "llm_retry";
4481
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
4482
+ error: string;
4483
+ timestamp: number;
4484
+ conversation_id: string;
4485
+ turn_id: string;
4486
+ error_code: string;
4487
+ retry_id: string;
4488
+ category: "transport" | "output" | "rate_limit" | "other";
4489
+ attempt: number;
4490
+ max_retries: number;
4491
+ total_attempts: number;
4492
+ started_at: number;
4493
+ delay_ms: number;
4494
+ metadata?: Record<string, SerializableJsonValue> | undefined;
4495
+ run_id?: string | undefined;
4496
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
4497
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
4498
+ next_retry_at?: number | undefined;
4499
+ execution_id?: string | undefined;
4500
+ execution_seq?: number | undefined;
4030
4501
  } | {
4031
4502
  id: string;
4032
4503
  type: "error";
@@ -4039,8 +4510,9 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4039
4510
  lane?: "foreground" | "auxiliary" | "child" | undefined;
4040
4511
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
4041
4512
  error_code?: string | undefined;
4042
- details?: SerializableJsonValue | undefined;
4513
+ retry_id?: string | undefined;
4043
4514
  retryable?: boolean | undefined;
4515
+ details?: SerializableJsonValue | undefined;
4044
4516
  execution_id?: string | undefined;
4045
4517
  execution_seq?: number | undefined;
4046
4518
  } | {
@@ -4056,8 +4528,8 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4056
4528
  lane?: "foreground" | "auxiliary" | "child" | undefined;
4057
4529
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
4058
4530
  error_code?: string | undefined;
4059
- details?: SerializableJsonValue | undefined;
4060
4531
  retryable?: boolean | undefined;
4532
+ details?: SerializableJsonValue | undefined;
4061
4533
  execution_seq?: number | undefined;
4062
4534
  } | {
4063
4535
  id: string;
@@ -4364,7 +4836,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4364
4836
  } | {
4365
4837
  id: string;
4366
4838
  type: "subrun_trace";
4367
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
4839
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
4368
4840
  timestamp: number;
4369
4841
  conversation_id: string;
4370
4842
  turn_id: string;
@@ -4395,6 +4867,19 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4395
4867
  fileName?: string | undefined;
4396
4868
  label?: string | undefined;
4397
4869
  }[] | undefined;
4870
+ retry?: {
4871
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
4872
+ error: string;
4873
+ error_code: string;
4874
+ retry_id: string;
4875
+ category: "transport" | "output" | "rate_limit" | "other";
4876
+ attempt: number;
4877
+ max_retries: number;
4878
+ total_attempts: number;
4879
+ started_at: number;
4880
+ delay_ms: number;
4881
+ next_retry_at?: number | undefined;
4882
+ } | undefined;
4398
4883
  run_id?: (string & z.BRAND<"RunId">) | undefined;
4399
4884
  lane?: "foreground" | "auxiliary" | "child" | undefined;
4400
4885
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
@@ -4403,10 +4888,17 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4403
4888
  meta?: Record<string, SerializableJsonValue> | undefined;
4404
4889
  duration_ms?: number | undefined;
4405
4890
  subrun_parent_id?: string | undefined;
4891
+ output?: SerializableJsonValue | undefined;
4892
+ failure?: {
4893
+ error: string;
4894
+ error_code?: string | undefined;
4895
+ retry_id?: string | undefined;
4896
+ retryable?: boolean | undefined;
4897
+ details?: SerializableJsonValue | undefined;
4898
+ } | undefined;
4406
4899
  answer_id?: string | undefined;
4407
4900
  seq?: number | undefined;
4408
4901
  is_last?: boolean | undefined;
4409
- output?: SerializableJsonValue | undefined;
4410
4902
  original_message_count?: number | undefined;
4411
4903
  compression_ratio?: number | undefined;
4412
4904
  included_old_summary?: boolean | undefined;
@@ -4433,6 +4925,29 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4433
4925
  prompt?: string | undefined;
4434
4926
  execution_id?: string | undefined;
4435
4927
  execution_seq?: number | undefined;
4928
+ } | {
4929
+ id: string;
4930
+ type: "llm_retry";
4931
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
4932
+ error: string;
4933
+ timestamp: number;
4934
+ conversation_id: string;
4935
+ turn_id: string;
4936
+ error_code: string;
4937
+ retry_id: string;
4938
+ category: "transport" | "output" | "rate_limit" | "other";
4939
+ attempt: number;
4940
+ max_retries: number;
4941
+ total_attempts: number;
4942
+ started_at: number;
4943
+ delay_ms: number;
4944
+ metadata?: Record<string, SerializableJsonValue> | undefined;
4945
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
4946
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
4947
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
4948
+ next_retry_at?: number | undefined;
4949
+ execution_id?: string | undefined;
4950
+ execution_seq?: number | undefined;
4436
4951
  } | {
4437
4952
  id: string;
4438
4953
  type: "error";
@@ -4445,8 +4960,9 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4445
4960
  lane?: "foreground" | "auxiliary" | "child" | undefined;
4446
4961
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
4447
4962
  error_code?: string | undefined;
4448
- details?: SerializableJsonValue | undefined;
4963
+ retry_id?: string | undefined;
4449
4964
  retryable?: boolean | undefined;
4965
+ details?: SerializableJsonValue | undefined;
4450
4966
  execution_id?: string | undefined;
4451
4967
  execution_seq?: number | undefined;
4452
4968
  } | {
@@ -4462,8 +4978,8 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4462
4978
  lane?: "foreground" | "auxiliary" | "child" | undefined;
4463
4979
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
4464
4980
  error_code?: string | undefined;
4465
- details?: SerializableJsonValue | undefined;
4466
4981
  retryable?: boolean | undefined;
4982
+ details?: SerializableJsonValue | undefined;
4467
4983
  execution_seq?: number | undefined;
4468
4984
  } | {
4469
4985
  id: string;
@@ -4655,5 +5171,5 @@ declare const createSSERunStatusEvent: (id: string, conversationId: string, turn
4655
5171
  declare const createSSETransportEndEvent: (id: string, conversationId: string, turnId: string, options: SSEEventCreatorOptions<SSETransportEndEvent> & Pick<SSETransportEndEvent, "execution_id">) => SSETransportEndEvent;
4656
5172
  declare const createSSEHistorySummaryEvent: (id: string, conversationId: string, turnId: string, content: string, replacedMessageIds: readonly string[], originalMessageCount: number, summarySeq: number, options?: SSEEventCreatorOptions<SSEHistorySummaryEvent, "summary_id" | "content" | "replaced_message_ids" | "original_message_count" | "summary_seq">) => SSEHistorySummaryEvent;
4657
5173
 
4658
- export { BaseSSEEvent, SSEContextUsageSnapshotEvent, SSEErrorEvent, SSEEvent, SSEExecutionScope, SSEFinalAnswerChunkEvent, SSEFinalAnswerEvent, SSEFinalAnswerResetEvent, SSEHistorySummaryEvent, SSEMarkdownChunkEvent, SSERequiresUserInteractionEvent, SSERunExecutionMetricsEvent, SSERunStatusEvent, SSESubRunTraceEvent, SSESummarizationEndEvent, SSESummarizationErrorEvent, SSESummarizationStartEvent, SSEThoughtEvent, SSEToolCallDecisionEvent, SSEToolOutputEvent, SSEToolProcessEvent, SSETransportEndEvent, SSETransportErrorEvent, createSSEErrorEvent, createSSEFinalAnswerChunkEvent, createSSEFinalAnswerEvent, createSSEHistorySummaryEvent, createSSEMarkdownChunkEvent, createSSERequiresUserInteractionEvent, createSSERunStatusEvent, createSSESubRunTraceEvent, createSSEThoughtEvent, createSSEToolCallDecisionEvent, createSSEToolOutputEvent, createSSEToolProcessEvent, createSSETransportEndEvent, createSSETransportErrorEvent, parseSSEExecutionScope, runtimeEventToSSEEvent, validateSSEEvent };
5174
+ export { BaseSSEEvent, SSEContextUsageSnapshotEvent, SSEErrorEvent, SSEEvent, SSEExecutionScope, SSEFinalAnswerChunkEvent, SSEFinalAnswerEvent, SSEFinalAnswerResetEvent, SSEHistorySummaryEvent, SSELlmRetryEvent, SSEMarkdownChunkEvent, SSERequiresUserInteractionEvent, SSERunExecutionMetricsEvent, SSERunStatusEvent, SSESubRunTraceEvent, SSESummarizationEndEvent, SSESummarizationErrorEvent, SSESummarizationStartEvent, SSEThoughtEvent, SSEToolCallDecisionEvent, SSEToolOutputEvent, SSEToolProcessEvent, SSETransportEndEvent, SSETransportErrorEvent, createSSEErrorEvent, createSSEFinalAnswerChunkEvent, createSSEFinalAnswerEvent, createSSEHistorySummaryEvent, createSSEMarkdownChunkEvent, createSSERequiresUserInteractionEvent, createSSERunStatusEvent, createSSESubRunTraceEvent, createSSEThoughtEvent, createSSEToolCallDecisionEvent, createSSEToolOutputEvent, createSSEToolProcessEvent, createSSETransportEndEvent, createSSETransportErrorEvent, parseSSEExecutionScope, runtimeEventToSSEEvent, validateSSEEvent };
4659
5175
  export type { SSEEventInput };