@vercel/factory 0.0.17 → 0.0.18

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 (186) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/api-contracts.d.mts +665 -715
  3. package/dist/api-contracts.mjs +91 -4
  4. package/dist/api-contracts.mjs.map +1 -1
  5. package/dist/api-task-graph.mjs +14 -5
  6. package/dist/api-task-graph.mjs.map +1 -1
  7. package/dist/api.d.mts +58 -11
  8. package/dist/api.mjs +715 -399
  9. package/dist/api.mjs.map +1 -1
  10. package/dist/approval-access.d.mts +1 -1
  11. package/dist/approval-contracts.d.mts +3 -4
  12. package/dist/approval-contracts.mjs +1 -2
  13. package/dist/approval-contracts.mjs.map +1 -1
  14. package/dist/blob/index.d.mts +1 -1
  15. package/dist/budget.mjs +20 -3
  16. package/dist/budget.mjs.map +1 -1
  17. package/dist/change-verification/brief.d.mts +1 -1
  18. package/dist/change-verification/dispatch.mjs +8 -1
  19. package/dist/change-verification/dispatch.mjs.map +1 -1
  20. package/dist/changes/eve-record-change.mjs +4 -1
  21. package/dist/changes/eve-record-change.mjs.map +1 -1
  22. package/dist/client-stream.d.mts +19 -2
  23. package/dist/client-stream.mjs +115 -53
  24. package/dist/client-stream.mjs.map +1 -1
  25. package/dist/client-transcript.d.mts +25 -2
  26. package/dist/client-transcript.mjs +95 -13
  27. package/dist/client-transcript.mjs.map +1 -1
  28. package/dist/client.d.mts +145 -19
  29. package/dist/client.mjs +89 -16
  30. package/dist/client.mjs.map +1 -1
  31. package/dist/code-review/contracts.d.mts +1 -0
  32. package/dist/code-review/eve-post-review.d.mts +4 -2
  33. package/dist/code-review/eve-post-review.mjs +8 -0
  34. package/dist/code-review/eve-post-review.mjs.map +1 -1
  35. package/dist/code-review/github-reporter.d.mts +6 -2
  36. package/dist/code-review/github-reporter.mjs +86 -35
  37. package/dist/code-review/github-reporter.mjs.map +1 -1
  38. package/dist/code-review/preparation.d.mts +2 -1
  39. package/dist/code-review/preparation.mjs +2 -1
  40. package/dist/code-review/preparation.mjs.map +1 -1
  41. package/dist/code-review/stall.mjs +11 -2
  42. package/dist/code-review/stall.mjs.map +1 -1
  43. package/dist/connectors/github.d.mts +1 -1
  44. package/dist/connectors/index.d.mts +1 -1
  45. package/dist/connectors/slack.d.mts +1 -1
  46. package/dist/delivery-metrics/metrics.d.mts +1 -1
  47. package/dist/dispatch.mjs +3 -3
  48. package/dist/dispatch.mjs.map +1 -1
  49. package/dist/eve/index.d.mts +1 -1
  50. package/dist/eve/index.mjs +8 -1
  51. package/dist/eve/index.mjs.map +1 -1
  52. package/dist/eve/task-execution.d.mts +4 -4
  53. package/dist/eve/transcript.d.mts +3 -1
  54. package/dist/eve/transcript.mjs.map +1 -1
  55. package/dist/finding-remediation/admission.d.mts +1 -1
  56. package/dist/finding-remediation/brief.d.mts +1 -1
  57. package/dist/github-app.d.mts +1 -1
  58. package/dist/github-publication.d.mts +1 -1
  59. package/dist/github.d.mts +9 -1
  60. package/dist/github.mjs +29 -11
  61. package/dist/github.mjs.map +1 -1
  62. package/dist/index.d.mts +1 -1
  63. package/dist/intake-contracts.d.mts +1 -0
  64. package/dist/intake-contracts.mjs +2 -1
  65. package/dist/intake-contracts.mjs.map +1 -1
  66. package/dist/integrations/github-issues.d.mts +53 -0
  67. package/dist/integrations/github-issues.mjs +170 -0
  68. package/dist/integrations/github-issues.mjs.map +1 -0
  69. package/dist/integrations/github.d.mts +2 -1
  70. package/dist/integrations/github.mjs +2 -1
  71. package/dist/multi-repository-changes/coordination.mjs +1 -1
  72. package/dist/planning/reconcile.mjs +15 -2
  73. package/dist/planning/reconcile.mjs.map +1 -1
  74. package/dist/postgres/index.d.mts +2 -1
  75. package/dist/postgres/index.mjs +11 -5
  76. package/dist/postgres/index.mjs.map +1 -1
  77. package/dist/postgres/indexed-codec.mjs +137 -0
  78. package/dist/postgres/indexed-codec.mjs.map +1 -0
  79. package/dist/postgres/indexed-schema.mjs +99 -0
  80. package/dist/postgres/indexed-schema.mjs.map +1 -0
  81. package/dist/postgres/indexed.d.mts +28 -0
  82. package/dist/postgres/indexed.mjs +277 -0
  83. package/dist/postgres/indexed.mjs.map +1 -0
  84. package/dist/postgres/record-predicates.mjs +23 -0
  85. package/dist/postgres/record-predicates.mjs.map +1 -0
  86. package/dist/presets/software-development/deepsec-brief.d.mts +1 -1
  87. package/dist/presets/software-development/dispatch.mjs +1 -1
  88. package/dist/presets/software-development/dispatch.mjs.map +1 -1
  89. package/dist/presets/software-development/recovery.mjs +9 -2
  90. package/dist/presets/software-development/recovery.mjs.map +1 -1
  91. package/dist/pull-requests/eve-fetch.d.mts +4 -1
  92. package/dist/pull-requests/eve-fetch.mjs +9 -0
  93. package/dist/pull-requests/eve-fetch.mjs.map +1 -1
  94. package/dist/pull-requests/github-publisher.d.mts +1 -1
  95. package/dist/pull-requests/github-publisher.mjs +19 -7
  96. package/dist/pull-requests/github-publisher.mjs.map +1 -1
  97. package/dist/repositories.mjs +20 -13
  98. package/dist/repositories.mjs.map +1 -1
  99. package/dist/sandbox/execution-run-ledger.d.mts +2 -2
  100. package/dist/sandbox/execution-run-ledger.mjs.map +1 -1
  101. package/dist/sandbox/execution.d.mts +2 -2
  102. package/dist/sandbox/execution.mjs.map +1 -1
  103. package/dist/schema/catalog.mjs +1 -1
  104. package/dist/schema/change.d.mts +1 -1
  105. package/dist/schema/communication.d.mts +2 -2
  106. package/dist/schema/factory-config.d.mts +1 -1
  107. package/dist/schema/outbox.d.mts +6 -6
  108. package/dist/schema/session-summary.d.mts +218 -0
  109. package/dist/schema/session-summary.mjs +68 -0
  110. package/dist/schema/session-summary.mjs.map +1 -0
  111. package/dist/schema/session.d.mts +39 -59
  112. package/dist/schema/session.mjs +6 -6
  113. package/dist/schema/session.mjs.map +1 -1
  114. package/dist/schema/task-graph.d.mts +24 -24
  115. package/dist/schema/transcript.d.mts +141 -3
  116. package/dist/schema/transcript.mjs +19 -3
  117. package/dist/schema/transcript.mjs.map +1 -1
  118. package/dist/schema/transitions.d.mts +1 -1
  119. package/dist/schema/transitions.mjs +1 -1
  120. package/dist/schema/transitions.mjs.map +1 -1
  121. package/dist/signals.d.mts +1 -1
  122. package/dist/stall.mjs +10 -2
  123. package/dist/stall.mjs.map +1 -1
  124. package/dist/storage.d.mts +10 -1
  125. package/dist/storage.mjs +7 -1
  126. package/dist/store/approvals.d.mts +14 -0
  127. package/dist/store/approvals.mjs +78 -0
  128. package/dist/store/approvals.mjs.map +1 -0
  129. package/dist/store/conversations.d.mts +59 -0
  130. package/dist/store/conversations.mjs +549 -0
  131. package/dist/store/conversations.mjs.map +1 -0
  132. package/dist/store/driver.d.mts +1 -1
  133. package/dist/store/driver.mjs.map +1 -1
  134. package/dist/store/engine.d.mts +38 -16
  135. package/dist/store/engine.mjs +229 -106
  136. package/dist/store/engine.mjs.map +1 -1
  137. package/dist/store/indexed-engine.d.mts +57 -0
  138. package/dist/store/indexed-engine.mjs +155 -0
  139. package/dist/store/indexed-engine.mjs.map +1 -0
  140. package/dist/store/indexed-memory.d.mts +7 -0
  141. package/dist/store/indexed-memory.mjs +200 -0
  142. package/dist/store/indexed-memory.mjs.map +1 -0
  143. package/dist/store/indexed-projections.d.mts +280 -0
  144. package/dist/store/indexed-projections.mjs +481 -0
  145. package/dist/store/indexed-projections.mjs.map +1 -0
  146. package/dist/store/indexed.d.mts +101 -0
  147. package/dist/store/indexed.mjs +19 -0
  148. package/dist/store/indexed.mjs.map +1 -0
  149. package/dist/store/iterate.d.mts +9 -0
  150. package/dist/store/iterate.mjs +23 -0
  151. package/dist/store/iterate.mjs.map +1 -0
  152. package/dist/store/query-scope.mjs +62 -0
  153. package/dist/store/query-scope.mjs.map +1 -0
  154. package/dist/store/query.d.mts +32 -0
  155. package/dist/store/query.mjs +103 -0
  156. package/dist/store/query.mjs.map +1 -0
  157. package/dist/store/session-history.mjs +24 -0
  158. package/dist/store/session-history.mjs.map +1 -0
  159. package/dist/store/slack-pr-notifications.d.mts +2 -2
  160. package/dist/store/slack-pr-notifications.mjs.map +1 -1
  161. package/dist/store/state.d.mts +26 -0
  162. package/dist/store/state.mjs +95 -0
  163. package/dist/store/state.mjs.map +1 -0
  164. package/dist/store/task-effects.d.mts +1 -1
  165. package/dist/store/task-graphs.d.mts +1 -1
  166. package/dist/store/task-messages.d.mts +1 -1
  167. package/dist/store/task-work.d.mts +1 -1
  168. package/dist/store/task-work.mjs +1 -1
  169. package/dist/store/transcripts.mjs +308 -0
  170. package/dist/store/transcripts.mjs.map +1 -0
  171. package/dist/sweep.d.mts +1 -1
  172. package/dist/sweep.mjs +12 -7
  173. package/dist/sweep.mjs.map +1 -1
  174. package/dist/task-communication.mjs +15 -1
  175. package/dist/task-communication.mjs.map +1 -1
  176. package/dist/task-protocols.d.mts +3 -3
  177. package/dist/tasks.d.mts +1 -1
  178. package/dist/vercel.d.mts +1 -1
  179. package/dist/work-triage/find-existing-work.d.mts +1 -1
  180. package/dist/work-triage/find-existing-work.mjs +12 -2
  181. package/dist/work-triage/find-existing-work.mjs.map +1 -1
  182. package/docs/index.md +4 -0
  183. package/docs/recipes/persistence-recovery.md +15 -9
  184. package/docs/recipes/postgres-indexed-engine.md +108 -0
  185. package/docs/recipes/postgres-indexed-storage.md +145 -0
  186. package/package.json +3 -1
@@ -265,6 +265,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
265
265
  };
266
266
  attempt: number;
267
267
  updatedAt: string;
268
+ createdAt: string;
268
269
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
269
270
  kind: TaskKind;
270
271
  model?: string | undefined;
@@ -312,7 +313,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
312
313
  answerEventIds?: readonly `ans_${string}`[] | undefined;
313
314
  changeId?: `chg_${string}` | undefined;
314
315
  reportRef?: string | undefined;
315
- createdAt: string;
316
316
  } & {
317
317
  waitingForMessages?: false;
318
318
  needsHumanAction?: never;
@@ -342,6 +342,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
342
342
  };
343
343
  attempt: number;
344
344
  updatedAt: string;
345
+ createdAt: string;
345
346
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
346
347
  kind: TaskKind;
347
348
  model?: string | undefined;
@@ -389,7 +390,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
389
390
  answerEventIds?: readonly `ans_${string}`[] | undefined;
390
391
  changeId?: `chg_${string}` | undefined;
391
392
  reportRef?: string | undefined;
392
- createdAt: string;
393
393
  } & {
394
394
  waitingForMessages?: false;
395
395
  needsHumanAction?: never;
@@ -425,6 +425,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
425
425
  };
426
426
  attempt: number;
427
427
  updatedAt: string;
428
+ createdAt: string;
428
429
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
429
430
  kind: TaskKind;
430
431
  model?: string | undefined;
@@ -472,7 +473,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
472
473
  answerEventIds?: readonly `ans_${string}`[] | undefined;
473
474
  changeId?: `chg_${string}` | undefined;
474
475
  reportRef?: string | undefined;
475
- createdAt: string;
476
476
  } & {
477
477
  waitingForMessages?: false;
478
478
  needsHumanAction?: never;
@@ -508,6 +508,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
508
508
  };
509
509
  attempt: number;
510
510
  updatedAt: string;
511
+ createdAt: string;
511
512
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
512
513
  kind: TaskKind;
513
514
  model?: string | undefined;
@@ -555,7 +556,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
555
556
  answerEventIds?: readonly `ans_${string}`[] | undefined;
556
557
  changeId?: `chg_${string}` | undefined;
557
558
  reportRef?: string | undefined;
558
- createdAt: string;
559
559
  } & {
560
560
  waitingForMessages?: false;
561
561
  needsHumanAction?: never;
@@ -663,6 +663,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
663
663
  };
664
664
  attempt: number;
665
665
  updatedAt: string;
666
+ createdAt: string;
666
667
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
667
668
  kind: TaskKind;
668
669
  model?: string | undefined;
@@ -710,7 +711,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
710
711
  answerEventIds?: readonly `ans_${string}`[] | undefined;
711
712
  changeId?: `chg_${string}` | undefined;
712
713
  reportRef?: string | undefined;
713
- createdAt: string;
714
714
  } & {
715
715
  waitingForMessages?: false;
716
716
  needsHumanAction?: never;
@@ -740,6 +740,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
740
740
  };
741
741
  attempt: number;
742
742
  updatedAt: string;
743
+ createdAt: string;
743
744
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
744
745
  kind: TaskKind;
745
746
  model?: string | undefined;
@@ -787,7 +788,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
787
788
  answerEventIds?: readonly `ans_${string}`[] | undefined;
788
789
  changeId?: `chg_${string}` | undefined;
789
790
  reportRef?: string | undefined;
790
- createdAt: string;
791
791
  } & {
792
792
  waitingForMessages?: false;
793
793
  needsHumanAction?: never;
@@ -823,6 +823,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
823
823
  };
824
824
  attempt: number;
825
825
  updatedAt: string;
826
+ createdAt: string;
826
827
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
827
828
  kind: TaskKind;
828
829
  model?: string | undefined;
@@ -870,7 +871,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
870
871
  answerEventIds?: readonly `ans_${string}`[] | undefined;
871
872
  changeId?: `chg_${string}` | undefined;
872
873
  reportRef?: string | undefined;
873
- createdAt: string;
874
874
  } & {
875
875
  waitingForMessages?: false;
876
876
  needsHumanAction?: never;
@@ -906,6 +906,7 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
906
906
  };
907
907
  attempt: number;
908
908
  updatedAt: string;
909
+ createdAt: string;
909
910
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
910
911
  kind: TaskKind;
911
912
  model?: string | undefined;
@@ -953,7 +954,6 @@ declare const taskGraphAdmissionSchema: Omit<z.ZodObject<{
953
954
  answerEventIds?: readonly `ans_${string}`[] | undefined;
954
955
  changeId?: `chg_${string}` | undefined;
955
956
  reportRef?: string | undefined;
956
- createdAt: string;
957
957
  } & {
958
958
  waitingForMessages?: false;
959
959
  needsHumanAction?: never;
@@ -1315,6 +1315,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1315
1315
  };
1316
1316
  attempt: number;
1317
1317
  updatedAt: string;
1318
+ createdAt: string;
1318
1319
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1319
1320
  kind: TaskKind;
1320
1321
  model?: string | undefined;
@@ -1362,7 +1363,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1362
1363
  answerEventIds?: readonly `ans_${string}`[] | undefined;
1363
1364
  changeId?: `chg_${string}` | undefined;
1364
1365
  reportRef?: string | undefined;
1365
- createdAt: string;
1366
1366
  } & {
1367
1367
  waitingForMessages?: false;
1368
1368
  needsHumanAction?: never;
@@ -1392,6 +1392,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1392
1392
  };
1393
1393
  attempt: number;
1394
1394
  updatedAt: string;
1395
+ createdAt: string;
1395
1396
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1396
1397
  kind: TaskKind;
1397
1398
  model?: string | undefined;
@@ -1439,7 +1440,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1439
1440
  answerEventIds?: readonly `ans_${string}`[] | undefined;
1440
1441
  changeId?: `chg_${string}` | undefined;
1441
1442
  reportRef?: string | undefined;
1442
- createdAt: string;
1443
1443
  } & {
1444
1444
  waitingForMessages?: false;
1445
1445
  needsHumanAction?: never;
@@ -1475,6 +1475,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1475
1475
  };
1476
1476
  attempt: number;
1477
1477
  updatedAt: string;
1478
+ createdAt: string;
1478
1479
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1479
1480
  kind: TaskKind;
1480
1481
  model?: string | undefined;
@@ -1522,7 +1523,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1522
1523
  answerEventIds?: readonly `ans_${string}`[] | undefined;
1523
1524
  changeId?: `chg_${string}` | undefined;
1524
1525
  reportRef?: string | undefined;
1525
- createdAt: string;
1526
1526
  } & {
1527
1527
  waitingForMessages?: false;
1528
1528
  needsHumanAction?: never;
@@ -1558,6 +1558,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1558
1558
  };
1559
1559
  attempt: number;
1560
1560
  updatedAt: string;
1561
+ createdAt: string;
1561
1562
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1562
1563
  kind: TaskKind;
1563
1564
  model?: string | undefined;
@@ -1605,7 +1606,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1605
1606
  answerEventIds?: readonly `ans_${string}`[] | undefined;
1606
1607
  changeId?: `chg_${string}` | undefined;
1607
1608
  reportRef?: string | undefined;
1608
- createdAt: string;
1609
1609
  } & {
1610
1610
  waitingForMessages?: false;
1611
1611
  needsHumanAction?: never;
@@ -1713,6 +1713,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1713
1713
  };
1714
1714
  attempt: number;
1715
1715
  updatedAt: string;
1716
+ createdAt: string;
1716
1717
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1717
1718
  kind: TaskKind;
1718
1719
  model?: string | undefined;
@@ -1760,7 +1761,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1760
1761
  answerEventIds?: readonly `ans_${string}`[] | undefined;
1761
1762
  changeId?: `chg_${string}` | undefined;
1762
1763
  reportRef?: string | undefined;
1763
- createdAt: string;
1764
1764
  } & {
1765
1765
  waitingForMessages?: false;
1766
1766
  needsHumanAction?: never;
@@ -1790,6 +1790,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1790
1790
  };
1791
1791
  attempt: number;
1792
1792
  updatedAt: string;
1793
+ createdAt: string;
1793
1794
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1794
1795
  kind: TaskKind;
1795
1796
  model?: string | undefined;
@@ -1837,7 +1838,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1837
1838
  answerEventIds?: readonly `ans_${string}`[] | undefined;
1838
1839
  changeId?: `chg_${string}` | undefined;
1839
1840
  reportRef?: string | undefined;
1840
- createdAt: string;
1841
1841
  } & {
1842
1842
  waitingForMessages?: false;
1843
1843
  needsHumanAction?: never;
@@ -1873,6 +1873,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1873
1873
  };
1874
1874
  attempt: number;
1875
1875
  updatedAt: string;
1876
+ createdAt: string;
1876
1877
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1877
1878
  kind: TaskKind;
1878
1879
  model?: string | undefined;
@@ -1920,7 +1921,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1920
1921
  answerEventIds?: readonly `ans_${string}`[] | undefined;
1921
1922
  changeId?: `chg_${string}` | undefined;
1922
1923
  reportRef?: string | undefined;
1923
- createdAt: string;
1924
1924
  } & {
1925
1925
  waitingForMessages?: false;
1926
1926
  needsHumanAction?: never;
@@ -1956,6 +1956,7 @@ declare const taskGraphNodeSchema: z.ZodObject<{
1956
1956
  };
1957
1957
  attempt: number;
1958
1958
  updatedAt: string;
1959
+ createdAt: string;
1959
1960
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
1960
1961
  kind: TaskKind;
1961
1962
  model?: string | undefined;
@@ -2003,7 +2004,6 @@ declare const taskGraphNodeSchema: z.ZodObject<{
2003
2004
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2004
2005
  changeId?: `chg_${string}` | undefined;
2005
2006
  reportRef?: string | undefined;
2006
- createdAt: string;
2007
2007
  } & {
2008
2008
  waitingForMessages?: false;
2009
2009
  needsHumanAction?: never;
@@ -2373,6 +2373,7 @@ declare const taskGraphSchema: z.ZodObject<{
2373
2373
  };
2374
2374
  attempt: number;
2375
2375
  updatedAt: string;
2376
+ createdAt: string;
2376
2377
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
2377
2378
  kind: TaskKind;
2378
2379
  model?: string | undefined;
@@ -2420,7 +2421,6 @@ declare const taskGraphSchema: z.ZodObject<{
2420
2421
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2421
2422
  changeId?: `chg_${string}` | undefined;
2422
2423
  reportRef?: string | undefined;
2423
- createdAt: string;
2424
2424
  } & {
2425
2425
  waitingForMessages?: false;
2426
2426
  needsHumanAction?: never;
@@ -2450,6 +2450,7 @@ declare const taskGraphSchema: z.ZodObject<{
2450
2450
  };
2451
2451
  attempt: number;
2452
2452
  updatedAt: string;
2453
+ createdAt: string;
2453
2454
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
2454
2455
  kind: TaskKind;
2455
2456
  model?: string | undefined;
@@ -2497,7 +2498,6 @@ declare const taskGraphSchema: z.ZodObject<{
2497
2498
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2498
2499
  changeId?: `chg_${string}` | undefined;
2499
2500
  reportRef?: string | undefined;
2500
- createdAt: string;
2501
2501
  } & {
2502
2502
  waitingForMessages?: false;
2503
2503
  needsHumanAction?: never;
@@ -2533,6 +2533,7 @@ declare const taskGraphSchema: z.ZodObject<{
2533
2533
  };
2534
2534
  attempt: number;
2535
2535
  updatedAt: string;
2536
+ createdAt: string;
2536
2537
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
2537
2538
  kind: TaskKind;
2538
2539
  model?: string | undefined;
@@ -2580,7 +2581,6 @@ declare const taskGraphSchema: z.ZodObject<{
2580
2581
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2581
2582
  changeId?: `chg_${string}` | undefined;
2582
2583
  reportRef?: string | undefined;
2583
- createdAt: string;
2584
2584
  } & {
2585
2585
  waitingForMessages?: false;
2586
2586
  needsHumanAction?: never;
@@ -2616,6 +2616,7 @@ declare const taskGraphSchema: z.ZodObject<{
2616
2616
  };
2617
2617
  attempt: number;
2618
2618
  updatedAt: string;
2619
+ createdAt: string;
2619
2620
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
2620
2621
  kind: TaskKind;
2621
2622
  model?: string | undefined;
@@ -2663,7 +2664,6 @@ declare const taskGraphSchema: z.ZodObject<{
2663
2664
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2664
2665
  changeId?: `chg_${string}` | undefined;
2665
2666
  reportRef?: string | undefined;
2666
- createdAt: string;
2667
2667
  } & {
2668
2668
  waitingForMessages?: false;
2669
2669
  needsHumanAction?: never;
@@ -2771,6 +2771,7 @@ declare const taskGraphSchema: z.ZodObject<{
2771
2771
  };
2772
2772
  attempt: number;
2773
2773
  updatedAt: string;
2774
+ createdAt: string;
2774
2775
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
2775
2776
  kind: TaskKind;
2776
2777
  model?: string | undefined;
@@ -2818,7 +2819,6 @@ declare const taskGraphSchema: z.ZodObject<{
2818
2819
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2819
2820
  changeId?: `chg_${string}` | undefined;
2820
2821
  reportRef?: string | undefined;
2821
- createdAt: string;
2822
2822
  } & {
2823
2823
  waitingForMessages?: false;
2824
2824
  needsHumanAction?: never;
@@ -2848,6 +2848,7 @@ declare const taskGraphSchema: z.ZodObject<{
2848
2848
  };
2849
2849
  attempt: number;
2850
2850
  updatedAt: string;
2851
+ createdAt: string;
2851
2852
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
2852
2853
  kind: TaskKind;
2853
2854
  model?: string | undefined;
@@ -2895,7 +2896,6 @@ declare const taskGraphSchema: z.ZodObject<{
2895
2896
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2896
2897
  changeId?: `chg_${string}` | undefined;
2897
2898
  reportRef?: string | undefined;
2898
- createdAt: string;
2899
2899
  } & {
2900
2900
  waitingForMessages?: false;
2901
2901
  needsHumanAction?: never;
@@ -2931,6 +2931,7 @@ declare const taskGraphSchema: z.ZodObject<{
2931
2931
  };
2932
2932
  attempt: number;
2933
2933
  updatedAt: string;
2934
+ createdAt: string;
2934
2935
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
2935
2936
  kind: TaskKind;
2936
2937
  model?: string | undefined;
@@ -2978,7 +2979,6 @@ declare const taskGraphSchema: z.ZodObject<{
2978
2979
  answerEventIds?: readonly `ans_${string}`[] | undefined;
2979
2980
  changeId?: `chg_${string}` | undefined;
2980
2981
  reportRef?: string | undefined;
2981
- createdAt: string;
2982
2982
  } & {
2983
2983
  waitingForMessages?: false;
2984
2984
  needsHumanAction?: never;
@@ -3014,6 +3014,7 @@ declare const taskGraphSchema: z.ZodObject<{
3014
3014
  };
3015
3015
  attempt: number;
3016
3016
  updatedAt: string;
3017
+ createdAt: string;
3017
3018
  repositoryIds: readonly [`repo_${string}`, ...`repo_${string}`[]];
3018
3019
  kind: TaskKind;
3019
3020
  model?: string | undefined;
@@ -3061,7 +3062,6 @@ declare const taskGraphSchema: z.ZodObject<{
3061
3062
  answerEventIds?: readonly `ans_${string}`[] | undefined;
3062
3063
  changeId?: `chg_${string}` | undefined;
3063
3064
  reportRef?: string | undefined;
3064
- createdAt: string;
3065
3065
  } & {
3066
3066
  waitingForMessages?: false;
3067
3067
  needsHumanAction?: never;
@@ -46,19 +46,27 @@ declare const transcriptBlockSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.Zo
46
46
  id: z.ZodString;
47
47
  title: z.ZodString;
48
48
  text: z.ZodString;
49
+ contentRef: z.ZodOptional<z.ZodObject<{
50
+ blockId: z.ZodString;
51
+ bytes: z.ZodNumber;
52
+ }, z.core.$strict>>;
49
53
  createdAt: z.ZodOptional<z.ZodISODateTime>;
50
54
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
51
55
  kind: z.ZodEnum<{
52
56
  error: "error";
57
+ status: "status";
53
58
  assistant: "assistant";
54
59
  reasoning: "reasoning";
55
- status: "status";
56
60
  }>;
57
61
  tool: z.ZodOptional<z.ZodNever>;
58
62
  attachments: z.ZodOptional<z.ZodNever>;
59
63
  id: z.ZodString;
60
64
  title: z.ZodString;
61
65
  text: z.ZodString;
66
+ contentRef: z.ZodOptional<z.ZodObject<{
67
+ blockId: z.ZodString;
68
+ bytes: z.ZodNumber;
69
+ }, z.core.$strict>>;
62
70
  createdAt: z.ZodOptional<z.ZodISODateTime>;
63
71
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
64
72
  kind: z.ZodLiteral<"tool">;
@@ -82,6 +90,10 @@ declare const transcriptBlockSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.Zo
82
90
  id: z.ZodString;
83
91
  title: z.ZodString;
84
92
  text: z.ZodString;
93
+ contentRef: z.ZodOptional<z.ZodObject<{
94
+ blockId: z.ZodString;
95
+ bytes: z.ZodNumber;
96
+ }, z.core.$strict>>;
85
97
  createdAt: z.ZodOptional<z.ZodISODateTime>;
86
98
  }, z.core.$strict>>], "kind">;
87
99
  /** Validates a cursor-addressed transcript projection and its current execution state. */
@@ -102,19 +114,27 @@ declare const transcriptSnapshotSchema: z.ZodReadonly<z.ZodObject<{
102
114
  id: z.ZodString;
103
115
  title: z.ZodString;
104
116
  text: z.ZodString;
117
+ contentRef: z.ZodOptional<z.ZodObject<{
118
+ blockId: z.ZodString;
119
+ bytes: z.ZodNumber;
120
+ }, z.core.$strict>>;
105
121
  createdAt: z.ZodOptional<z.ZodISODateTime>;
106
122
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
107
123
  kind: z.ZodEnum<{
108
124
  error: "error";
125
+ status: "status";
109
126
  assistant: "assistant";
110
127
  reasoning: "reasoning";
111
- status: "status";
112
128
  }>;
113
129
  tool: z.ZodOptional<z.ZodNever>;
114
130
  attachments: z.ZodOptional<z.ZodNever>;
115
131
  id: z.ZodString;
116
132
  title: z.ZodString;
117
133
  text: z.ZodString;
134
+ contentRef: z.ZodOptional<z.ZodObject<{
135
+ blockId: z.ZodString;
136
+ bytes: z.ZodNumber;
137
+ }, z.core.$strict>>;
118
138
  createdAt: z.ZodOptional<z.ZodISODateTime>;
119
139
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
120
140
  kind: z.ZodLiteral<"tool">;
@@ -138,6 +158,10 @@ declare const transcriptSnapshotSchema: z.ZodReadonly<z.ZodObject<{
138
158
  id: z.ZodString;
139
159
  title: z.ZodString;
140
160
  text: z.ZodString;
161
+ contentRef: z.ZodOptional<z.ZodObject<{
162
+ blockId: z.ZodString;
163
+ bytes: z.ZodNumber;
164
+ }, z.core.$strict>>;
141
165
  createdAt: z.ZodOptional<z.ZodISODateTime>;
142
166
  }, z.core.$strict>>], "kind">>>;
143
167
  inputs: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
@@ -162,6 +186,12 @@ declare const transcriptSnapshotSchema: z.ZodReadonly<z.ZodObject<{
162
186
  }>;
163
187
  turnId: z.ZodOptional<z.ZodString>;
164
188
  tokens: z.ZodNumber;
189
+ usage: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
190
+ steps: z.ZodNumber;
191
+ costUsd: z.ZodOptional<z.ZodNumber>;
192
+ inputTokens: z.ZodOptional<z.ZodNumber>;
193
+ outputTokens: z.ZodOptional<z.ZodNumber>;
194
+ }, z.core.$strip>>>;
165
195
  }, z.core.$strip>>;
166
196
  /** Structured pending input request projected from a provider transcript. */
167
197
  type InputRequest = z.infer<typeof inputRequestSchema>;
@@ -171,6 +201,114 @@ type ToolCall = z.infer<typeof toolCallSchema>;
171
201
  type TranscriptBlock = z.infer<typeof transcriptBlockSchema>;
172
202
  /** Cursor-addressed read model of a provider execution transcript. */
173
203
  type TranscriptSnapshot = z.infer<typeof transcriptSnapshotSchema>;
204
+ /** Validates one bounded, newest-first history page returned in display order. */
205
+ declare const transcriptPageSchema: z.ZodObject<{
206
+ snapshot: z.ZodReadonly<z.ZodObject<{
207
+ blocks: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
208
+ kind: z.ZodLiteral<"user">;
209
+ tool: z.ZodOptional<z.ZodNever>;
210
+ attachments: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
211
+ id: z.ZodType<`img_${string}`, string, z.core.$ZodTypeInternals<`img_${string}`, string>>;
212
+ filename: z.ZodString;
213
+ mediaType: z.ZodEnum<{
214
+ "image/png": "image/png";
215
+ "image/jpeg": "image/jpeg";
216
+ "image/webp": "image/webp";
217
+ }>;
218
+ size: z.ZodNumber;
219
+ }, z.core.$strict>>>>;
220
+ id: z.ZodString;
221
+ title: z.ZodString;
222
+ text: z.ZodString;
223
+ contentRef: z.ZodOptional<z.ZodObject<{
224
+ blockId: z.ZodString;
225
+ bytes: z.ZodNumber;
226
+ }, z.core.$strict>>;
227
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
228
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
229
+ kind: z.ZodEnum<{
230
+ error: "error";
231
+ status: "status";
232
+ assistant: "assistant";
233
+ reasoning: "reasoning";
234
+ }>;
235
+ tool: z.ZodOptional<z.ZodNever>;
236
+ attachments: z.ZodOptional<z.ZodNever>;
237
+ id: z.ZodString;
238
+ title: z.ZodString;
239
+ text: z.ZodString;
240
+ contentRef: z.ZodOptional<z.ZodObject<{
241
+ blockId: z.ZodString;
242
+ bytes: z.ZodNumber;
243
+ }, z.core.$strict>>;
244
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
245
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
246
+ kind: z.ZodLiteral<"tool">;
247
+ tool: z.ZodReadonly<z.ZodObject<{
248
+ callId: z.ZodString;
249
+ name: z.ZodString;
250
+ input: z.ZodOptional<z.ZodUnknown>;
251
+ inputText: z.ZodString;
252
+ output: z.ZodOptional<z.ZodUnknown>;
253
+ error: z.ZodOptional<z.ZodUnknown>;
254
+ state: z.ZodEnum<{
255
+ running: "running";
256
+ failed: "failed";
257
+ cancelled: "cancelled";
258
+ rejected: "rejected";
259
+ "input-streaming": "input-streaming";
260
+ completed: "completed";
261
+ }>;
262
+ }, z.core.$strip>>;
263
+ attachments: z.ZodOptional<z.ZodNever>;
264
+ id: z.ZodString;
265
+ title: z.ZodString;
266
+ text: z.ZodString;
267
+ contentRef: z.ZodOptional<z.ZodObject<{
268
+ blockId: z.ZodString;
269
+ bytes: z.ZodNumber;
270
+ }, z.core.$strict>>;
271
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
272
+ }, z.core.$strict>>], "kind">>>;
273
+ inputs: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
274
+ requestId: z.ZodString;
275
+ prompt: z.ZodString;
276
+ kind: z.ZodString;
277
+ allowFreeform: z.ZodOptional<z.ZodBoolean>;
278
+ options: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
279
+ id: z.ZodString;
280
+ label: z.ZodString;
281
+ description: z.ZodOptional<z.ZodString>;
282
+ }, z.core.$strip>>>>>;
283
+ }, z.core.$strip>>>>;
284
+ cursor: z.ZodNumber;
285
+ state: z.ZodEnum<{
286
+ running: "running";
287
+ failed: "failed";
288
+ completed: "completed";
289
+ connecting: "connecting";
290
+ "needs input": "needs input";
291
+ waiting: "waiting";
292
+ }>;
293
+ turnId: z.ZodOptional<z.ZodString>;
294
+ tokens: z.ZodNumber;
295
+ usage: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
296
+ steps: z.ZodNumber;
297
+ costUsd: z.ZodOptional<z.ZodNumber>;
298
+ inputTokens: z.ZodOptional<z.ZodNumber>;
299
+ outputTokens: z.ZodOptional<z.ZodNumber>;
300
+ }, z.core.$strip>>>;
301
+ }, z.core.$strip>>;
302
+ nextCursor: z.ZodNullable<z.ZodString>;
303
+ totalBlocks: z.ZodNumber;
304
+ }, z.core.$strict>;
305
+ /** One bounded transcript page with an explicit continuation for older history. */
306
+ type TranscriptPage = z.infer<typeof transcriptPageSchema>;
307
+ /** Required transcript page bound and optional execution-scoped continuation. */
308
+ interface TranscriptPageQuery {
309
+ readonly limit: number;
310
+ readonly cursor?: string;
311
+ }
174
312
  //#endregion
175
- export { InputRequest, ToolCall, TranscriptBlock, TranscriptSnapshot, inputRequestSchema, toolCallSchema, transcriptBlockSchema, transcriptSnapshotSchema };
313
+ export { InputRequest, ToolCall, TranscriptBlock, TranscriptPage, TranscriptPageQuery, TranscriptSnapshot, inputRequestSchema, toolCallSchema, transcriptBlockSchema, transcriptPageSchema, transcriptSnapshotSchema };
176
314
  //# sourceMappingURL=transcript.d.mts.map
@@ -34,7 +34,11 @@ const transcriptBlockBase = {
34
34
  id: z.string().describe("Stable block ID used to replace streamed updates in place."),
35
35
  title: z.string().describe("Short operator-facing block title."),
36
36
  text: z.string().describe("Rendered Markdown or plain-text block content."),
37
- createdAt: z.iso.datetime().optional().describe("Source event timestamp retained in older saved transcripts.")
37
+ contentRef: z.strictObject({
38
+ blockId: z.string().describe("Execution-scoped block identity for an explicit full-content read."),
39
+ bytes: z.number().int().positive().describe("Full encoded block size in bytes.")
40
+ }).optional().describe("Present only on a bounded preview; the full block remains in structured storage."),
41
+ createdAt: z.iso.datetime().optional().describe("Source event timestamp, when recorded by the execution provider.")
38
42
  };
39
43
  const userTranscriptBlockSchema = z.strictObject({
40
44
  ...transcriptBlockBase,
@@ -79,9 +83,21 @@ const transcriptSnapshotSchema = z.object({
79
83
  "failed"
80
84
  ]).describe("Current execution state shown to the operator."),
81
85
  turnId: z.string().optional().describe("Active provider turn ID, when one is running."),
82
- tokens: z.number().nonnegative().describe("Accumulated input and output tokens.")
86
+ tokens: z.number().nonnegative().describe("Accumulated input and output tokens."),
87
+ usage: z.object({
88
+ steps: z.number().int().nonnegative().describe("Observed completed model steps."),
89
+ costUsd: z.number().nonnegative().optional().describe("Total model cost, present only when every observed step reports cost."),
90
+ inputTokens: z.number().int().nonnegative().optional().describe("Total input tokens, present only when every observed step reports them."),
91
+ outputTokens: z.number().int().nonnegative().optional().describe("Total output tokens, present only when every observed step reports them.")
92
+ }).readonly().optional().describe("Execution-local usage; absent on older projections without a full breakdown.")
83
93
  }).readonly();
94
+ /** Validates one bounded, newest-first history page returned in display order. */
95
+ const transcriptPageSchema = z.strictObject({
96
+ snapshot: transcriptSnapshotSchema.describe("Current state and this page's blocks, oldest first."),
97
+ nextCursor: z.string().nullable().describe("Cursor for the preceding page of older blocks."),
98
+ totalBlocks: z.number().int().nonnegative().describe("Current number of blocks in this execution.")
99
+ });
84
100
  //#endregion
85
- export { inputRequestSchema, toolCallSchema, transcriptBlockSchema, transcriptSnapshotSchema };
101
+ export { inputRequestSchema, toolCallSchema, transcriptBlockSchema, transcriptPageSchema, transcriptSnapshotSchema };
86
102
 
87
103
  //# sourceMappingURL=transcript.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.mjs","names":[],"sources":["../../src/schema/transcript.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { imageAttachmentsSchema } from \"../image-input\";\n\n/** Validates a structured input request projected from a provider transcript. */\nexport const inputRequestSchema = z\n .object({\n requestId: z.string().describe(\"Stable provider input request ID.\"),\n prompt: z.string().describe(\"Question or instruction presented to the operator.\"),\n kind: z.string().describe(\"Provider-defined input request kind.\"),\n allowFreeform: z\n .boolean()\n .optional()\n .describe(\"Whether the operator may enter text instead of selecting an option.\"),\n options: z\n .array(\n z\n .object({\n id: z.string().describe(\"Stable option ID returned in the response.\"),\n label: z.string().describe(\"Operator-facing option label.\"),\n description: z.string().optional().describe(\"Additional option context.\"),\n })\n .readonly(),\n )\n .readonly()\n .optional()\n .describe(\"Selectable answers offered by the provider.\"),\n })\n .readonly();\n\n/** Validates the streamed state and payloads of one projected tool call. */\nexport const toolCallSchema = z\n .object({\n callId: z.string().describe(\"Provider tool-call ID used to correlate streamed updates.\"),\n name: z.string().describe(\"Tool name shown in the transcript.\"),\n input: z.unknown().optional().describe(\"Parsed tool input when complete JSON is available.\"),\n inputText: z.string().describe(\"Accumulated tool input text, including partial JSON.\"),\n output: z.unknown().optional().describe(\"Latest partial or final tool output.\"),\n error: z.unknown().optional().describe(\"Provider error associated with this tool call.\"),\n state: z\n .enum([\"input-streaming\", \"running\", \"completed\", \"failed\", \"cancelled\", \"rejected\"])\n .describe(\"Current streamed tool-call lifecycle state.\"),\n })\n .readonly();\n\nconst transcriptBlockBase = {\n id: z.string().describe(\"Stable block ID used to replace streamed updates in place.\"),\n title: z.string().describe(\"Short operator-facing block title.\"),\n text: z.string().describe(\"Rendered Markdown or plain-text block content.\"),\n createdAt: z.iso\n .datetime()\n .optional()\n .describe(\"Source event timestamp retained in older saved transcripts.\"),\n};\n\nconst userTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z.literal(\"user\").describe(\"Human-authored message block.\"),\n tool: z.never().optional().describe(\"Tool payloads are forbidden on user messages.\"),\n attachments: imageAttachmentsSchema\n .optional()\n .describe(\"Images attached to this human message.\"),\n })\n .readonly();\n\nconst textTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z\n .enum([\"assistant\", \"reasoning\", \"status\", \"error\"])\n .describe(\"Non-tool transcript block kind.\"),\n tool: z.never().optional().describe(\"Tool payloads are forbidden on text blocks.\"),\n attachments: z.never().optional().describe(\"Attachments are reserved for user messages.\"),\n })\n .readonly();\n\nconst toolTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z.literal(\"tool\").describe(\"Correlated tool-call block.\"),\n tool: toolCallSchema.describe(\"Tool invocation represented by this block.\"),\n attachments: z.never().optional().describe(\"Attachments are reserved for user messages.\"),\n })\n .readonly();\n\n/** Validates a rendered transcript block with payloads correlated to its kind. */\nexport const transcriptBlockSchema = z.discriminatedUnion(\"kind\", [\n userTranscriptBlockSchema,\n textTranscriptBlockSchema,\n toolTranscriptBlockSchema,\n]);\n\n/** Validates a cursor-addressed transcript projection and its current execution state. */\nexport const transcriptSnapshotSchema = z\n .object({\n blocks: z\n .array(transcriptBlockSchema)\n .readonly()\n .describe(\"Ordered rendered transcript blocks.\"),\n inputs: z.array(inputRequestSchema).readonly().describe(\"Unresolved provider input requests.\"),\n cursor: z.number().int().nonnegative().describe(\"Next provider event index to request.\"),\n state: z\n .enum([\"connecting\", \"running\", \"needs input\", \"waiting\", \"completed\", \"failed\"])\n .describe(\"Current execution state shown to the operator.\"),\n turnId: z.string().optional().describe(\"Active provider turn ID, when one is running.\"),\n tokens: z.number().nonnegative().describe(\"Accumulated input and output tokens.\"),\n })\n .readonly();\n\n/** Structured pending input request projected from a provider transcript. */\nexport type InputRequest = z.infer<typeof inputRequestSchema>;\n/** Projected tool invocation with streamed input, result, error, and lifecycle state. */\nexport type ToolCall = z.infer<typeof toolCallSchema>;\n/** Renderable unit in a structured Factory transcript. */\nexport type TranscriptBlock = z.infer<typeof transcriptBlockSchema>;\n/** Cursor-addressed read model of a provider execution transcript. */\nexport type TranscriptSnapshot = z.infer<typeof transcriptSnapshotSchema>;\n"],"mappings":";;;;AAIA,MAAa,qBAAqB,EAC/B,OAAO;CACN,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,mCAAmC;CAClE,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,oDAAoD;CAChF,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,sCAAsC;CAChE,eAAe,EACZ,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,SAAS,qEAAqE;CACjF,SAAS,EACN,MACC,EACG,OAAO;EACN,IAAI,EAAE,OAAO,CAAC,CAAC,SAAS,4CAA4C;EACpE,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,+BAA+B;EAC1D,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,4BAA4B;CAC1E,CAAC,CAAC,CACD,SAAS,CACd,CAAC,CACA,SAAS,CAAC,CACV,S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C,MAAM,EAAE,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,6CAA6C;CACjF,aAAa,EAAE,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,6CAA6C;AAC1F,CAAC,CAAC,CACD,SAAS;AAEZ,MAAM,4BAA4B,EAC/B,aAAa;CACZ,GAAG;CACH,MAAM,EAAE,QAAQ,MAAM,CAAC,CAAC,SAAS,6BAA6B;CAC9D,MAAM,eAAe,SAAS,4CAA4C;CAC1E,aAAa,EAAE,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,6CAA6C;AAC1F,CAAC,CAAC,CACD,SAAS;;AAGZ,MAAa,wBAAwB,EAAE,mBAAmB,QAAQ;CAChE;CACA;CACA;AACF,CAAC;;AAGD,MAAa,2BAA2B,EACrC,OAAO;CACN,QAAQ,EACL,MAAM,qBAAqB,CAAC,CAC5B,SAAS,CAAC,CACV,SAAS,qCAAqC;CACjD,QAAQ,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,qCAAqC;CAC7F,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,uCAAuC;CACvF,OAAO,EACJ,KAAK;EAAC;EAAc;EAAW;EAAe;EAAW;EAAa;CAAQ,CAAC,CAAC,CAChF,SAAS,gDAAgD;CAC5D,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,+CAA+C;CACtF,QAAQ,EAAE,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,sCAAsC;AAClF,CAAC,CAAC,CACD,SAAS"}
1
+ {"version":3,"file":"transcript.mjs","names":[],"sources":["../../src/schema/transcript.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { imageAttachmentsSchema } from \"../image-input\";\n\n/** Validates a structured input request projected from a provider transcript. */\nexport const inputRequestSchema = z\n .object({\n requestId: z.string().describe(\"Stable provider input request ID.\"),\n prompt: z.string().describe(\"Question or instruction presented to the operator.\"),\n kind: z.string().describe(\"Provider-defined input request kind.\"),\n allowFreeform: z\n .boolean()\n .optional()\n .describe(\"Whether the operator may enter text instead of selecting an option.\"),\n options: z\n .array(\n z\n .object({\n id: z.string().describe(\"Stable option ID returned in the response.\"),\n label: z.string().describe(\"Operator-facing option label.\"),\n description: z.string().optional().describe(\"Additional option context.\"),\n })\n .readonly(),\n )\n .readonly()\n .optional()\n .describe(\"Selectable answers offered by the provider.\"),\n })\n .readonly();\n\n/** Validates the streamed state and payloads of one projected tool call. */\nexport const toolCallSchema = z\n .object({\n callId: z.string().describe(\"Provider tool-call ID used to correlate streamed updates.\"),\n name: z.string().describe(\"Tool name shown in the transcript.\"),\n input: z.unknown().optional().describe(\"Parsed tool input when complete JSON is available.\"),\n inputText: z.string().describe(\"Accumulated tool input text, including partial JSON.\"),\n output: z.unknown().optional().describe(\"Latest partial or final tool output.\"),\n error: z.unknown().optional().describe(\"Provider error associated with this tool call.\"),\n state: z\n .enum([\"input-streaming\", \"running\", \"completed\", \"failed\", \"cancelled\", \"rejected\"])\n .describe(\"Current streamed tool-call lifecycle state.\"),\n })\n .readonly();\n\nconst transcriptBlockBase = {\n id: z.string().describe(\"Stable block ID used to replace streamed updates in place.\"),\n title: z.string().describe(\"Short operator-facing block title.\"),\n text: z.string().describe(\"Rendered Markdown or plain-text block content.\"),\n contentRef: z\n .strictObject({\n blockId: z\n .string()\n .describe(\"Execution-scoped block identity for an explicit full-content read.\"),\n bytes: z.number().int().positive().describe(\"Full encoded block size in bytes.\"),\n })\n .optional()\n .describe(\"Present only on a bounded preview; the full block remains in structured storage.\"),\n createdAt: z.iso\n .datetime()\n .optional()\n .describe(\"Source event timestamp, when recorded by the execution provider.\"),\n};\n\nconst userTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z.literal(\"user\").describe(\"Human-authored message block.\"),\n tool: z.never().optional().describe(\"Tool payloads are forbidden on user messages.\"),\n attachments: imageAttachmentsSchema\n .optional()\n .describe(\"Images attached to this human message.\"),\n })\n .readonly();\n\nconst textTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z\n .enum([\"assistant\", \"reasoning\", \"status\", \"error\"])\n .describe(\"Non-tool transcript block kind.\"),\n tool: z.never().optional().describe(\"Tool payloads are forbidden on text blocks.\"),\n attachments: z.never().optional().describe(\"Attachments are reserved for user messages.\"),\n })\n .readonly();\n\nconst toolTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z.literal(\"tool\").describe(\"Correlated tool-call block.\"),\n tool: toolCallSchema.describe(\"Tool invocation represented by this block.\"),\n attachments: z.never().optional().describe(\"Attachments are reserved for user messages.\"),\n })\n .readonly();\n\n/** Validates a rendered transcript block with payloads correlated to its kind. */\nexport const transcriptBlockSchema = z.discriminatedUnion(\"kind\", [\n userTranscriptBlockSchema,\n textTranscriptBlockSchema,\n toolTranscriptBlockSchema,\n]);\n\n/** Validates a cursor-addressed transcript projection and its current execution state. */\nexport const transcriptSnapshotSchema = z\n .object({\n blocks: z\n .array(transcriptBlockSchema)\n .readonly()\n .describe(\"Ordered rendered transcript blocks.\"),\n inputs: z.array(inputRequestSchema).readonly().describe(\"Unresolved provider input requests.\"),\n cursor: z.number().int().nonnegative().describe(\"Next provider event index to request.\"),\n state: z\n .enum([\"connecting\", \"running\", \"needs input\", \"waiting\", \"completed\", \"failed\"])\n .describe(\"Current execution state shown to the operator.\"),\n turnId: z.string().optional().describe(\"Active provider turn ID, when one is running.\"),\n tokens: z.number().nonnegative().describe(\"Accumulated input and output tokens.\"),\n usage: z\n .object({\n steps: z.number().int().nonnegative().describe(\"Observed completed model steps.\"),\n costUsd: z\n .number()\n .nonnegative()\n .optional()\n .describe(\"Total model cost, present only when every observed step reports cost.\"),\n inputTokens: z\n .number()\n .int()\n .nonnegative()\n .optional()\n .describe(\"Total input tokens, present only when every observed step reports them.\"),\n outputTokens: z\n .number()\n .int()\n .nonnegative()\n .optional()\n .describe(\"Total output tokens, present only when every observed step reports them.\"),\n })\n .readonly()\n .optional()\n .describe(\"Execution-local usage; absent on older projections without a full breakdown.\"),\n })\n .readonly();\n\n/** Structured pending input request projected from a provider transcript. */\nexport type InputRequest = z.infer<typeof inputRequestSchema>;\n/** Projected tool invocation with streamed input, result, error, and lifecycle state. */\nexport type ToolCall = z.infer<typeof toolCallSchema>;\n/** Renderable unit in a structured Factory transcript. */\nexport type TranscriptBlock = z.infer<typeof transcriptBlockSchema>;\n/** Cursor-addressed read model of a provider execution transcript. */\nexport type TranscriptSnapshot = z.infer<typeof transcriptSnapshotSchema>;\n\n/** Validates one bounded, newest-first history page returned in display order. */\nexport const transcriptPageSchema = z.strictObject({\n snapshot: transcriptSnapshotSchema.describe(\n \"Current state and this page's blocks, oldest first.\",\n ),\n nextCursor: z.string().nullable().describe(\"Cursor for the preceding page of older blocks.\"),\n totalBlocks: z\n .number()\n .int()\n .nonnegative()\n .describe(\"Current number of blocks in this execution.\"),\n});\n\n/** One bounded transcript page with an explicit continuation for older history. */\nexport type TranscriptPage = z.infer<typeof transcriptPageSchema>;\n\n/** Required transcript page bound and optional execution-scoped continuation. */\nexport interface TranscriptPageQuery {\n readonly limit: number;\n readonly cursor?: string;\n}\n"],"mappings":";;;;AAIA,MAAa,qBAAqB,EAC/B,OAAO;CACN,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,mCAAmC;CAClE,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,oDAAoD;CAChF,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,sCAAsC;CAChE,eAAe,EACZ,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,SAAS,qEAAqE;CACjF,SAAS,EACN,MACC,EACG,OAAO;EACN,IAAI,EAAE,OAAO,CAAC,CAAC,SAAS,4CAA4C;EACpE,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,+BAA+B;EAC1D,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,4BAA4B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,YAAY,CAAC,CAAC,SAAS,sCAAsC;CAChF,OAAO,EACJ,OAAO;EACN,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,iCAAiC;EAChF,SAAS,EACN,OAAO,CAAC,CACR,YAAY,CAAC,CACb,SAAS,CAAC,CACV,SAAS,uEAAuE;EACnF,aAAa,EACV,OAAO,CAAC,CACR,IAAI,CAAC,CACL,YAAY,CAAC,CACb,SAAS,CAAC,CACV,SAAS,yEAAyE;EACrF,cAAc,EACX,OAAO,CAAC,CACR,IAAI,CAAC,CACL,YAAY,CAAC,CACb,SAAS,CAAC,CACV,SAAS,0EAA0E;CACxF,CAAC,CAAC,CACD,SAAS,CAAC,CACV,SAAS,CAAC,CACV,SAAS,8EAA8E;AAC5F,CAAC,CAAC,CACD,SAAS;;AAYZ,MAAa,uBAAuB,EAAE,aAAa;CACjD,UAAU,yBAAyB,SACjC,qDACF;CACA,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,gDAAgD;CAC3F,aAAa,EACV,OAAO,CAAC,CACR,IAAI,CAAC,CACL,YAAY,CAAC,CACb,SAAS,6CAA6C;AAC3D,CAAC"}
@@ -1,6 +1,6 @@
1
- import { SignalOutcome, SignalTriage } from "./signal.mjs";
2
1
  import { TaskState } from "./task.mjs";
3
2
  import { ChangeState } from "./change.mjs";
3
+ import { SignalOutcome, SignalTriage } from "./signal.mjs";
4
4
  //#region src/schema/transitions.d.ts
5
5
  /** Authority category responsible for advancing a state-machine edge. */
6
6
  type TransitionActor = "system" | "reconciler" | "foreman" | "operator" | "webhook" | "human";
@@ -60,7 +60,7 @@ const taskTransitions = [
60
60
  {
61
61
  from: "running",
62
62
  to: "stalled",
63
- trigger: "no progress within the stall window",
63
+ trigger: "no progress within the stall window or workflow pauses obsolete execution",
64
64
  actor: "reconciler"
65
65
  },
66
66
  {