@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
@@ -1446,7 +1446,63 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1446
1446
  subrun_id: z.ZodEffects<z.ZodString, string, string>;
1447
1447
  subrun_parent_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1448
1448
  source_event_id: z.ZodEffects<z.ZodString, string, string>;
1449
- kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
1449
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
1450
+ retry: z.ZodOptional<z.ZodObject<{
1451
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
1452
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
1453
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
1454
+ attempt: z.ZodNumber;
1455
+ max_retries: z.ZodNumber;
1456
+ total_attempts: z.ZodNumber;
1457
+ started_at: z.ZodNumber;
1458
+ delay_ms: z.ZodNumber;
1459
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
1460
+ error: z.ZodString;
1461
+ error_code: z.ZodString;
1462
+ }, "strict", z.ZodTypeAny, {
1463
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
1464
+ error: string;
1465
+ error_code: string;
1466
+ retry_id: string;
1467
+ category: "transport" | "output" | "rate_limit" | "other";
1468
+ attempt: number;
1469
+ max_retries: number;
1470
+ total_attempts: number;
1471
+ started_at: number;
1472
+ delay_ms: number;
1473
+ next_retry_at?: number | undefined;
1474
+ }, {
1475
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
1476
+ error: string;
1477
+ error_code: string;
1478
+ retry_id: string;
1479
+ category: "transport" | "output" | "rate_limit" | "other";
1480
+ attempt: number;
1481
+ max_retries: number;
1482
+ total_attempts: number;
1483
+ started_at: number;
1484
+ delay_ms: number;
1485
+ next_retry_at?: number | undefined;
1486
+ }>>;
1487
+ failure: z.ZodOptional<z.ZodObject<{
1488
+ error: z.ZodString;
1489
+ error_code: z.ZodOptional<z.ZodString>;
1490
+ retryable: z.ZodOptional<z.ZodBoolean>;
1491
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1492
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
1493
+ }, "strict", z.ZodTypeAny, {
1494
+ error: string;
1495
+ error_code?: string | undefined;
1496
+ retry_id?: string | undefined;
1497
+ retryable?: boolean | undefined;
1498
+ details?: SerializableJsonValue | undefined;
1499
+ }, {
1500
+ error: string;
1501
+ error_code?: string | undefined;
1502
+ retry_id?: string | undefined;
1503
+ retryable?: boolean | undefined;
1504
+ details?: SerializableJsonValue | undefined;
1505
+ }>>;
1450
1506
  delta: z.ZodOptional<z.ZodString>;
1451
1507
  content: z.ZodOptional<z.ZodString>;
1452
1508
  answer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -1522,7 +1578,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1522
1578
  version: 1;
1523
1579
  turn_id: string;
1524
1580
  ephemeral: true;
1525
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
1581
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
1526
1582
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
1527
1583
  subrun_id: string;
1528
1584
  source_event_id: string;
@@ -1558,11 +1614,31 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1558
1614
  meta?: Record<string, SerializableJsonValue> | undefined;
1559
1615
  duration_ms?: number | undefined;
1560
1616
  subrun_parent_id?: string | undefined;
1617
+ output?: SerializableJsonValue | undefined;
1618
+ retry?: {
1619
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
1620
+ error: string;
1621
+ error_code: string;
1622
+ retry_id: string;
1623
+ category: "transport" | "output" | "rate_limit" | "other";
1624
+ attempt: number;
1625
+ max_retries: number;
1626
+ total_attempts: number;
1627
+ started_at: number;
1628
+ delay_ms: number;
1629
+ next_retry_at?: number | undefined;
1630
+ } | undefined;
1631
+ failure?: {
1632
+ error: string;
1633
+ error_code?: string | undefined;
1634
+ retry_id?: string | undefined;
1635
+ retryable?: boolean | undefined;
1636
+ details?: SerializableJsonValue | undefined;
1637
+ } | undefined;
1561
1638
  answer_id?: string | undefined;
1562
1639
  seq?: number | undefined;
1563
1640
  is_last?: boolean | undefined;
1564
1641
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
1565
- output?: SerializableJsonValue | undefined;
1566
1642
  original_message_count?: number | undefined;
1567
1643
  compression_ratio?: number | undefined;
1568
1644
  included_old_summary?: boolean | undefined;
@@ -1574,7 +1650,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1574
1650
  timestamp: number;
1575
1651
  turn_id: string;
1576
1652
  ephemeral: true;
1577
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
1653
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
1578
1654
  parent_tool_call_id: string;
1579
1655
  subrun_id: string;
1580
1656
  source_event_id: string;
@@ -1611,11 +1687,31 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1611
1687
  meta?: Record<string, SerializableJsonValue> | undefined;
1612
1688
  duration_ms?: number | undefined;
1613
1689
  subrun_parent_id?: string | undefined;
1690
+ output?: SerializableJsonValue | undefined;
1691
+ retry?: {
1692
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
1693
+ error: string;
1694
+ error_code: string;
1695
+ retry_id: string;
1696
+ category: "transport" | "output" | "rate_limit" | "other";
1697
+ attempt: number;
1698
+ max_retries: number;
1699
+ total_attempts: number;
1700
+ started_at: number;
1701
+ delay_ms: number;
1702
+ next_retry_at?: number | undefined;
1703
+ } | undefined;
1704
+ failure?: {
1705
+ error: string;
1706
+ error_code?: string | undefined;
1707
+ retry_id?: string | undefined;
1708
+ retryable?: boolean | undefined;
1709
+ details?: SerializableJsonValue | undefined;
1710
+ } | undefined;
1614
1711
  answer_id?: string | undefined;
1615
1712
  seq?: number | undefined;
1616
1713
  is_last?: boolean | undefined;
1617
1714
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
1618
- output?: SerializableJsonValue | undefined;
1619
1715
  original_message_count?: number | undefined;
1620
1716
  compression_ratio?: number | undefined;
1621
1717
  included_old_summary?: boolean | undefined;
@@ -1723,12 +1819,12 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1723
1819
  policy: z.ZodOptional<z.ZodString>;
1724
1820
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1725
1821
  }, "strip", z.ZodTypeAny, {
1726
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
1822
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
1727
1823
  metadata?: Record<string, unknown> | undefined;
1728
1824
  reason?: string | undefined;
1729
1825
  policy?: string | undefined;
1730
1826
  }, {
1731
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
1827
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
1732
1828
  metadata?: Record<string, unknown> | undefined;
1733
1829
  reason?: string | undefined;
1734
1830
  policy?: string | undefined;
@@ -1814,7 +1910,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1814
1910
  action: string;
1815
1911
  parentRunId?: (string & z.BRAND<"RunId">) | undefined;
1816
1912
  decision?: {
1817
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
1913
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
1818
1914
  metadata?: Record<string, unknown> | undefined;
1819
1915
  reason?: string | undefined;
1820
1916
  policy?: string | undefined;
@@ -1856,7 +1952,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1856
1952
  action: string;
1857
1953
  parentRunId?: string | undefined;
1858
1954
  decision?: {
1859
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
1955
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
1860
1956
  metadata?: Record<string, unknown> | undefined;
1861
1957
  reason?: string | undefined;
1862
1958
  policy?: string | undefined;
@@ -1906,7 +2002,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1906
2002
  action: string;
1907
2003
  parentRunId?: (string & z.BRAND<"RunId">) | undefined;
1908
2004
  decision?: {
1909
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
2005
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
1910
2006
  metadata?: Record<string, unknown> | undefined;
1911
2007
  reason?: string | undefined;
1912
2008
  policy?: string | undefined;
@@ -1961,7 +2057,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1961
2057
  action: string;
1962
2058
  parentRunId?: string | undefined;
1963
2059
  decision?: {
1964
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
2060
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
1965
2061
  metadata?: Record<string, unknown> | undefined;
1966
2062
  reason?: string | undefined;
1967
2063
  policy?: string | undefined;
@@ -2624,11 +2720,85 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2624
2720
  lane: z.ZodOptional<z.ZodEnum<["foreground", "auxiliary", "child"]>>;
2625
2721
  visibility: z.ZodOptional<z.ZodEnum<["conversation", "parent-trace", "none"]>>;
2626
2722
  } & {
2627
- type: z.ZodLiteral<"error">;
2723
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
2724
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
2725
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
2726
+ attempt: z.ZodNumber;
2727
+ max_retries: z.ZodNumber;
2728
+ total_attempts: z.ZodNumber;
2729
+ started_at: z.ZodNumber;
2730
+ delay_ms: z.ZodNumber;
2731
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
2732
+ error: z.ZodString;
2733
+ error_code: z.ZodString;
2734
+ type: z.ZodLiteral<"llm_retry">;
2735
+ }, "strip", z.ZodTypeAny, {
2736
+ type: "llm_retry";
2737
+ id: string;
2738
+ conversation_id: string;
2739
+ timestamp: number;
2740
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
2741
+ version: 1;
2742
+ turn_id: string;
2743
+ error: string;
2744
+ error_code: string;
2745
+ retry_id: string;
2746
+ category: "transport" | "output" | "rate_limit" | "other";
2747
+ attempt: number;
2748
+ max_retries: number;
2749
+ total_attempts: number;
2750
+ started_at: number;
2751
+ delay_ms: number;
2752
+ metadata?: Record<string, SerializableJsonValue> | undefined;
2753
+ ephemeral?: boolean | undefined;
2754
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
2755
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
2756
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
2757
+ visibility?: "conversation" | "parent-trace" | "none" | undefined;
2758
+ next_retry_at?: number | undefined;
2759
+ }, {
2760
+ type: "llm_retry";
2761
+ id: string;
2762
+ conversation_id: string;
2763
+ timestamp: number;
2764
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
2765
+ turn_id: string;
2766
+ error: string;
2767
+ error_code: string;
2768
+ retry_id: string;
2769
+ category: "transport" | "output" | "rate_limit" | "other";
2770
+ attempt: number;
2771
+ max_retries: number;
2772
+ total_attempts: number;
2773
+ started_at: number;
2774
+ delay_ms: number;
2775
+ metadata?: Record<string, SerializableJsonValue> | undefined;
2776
+ version?: 1 | undefined;
2777
+ ephemeral?: boolean | undefined;
2778
+ run_id?: string | undefined;
2779
+ parent_run_id?: string | undefined;
2780
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
2781
+ visibility?: "conversation" | "parent-trace" | "none" | undefined;
2782
+ next_retry_at?: number | undefined;
2783
+ }>, z.ZodObject<{
2784
+ id: z.ZodEffects<z.ZodString, string, string>;
2785
+ conversation_id: z.ZodEffects<z.ZodString, string, string>;
2786
+ timestamp: z.ZodNumber;
2787
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
2788
+ version: z.ZodDefault<z.ZodLiteral<1>>;
2789
+ turn_id: z.ZodEffects<z.ZodString, string, string>;
2790
+ ephemeral: z.ZodOptional<z.ZodBoolean>;
2791
+ run_id: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "RunId">>;
2792
+ parent_run_id: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "RunId">>;
2793
+ lane: z.ZodOptional<z.ZodEnum<["foreground", "auxiliary", "child"]>>;
2794
+ visibility: z.ZodOptional<z.ZodEnum<["conversation", "parent-trace", "none"]>>;
2795
+ } & {
2628
2796
  error: z.ZodString;
2629
- details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
2630
2797
  error_code: z.ZodOptional<z.ZodString>;
2631
2798
  retryable: z.ZodOptional<z.ZodBoolean>;
2799
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
2800
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
2801
+ type: z.ZodLiteral<"error">;
2632
2802
  }, "strip", z.ZodTypeAny, {
2633
2803
  type: "error";
2634
2804
  id: string;
@@ -2644,8 +2814,9 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2644
2814
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2645
2815
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
2646
2816
  error_code?: string | undefined;
2647
- details?: SerializableJsonValue | undefined;
2817
+ retry_id?: string | undefined;
2648
2818
  retryable?: boolean | undefined;
2819
+ details?: SerializableJsonValue | undefined;
2649
2820
  }, {
2650
2821
  type: "error";
2651
2822
  id: string;
@@ -2661,8 +2832,9 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2661
2832
  lane?: "foreground" | "auxiliary" | "child" | undefined;
2662
2833
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
2663
2834
  error_code?: string | undefined;
2664
- details?: SerializableJsonValue | undefined;
2835
+ retry_id?: string | undefined;
2665
2836
  retryable?: boolean | undefined;
2837
+ details?: SerializableJsonValue | undefined;
2666
2838
  }>, z.ZodObject<{
2667
2839
  id: z.ZodEffects<z.ZodString, string, string>;
2668
2840
  conversation_id: z.ZodEffects<z.ZodString, string, string>;
@@ -3008,7 +3180,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3008
3180
  version: 1;
3009
3181
  turn_id: string;
3010
3182
  duration_ms: number;
3011
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
3183
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
3012
3184
  execution_id: string;
3013
3185
  metadata?: Record<string, SerializableJsonValue> | undefined;
3014
3186
  ephemeral?: boolean | undefined;
@@ -3042,7 +3214,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3042
3214
  timestamp: number;
3043
3215
  turn_id: string;
3044
3216
  duration_ms: number;
3045
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
3217
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
3046
3218
  execution_id: string;
3047
3219
  metadata?: Record<string, SerializableJsonValue> | undefined;
3048
3220
  version?: 1 | undefined;
@@ -4032,7 +4204,63 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4032
4204
  subrun_id: z.ZodEffects<z.ZodString, string, string>;
4033
4205
  subrun_parent_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
4034
4206
  source_event_id: z.ZodEffects<z.ZodString, string, string>;
4035
- kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary"]>;
4207
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer", "history_summary", "llm_retry", "error"]>;
4208
+ retry: z.ZodOptional<z.ZodObject<{
4209
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
4210
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
4211
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
4212
+ attempt: z.ZodNumber;
4213
+ max_retries: z.ZodNumber;
4214
+ total_attempts: z.ZodNumber;
4215
+ started_at: z.ZodNumber;
4216
+ delay_ms: z.ZodNumber;
4217
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
4218
+ error: z.ZodString;
4219
+ error_code: z.ZodString;
4220
+ }, "strict", z.ZodTypeAny, {
4221
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4222
+ error: string;
4223
+ error_code: string;
4224
+ retry_id: string;
4225
+ category: "transport" | "output" | "rate_limit" | "other";
4226
+ attempt: number;
4227
+ max_retries: number;
4228
+ total_attempts: number;
4229
+ started_at: number;
4230
+ delay_ms: number;
4231
+ next_retry_at?: number | undefined;
4232
+ }, {
4233
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4234
+ error: string;
4235
+ error_code: string;
4236
+ retry_id: string;
4237
+ category: "transport" | "output" | "rate_limit" | "other";
4238
+ attempt: number;
4239
+ max_retries: number;
4240
+ total_attempts: number;
4241
+ started_at: number;
4242
+ delay_ms: number;
4243
+ next_retry_at?: number | undefined;
4244
+ }>>;
4245
+ failure: z.ZodOptional<z.ZodObject<{
4246
+ error: z.ZodString;
4247
+ error_code: z.ZodOptional<z.ZodString>;
4248
+ retryable: z.ZodOptional<z.ZodBoolean>;
4249
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
4250
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
4251
+ }, "strict", z.ZodTypeAny, {
4252
+ error: string;
4253
+ error_code?: string | undefined;
4254
+ retry_id?: string | undefined;
4255
+ retryable?: boolean | undefined;
4256
+ details?: SerializableJsonValue | undefined;
4257
+ }, {
4258
+ error: string;
4259
+ error_code?: string | undefined;
4260
+ retry_id?: string | undefined;
4261
+ retryable?: boolean | undefined;
4262
+ details?: SerializableJsonValue | undefined;
4263
+ }>>;
4036
4264
  delta: z.ZodOptional<z.ZodString>;
4037
4265
  content: z.ZodOptional<z.ZodString>;
4038
4266
  answer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -4108,7 +4336,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4108
4336
  version: 1;
4109
4337
  turn_id: string;
4110
4338
  ephemeral: true;
4111
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
4339
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
4112
4340
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
4113
4341
  subrun_id: string;
4114
4342
  source_event_id: string;
@@ -4144,11 +4372,31 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4144
4372
  meta?: Record<string, SerializableJsonValue> | undefined;
4145
4373
  duration_ms?: number | undefined;
4146
4374
  subrun_parent_id?: string | undefined;
4375
+ output?: SerializableJsonValue | undefined;
4376
+ retry?: {
4377
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4378
+ error: string;
4379
+ error_code: string;
4380
+ retry_id: string;
4381
+ category: "transport" | "output" | "rate_limit" | "other";
4382
+ attempt: number;
4383
+ max_retries: number;
4384
+ total_attempts: number;
4385
+ started_at: number;
4386
+ delay_ms: number;
4387
+ next_retry_at?: number | undefined;
4388
+ } | undefined;
4389
+ failure?: {
4390
+ error: string;
4391
+ error_code?: string | undefined;
4392
+ retry_id?: string | undefined;
4393
+ retryable?: boolean | undefined;
4394
+ details?: SerializableJsonValue | undefined;
4395
+ } | undefined;
4147
4396
  answer_id?: string | undefined;
4148
4397
  seq?: number | undefined;
4149
4398
  is_last?: boolean | undefined;
4150
4399
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
4151
- output?: SerializableJsonValue | undefined;
4152
4400
  original_message_count?: number | undefined;
4153
4401
  compression_ratio?: number | undefined;
4154
4402
  included_old_summary?: boolean | undefined;
@@ -4160,7 +4408,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4160
4408
  timestamp: number;
4161
4409
  turn_id: string;
4162
4410
  ephemeral: true;
4163
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
4411
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
4164
4412
  parent_tool_call_id: string;
4165
4413
  subrun_id: string;
4166
4414
  source_event_id: string;
@@ -4197,11 +4445,31 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4197
4445
  meta?: Record<string, SerializableJsonValue> | undefined;
4198
4446
  duration_ms?: number | undefined;
4199
4447
  subrun_parent_id?: string | undefined;
4448
+ output?: SerializableJsonValue | undefined;
4449
+ retry?: {
4450
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
4451
+ error: string;
4452
+ error_code: string;
4453
+ retry_id: string;
4454
+ category: "transport" | "output" | "rate_limit" | "other";
4455
+ attempt: number;
4456
+ max_retries: number;
4457
+ total_attempts: number;
4458
+ started_at: number;
4459
+ delay_ms: number;
4460
+ next_retry_at?: number | undefined;
4461
+ } | undefined;
4462
+ failure?: {
4463
+ error: string;
4464
+ error_code?: string | undefined;
4465
+ retry_id?: string | undefined;
4466
+ retryable?: boolean | undefined;
4467
+ details?: SerializableJsonValue | undefined;
4468
+ } | undefined;
4200
4469
  answer_id?: string | undefined;
4201
4470
  seq?: number | undefined;
4202
4471
  is_last?: boolean | undefined;
4203
4472
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
4204
- output?: SerializableJsonValue | undefined;
4205
4473
  original_message_count?: number | undefined;
4206
4474
  compression_ratio?: number | undefined;
4207
4475
  included_old_summary?: boolean | undefined;
@@ -4309,12 +4577,12 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4309
4577
  policy: z.ZodOptional<z.ZodString>;
4310
4578
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4311
4579
  }, "strip", z.ZodTypeAny, {
4312
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
4580
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
4313
4581
  metadata?: Record<string, unknown> | undefined;
4314
4582
  reason?: string | undefined;
4315
4583
  policy?: string | undefined;
4316
4584
  }, {
4317
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
4585
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
4318
4586
  metadata?: Record<string, unknown> | undefined;
4319
4587
  reason?: string | undefined;
4320
4588
  policy?: string | undefined;
@@ -4400,7 +4668,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4400
4668
  action: string;
4401
4669
  parentRunId?: (string & z.BRAND<"RunId">) | undefined;
4402
4670
  decision?: {
4403
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
4671
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
4404
4672
  metadata?: Record<string, unknown> | undefined;
4405
4673
  reason?: string | undefined;
4406
4674
  policy?: string | undefined;
@@ -4442,7 +4710,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4442
4710
  action: string;
4443
4711
  parentRunId?: string | undefined;
4444
4712
  decision?: {
4445
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
4713
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
4446
4714
  metadata?: Record<string, unknown> | undefined;
4447
4715
  reason?: string | undefined;
4448
4716
  policy?: string | undefined;
@@ -4492,7 +4760,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4492
4760
  action: string;
4493
4761
  parentRunId?: (string & z.BRAND<"RunId">) | undefined;
4494
4762
  decision?: {
4495
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
4763
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
4496
4764
  metadata?: Record<string, unknown> | undefined;
4497
4765
  reason?: string | undefined;
4498
4766
  policy?: string | undefined;
@@ -4547,7 +4815,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4547
4815
  action: string;
4548
4816
  parentRunId?: string | undefined;
4549
4817
  decision?: {
4550
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
4818
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
4551
4819
  metadata?: Record<string, unknown> | undefined;
4552
4820
  reason?: string | undefined;
4553
4821
  policy?: string | undefined;
@@ -5210,11 +5478,85 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5210
5478
  lane: z.ZodOptional<z.ZodEnum<["foreground", "auxiliary", "child"]>>;
5211
5479
  visibility: z.ZodOptional<z.ZodEnum<["conversation", "parent-trace", "none"]>>;
5212
5480
  } & {
5213
- type: z.ZodLiteral<"error">;
5481
+ retry_id: z.ZodEffects<z.ZodString, string, string>;
5482
+ status: z.ZodEnum<["waiting", "retrying", "succeeded", "exhausted", "failed", "cancelled"]>;
5483
+ category: z.ZodEnum<["transport", "output", "rate_limit", "other"]>;
5484
+ attempt: z.ZodNumber;
5485
+ max_retries: z.ZodNumber;
5486
+ total_attempts: z.ZodNumber;
5487
+ started_at: z.ZodNumber;
5488
+ delay_ms: z.ZodNumber;
5489
+ next_retry_at: z.ZodOptional<z.ZodNumber>;
5490
+ error: z.ZodString;
5491
+ error_code: z.ZodString;
5492
+ type: z.ZodLiteral<"llm_retry">;
5493
+ }, "strip", z.ZodTypeAny, {
5494
+ type: "llm_retry";
5495
+ id: string;
5496
+ conversation_id: string;
5497
+ timestamp: number;
5498
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
5499
+ version: 1;
5500
+ turn_id: string;
5501
+ error: string;
5502
+ error_code: string;
5503
+ retry_id: string;
5504
+ category: "transport" | "output" | "rate_limit" | "other";
5505
+ attempt: number;
5506
+ max_retries: number;
5507
+ total_attempts: number;
5508
+ started_at: number;
5509
+ delay_ms: number;
5510
+ metadata?: Record<string, SerializableJsonValue> | undefined;
5511
+ ephemeral?: boolean | undefined;
5512
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
5513
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
5514
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
5515
+ visibility?: "conversation" | "parent-trace" | "none" | undefined;
5516
+ next_retry_at?: number | undefined;
5517
+ }, {
5518
+ type: "llm_retry";
5519
+ id: string;
5520
+ conversation_id: string;
5521
+ timestamp: number;
5522
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
5523
+ turn_id: string;
5524
+ error: string;
5525
+ error_code: string;
5526
+ retry_id: string;
5527
+ category: "transport" | "output" | "rate_limit" | "other";
5528
+ attempt: number;
5529
+ max_retries: number;
5530
+ total_attempts: number;
5531
+ started_at: number;
5532
+ delay_ms: number;
5533
+ metadata?: Record<string, SerializableJsonValue> | undefined;
5534
+ version?: 1 | undefined;
5535
+ ephemeral?: boolean | undefined;
5536
+ run_id?: string | undefined;
5537
+ parent_run_id?: string | undefined;
5538
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
5539
+ visibility?: "conversation" | "parent-trace" | "none" | undefined;
5540
+ next_retry_at?: number | undefined;
5541
+ }>, z.ZodObject<{
5542
+ id: z.ZodEffects<z.ZodString, string, string>;
5543
+ conversation_id: z.ZodEffects<z.ZodString, string, string>;
5544
+ timestamp: z.ZodNumber;
5545
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>>;
5546
+ version: z.ZodDefault<z.ZodLiteral<1>>;
5547
+ turn_id: z.ZodEffects<z.ZodString, string, string>;
5548
+ ephemeral: z.ZodOptional<z.ZodBoolean>;
5549
+ run_id: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "RunId">>;
5550
+ parent_run_id: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodString, string, string>, "RunId">>;
5551
+ lane: z.ZodOptional<z.ZodEnum<["foreground", "auxiliary", "child"]>>;
5552
+ visibility: z.ZodOptional<z.ZodEnum<["conversation", "parent-trace", "none"]>>;
5553
+ } & {
5214
5554
  error: z.ZodString;
5215
- details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
5216
5555
  error_code: z.ZodOptional<z.ZodString>;
5217
5556
  retryable: z.ZodOptional<z.ZodBoolean>;
5557
+ retry_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
5558
+ details: z.ZodOptional<z.ZodType<SerializableJsonValue, z.ZodTypeDef, SerializableJsonValue>>;
5559
+ type: z.ZodLiteral<"error">;
5218
5560
  }, "strip", z.ZodTypeAny, {
5219
5561
  type: "error";
5220
5562
  id: string;
@@ -5230,8 +5572,9 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5230
5572
  lane?: "foreground" | "auxiliary" | "child" | undefined;
5231
5573
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
5232
5574
  error_code?: string | undefined;
5233
- details?: SerializableJsonValue | undefined;
5575
+ retry_id?: string | undefined;
5234
5576
  retryable?: boolean | undefined;
5577
+ details?: SerializableJsonValue | undefined;
5235
5578
  }, {
5236
5579
  type: "error";
5237
5580
  id: string;
@@ -5247,8 +5590,9 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5247
5590
  lane?: "foreground" | "auxiliary" | "child" | undefined;
5248
5591
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
5249
5592
  error_code?: string | undefined;
5250
- details?: SerializableJsonValue | undefined;
5593
+ retry_id?: string | undefined;
5251
5594
  retryable?: boolean | undefined;
5595
+ details?: SerializableJsonValue | undefined;
5252
5596
  }>, z.ZodObject<{
5253
5597
  id: z.ZodEffects<z.ZodString, string, string>;
5254
5598
  conversation_id: z.ZodEffects<z.ZodString, string, string>;
@@ -5594,7 +5938,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5594
5938
  version: 1;
5595
5939
  turn_id: string;
5596
5940
  duration_ms: number;
5597
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
5941
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
5598
5942
  execution_id: string;
5599
5943
  metadata?: Record<string, SerializableJsonValue> | undefined;
5600
5944
  ephemeral?: boolean | undefined;
@@ -5628,7 +5972,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5628
5972
  timestamp: number;
5629
5973
  turn_id: string;
5630
5974
  duration_ms: number;
5631
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
5975
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
5632
5976
  execution_id: string;
5633
5977
  metadata?: Record<string, SerializableJsonValue> | undefined;
5634
5978
  version?: 1 | undefined;
@@ -5845,7 +6189,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5845
6189
  version: 1;
5846
6190
  turn_id: string;
5847
6191
  ephemeral: true;
5848
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
6192
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
5849
6193
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
5850
6194
  subrun_id: string;
5851
6195
  source_event_id: string;
@@ -5881,11 +6225,31 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5881
6225
  meta?: Record<string, SerializableJsonValue> | undefined;
5882
6226
  duration_ms?: number | undefined;
5883
6227
  subrun_parent_id?: string | undefined;
6228
+ output?: SerializableJsonValue | undefined;
6229
+ retry?: {
6230
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
6231
+ error: string;
6232
+ error_code: string;
6233
+ retry_id: string;
6234
+ category: "transport" | "output" | "rate_limit" | "other";
6235
+ attempt: number;
6236
+ max_retries: number;
6237
+ total_attempts: number;
6238
+ started_at: number;
6239
+ delay_ms: number;
6240
+ next_retry_at?: number | undefined;
6241
+ } | undefined;
6242
+ failure?: {
6243
+ error: string;
6244
+ error_code?: string | undefined;
6245
+ retry_id?: string | undefined;
6246
+ retryable?: boolean | undefined;
6247
+ details?: SerializableJsonValue | undefined;
6248
+ } | undefined;
5884
6249
  answer_id?: string | undefined;
5885
6250
  seq?: number | undefined;
5886
6251
  is_last?: boolean | undefined;
5887
6252
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
5888
- output?: SerializableJsonValue | undefined;
5889
6253
  original_message_count?: number | undefined;
5890
6254
  compression_ratio?: number | undefined;
5891
6255
  included_old_summary?: boolean | undefined;
@@ -5930,7 +6294,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5930
6294
  action: string;
5931
6295
  parentRunId?: (string & z.BRAND<"RunId">) | undefined;
5932
6296
  decision?: {
5933
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
6297
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
5934
6298
  metadata?: Record<string, unknown> | undefined;
5935
6299
  reason?: string | undefined;
5936
6300
  policy?: string | undefined;
@@ -6094,6 +6458,30 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
6094
6458
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
6095
6459
  compression_ratio?: number | undefined;
6096
6460
  included_old_summary?: boolean | undefined;
6461
+ } | {
6462
+ type: "llm_retry";
6463
+ id: string;
6464
+ conversation_id: string;
6465
+ timestamp: number;
6466
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
6467
+ version: 1;
6468
+ turn_id: string;
6469
+ error: string;
6470
+ error_code: string;
6471
+ retry_id: string;
6472
+ category: "transport" | "output" | "rate_limit" | "other";
6473
+ attempt: number;
6474
+ max_retries: number;
6475
+ total_attempts: number;
6476
+ started_at: number;
6477
+ delay_ms: number;
6478
+ metadata?: Record<string, SerializableJsonValue> | undefined;
6479
+ ephemeral?: boolean | undefined;
6480
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
6481
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
6482
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
6483
+ visibility?: "conversation" | "parent-trace" | "none" | undefined;
6484
+ next_retry_at?: number | undefined;
6097
6485
  } | {
6098
6486
  type: "error";
6099
6487
  id: string;
@@ -6109,8 +6497,9 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
6109
6497
  lane?: "foreground" | "auxiliary" | "child" | undefined;
6110
6498
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
6111
6499
  error_code?: string | undefined;
6112
- details?: SerializableJsonValue | undefined;
6500
+ retry_id?: string | undefined;
6113
6501
  retryable?: boolean | undefined;
6502
+ details?: SerializableJsonValue | undefined;
6114
6503
  } | {
6115
6504
  type: "control";
6116
6505
  id: string;
@@ -6168,7 +6557,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
6168
6557
  version: 1;
6169
6558
  turn_id: string;
6170
6559
  duration_ms: number;
6171
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
6560
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
6172
6561
  execution_id: string;
6173
6562
  metadata?: Record<string, SerializableJsonValue> | undefined;
6174
6563
  ephemeral?: boolean | undefined;
@@ -6247,6 +6636,9 @@ type FinalAnswerResetEvent = Extract<RuntimeEvent, {
6247
6636
  type HistorySummaryEvent = Extract<RuntimeEvent, {
6248
6637
  type: 'history_summary';
6249
6638
  }>;
6639
+ type LlmRetryEvent = Extract<RuntimeEvent, {
6640
+ type: 'llm_retry';
6641
+ }>;
6250
6642
  type ErrorEvent = Extract<RuntimeEvent, {
6251
6643
  type: 'error';
6252
6644
  }>;
@@ -6448,7 +6840,7 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6448
6840
  version: 1;
6449
6841
  turn_id: string;
6450
6842
  ephemeral: true;
6451
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
6843
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
6452
6844
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
6453
6845
  subrun_id: string;
6454
6846
  source_event_id: string;
@@ -6484,11 +6876,31 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6484
6876
  meta?: Record<string, SerializableJsonValue> | undefined;
6485
6877
  duration_ms?: number | undefined;
6486
6878
  subrun_parent_id?: string | undefined;
6879
+ output?: SerializableJsonValue | undefined;
6880
+ retry?: {
6881
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
6882
+ error: string;
6883
+ error_code: string;
6884
+ retry_id: string;
6885
+ category: "transport" | "output" | "rate_limit" | "other";
6886
+ attempt: number;
6887
+ max_retries: number;
6888
+ total_attempts: number;
6889
+ started_at: number;
6890
+ delay_ms: number;
6891
+ next_retry_at?: number | undefined;
6892
+ } | undefined;
6893
+ failure?: {
6894
+ error: string;
6895
+ error_code?: string | undefined;
6896
+ retry_id?: string | undefined;
6897
+ retryable?: boolean | undefined;
6898
+ details?: SerializableJsonValue | undefined;
6899
+ } | undefined;
6487
6900
  answer_id?: string | undefined;
6488
6901
  seq?: number | undefined;
6489
6902
  is_last?: boolean | undefined;
6490
6903
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
6491
- output?: SerializableJsonValue | undefined;
6492
6904
  original_message_count?: number | undefined;
6493
6905
  compression_ratio?: number | undefined;
6494
6906
  included_old_summary?: boolean | undefined;
@@ -6533,7 +6945,7 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6533
6945
  action: string;
6534
6946
  parentRunId?: (string & z.BRAND<"RunId">) | undefined;
6535
6947
  decision?: {
6536
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
6948
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
6537
6949
  metadata?: Record<string, unknown> | undefined;
6538
6950
  reason?: string | undefined;
6539
6951
  policy?: string | undefined;
@@ -6697,6 +7109,30 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6697
7109
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
6698
7110
  compression_ratio?: number | undefined;
6699
7111
  included_old_summary?: boolean | undefined;
7112
+ } | {
7113
+ type: "llm_retry";
7114
+ id: string;
7115
+ conversation_id: string;
7116
+ timestamp: number;
7117
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
7118
+ version: 1;
7119
+ turn_id: string;
7120
+ error: string;
7121
+ error_code: string;
7122
+ retry_id: string;
7123
+ category: "transport" | "output" | "rate_limit" | "other";
7124
+ attempt: number;
7125
+ max_retries: number;
7126
+ total_attempts: number;
7127
+ started_at: number;
7128
+ delay_ms: number;
7129
+ metadata?: Record<string, SerializableJsonValue> | undefined;
7130
+ ephemeral?: boolean | undefined;
7131
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
7132
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
7133
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
7134
+ visibility?: "conversation" | "parent-trace" | "none" | undefined;
7135
+ next_retry_at?: number | undefined;
6700
7136
  } | {
6701
7137
  type: "error";
6702
7138
  id: string;
@@ -6712,8 +7148,9 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6712
7148
  lane?: "foreground" | "auxiliary" | "child" | undefined;
6713
7149
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
6714
7150
  error_code?: string | undefined;
6715
- details?: SerializableJsonValue | undefined;
7151
+ retry_id?: string | undefined;
6716
7152
  retryable?: boolean | undefined;
7153
+ details?: SerializableJsonValue | undefined;
6717
7154
  } | {
6718
7155
  type: "control";
6719
7156
  id: string;
@@ -6771,7 +7208,7 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6771
7208
  version: 1;
6772
7209
  turn_id: string;
6773
7210
  duration_ms: number;
6774
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
7211
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
6775
7212
  execution_id: string;
6776
7213
  metadata?: Record<string, SerializableJsonValue> | undefined;
6777
7214
  ephemeral?: boolean | undefined;
@@ -6988,7 +7425,7 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
6988
7425
  version: 1;
6989
7426
  turn_id: string;
6990
7427
  ephemeral: true;
6991
- kind: "tool_call_decision" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary";
7428
+ kind: "tool_call_decision" | "error" | "tool_process" | "tool_output" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "final_answer" | "history_summary" | "llm_retry";
6992
7429
  parent_tool_call_id: string & z.BRAND<"ToolCallId">;
6993
7430
  subrun_id: string;
6994
7431
  source_event_id: string;
@@ -7024,11 +7461,31 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7024
7461
  meta?: Record<string, SerializableJsonValue> | undefined;
7025
7462
  duration_ms?: number | undefined;
7026
7463
  subrun_parent_id?: string | undefined;
7464
+ output?: SerializableJsonValue | undefined;
7465
+ retry?: {
7466
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
7467
+ error: string;
7468
+ error_code: string;
7469
+ retry_id: string;
7470
+ category: "transport" | "output" | "rate_limit" | "other";
7471
+ attempt: number;
7472
+ max_retries: number;
7473
+ total_attempts: number;
7474
+ started_at: number;
7475
+ delay_ms: number;
7476
+ next_retry_at?: number | undefined;
7477
+ } | undefined;
7478
+ failure?: {
7479
+ error: string;
7480
+ error_code?: string | undefined;
7481
+ retry_id?: string | undefined;
7482
+ retryable?: boolean | undefined;
7483
+ details?: SerializableJsonValue | undefined;
7484
+ } | undefined;
7027
7485
  answer_id?: string | undefined;
7028
7486
  seq?: number | undefined;
7029
7487
  is_last?: boolean | undefined;
7030
7488
  completion_reason?: "tool_call" | "terminal" | "interrupted" | undefined;
7031
- output?: SerializableJsonValue | undefined;
7032
7489
  original_message_count?: number | undefined;
7033
7490
  compression_ratio?: number | undefined;
7034
7491
  included_old_summary?: boolean | undefined;
@@ -7073,7 +7530,7 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7073
7530
  action: string;
7074
7531
  parentRunId?: (string & z.BRAND<"RunId">) | undefined;
7075
7532
  decision?: {
7076
- outcome: "allowed" | "denied" | "fallback" | "retry" | "cancelled" | "paused" | "resumed" | "requested" | "recorded";
7533
+ outcome: "cancelled" | "retry" | "allowed" | "denied" | "fallback" | "paused" | "resumed" | "requested" | "recorded";
7077
7534
  metadata?: Record<string, unknown> | undefined;
7078
7535
  reason?: string | undefined;
7079
7536
  policy?: string | undefined;
@@ -7237,6 +7694,30 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7237
7694
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
7238
7695
  compression_ratio?: number | undefined;
7239
7696
  included_old_summary?: boolean | undefined;
7697
+ } | {
7698
+ type: "llm_retry";
7699
+ id: string;
7700
+ conversation_id: string;
7701
+ timestamp: number;
7702
+ status: "waiting" | "retrying" | "succeeded" | "exhausted" | "failed" | "cancelled";
7703
+ version: 1;
7704
+ turn_id: string;
7705
+ error: string;
7706
+ error_code: string;
7707
+ retry_id: string;
7708
+ category: "transport" | "output" | "rate_limit" | "other";
7709
+ attempt: number;
7710
+ max_retries: number;
7711
+ total_attempts: number;
7712
+ started_at: number;
7713
+ delay_ms: number;
7714
+ metadata?: Record<string, SerializableJsonValue> | undefined;
7715
+ ephemeral?: boolean | undefined;
7716
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
7717
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
7718
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
7719
+ visibility?: "conversation" | "parent-trace" | "none" | undefined;
7720
+ next_retry_at?: number | undefined;
7240
7721
  } | {
7241
7722
  type: "error";
7242
7723
  id: string;
@@ -7252,8 +7733,9 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7252
7733
  lane?: "foreground" | "auxiliary" | "child" | undefined;
7253
7734
  visibility?: "conversation" | "parent-trace" | "none" | undefined;
7254
7735
  error_code?: string | undefined;
7255
- details?: SerializableJsonValue | undefined;
7736
+ retry_id?: string | undefined;
7256
7737
  retryable?: boolean | undefined;
7738
+ details?: SerializableJsonValue | undefined;
7257
7739
  } | {
7258
7740
  type: "control";
7259
7741
  id: string;
@@ -7311,7 +7793,7 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7311
7793
  version: 1;
7312
7794
  turn_id: string;
7313
7795
  duration_ms: number;
7314
- outcome: "cancelled" | "completed" | "awaiting_user" | "failed";
7796
+ outcome: "failed" | "cancelled" | "completed" | "awaiting_user";
7315
7797
  execution_id: string;
7316
7798
  metadata?: Record<string, SerializableJsonValue> | undefined;
7317
7799
  ephemeral?: boolean | undefined;
@@ -7385,4 +7867,4 @@ declare const createContextUsageSnapshotEvent: (id: string, conversationId: stri
7385
7867
  declare const createRunExecutionMetricsEvent: (id: string, conversationId: string, turnId: string, options: RuntimeEventCreatorOptions<RunExecutionMetricsEvent> & Pick<RunExecutionMetricsEvent, "execution_id" | "outcome" | "duration_ms">) => RunExecutionMetricsEvent;
7386
7868
 
7387
7869
  export { BaseEvent, RunExecutionOutcome, RuntimeEvent, RuntimeEventRoutingIdentity, RuntimeEventVisibility, RuntimeRunLane, RuntimeRunStatus, ToolCallDecisionPayload, createAuditEnvelopeEvent, createContextUsageSnapshotEvent, createErrorEvent, createFinalAnswerChunkEvent, createFinalAnswerEvent, createFinalAnswerResetEvent, createHistorySummaryEvent, createRequiresUserInteractionEvent, createRunExecutionMetricsEvent, createSubRunTraceEvent, createThoughtEvent, createToolCallDecisionEvent, createToolOutputEvent, createToolProcessEvent, createUserInputEvent, isRoutedRuntimeEvent, parseRoutedRuntimeEvent, parseRuntimeEventRoutingIdentity, parseRuntimeEvents, routeRuntimeEvent, validateRuntimeEvent, validateRuntimeEvents };
7388
- export type { AuditEnvelopeEvent, ContextUsageSnapshotEvent, ControlEvent, ErrorEvent, FinalAnswerChunkEvent, FinalAnswerEvent, FinalAnswerResetEvent, HistorySummaryEvent, RequiresUserInteractionEvent, RoutedRuntimeEvent, RunExecutionMetricsEvent, RuntimeEventInput, SubRunTraceEvent, ThoughtEvent, ToolCallDecisionEvent, ToolOutputEvent, ToolOutputEventResult, ToolProcessEvent, UserInputEvent };
7870
+ export type { AuditEnvelopeEvent, ContextUsageSnapshotEvent, ControlEvent, ErrorEvent, FinalAnswerChunkEvent, FinalAnswerEvent, FinalAnswerResetEvent, HistorySummaryEvent, LlmRetryEvent, RequiresUserInteractionEvent, RoutedRuntimeEvent, RunExecutionMetricsEvent, RuntimeEventInput, SubRunTraceEvent, ThoughtEvent, ToolCallDecisionEvent, ToolOutputEvent, ToolOutputEventResult, ToolProcessEvent, UserInputEvent };