@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
@@ -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: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
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: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
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>>;
@@ -635,7 +691,7 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
635
691
  conversation_id: string;
636
692
  timestamp: number;
637
693
  turn_id: string;
638
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
694
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
639
695
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
640
696
  subrun_id: string;
641
697
  source_event_id: string;
@@ -670,11 +726,31 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
670
726
  meta?: Record<string, SerializableJsonValue> | undefined;
671
727
  duration_ms?: number | undefined;
672
728
  subrun_parent_id?: string | undefined;
729
+ output?: SerializableJsonValue | undefined;
730
+ retry?: {
731
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
732
+ error: string;
733
+ error_code: string;
734
+ retry_id: string;
735
+ category: "transport" | "output" | "rate_limit" | "other";
736
+ attempt: number;
737
+ max_retries: number;
738
+ total_attempts: number;
739
+ started_at: number;
740
+ delay_ms: number;
741
+ next_retry_at?: number | undefined;
742
+ } | undefined;
743
+ failure?: {
744
+ error: string;
745
+ error_code?: string | undefined;
746
+ retry_id?: string | undefined;
747
+ retryable?: boolean | undefined;
748
+ details?: SerializableJsonValue | undefined;
749
+ } | undefined;
673
750
  answer_id?: string | undefined;
674
751
  seq?: number | undefined;
675
752
  is_last?: boolean | undefined;
676
753
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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;
@@ -687,7 +763,7 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
687
763
  conversation_id: string;
688
764
  timestamp: number;
689
765
  turn_id: string;
690
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
766
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
691
767
  parent_tool_call_id: string;
692
768
  subrun_id: string;
693
769
  source_event_id: string;
@@ -722,11 +798,31 @@ declare const SSESubRunTraceEvent: z.ZodObject<{
722
798
  meta?: Record<string, SerializableJsonValue> | undefined;
723
799
  duration_ms?: number | undefined;
724
800
  subrun_parent_id?: string | undefined;
801
+ output?: SerializableJsonValue | undefined;
802
+ retry?: {
803
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
804
+ error: string;
805
+ error_code: string;
806
+ retry_id: string;
807
+ category: "transport" | "output" | "rate_limit" | "other";
808
+ attempt: number;
809
+ max_retries: number;
810
+ total_attempts: number;
811
+ started_at: number;
812
+ delay_ms: number;
813
+ next_retry_at?: number | undefined;
814
+ } | undefined;
815
+ failure?: {
816
+ error: string;
817
+ error_code?: string | undefined;
818
+ retry_id?: string | undefined;
819
+ retryable?: boolean | undefined;
820
+ details?: SerializableJsonValue | undefined;
821
+ } | undefined;
725
822
  answer_id?: string | undefined;
726
823
  seq?: number | undefined;
727
824
  is_last?: boolean | undefined;
728
825
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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
+ type: "llm_retry";
923
+ id: string;
924
+ conversation_id: string;
925
+ timestamp: number;
926
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
927
+ turn_id: string;
928
+ error: 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?: "conversation" | "parent-trace" | "none" | undefined;
941
+ next_retry_at?: number | undefined;
942
+ execution_id?: string | undefined;
943
+ execution_seq?: number | undefined;
944
+ }, {
945
+ type: "llm_retry";
946
+ id: string;
947
+ conversation_id: string;
948
+ timestamp: number;
949
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
950
+ turn_id: string;
951
+ error: 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?: "conversation" | "parent-trace" | "none" | 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
  type: "error";
820
989
  id: string;
@@ -827,8 +996,9 @@ declare const SSEErrorEvent: z.ZodObject<{
827
996
  lane?: "foreground" | "auxiliary" | "child" | undefined;
828
997
  visibility?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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
  type: "transport_error";
@@ -900,8 +1071,8 @@ declare const SSETransportErrorEvent: z.ZodObject<{
900
1071
  lane?: "foreground" | "auxiliary" | "child" | undefined;
901
1072
  visibility?: "conversation" | "parent-trace" | "none" | 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>;
@@ -1194,7 +1365,7 @@ declare const SSERunExecutionMetricsEvent: z.ZodObject<{
1194
1365
  timestamp: number;
1195
1366
  turn_id: string;
1196
1367
  duration_ms: number;
1197
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
1368
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
1198
1369
  execution_id: string;
1199
1370
  metadata?: Record<string, SerializableJsonValue> | undefined;
1200
1371
  run_id?: (string & z.BRAND<"RunId">) | undefined;
@@ -1227,7 +1398,7 @@ declare const SSERunExecutionMetricsEvent: z.ZodObject<{
1227
1398
  timestamp: number;
1228
1399
  turn_id: string;
1229
1400
  duration_ms: number;
1230
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
1401
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
1231
1402
  execution_id: string;
1232
1403
  metadata?: Record<string, SerializableJsonValue> | undefined;
1233
1404
  run_id?: string | undefined;
@@ -1275,7 +1446,7 @@ declare const SSERunStatusEvent: z.ZodObject<{
1275
1446
  id: string;
1276
1447
  conversation_id: string;
1277
1448
  timestamp: number;
1278
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
1449
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
1279
1450
  turn_id: string;
1280
1451
  run_id: string & z.BRAND<"RunId">;
1281
1452
  execution_id: string;
@@ -1289,7 +1460,7 @@ declare const SSERunStatusEvent: z.ZodObject<{
1289
1460
  id: string;
1290
1461
  conversation_id: string;
1291
1462
  timestamp: number;
1292
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
1463
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
1293
1464
  turn_id: string;
1294
1465
  run_id: string;
1295
1466
  execution_id: string;
@@ -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: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
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: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
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>>;
@@ -2109,7 +2336,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2109
2336
  conversation_id: string;
2110
2337
  timestamp: number;
2111
2338
  turn_id: string;
2112
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
2339
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
2113
2340
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
2114
2341
  subrun_id: string;
2115
2342
  source_event_id: string;
@@ -2144,11 +2371,31 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2144
2371
  meta?: Record<string, SerializableJsonValue> | undefined;
2145
2372
  duration_ms?: number | undefined;
2146
2373
  subrun_parent_id?: string | undefined;
2374
+ output?: SerializableJsonValue | undefined;
2375
+ retry?: {
2376
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
2377
+ error: string;
2378
+ error_code: string;
2379
+ retry_id: string;
2380
+ category: "transport" | "output" | "rate_limit" | "other";
2381
+ attempt: number;
2382
+ max_retries: number;
2383
+ total_attempts: number;
2384
+ started_at: number;
2385
+ delay_ms: number;
2386
+ next_retry_at?: number | undefined;
2387
+ } | undefined;
2388
+ failure?: {
2389
+ error: string;
2390
+ error_code?: string | undefined;
2391
+ retry_id?: string | undefined;
2392
+ retryable?: boolean | undefined;
2393
+ details?: SerializableJsonValue | undefined;
2394
+ } | undefined;
2147
2395
  answer_id?: string | undefined;
2148
2396
  seq?: number | undefined;
2149
2397
  is_last?: boolean | undefined;
2150
2398
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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;
@@ -2161,7 +2408,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2161
2408
  conversation_id: string;
2162
2409
  timestamp: number;
2163
2410
  turn_id: string;
2164
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
2411
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
2165
2412
  parent_tool_call_id: string;
2166
2413
  subrun_id: string;
2167
2414
  source_event_id: string;
@@ -2196,11 +2443,31 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2196
2443
  meta?: Record<string, SerializableJsonValue> | undefined;
2197
2444
  duration_ms?: number | undefined;
2198
2445
  subrun_parent_id?: string | undefined;
2446
+ output?: SerializableJsonValue | undefined;
2447
+ retry?: {
2448
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
2449
+ error: string;
2450
+ error_code: string;
2451
+ retry_id: string;
2452
+ category: "transport" | "output" | "rate_limit" | "other";
2453
+ attempt: number;
2454
+ max_retries: number;
2455
+ total_attempts: number;
2456
+ started_at: number;
2457
+ delay_ms: number;
2458
+ next_retry_at?: number | undefined;
2459
+ } | undefined;
2460
+ failure?: {
2461
+ error: string;
2462
+ error_code?: string | undefined;
2463
+ retry_id?: string | undefined;
2464
+ retryable?: boolean | undefined;
2465
+ details?: SerializableJsonValue | undefined;
2466
+ } | undefined;
2199
2467
  answer_id?: string | undefined;
2200
2468
  seq?: number | undefined;
2201
2469
  is_last?: boolean | undefined;
2202
2470
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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
+ type: "llm_retry";
2564
+ id: string;
2565
+ conversation_id: string;
2566
+ timestamp: number;
2567
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
2568
+ turn_id: string;
2569
+ error: 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?: "conversation" | "parent-trace" | "none" | undefined;
2582
+ next_retry_at?: number | undefined;
2583
+ execution_id?: string | undefined;
2584
+ execution_seq?: number | undefined;
2585
+ }, {
2586
+ type: "llm_retry";
2587
+ id: string;
2588
+ conversation_id: string;
2589
+ timestamp: number;
2590
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
2591
+ turn_id: string;
2592
+ error: 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?: "conversation" | "parent-trace" | "none" | 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
  type: "error";
2290
2628
  id: string;
@@ -2297,8 +2635,9 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2297
2635
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2298
2636
  visibility?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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
  type: "transport_error";
@@ -2363,8 +2703,8 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2363
2703
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2364
2704
  visibility?: "conversation" | "parent-trace" | "none" | 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>;
@@ -2653,7 +2993,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2653
2993
  timestamp: number;
2654
2994
  turn_id: string;
2655
2995
  duration_ms: number;
2656
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
2996
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
2657
2997
  execution_id: string;
2658
2998
  metadata?: Record<string, SerializableJsonValue> | undefined;
2659
2999
  run_id?: (string & z.BRAND<"RunId">) | undefined;
@@ -2686,7 +3026,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2686
3026
  timestamp: number;
2687
3027
  turn_id: string;
2688
3028
  duration_ms: number;
2689
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
3029
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
2690
3030
  execution_id: string;
2691
3031
  metadata?: Record<string, SerializableJsonValue> | undefined;
2692
3032
  run_id?: string | undefined;
@@ -2732,7 +3072,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2732
3072
  id: string;
2733
3073
  conversation_id: string;
2734
3074
  timestamp: number;
2735
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
3075
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
2736
3076
  turn_id: string;
2737
3077
  run_id: string & z.BRAND<"RunId">;
2738
3078
  execution_id: string;
@@ -2746,7 +3086,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
2746
3086
  id: string;
2747
3087
  conversation_id: string;
2748
3088
  timestamp: number;
2749
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
3089
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
2750
3090
  turn_id: string;
2751
3091
  run_id: string;
2752
3092
  execution_id: string;
@@ -3145,7 +3485,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3145
3485
  conversation_id: string;
3146
3486
  timestamp: number;
3147
3487
  turn_id: string;
3148
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
3488
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
3149
3489
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
3150
3490
  subrun_id: string;
3151
3491
  source_event_id: string;
@@ -3180,11 +3520,31 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3180
3520
  meta?: Record<string, SerializableJsonValue> | undefined;
3181
3521
  duration_ms?: number | undefined;
3182
3522
  subrun_parent_id?: string | undefined;
3523
+ output?: SerializableJsonValue | undefined;
3524
+ retry?: {
3525
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
3526
+ error: string;
3527
+ error_code: string;
3528
+ retry_id: string;
3529
+ category: "transport" | "output" | "rate_limit" | "other";
3530
+ attempt: number;
3531
+ max_retries: number;
3532
+ total_attempts: number;
3533
+ started_at: number;
3534
+ delay_ms: number;
3535
+ next_retry_at?: number | undefined;
3536
+ } | undefined;
3537
+ failure?: {
3538
+ error: string;
3539
+ error_code?: string | undefined;
3540
+ retry_id?: string | undefined;
3541
+ retryable?: boolean | undefined;
3542
+ details?: SerializableJsonValue | undefined;
3543
+ } | undefined;
3183
3544
  answer_id?: string | undefined;
3184
3545
  seq?: number | undefined;
3185
3546
  is_last?: boolean | undefined;
3186
3547
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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
+ type: "llm_retry";
3576
+ id: string;
3577
+ conversation_id: string;
3578
+ timestamp: number;
3579
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
3580
+ turn_id: string;
3581
+ error: 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?: "conversation" | "parent-trace" | "none" | undefined;
3594
+ next_retry_at?: number | undefined;
3595
+ execution_id?: string | undefined;
3596
+ execution_seq?: number | undefined;
3214
3597
  } | {
3215
3598
  type: "error";
3216
3599
  id: string;
@@ -3223,8 +3606,9 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3223
3606
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3224
3607
  visibility?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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
  type: "context_usage_snapshot";
@@ -3281,7 +3665,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3281
3665
  timestamp: number;
3282
3666
  turn_id: string;
3283
3667
  duration_ms: number;
3284
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
3668
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
3285
3669
  execution_id: string;
3286
3670
  metadata?: Record<string, SerializableJsonValue> | undefined;
3287
3671
  run_id?: (string & z.BRAND<"RunId">) | undefined;
@@ -3312,7 +3696,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3312
3696
  id: string;
3313
3697
  conversation_id: string;
3314
3698
  timestamp: number;
3315
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
3699
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
3316
3700
  turn_id: string;
3317
3701
  run_id: string & z.BRAND<"RunId">;
3318
3702
  execution_id: string;
@@ -3551,7 +3935,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3551
3935
  conversation_id: string;
3552
3936
  timestamp: number;
3553
3937
  turn_id: string;
3554
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
3938
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
3555
3939
  parent_tool_call_id: string;
3556
3940
  subrun_id: string;
3557
3941
  source_event_id: string;
@@ -3586,11 +3970,31 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3586
3970
  meta?: Record<string, SerializableJsonValue> | undefined;
3587
3971
  duration_ms?: number | undefined;
3588
3972
  subrun_parent_id?: string | undefined;
3973
+ output?: SerializableJsonValue | undefined;
3974
+ retry?: {
3975
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
3976
+ error: string;
3977
+ error_code: string;
3978
+ retry_id: string;
3979
+ category: "transport" | "output" | "rate_limit" | "other";
3980
+ attempt: number;
3981
+ max_retries: number;
3982
+ total_attempts: number;
3983
+ started_at: number;
3984
+ delay_ms: number;
3985
+ next_retry_at?: number | undefined;
3986
+ } | undefined;
3987
+ failure?: {
3988
+ error: string;
3989
+ error_code?: string | undefined;
3990
+ retry_id?: string | undefined;
3991
+ retryable?: boolean | undefined;
3992
+ details?: SerializableJsonValue | undefined;
3993
+ } | undefined;
3589
3994
  answer_id?: string | undefined;
3590
3995
  seq?: number | undefined;
3591
3996
  is_last?: boolean | undefined;
3592
3997
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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
+ type: "llm_retry";
4026
+ id: string;
4027
+ conversation_id: string;
4028
+ timestamp: number;
4029
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4030
+ turn_id: string;
4031
+ error: 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?: "conversation" | "parent-trace" | "none" | undefined;
4044
+ next_retry_at?: number | undefined;
4045
+ execution_id?: string | undefined;
4046
+ execution_seq?: number | undefined;
3620
4047
  } | {
3621
4048
  type: "error";
3622
4049
  id: string;
@@ -3629,8 +4056,9 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3629
4056
  lane?: "foreground" | "auxiliary" | "child" | undefined;
3630
4057
  visibility?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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
  type: "context_usage_snapshot";
@@ -3687,7 +4115,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3687
4115
  timestamp: number;
3688
4116
  turn_id: string;
3689
4117
  duration_ms: number;
3690
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
4118
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
3691
4119
  execution_id: string;
3692
4120
  metadata?: Record<string, SerializableJsonValue> | undefined;
3693
4121
  run_id?: string | undefined;
@@ -3718,7 +4146,7 @@ declare const SSEEvent: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObjec
3718
4146
  id: string;
3719
4147
  conversation_id: string;
3720
4148
  timestamp: number;
3721
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
4149
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
3722
4150
  turn_id: string;
3723
4151
  run_id: string;
3724
4152
  execution_id: string;
@@ -3961,7 +4389,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
3961
4389
  conversation_id: string;
3962
4390
  timestamp: number;
3963
4391
  turn_id: string;
3964
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
4392
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
3965
4393
  parent_tool_call_id: string;
3966
4394
  subrun_id: string;
3967
4395
  source_event_id: string;
@@ -3996,11 +4424,31 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
3996
4424
  meta?: Record<string, SerializableJsonValue> | undefined;
3997
4425
  duration_ms?: number | undefined;
3998
4426
  subrun_parent_id?: string | undefined;
4427
+ output?: SerializableJsonValue | undefined;
4428
+ retry?: {
4429
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4430
+ error: string;
4431
+ error_code: string;
4432
+ retry_id: string;
4433
+ category: "transport" | "output" | "rate_limit" | "other";
4434
+ attempt: number;
4435
+ max_retries: number;
4436
+ total_attempts: number;
4437
+ started_at: number;
4438
+ delay_ms: number;
4439
+ next_retry_at?: number | undefined;
4440
+ } | undefined;
4441
+ failure?: {
4442
+ error: string;
4443
+ error_code?: string | undefined;
4444
+ retry_id?: string | undefined;
4445
+ retryable?: boolean | undefined;
4446
+ details?: SerializableJsonValue | undefined;
4447
+ } | undefined;
3999
4448
  answer_id?: string | undefined;
4000
4449
  seq?: number | undefined;
4001
4450
  is_last?: boolean | undefined;
4002
4451
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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
+ type: "llm_retry";
4480
+ id: string;
4481
+ conversation_id: string;
4482
+ timestamp: number;
4483
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4484
+ turn_id: string;
4485
+ error: 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?: "conversation" | "parent-trace" | "none" | undefined;
4498
+ next_retry_at?: number | undefined;
4499
+ execution_id?: string | undefined;
4500
+ execution_seq?: number | undefined;
4030
4501
  } | {
4031
4502
  type: "error";
4032
4503
  id: string;
@@ -4039,8 +4510,9 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4039
4510
  lane?: "foreground" | "auxiliary" | "child" | undefined;
4040
4511
  visibility?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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
  type: "context_usage_snapshot";
@@ -4097,7 +4569,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4097
4569
  timestamp: number;
4098
4570
  turn_id: string;
4099
4571
  duration_ms: number;
4100
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
4572
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
4101
4573
  execution_id: string;
4102
4574
  metadata?: Record<string, SerializableJsonValue> | undefined;
4103
4575
  run_id?: string | undefined;
@@ -4128,7 +4600,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4128
4600
  id: string;
4129
4601
  conversation_id: string;
4130
4602
  timestamp: number;
4131
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
4603
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
4132
4604
  turn_id: string;
4133
4605
  run_id: string;
4134
4606
  execution_id: string;
@@ -4367,7 +4839,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4367
4839
  conversation_id: string;
4368
4840
  timestamp: number;
4369
4841
  turn_id: string;
4370
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
4842
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
4371
4843
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
4372
4844
  subrun_id: string;
4373
4845
  source_event_id: string;
@@ -4402,11 +4874,31 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4402
4874
  meta?: Record<string, SerializableJsonValue> | undefined;
4403
4875
  duration_ms?: number | undefined;
4404
4876
  subrun_parent_id?: string | undefined;
4877
+ output?: SerializableJsonValue | undefined;
4878
+ retry?: {
4879
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4880
+ error: string;
4881
+ error_code: string;
4882
+ retry_id: string;
4883
+ category: "transport" | "output" | "rate_limit" | "other";
4884
+ attempt: number;
4885
+ max_retries: number;
4886
+ total_attempts: number;
4887
+ started_at: number;
4888
+ delay_ms: number;
4889
+ next_retry_at?: number | undefined;
4890
+ } | undefined;
4891
+ failure?: {
4892
+ error: string;
4893
+ error_code?: string | undefined;
4894
+ retry_id?: string | undefined;
4895
+ retryable?: boolean | undefined;
4896
+ details?: SerializableJsonValue | undefined;
4897
+ } | undefined;
4405
4898
  answer_id?: string | undefined;
4406
4899
  seq?: number | undefined;
4407
4900
  is_last?: boolean | undefined;
4408
4901
  completion_reason?: "tool_call" | "terminal" | "interrupted" | 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
+ type: "llm_retry";
4930
+ id: string;
4931
+ conversation_id: string;
4932
+ timestamp: number;
4933
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4934
+ turn_id: string;
4935
+ error: 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?: "conversation" | "parent-trace" | "none" | undefined;
4948
+ next_retry_at?: number | undefined;
4949
+ execution_id?: string | undefined;
4950
+ execution_seq?: number | undefined;
4436
4951
  } | {
4437
4952
  type: "error";
4438
4953
  id: string;
@@ -4445,8 +4960,9 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4445
4960
  lane?: "foreground" | "auxiliary" | "child" | undefined;
4446
4961
  visibility?: "conversation" | "parent-trace" | "none" | 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?: "conversation" | "parent-trace" | "none" | 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
  type: "context_usage_snapshot";
@@ -4503,7 +5019,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4503
5019
  timestamp: number;
4504
5020
  turn_id: string;
4505
5021
  duration_ms: number;
4506
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
5022
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
4507
5023
  execution_id: string;
4508
5024
  metadata?: Record<string, SerializableJsonValue> | undefined;
4509
5025
  run_id?: (string & z.BRAND<"RunId">) | undefined;
@@ -4534,7 +5050,7 @@ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
4534
5050
  id: string;
4535
5051
  conversation_id: string;
4536
5052
  timestamp: number;
4537
- status: "pending" | "cancelled" | "paused" | "completed" | "awaiting_user" | "failed" | "running";
5053
+ status: "failed" | "cancelled" | "pending" | "paused" | "completed" | "awaiting_user" | "running";
4538
5054
  turn_id: string;
4539
5055
  run_id: string & z.BRAND<"RunId">;
4540
5056
  execution_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 };