@linnlabs/linnkit 0.37.5 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/cli.cjs +346 -178
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +346 -178
  5. package/dist/cli.js.map +1 -1
  6. package/dist/context-manager.cjs +55 -11
  7. package/dist/context-manager.cjs.map +1 -1
  8. package/dist/context-manager.js +55 -11
  9. package/dist/context-manager.js.map +1 -1
  10. package/dist/contracts/events.d.cts +517 -35
  11. package/dist/contracts/events.d.ts +517 -35
  12. package/dist/contracts/llm-retry.d.cts +47 -0
  13. package/dist/contracts/llm-retry.d.ts +47 -0
  14. package/dist/contracts/runtime-error.d.cts +26 -0
  15. package/dist/contracts/runtime-error.d.ts +26 -0
  16. package/dist/contracts/sse.d.cts +555 -39
  17. package/dist/contracts/sse.d.ts +555 -39
  18. package/dist/contracts/sub-run-trace-payload.d.cts +102 -6
  19. package/dist/contracts/sub-run-trace-payload.d.ts +102 -6
  20. package/dist/contracts/token-accounting.d.cts +18 -18
  21. package/dist/contracts/token-accounting.d.ts +18 -18
  22. package/dist/contracts.cjs +65 -10
  23. package/dist/contracts.cjs.map +1 -1
  24. package/dist/contracts.d.cts +4 -2
  25. package/dist/contracts.d.ts +4 -2
  26. package/dist/contracts.js +62 -11
  27. package/dist/contracts.js.map +1 -1
  28. package/dist/index.cjs +551 -286
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.js +551 -286
  31. package/dist/index.js.map +1 -1
  32. package/dist/ports/canonical-inference.d.cts +3 -0
  33. package/dist/ports/canonical-inference.d.ts +3 -0
  34. package/dist/ports/llm-call.d.cts +4 -0
  35. package/dist/ports/llm-call.d.ts +4 -0
  36. package/dist/quickstart.cjs +346 -178
  37. package/dist/quickstart.cjs.map +1 -1
  38. package/dist/quickstart.js +346 -178
  39. package/dist/quickstart.js.map +1 -1
  40. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.cts +8 -0
  41. package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.ts +8 -0
  42. package/dist/runtime-kernel/events/agentEvents.d.cts +85 -4
  43. package/dist/runtime-kernel/events/agentEvents.d.ts +85 -4
  44. package/dist/runtime-kernel/events/eventGovernance.d.cts +1 -1
  45. package/dist/runtime-kernel/events/eventGovernance.d.ts +1 -1
  46. package/dist/runtime-kernel/events.cjs +55 -11
  47. package/dist/runtime-kernel/events.cjs.map +1 -1
  48. package/dist/runtime-kernel/events.js +55 -11
  49. package/dist/runtime-kernel/events.js.map +1 -1
  50. package/dist/runtime-kernel/llm/request-builder.d.cts +2 -0
  51. package/dist/runtime-kernel/llm/request-builder.d.ts +2 -0
  52. package/dist/runtime-kernel.cjs +513 -271
  53. package/dist/runtime-kernel.cjs.map +1 -1
  54. package/dist/runtime-kernel.js +513 -271
  55. package/dist/runtime-kernel.js.map +1 -1
  56. package/dist/shared/errorClassifier.d.cts +5 -0
  57. package/dist/shared/errorClassifier.d.ts +5 -0
  58. package/dist/testkit.cjs +511 -269
  59. package/dist/testkit.cjs.map +1 -1
  60. package/dist/testkit.js +511 -269
  61. package/dist/testkit.js.map +1 -1
  62. package/docs/integration/llm-provider.md +24 -5
  63. package/docs/integration/realtime.md +29 -0
  64. package/docs/integration/tools.md +4 -0
  65. package/package.json +2 -2
@@ -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: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
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: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
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>>;
@@ -1517,7 +1573,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1517
1573
  }, "strip", z.ZodTypeAny, {
1518
1574
  id: string;
1519
1575
  type: "subrun_trace";
1520
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
1576
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
1521
1577
  timestamp: number;
1522
1578
  version: 1;
1523
1579
  conversation_id: string;
@@ -1550,6 +1606,19 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1550
1606
  fileName?: string | undefined;
1551
1607
  label?: string | undefined;
1552
1608
  }[] | undefined;
1609
+ retry?: {
1610
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
1611
+ error: string;
1612
+ error_code: string;
1613
+ retry_id: string;
1614
+ category: "transport" | "output" | "rate_limit" | "other";
1615
+ attempt: number;
1616
+ max_retries: number;
1617
+ total_attempts: number;
1618
+ started_at: number;
1619
+ delay_ms: number;
1620
+ next_retry_at?: number | undefined;
1621
+ } | undefined;
1553
1622
  run_id?: (string & z.BRAND<"RunId">) | undefined;
1554
1623
  parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
1555
1624
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -1559,10 +1628,17 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1559
1628
  meta?: Record<string, SerializableJsonValue> | undefined;
1560
1629
  duration_ms?: number | undefined;
1561
1630
  subrun_parent_id?: string | undefined;
1631
+ output?: SerializableJsonValue | undefined;
1632
+ failure?: {
1633
+ error: string;
1634
+ error_code?: string | undefined;
1635
+ retry_id?: string | undefined;
1636
+ retryable?: boolean | undefined;
1637
+ details?: SerializableJsonValue | undefined;
1638
+ } | undefined;
1562
1639
  answer_id?: string | undefined;
1563
1640
  seq?: number | undefined;
1564
1641
  is_last?: boolean | 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;
@@ -1570,7 +1646,7 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1570
1646
  }, {
1571
1647
  id: string;
1572
1648
  type: "subrun_trace";
1573
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
1649
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
1574
1650
  timestamp: number;
1575
1651
  conversation_id: string;
1576
1652
  turn_id: string;
@@ -1603,6 +1679,19 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1603
1679
  label?: string | undefined;
1604
1680
  }[] | undefined;
1605
1681
  version?: 1 | undefined;
1682
+ retry?: {
1683
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
1684
+ error: string;
1685
+ error_code: string;
1686
+ retry_id: string;
1687
+ category: "transport" | "output" | "rate_limit" | "other";
1688
+ attempt: number;
1689
+ max_retries: number;
1690
+ total_attempts: number;
1691
+ started_at: number;
1692
+ delay_ms: number;
1693
+ next_retry_at?: number | undefined;
1694
+ } | undefined;
1606
1695
  run_id?: string | undefined;
1607
1696
  parent_run_id?: string | undefined;
1608
1697
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -1612,10 +1701,17 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1612
1701
  meta?: Record<string, SerializableJsonValue> | undefined;
1613
1702
  duration_ms?: number | undefined;
1614
1703
  subrun_parent_id?: string | undefined;
1704
+ output?: SerializableJsonValue | undefined;
1705
+ failure?: {
1706
+ error: string;
1707
+ error_code?: string | undefined;
1708
+ retry_id?: string | undefined;
1709
+ retryable?: boolean | undefined;
1710
+ details?: SerializableJsonValue | undefined;
1711
+ } | undefined;
1615
1712
  answer_id?: string | undefined;
1616
1713
  seq?: number | undefined;
1617
1714
  is_last?: boolean | 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;
@@ -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
+ id: string;
2737
+ type: "llm_retry";
2738
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2739
+ error: string;
2740
+ timestamp: number;
2741
+ version: 1;
2742
+ conversation_id: string;
2743
+ turn_id: 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
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
2754
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
2755
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
2756
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
2757
+ ephemeral?: boolean | undefined;
2758
+ next_retry_at?: number | undefined;
2759
+ }, {
2760
+ id: string;
2761
+ type: "llm_retry";
2762
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
2763
+ error: string;
2764
+ timestamp: number;
2765
+ conversation_id: string;
2766
+ turn_id: 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
+ run_id?: string | undefined;
2778
+ parent_run_id?: string | undefined;
2779
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
2780
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
2781
+ ephemeral?: boolean | 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
  id: string;
2634
2804
  type: "error";
@@ -2644,8 +2814,9 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2644
2814
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
2645
2815
  ephemeral?: boolean | 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
  id: string;
2651
2822
  type: "error";
@@ -2661,8 +2832,9 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2661
2832
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
2662
2833
  ephemeral?: boolean | 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>;
@@ -2706,8 +2878,8 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2706
2878
  turn_id: string;
2707
2879
  op: "truncate_after" | "replace" | "redo" | "branch";
2708
2880
  metadata?: Record<string, SerializableJsonValue> | undefined;
2709
- reason?: string | undefined;
2710
2881
  version?: 1 | undefined;
2882
+ reason?: string | undefined;
2711
2883
  run_id?: string | undefined;
2712
2884
  parent_run_id?: string | undefined;
2713
2885
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -3004,8 +3176,8 @@ declare const RuntimeEventShape: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3004
3176
  id: string;
3005
3177
  type: "run_execution_metrics";
3006
3178
  timestamp: number;
3007
- outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
3008
3179
  version: 1;
3180
+ outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
3009
3181
  conversation_id: string;
3010
3182
  turn_id: string;
3011
3183
  duration_ms: number;
@@ -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: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
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: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
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>>;
@@ -4103,7 +4331,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4103
4331
  }, "strip", z.ZodTypeAny, {
4104
4332
  id: string;
4105
4333
  type: "subrun_trace";
4106
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
4334
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
4107
4335
  timestamp: number;
4108
4336
  version: 1;
4109
4337
  conversation_id: string;
@@ -4136,6 +4364,19 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4136
4364
  fileName?: string | undefined;
4137
4365
  label?: string | undefined;
4138
4366
  }[] | undefined;
4367
+ retry?: {
4368
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
4369
+ error: string;
4370
+ error_code: string;
4371
+ retry_id: string;
4372
+ category: "transport" | "output" | "rate_limit" | "other";
4373
+ attempt: number;
4374
+ max_retries: number;
4375
+ total_attempts: number;
4376
+ started_at: number;
4377
+ delay_ms: number;
4378
+ next_retry_at?: number | undefined;
4379
+ } | undefined;
4139
4380
  run_id?: (string & z.BRAND<"RunId">) | undefined;
4140
4381
  parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
4141
4382
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -4145,10 +4386,17 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4145
4386
  meta?: Record<string, SerializableJsonValue> | undefined;
4146
4387
  duration_ms?: number | undefined;
4147
4388
  subrun_parent_id?: string | undefined;
4389
+ output?: SerializableJsonValue | undefined;
4390
+ failure?: {
4391
+ error: string;
4392
+ error_code?: string | undefined;
4393
+ retry_id?: string | undefined;
4394
+ retryable?: boolean | undefined;
4395
+ details?: SerializableJsonValue | undefined;
4396
+ } | undefined;
4148
4397
  answer_id?: string | undefined;
4149
4398
  seq?: number | undefined;
4150
4399
  is_last?: boolean | 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;
@@ -4156,7 +4404,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4156
4404
  }, {
4157
4405
  id: string;
4158
4406
  type: "subrun_trace";
4159
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
4407
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
4160
4408
  timestamp: number;
4161
4409
  conversation_id: string;
4162
4410
  turn_id: string;
@@ -4189,6 +4437,19 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4189
4437
  label?: string | undefined;
4190
4438
  }[] | undefined;
4191
4439
  version?: 1 | undefined;
4440
+ retry?: {
4441
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
4442
+ error: string;
4443
+ error_code: string;
4444
+ retry_id: string;
4445
+ category: "transport" | "output" | "rate_limit" | "other";
4446
+ attempt: number;
4447
+ max_retries: number;
4448
+ total_attempts: number;
4449
+ started_at: number;
4450
+ delay_ms: number;
4451
+ next_retry_at?: number | undefined;
4452
+ } | undefined;
4192
4453
  run_id?: string | undefined;
4193
4454
  parent_run_id?: string | undefined;
4194
4455
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -4198,10 +4459,17 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
4198
4459
  meta?: Record<string, SerializableJsonValue> | undefined;
4199
4460
  duration_ms?: number | undefined;
4200
4461
  subrun_parent_id?: string | undefined;
4462
+ output?: SerializableJsonValue | undefined;
4463
+ failure?: {
4464
+ error: string;
4465
+ error_code?: string | undefined;
4466
+ retry_id?: string | undefined;
4467
+ retryable?: boolean | undefined;
4468
+ details?: SerializableJsonValue | undefined;
4469
+ } | undefined;
4201
4470
  answer_id?: string | undefined;
4202
4471
  seq?: number | undefined;
4203
4472
  is_last?: boolean | 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;
@@ -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
+ id: string;
5495
+ type: "llm_retry";
5496
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
5497
+ error: string;
5498
+ timestamp: number;
5499
+ version: 1;
5500
+ conversation_id: string;
5501
+ turn_id: 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
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
5512
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
5513
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
5514
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
5515
+ ephemeral?: boolean | undefined;
5516
+ next_retry_at?: number | undefined;
5517
+ }, {
5518
+ id: string;
5519
+ type: "llm_retry";
5520
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
5521
+ error: string;
5522
+ timestamp: number;
5523
+ conversation_id: string;
5524
+ turn_id: 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
+ run_id?: string | undefined;
5536
+ parent_run_id?: string | undefined;
5537
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
5538
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
5539
+ ephemeral?: boolean | 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
  id: string;
5220
5562
  type: "error";
@@ -5230,8 +5572,9 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5230
5572
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
5231
5573
  ephemeral?: boolean | 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
  id: string;
5237
5580
  type: "error";
@@ -5247,8 +5590,9 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5247
5590
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
5248
5591
  ephemeral?: boolean | 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>;
@@ -5292,8 +5636,8 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5292
5636
  turn_id: string;
5293
5637
  op: "truncate_after" | "replace" | "redo" | "branch";
5294
5638
  metadata?: Record<string, SerializableJsonValue> | undefined;
5295
- reason?: string | undefined;
5296
5639
  version?: 1 | undefined;
5640
+ reason?: string | undefined;
5297
5641
  run_id?: string | undefined;
5298
5642
  parent_run_id?: string | undefined;
5299
5643
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -5590,8 +5934,8 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5590
5934
  id: string;
5591
5935
  type: "run_execution_metrics";
5592
5936
  timestamp: number;
5593
- outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
5594
5937
  version: 1;
5938
+ outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
5595
5939
  conversation_id: string;
5596
5940
  turn_id: string;
5597
5941
  duration_ms: number;
@@ -5840,7 +6184,7 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5840
6184
  } | {
5841
6185
  id: string;
5842
6186
  type: "subrun_trace";
5843
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
6187
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
5844
6188
  timestamp: number;
5845
6189
  version: 1;
5846
6190
  conversation_id: string;
@@ -5873,6 +6217,19 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5873
6217
  fileName?: string | undefined;
5874
6218
  label?: string | undefined;
5875
6219
  }[] | undefined;
6220
+ retry?: {
6221
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
6222
+ error: string;
6223
+ error_code: string;
6224
+ retry_id: string;
6225
+ category: "transport" | "output" | "rate_limit" | "other";
6226
+ attempt: number;
6227
+ max_retries: number;
6228
+ total_attempts: number;
6229
+ started_at: number;
6230
+ delay_ms: number;
6231
+ next_retry_at?: number | undefined;
6232
+ } | undefined;
5876
6233
  run_id?: (string & z.BRAND<"RunId">) | undefined;
5877
6234
  parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
5878
6235
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -5882,10 +6239,17 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
5882
6239
  meta?: Record<string, SerializableJsonValue> | undefined;
5883
6240
  duration_ms?: number | undefined;
5884
6241
  subrun_parent_id?: string | undefined;
6242
+ output?: SerializableJsonValue | undefined;
6243
+ failure?: {
6244
+ error: string;
6245
+ error_code?: string | undefined;
6246
+ retry_id?: string | undefined;
6247
+ retryable?: boolean | undefined;
6248
+ details?: SerializableJsonValue | undefined;
6249
+ } | undefined;
5885
6250
  answer_id?: string | undefined;
5886
6251
  seq?: number | undefined;
5887
6252
  is_last?: boolean | 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;
@@ -6094,6 +6458,30 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
6094
6458
  ephemeral?: boolean | undefined;
6095
6459
  compression_ratio?: number | undefined;
6096
6460
  included_old_summary?: boolean | undefined;
6461
+ } | {
6462
+ id: string;
6463
+ type: "llm_retry";
6464
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
6465
+ error: string;
6466
+ timestamp: number;
6467
+ version: 1;
6468
+ conversation_id: string;
6469
+ turn_id: 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
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
6480
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
6481
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
6482
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
6483
+ ephemeral?: boolean | undefined;
6484
+ next_retry_at?: number | undefined;
6097
6485
  } | {
6098
6486
  id: string;
6099
6487
  type: "error";
@@ -6109,8 +6497,9 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
6109
6497
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
6110
6498
  ephemeral?: boolean | 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
  id: string;
6116
6505
  type: "control";
@@ -6164,8 +6553,8 @@ declare const RuntimeEvent: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodUnknown
6164
6553
  id: string;
6165
6554
  type: "run_execution_metrics";
6166
6555
  timestamp: number;
6167
- outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
6168
6556
  version: 1;
6557
+ outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
6169
6558
  conversation_id: string;
6170
6559
  turn_id: string;
6171
6560
  duration_ms: number;
@@ -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
  }>;
@@ -6443,7 +6835,7 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6443
6835
  } | {
6444
6836
  id: string;
6445
6837
  type: "subrun_trace";
6446
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
6838
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
6447
6839
  timestamp: number;
6448
6840
  version: 1;
6449
6841
  conversation_id: string;
@@ -6476,6 +6868,19 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6476
6868
  fileName?: string | undefined;
6477
6869
  label?: string | undefined;
6478
6870
  }[] | undefined;
6871
+ retry?: {
6872
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
6873
+ error: string;
6874
+ error_code: string;
6875
+ retry_id: string;
6876
+ category: "transport" | "output" | "rate_limit" | "other";
6877
+ attempt: number;
6878
+ max_retries: number;
6879
+ total_attempts: number;
6880
+ started_at: number;
6881
+ delay_ms: number;
6882
+ next_retry_at?: number | undefined;
6883
+ } | undefined;
6479
6884
  run_id?: (string & z.BRAND<"RunId">) | undefined;
6480
6885
  parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
6481
6886
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -6485,10 +6890,17 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6485
6890
  meta?: Record<string, SerializableJsonValue> | undefined;
6486
6891
  duration_ms?: number | undefined;
6487
6892
  subrun_parent_id?: string | undefined;
6893
+ output?: SerializableJsonValue | undefined;
6894
+ failure?: {
6895
+ error: string;
6896
+ error_code?: string | undefined;
6897
+ retry_id?: string | undefined;
6898
+ retryable?: boolean | undefined;
6899
+ details?: SerializableJsonValue | undefined;
6900
+ } | undefined;
6488
6901
  answer_id?: string | undefined;
6489
6902
  seq?: number | undefined;
6490
6903
  is_last?: boolean | 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;
@@ -6697,6 +7109,30 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6697
7109
  ephemeral?: boolean | undefined;
6698
7110
  compression_ratio?: number | undefined;
6699
7111
  included_old_summary?: boolean | undefined;
7112
+ } | {
7113
+ id: string;
7114
+ type: "llm_retry";
7115
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
7116
+ error: string;
7117
+ timestamp: number;
7118
+ version: 1;
7119
+ conversation_id: string;
7120
+ turn_id: 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
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
7131
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
7132
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
7133
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
7134
+ ephemeral?: boolean | undefined;
7135
+ next_retry_at?: number | undefined;
6700
7136
  } | {
6701
7137
  id: string;
6702
7138
  type: "error";
@@ -6712,8 +7148,9 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6712
7148
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
6713
7149
  ephemeral?: boolean | 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
  id: string;
6719
7156
  type: "control";
@@ -6767,8 +7204,8 @@ declare const validateRuntimeEvent: (event: unknown) => z.SafeParseReturnType<un
6767
7204
  id: string;
6768
7205
  type: "run_execution_metrics";
6769
7206
  timestamp: number;
6770
- outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
6771
7207
  version: 1;
7208
+ outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
6772
7209
  conversation_id: string;
6773
7210
  turn_id: string;
6774
7211
  duration_ms: number;
@@ -6983,7 +7420,7 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
6983
7420
  } | {
6984
7421
  id: string;
6985
7422
  type: "subrun_trace";
6986
- kind: "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
7423
+ kind: "error" | "history_summary" | "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk" | "llm_retry";
6987
7424
  timestamp: number;
6988
7425
  version: 1;
6989
7426
  conversation_id: string;
@@ -7016,6 +7453,19 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7016
7453
  fileName?: string | undefined;
7017
7454
  label?: string | undefined;
7018
7455
  }[] | undefined;
7456
+ retry?: {
7457
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
7458
+ error: string;
7459
+ error_code: string;
7460
+ retry_id: string;
7461
+ category: "transport" | "output" | "rate_limit" | "other";
7462
+ attempt: number;
7463
+ max_retries: number;
7464
+ total_attempts: number;
7465
+ started_at: number;
7466
+ delay_ms: number;
7467
+ next_retry_at?: number | undefined;
7468
+ } | undefined;
7019
7469
  run_id?: (string & z.BRAND<"RunId">) | undefined;
7020
7470
  parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
7021
7471
  lane?: "foreground" | "auxiliary" | "child" | undefined;
@@ -7025,10 +7475,17 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7025
7475
  meta?: Record<string, SerializableJsonValue> | undefined;
7026
7476
  duration_ms?: number | undefined;
7027
7477
  subrun_parent_id?: string | undefined;
7478
+ output?: SerializableJsonValue | undefined;
7479
+ failure?: {
7480
+ error: string;
7481
+ error_code?: string | undefined;
7482
+ retry_id?: string | undefined;
7483
+ retryable?: boolean | undefined;
7484
+ details?: SerializableJsonValue | undefined;
7485
+ } | undefined;
7028
7486
  answer_id?: string | undefined;
7029
7487
  seq?: number | undefined;
7030
7488
  is_last?: boolean | 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;
@@ -7237,6 +7694,30 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7237
7694
  ephemeral?: boolean | undefined;
7238
7695
  compression_ratio?: number | undefined;
7239
7696
  included_old_summary?: boolean | undefined;
7697
+ } | {
7698
+ id: string;
7699
+ type: "llm_retry";
7700
+ status: "failed" | "cancelled" | "waiting" | "retrying" | "succeeded" | "exhausted";
7701
+ error: string;
7702
+ timestamp: number;
7703
+ version: 1;
7704
+ conversation_id: string;
7705
+ turn_id: 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
+ run_id?: (string & z.BRAND<"RunId">) | undefined;
7716
+ parent_run_id?: (string & z.BRAND<"RunId">) | undefined;
7717
+ lane?: "foreground" | "auxiliary" | "child" | undefined;
7718
+ visibility?: "none" | "conversation" | "parent-trace" | undefined;
7719
+ ephemeral?: boolean | undefined;
7720
+ next_retry_at?: number | undefined;
7240
7721
  } | {
7241
7722
  id: string;
7242
7723
  type: "error";
@@ -7252,8 +7733,9 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7252
7733
  visibility?: "none" | "conversation" | "parent-trace" | undefined;
7253
7734
  ephemeral?: boolean | 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
  id: string;
7259
7741
  type: "control";
@@ -7307,8 +7789,8 @@ declare const validateRuntimeEvents: (events: unknown[]) => z.SafeParseReturnTyp
7307
7789
  id: string;
7308
7790
  type: "run_execution_metrics";
7309
7791
  timestamp: number;
7310
- outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
7311
7792
  version: 1;
7793
+ outcome: "completed" | "failed" | "cancelled" | "awaiting_user";
7312
7794
  conversation_id: string;
7313
7795
  turn_id: string;
7314
7796
  duration_ms: number;
@@ -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 };