@boxxy/model 0.1.1 → 0.1.3

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 (222) hide show
  1. package/README.md +8 -6
  2. package/dist/closeouts/build-close-out-schema.d.ts +31 -0
  3. package/dist/closeouts/close-out-answer-schema.d.ts +3 -0
  4. package/dist/closeouts/close-out-schema.d.ts +3 -0
  5. package/dist/closeouts/design-close-out-schema.d.ts +30 -0
  6. package/dist/closeouts/friction-schema.d.ts +14 -0
  7. package/dist/closeouts/open-item-schema.d.ts +3 -0
  8. package/dist/closeouts/review-close-out-schema.d.ts +40 -0
  9. package/dist/closeouts/triage-close-out-schema.d.ts +40 -0
  10. package/dist/closeouts/types.d.ts +221 -0
  11. package/dist/dispatch/build-applied-change.d.ts +6 -0
  12. package/dist/dispatch/collect-seat-sync.d.ts +14 -0
  13. package/dist/dispatch/pick-seat-take.d.ts +10 -0
  14. package/dist/dispatch/types.d.ts +11 -0
  15. package/dist/facts/outbox-fact-schema.d.ts +3 -0
  16. package/dist/facts/parse-new-fact.d.ts +2 -0
  17. package/dist/facts/types.d.ts +191 -0
  18. package/dist/facts/work-fact-schemas.d.ts +293 -0
  19. package/dist/index.d.ts +64 -16
  20. package/dist/items/build-item-views.d.ts +4 -0
  21. package/dist/items/collect-retries.d.ts +3 -0
  22. package/dist/items/collect-settled.d.ts +3 -0
  23. package/dist/items/derive-item-state.d.ts +17 -0
  24. package/dist/{live-levers.d.ts → items/live-levers.d.ts} +1 -1
  25. package/dist/items/types.d.ts +12 -0
  26. package/dist/pipeline/advance.d.ts +10 -0
  27. package/dist/pipeline/constants.d.ts +2 -0
  28. package/dist/pipeline/count-trailing.d.ts +1 -0
  29. package/dist/pipeline/find-position.d.ts +9 -0
  30. package/dist/pipeline/find-step.d.ts +3 -0
  31. package/dist/pipeline/merge-by-time.d.ts +9 -0
  32. package/dist/pipeline/position-schema.d.ts +3 -0
  33. package/dist/pipeline/types.d.ts +28 -0
  34. package/dist/planning/define-admission.d.ts +3 -0
  35. package/dist/planning/define-gate.d.ts +3 -0
  36. package/dist/planning/define-signal.d.ts +3 -0
  37. package/dist/planning/is-filter-match.d.ts +3 -0
  38. package/dist/planning/limit-fill-schema.d.ts +3 -0
  39. package/dist/{signal-key.d.ts → planning/signal-key.d.ts} +1 -1
  40. package/dist/planning/types.d.ts +155 -0
  41. package/dist/ports/types.d.ts +289 -0
  42. package/dist/reports/constants.d.ts +3 -0
  43. package/dist/reports/cost-to-land-schema.d.ts +29 -0
  44. package/dist/reports/outbox-status.d.ts +16 -0
  45. package/dist/reports/stage-time-schema.d.ts +25 -0
  46. package/dist/reports/types.d.ts +5 -0
  47. package/dist/rows/actor-ref-schema.d.ts +2 -0
  48. package/dist/rows/attempt-row-schema.d.ts +3 -0
  49. package/dist/rows/attempt-session-row-schema.d.ts +3 -0
  50. package/dist/{brand-schemas.d.ts → rows/brand-schemas.d.ts} +5 -2
  51. package/dist/rows/caller-identity-schema.d.ts +3 -0
  52. package/dist/rows/criterion-schema.d.ts +3 -0
  53. package/dist/rows/decision-row-schema.d.ts +34 -0
  54. package/dist/rows/evidence-row-schema.d.ts +3 -0
  55. package/dist/rows/item-row-schema.d.ts +28 -0
  56. package/dist/rows/item-view-schema.d.ts +3 -0
  57. package/dist/rows/lease-row-schema.d.ts +3 -0
  58. package/dist/rows/lever-row-schema.d.ts +12 -0
  59. package/dist/rows/limit-schema.d.ts +3 -0
  60. package/dist/rows/limit-seat-row-schema.d.ts +3 -0
  61. package/dist/rows/note-row-schema.d.ts +3 -0
  62. package/dist/rows/notice-row-schema.d.ts +3 -0
  63. package/dist/rows/pull-request-row-schema.d.ts +3 -0
  64. package/dist/rows/relation-row-schema.d.ts +3 -0
  65. package/dist/rows/row-schemas.d.ts +5 -0
  66. package/dist/rows/runner-row-schema.d.ts +3 -0
  67. package/dist/rows/spawn-request-schema.d.ts +3 -0
  68. package/dist/rules/define-phase.d.ts +3 -0
  69. package/dist/rules/load-rejection-schema.d.ts +3 -0
  70. package/dist/rules/types.d.ts +244 -0
  71. package/dist/test-utils/build-mock-cost-to-land.d.ts +2 -0
  72. package/dist/test-utils/build-mock-evidence-row.d.ts +2 -0
  73. package/dist/test-utils/build-mock-fact-id.d.ts +2 -0
  74. package/dist/test-utils/build-mock-frame-item.d.ts +2 -0
  75. package/dist/test-utils/build-mock-frame.d.ts +2 -0
  76. package/dist/test-utils/build-mock-item-rules.d.ts +2 -0
  77. package/dist/test-utils/build-mock-lease-row.d.ts +1 -1
  78. package/dist/test-utils/build-mock-outbox-fact.d.ts +2 -0
  79. package/dist/test-utils/build-mock-phase-kind.d.ts +7 -0
  80. package/dist/test-utils/build-mock-pipeline.d.ts +7 -0
  81. package/dist/test-utils/build-mock-relation-row.d.ts +2 -0
  82. package/dist/test-utils/build-mock-settled.d.ts +9 -0
  83. package/dist/test-utils/build-mock-snapshot.d.ts +2 -0
  84. package/dist/test-utils/build-mock-v1-attempt-row.d.ts +2 -0
  85. package/dist/test-utils/build-mock-v1-item-row.d.ts +2 -0
  86. package/dist/test-utils/build-mock-v1-item-view.d.ts +2 -0
  87. package/dist/test-utils/build-mock-v1-lever-row.d.ts +2 -0
  88. package/dist/test-utils/build-mock-v1-pull-request-row.d.ts +2 -0
  89. package/dist/test-utils/build-mock-work-fact.d.ts +12 -0
  90. package/dist/test-utils/create-fake-notifier.d.ts +9 -0
  91. package/dist/test-utils/create-fake-pepys-reader.d.ts +13 -0
  92. package/dist/test-utils/fact-sink-contract.d.ts +14 -0
  93. package/dist/test-utils/pepys-reader-contract.d.ts +17 -0
  94. package/dist/{types/core.d.ts → types.d.ts} +94 -36
  95. package/dist/utils/format-key-path.d.ts +1 -0
  96. package/dist/utils/to-json-value.d.ts +2 -0
  97. package/package.json +14 -3
  98. package/src/{build-close-out-schema.ts → closeouts/build-close-out-schema.ts} +5 -10
  99. package/src/closeouts/close-out-answer-schema.ts +42 -0
  100. package/src/closeouts/close-out-schema.ts +13 -0
  101. package/src/closeouts/design-close-out-schema.ts +20 -0
  102. package/src/closeouts/friction-schema.ts +11 -0
  103. package/src/closeouts/open-item-schema.ts +8 -0
  104. package/src/closeouts/review-close-out-schema.ts +38 -0
  105. package/src/closeouts/triage-close-out-schema.ts +29 -0
  106. package/src/closeouts/types.ts +230 -0
  107. package/src/dispatch/build-applied-change.ts +57 -0
  108. package/src/dispatch/collect-seat-sync.ts +86 -0
  109. package/src/dispatch/pick-seat-take.ts +39 -0
  110. package/src/dispatch/types.ts +14 -0
  111. package/src/facts/outbox-fact-schema.ts +22 -0
  112. package/src/facts/parse-new-fact.ts +16 -0
  113. package/src/facts/types.ts +235 -0
  114. package/src/facts/work-fact-schemas.ts +201 -0
  115. package/src/index.ts +147 -41
  116. package/src/items/build-item-views.ts +146 -0
  117. package/src/items/collect-retries.ts +12 -0
  118. package/src/items/collect-settled.ts +20 -0
  119. package/src/items/derive-item-state.ts +95 -0
  120. package/src/{live-levers.ts → items/live-levers.ts} +1 -1
  121. package/src/items/types.ts +26 -0
  122. package/src/pipeline/advance.ts +78 -0
  123. package/src/pipeline/constants.ts +12 -0
  124. package/src/pipeline/count-trailing.ts +16 -0
  125. package/src/pipeline/find-position.ts +74 -0
  126. package/src/pipeline/find-step.ts +6 -0
  127. package/src/pipeline/merge-by-time.ts +33 -0
  128. package/src/pipeline/position-schema.ts +27 -0
  129. package/src/pipeline/types.ts +47 -0
  130. package/src/{define-admission.ts → planning/define-admission.ts} +2 -2
  131. package/src/{define-gate.ts → planning/define-gate.ts} +2 -2
  132. package/src/{define-signal.ts → planning/define-signal.ts} +2 -2
  133. package/src/planning/is-filter-match.ts +10 -0
  134. package/src/planning/limit-fill-schema.ts +12 -0
  135. package/src/{signal-key.ts → planning/signal-key.ts} +1 -1
  136. package/src/planning/types.ts +216 -0
  137. package/src/ports/types.ts +412 -0
  138. package/src/reports/constants.ts +6 -0
  139. package/src/reports/cost-to-land-schema.ts +47 -0
  140. package/src/reports/outbox-status.ts +22 -0
  141. package/src/reports/stage-time-schema.ts +21 -0
  142. package/src/reports/types.ts +7 -0
  143. package/src/rows/actor-ref-schema.ts +17 -0
  144. package/src/rows/attempt-row-schema.ts +69 -0
  145. package/src/rows/attempt-session-row-schema.ts +12 -0
  146. package/src/{brand-schemas.ts → rows/brand-schemas.ts} +5 -2
  147. package/src/rows/caller-identity-schema.ts +7 -0
  148. package/src/rows/criterion-schema.ts +9 -0
  149. package/src/rows/decision-row-schema.ts +34 -0
  150. package/src/rows/evidence-row-schema.ts +13 -0
  151. package/src/rows/item-row-schema.ts +32 -0
  152. package/src/rows/item-view-schema.ts +31 -0
  153. package/src/rows/lease-row-schema.ts +12 -0
  154. package/src/rows/lever-row-schema.ts +17 -0
  155. package/src/rows/limit-schema.ts +12 -0
  156. package/src/rows/limit-seat-row-schema.ts +12 -0
  157. package/src/rows/note-row-schema.ts +12 -0
  158. package/src/rows/notice-row-schema.ts +17 -0
  159. package/src/rows/pull-request-row-schema.ts +15 -0
  160. package/src/rows/relation-row-schema.ts +13 -0
  161. package/src/rows/row-schemas.ts +30 -0
  162. package/src/rows/runner-row-schema.ts +9 -0
  163. package/src/rows/spawn-request-schema.ts +15 -0
  164. package/src/rules/define-phase.ts +12 -0
  165. package/src/rules/load-rejection-schema.ts +51 -0
  166. package/src/rules/types.ts +291 -0
  167. package/src/test-utils/build-mock-cost-to-land.ts +31 -0
  168. package/src/test-utils/build-mock-evidence-row.ts +17 -0
  169. package/src/test-utils/build-mock-fact-id.ts +7 -0
  170. package/src/test-utils/build-mock-frame-item.ts +14 -0
  171. package/src/test-utils/build-mock-frame.ts +13 -0
  172. package/src/test-utils/build-mock-item-rules.ts +17 -0
  173. package/src/test-utils/build-mock-lease-row.ts +2 -2
  174. package/src/test-utils/build-mock-outbox-fact.ts +22 -0
  175. package/src/test-utils/build-mock-phase-kind.ts +29 -0
  176. package/src/test-utils/build-mock-pipeline.ts +52 -0
  177. package/src/test-utils/{build-mock-link-row.ts → build-mock-relation-row.ts} +4 -4
  178. package/src/test-utils/build-mock-settled.ts +18 -0
  179. package/src/test-utils/build-mock-snapshot.ts +13 -0
  180. package/src/test-utils/{build-mock-attempt-row.ts → build-mock-v1-attempt-row.ts} +28 -9
  181. package/src/test-utils/{build-mock-item-row.ts → build-mock-v1-item-row.ts} +7 -3
  182. package/src/test-utils/build-mock-v1-item-view.ts +29 -0
  183. package/src/test-utils/{build-mock-lever-row.ts → build-mock-v1-lever-row.ts} +5 -3
  184. package/src/test-utils/build-mock-v1-pull-request-row.ts +26 -0
  185. package/src/test-utils/build-mock-work-fact.ts +179 -0
  186. package/src/test-utils/create-fake-notifier.ts +54 -0
  187. package/src/test-utils/create-fake-pepys-reader.ts +73 -0
  188. package/src/test-utils/fact-sink-contract.ts +103 -0
  189. package/src/test-utils/pepys-reader-contract.ts +117 -0
  190. package/src/{types/core.ts → types.ts} +184 -48
  191. package/src/utils/format-key-path.ts +19 -0
  192. package/src/utils/to-json-value.ts +25 -0
  193. package/dist/build-close-out-schema.d.ts +0 -3
  194. package/dist/define-admission.d.ts +0 -3
  195. package/dist/define-gate.d.ts +0 -3
  196. package/dist/define-signal.d.ts +0 -3
  197. package/dist/derive-item-state.d.ts +0 -2
  198. package/dist/fact-schemas.d.ts +0 -5
  199. package/dist/friction-schema.d.ts +0 -3
  200. package/dist/test-utils/build-mock-attempt-row.d.ts +0 -2
  201. package/dist/test-utils/build-mock-item-row.d.ts +0 -2
  202. package/dist/test-utils/build-mock-item-rows.d.ts +0 -2
  203. package/dist/test-utils/build-mock-lever-row.d.ts +0 -2
  204. package/dist/test-utils/build-mock-link-row.d.ts +0 -2
  205. package/dist/test-utils/build-mock-pull-request-row.d.ts +0 -2
  206. package/dist/types/dispatch.d.ts +0 -82
  207. package/dist/types/facts.d.ts +0 -154
  208. package/dist/types/planning.d.ts +0 -94
  209. package/dist/types/ports.d.ts +0 -218
  210. package/dist/types/registries.d.ts +0 -150
  211. package/src/derive-item-state.ts +0 -76
  212. package/src/fact-schemas.ts +0 -138
  213. package/src/friction-schema.ts +0 -10
  214. package/src/test-utils/build-mock-item-rows.ts +0 -14
  215. package/src/test-utils/build-mock-pull-request-row.ts +0 -16
  216. package/src/types/dispatch.ts +0 -95
  217. package/src/types/facts.ts +0 -166
  218. package/src/types/planning.ts +0 -136
  219. package/src/types/ports.ts +0 -262
  220. package/src/types/registries.ts +0 -185
  221. /package/dist/test-utils/{seed-faker.d.ts → pin-faker-seed.d.ts} +0 -0
  222. /package/src/test-utils/{seed-faker.ts → pin-faker-seed.ts} +0 -0
@@ -0,0 +1,293 @@
1
+ import { z } from 'zod';
2
+ export declare const workFactSchemas: {
3
+ 'boxxy.item.filed': z.ZodObject<{
4
+ id: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
5
+ kind: z.core.$ZodBranded<z.ZodString, "ItemKindName", "out">;
6
+ repo: z.core.$ZodBranded<z.ZodString, "RepoName", "out">;
7
+ title: z.ZodString;
8
+ outcome: z.ZodString;
9
+ acceptance: z.ZodArray<z.ZodType<import("../types.ts").Criterion, unknown, z.core.$ZodTypeInternals<import("../types.ts").Criterion, unknown>>>;
10
+ fields: z.ZodObject<{
11
+ designMode: z.ZodExactOptional<z.ZodEnum<{
12
+ agent: "agent";
13
+ attended: "attended";
14
+ }>>;
15
+ }, z.core.$strip>;
16
+ labels: z.ZodArray<z.ZodString>;
17
+ foundInAttempt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "AttemptId", "out">>;
18
+ filedBy: z.ZodUnion<readonly [z.ZodLiteral<"boxxy:owner:local">, z.ZodTemplateLiteral<`boxxy:runner:${string}`>, z.ZodTemplateLiteral<`boxxy:attempt:${string}`>, z.ZodTemplateLiteral<`boxxy:hook:${string}`>]>;
19
+ filedAt: z.core.$ZodBranded<z.ZodNumber, "Instant", "out">;
20
+ closedAt: z.ZodNullable<z.core.$ZodBranded<z.ZodNumber, "Instant", "out">>;
21
+ closeReason: z.ZodNullable<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ 'boxxy.item.noted': z.ZodObject<{
24
+ seq: z.ZodNumber;
25
+ text: z.ZodString;
26
+ }, z.core.$strip>;
27
+ 'boxxy.item.edited': z.ZodObject<{
28
+ title: z.ZodExactOptional<z.ZodString>;
29
+ outcome: z.ZodExactOptional<z.ZodString>;
30
+ acceptance: z.ZodExactOptional<z.ZodArray<z.ZodType<import("../types.ts").Criterion, unknown, z.core.$ZodTypeInternals<import("../types.ts").Criterion, unknown>>>>;
31
+ kind: z.ZodExactOptional<z.core.$ZodBranded<z.ZodString, "ItemKindName", "out">>;
32
+ fields: z.ZodExactOptional<z.ZodObject<{
33
+ designMode: z.ZodExactOptional<z.ZodEnum<{
34
+ agent: "agent";
35
+ attended: "attended";
36
+ }>>;
37
+ }, z.core.$strip>>;
38
+ labels: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
39
+ byAttempt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "AttemptId", "out">>;
40
+ }, z.core.$strip>;
41
+ 'boxxy.item.closed': z.ZodObject<{
42
+ reason: z.ZodString;
43
+ byAttempt: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "AttemptId", "out">>;
44
+ ended: z.ZodArray<z.ZodObject<{
45
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
46
+ how: z.ZodEnum<{
47
+ closing: "closing";
48
+ settled: "settled";
49
+ }>;
50
+ }, z.core.$strip>>;
51
+ }, z.core.$strip>;
52
+ 'boxxy.relation.added': z.ZodObject<{
53
+ source: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
54
+ target: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
55
+ type: z.core.$ZodBranded<z.ZodString, "RelationTypeName", "out">;
56
+ }, z.core.$strip>;
57
+ 'boxxy.relation.removed': z.ZodObject<{
58
+ source: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
59
+ target: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
60
+ type: z.core.$ZodBranded<z.ZodString, "RelationTypeName", "out">;
61
+ }, z.core.$strip>;
62
+ 'boxxy.lever.recorded': z.ZodObject<{
63
+ seq: z.ZodNumber;
64
+ kind: z.ZodTemplateLiteral<`${string}.${string}`>;
65
+ item: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
66
+ until: z.ZodNullable<z.core.$ZodBranded<z.ZodNumber, "Instant", "out">>;
67
+ expiresAt: z.ZodNullable<z.core.$ZodBranded<z.ZodNumber, "Instant", "out">>;
68
+ reason: z.ZodNullable<z.ZodString>;
69
+ phase: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "PhaseName", "out">>;
70
+ actor: z.ZodUnion<readonly [z.ZodLiteral<"boxxy:owner:local">, z.ZodTemplateLiteral<`boxxy:runner:${string}`>, z.ZodTemplateLiteral<`boxxy:attempt:${string}`>, z.ZodTemplateLiteral<`boxxy:hook:${string}`>]>;
71
+ at: z.core.$ZodBranded<z.ZodNumber, "Instant", "out">;
72
+ }, z.core.$strip>;
73
+ 'boxxy.attempt.claimed': z.ZodObject<{
74
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
75
+ phase: z.core.$ZodBranded<z.ZodString, "PhaseName", "out">;
76
+ number: z.ZodNumber;
77
+ round: z.ZodNumber;
78
+ mode: z.ZodEnum<{
79
+ agent: "agent";
80
+ attended: "attended";
81
+ }>;
82
+ pool: z.core.$ZodBranded<z.ZodString, "PoolName", "out">;
83
+ fields: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
84
+ seats: z.ZodArray<z.ZodObject<{
85
+ limit: z.core.$ZodBranded<z.ZodString, "LimitName", "out">;
86
+ }, z.core.$strip>>;
87
+ recipeHash: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodString, "ContentHash", "out">, "RecipeHash", "out">;
88
+ skillsRef: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "CommitSha", "out">>;
89
+ rulesVersion: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodString, "ContentHash", "out">, "RulesVersion", "out">;
90
+ }, z.core.$strip>;
91
+ 'boxxy.decision.recorded': z.ZodObject<{
92
+ id: z.core.$ZodBranded<z.ZodString, "DecisionId", "out">;
93
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
94
+ item: z.core.$ZodBranded<z.ZodString, "ItemId", "out">;
95
+ kind: z.ZodEnum<{
96
+ start: "start";
97
+ wake: "wake";
98
+ }>;
99
+ pool: z.core.$ZodBranded<z.ZodString, "PoolName", "out">;
100
+ rulesVersion: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodString, "ContentHash", "out">, "RulesVersion", "out">;
101
+ snapshotHash: z.core.$ZodBranded<z.core.$ZodBranded<z.ZodString, "ContentHash", "out">, "SnapshotHash", "out">;
102
+ storeVersion: z.ZodNumber;
103
+ pepysOffsets: z.ZodRecord<z.core.$ZodBranded<z.ZodString, "StreamName", "out">, z.ZodNumber>;
104
+ faults: z.ZodArray<z.ZodObject<{
105
+ plugin: z.ZodString;
106
+ kind: z.ZodEnum<{
107
+ admission: "admission";
108
+ "filter-field": "filter-field";
109
+ gate: "gate";
110
+ propagation: "propagation";
111
+ signal: "signal";
112
+ waiver: "waiver";
113
+ }>;
114
+ item: z.ZodNullable<z.core.$ZodBranded<z.ZodString, "ItemId", "out">>;
115
+ error: z.ZodString;
116
+ }, z.core.$strip>>;
117
+ limits: z.ZodArray<z.ZodObject<{
118
+ limit: z.core.$ZodBranded<z.ZodString, "LimitName", "out">;
119
+ held: z.ZodNumber;
120
+ max: z.ZodNumber;
121
+ }, z.core.$strip>>;
122
+ at: z.core.$ZodBranded<z.ZodNumber, "Instant", "out">;
123
+ }, z.core.$strip>;
124
+ 'boxxy.attempt.started': z.ZodObject<{
125
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
126
+ atcSession: z.core.$ZodBranded<z.ZodString, "AtcSessionId", "out">;
127
+ resumeFallback: z.ZodBoolean;
128
+ caller: z.ZodNullable<z.ZodType<import("../types.ts").CallerIdentity, unknown, z.core.$ZodTypeInternals<import("../types.ts").CallerIdentity, unknown>>>;
129
+ }, z.core.$strip>;
130
+ 'boxxy.attempt.spawn_unanswered': z.ZodObject<{
131
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
132
+ reason: z.ZodString;
133
+ }, z.core.$strip>;
134
+ 'boxxy.attempt.reconciled': z.ZodObject<{
135
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
136
+ atcSession: z.core.$ZodBranded<z.ZodString, "AtcSessionId", "out">;
137
+ caller: z.ZodNullable<z.ZodType<import("../types.ts").CallerIdentity, unknown, z.core.$ZodTypeInternals<import("../types.ts").CallerIdentity, unknown>>>;
138
+ }, z.core.$strip>;
139
+ 'boxxy.attempt.session_bound': z.ZodObject<{
140
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
141
+ atcSession: z.core.$ZodBranded<z.ZodString, "AtcSessionId", "out">;
142
+ agentSession: z.core.$ZodBranded<z.ZodString, "AgentSessionId", "out">;
143
+ product: z.ZodEnum<{
144
+ claude_code: "claude_code";
145
+ codex: "codex";
146
+ }>;
147
+ source: z.ZodEnum<{
148
+ hook: "hook";
149
+ worker: "worker";
150
+ }>;
151
+ seenAt: z.core.$ZodBranded<z.ZodNumber, "Instant", "out">;
152
+ }, z.core.$strip>;
153
+ 'boxxy.attempt.slept': z.ZodObject<{
154
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
155
+ idleSince: z.core.$ZodBranded<z.ZodNumber, "Instant", "out">;
156
+ asked: z.ZodBoolean;
157
+ }, z.core.$strip>;
158
+ 'boxxy.attempt.wake_requested': z.ZodObject<{
159
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
160
+ by: z.ZodEnum<{
161
+ command: "command";
162
+ "host-slept-unasked": "host-slept-unasked";
163
+ "session-ran": "session-ran";
164
+ }>;
165
+ }, z.core.$strip>;
166
+ 'boxxy.attempt.woken': z.ZodObject<{
167
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
168
+ holdGen: z.ZodNumber;
169
+ seats: z.ZodArray<z.ZodObject<{
170
+ limit: z.core.$ZodBranded<z.ZodString, "LimitName", "out">;
171
+ }, z.core.$strip>>;
172
+ overCap: z.ZodBoolean;
173
+ }, z.core.$strip>;
174
+ 'boxxy.attempt.resumed': z.ZodObject<{
175
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
176
+ atcSession: z.core.$ZodBranded<z.ZodString, "AtcSessionId", "out">;
177
+ caller: z.ZodNullable<z.ZodType<import("../types.ts").CallerIdentity, unknown, z.core.$ZodTypeInternals<import("../types.ts").CallerIdentity, unknown>>>;
178
+ }, z.core.$strip>;
179
+ 'boxxy.attempt.closed_out': z.ZodObject<{
180
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
181
+ phase: z.core.$ZodBranded<z.ZodString, "PhaseName", "out">;
182
+ closeOut: z.ZodType<import("../index.ts").CloseOut, unknown, z.core.$ZodTypeInternals<import("../index.ts").CloseOut, unknown>>;
183
+ hash: z.core.$ZodBranded<z.ZodString, "ContentHash", "out">;
184
+ }, z.core.$strip>;
185
+ 'boxxy.attempt.timed_out': z.ZodObject<{
186
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
187
+ phase: z.core.$ZodBranded<z.ZodString, "PhaseName", "out">;
188
+ afterMinutes: z.ZodNumber;
189
+ }, z.core.$strip>;
190
+ 'boxxy.attempt.turn_ended': z.ZodObject<{
191
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
192
+ phase: z.core.$ZodBranded<z.ZodString, "PhaseName", "out">;
193
+ }, z.core.$strip>;
194
+ 'boxxy.attempt.settled': z.ZodObject<{
195
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
196
+ phase: z.core.$ZodBranded<z.ZodString, "PhaseName", "out">;
197
+ round: z.ZodNumber;
198
+ state: z.ZodEnum<{
199
+ failed: "failed";
200
+ succeeded: "succeeded";
201
+ }>;
202
+ failure: z.ZodNullable<z.ZodString>;
203
+ outcome: z.ZodString;
204
+ returnedOutcome: z.ZodNullable<z.ZodString>;
205
+ closing: z.ZodNullable<z.ZodEnum<{
206
+ "closed-out": "closed-out";
207
+ "item-closed": "item-closed";
208
+ "skill-missing": "skill-missing";
209
+ stalled: "stalled";
210
+ "timed-out": "timed-out";
211
+ "turn-ended": "turn-ended";
212
+ "usage-limit": "usage-limit";
213
+ }>>;
214
+ asleep: z.ZodBoolean;
215
+ sessionStopped: z.ZodBoolean;
216
+ endedAt: z.core.$ZodBranded<z.ZodNumber, "Instant", "out">;
217
+ criteria: z.ZodArray<z.ZodObject<{
218
+ criterion: z.core.$ZodBranded<z.ZodString, "CriterionId", "out">;
219
+ evidence: z.ZodArray<z.core.$ZodBranded<z.ZodString, "FactId", "out">>;
220
+ }, z.core.$strip>>;
221
+ matched: z.ZodArray<z.core.$ZodBranded<z.ZodString, "ItemId", "out">>;
222
+ frictionDropped: z.ZodNumber;
223
+ skippedEffects: z.ZodArray<z.ZodObject<{
224
+ effect: z.ZodEnum<{
225
+ "add-relation": "add-relation";
226
+ "close-item": "close-item";
227
+ "file-item": "file-item";
228
+ "record-proposal": "record-proposal";
229
+ "set-acceptance": "set-acceptance";
230
+ "set-field": "set-field";
231
+ "set-kind": "set-kind";
232
+ }>;
233
+ reason: z.ZodString;
234
+ }, z.core.$strip>>;
235
+ }, z.core.$strip>;
236
+ 'boxxy.proposal.recorded': z.ZodObject<{
237
+ target: z.ZodObject<{
238
+ kind: z.ZodEnum<{
239
+ "agents-md": "agents-md";
240
+ lint: "lint";
241
+ rule: "rule";
242
+ skill: "skill";
243
+ tool: "tool";
244
+ }>;
245
+ name: z.ZodString;
246
+ }, z.core.$strip>;
247
+ change: z.ZodString;
248
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
249
+ }, z.core.$strip>;
250
+ 'boxxy.evidence.recorded': z.ZodObject<{
251
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
252
+ kind: z.ZodEnum<{
253
+ "ci-run": "ci-run";
254
+ commit: "commit";
255
+ "live-check": "live-check";
256
+ pull_request: "pull_request";
257
+ test: "test";
258
+ }>;
259
+ ref: z.ZodString;
260
+ observed: z.ZodNullable<z.ZodString>;
261
+ }, z.core.$strip>;
262
+ 'boxxy.pull_request.linked': z.ZodObject<{
263
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
264
+ repo: z.core.$ZodBranded<z.ZodString, "RepoName", "out">;
265
+ number: z.ZodNumber;
266
+ url: z.ZodURL;
267
+ pullRequestId: z.ZodString;
268
+ source: z.ZodEnum<{
269
+ hook: "hook";
270
+ watch: "watch";
271
+ }>;
272
+ }, z.core.$strip>;
273
+ 'boxxy.commit.linked': z.ZodObject<{
274
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
275
+ repo: z.core.$ZodBranded<z.ZodString, "RepoName", "out">;
276
+ sha: z.core.$ZodBranded<z.ZodString, "CommitSha", "out">;
277
+ pullRequestNumber: z.ZodNumber;
278
+ }, z.core.$strip>;
279
+ 'boxxy.pull_request.merged': z.ZodObject<{
280
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
281
+ repo: z.core.$ZodBranded<z.ZodString, "RepoName", "out">;
282
+ number: z.ZodNumber;
283
+ pullRequestId: z.ZodString;
284
+ mergedAt: z.core.$ZodBranded<z.ZodNumber, "Instant", "out">;
285
+ mergeCommit: z.core.$ZodBranded<z.ZodString, "CommitSha", "out">;
286
+ }, z.core.$strip>;
287
+ 'boxxy.pull_request.closed': z.ZodObject<{
288
+ attempt: z.core.$ZodBranded<z.ZodString, "AttemptId", "out">;
289
+ repo: z.core.$ZodBranded<z.ZodString, "RepoName", "out">;
290
+ number: z.ZodNumber;
291
+ pullRequestId: z.ZodString;
292
+ }, z.core.$strip>;
293
+ };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,65 @@
1
1
  export type { ContentHash, JsonValue } from '@boxxy/content-hash';
2
- export { brandSchemas } from './brand-schemas.ts';
3
- export { buildCloseOutSchema } from './build-close-out-schema.ts';
4
- export { defineAdmission } from './define-admission.ts';
5
- export { defineGate } from './define-gate.ts';
6
- export { defineSignal } from './define-signal.ts';
7
- export { deriveItemState } from './derive-item-state.ts';
8
- export { factSchemas } from './fact-schemas.ts';
9
- export { frictionSchema } from './friction-schema.ts';
10
- export { liveLevers } from './live-levers.ts';
11
- export { signalKey } from './signal-key.ts';
12
- export type { Actor, ActorRef, AgentSessionId, AtcSessionId, AttemptId, AttemptRow, AttemptSessionRow, AttemptState, CommitSha, ConceptPin, Criterion, CriterionId, DecisionId, DecisionRow, DerivedState, Effort, EvidenceKind, EvidenceRow, EvidenceSource, FactId, FaultRecord, ForcedFailure, Instant, ItemId, ItemKindName, ItemRow, ItemRows, ItemState, ItemView, ItemWithLevers, KnownFailure, LeaseRow, LeverKind, LeverRow, LinkRow, LinkTypeName, LiveAttemptState, LoadedRecipe, MaxAttemptsByKind, Minutes, ObservationBoundary, PhaseName, PipelineName, PoolName, PoolSlotRow, PullRequestRef, PullRequestRow, Recipe, RecipeHash, RecipeMaterial, RecipeName, RepoName, ResolvedRecipe, RulesVersion, RunnerId, RunnerRow, SnapshotHash, SourceName, StreamName, WaitingReason, WorkerKindName, } from './types/core.ts';
13
- export type { Claim, CloseOutContext, CloseOutParse, CloseOutParser, CloseOutProblem, ReconcileAction, ReconcileTable, SettleInput, Settlement, SettleRule, SpawnContext, } from './types/dispatch.ts';
14
- export type { BuildCloseOut, EntityRef, FactEnvelope, FactType, Friction, FrictionTargetKind, LinkPayload, NewFact, OpenItem, OutboxFact, SliceOneFacts, } from './types/facts.ts';
15
- export type { Admission, AdmissionGrant, AdmissionName, Decision, Fault, Frame, FrameItem, FrameValues, Gate, GateName, Hold, Lift, Pick, PlanContext, Pool, PropagationLine, Signal, SignalKey, SignalName, Snapshot, View, ViewName, Waiver, WaiverName, } from './types/planning.ts';
16
- export type { AnyNewFact, ApplyResult, ClaimStore, Clock, CostReader, CostToLandInput, CostToLandRow, FactSink, Forge, ItemDetailRows, ItemFilter, NewId, PullRequestReading, RowWrite, SessionFault, SessionReading, SpawnRequest, StartOutcome, StoreChange, StoreReader, StoreTx, TableName, Tables, WorkerKind, } from './types/ports.ts';
17
- export type { Concept, ConceptEntry, ConceptName, FilterField, KindRules, LoadedRules, LoadRejection, LoadRejectionReason, LoadResult, ParamKindName, ParamKinds, Pipeline, PipelineStep, PlainKinds, PluginKindName, PluginRef, Registered, Registry, Resolved, RulesFile, Schema, SignalRef, } from './types/registries.ts';
2
+ export { brandSchemas } from './rows/brand-schemas.ts';
3
+ export { buildAppliedChange, type ChangeAssignments } from './dispatch/build-applied-change.ts';
4
+ export { advance } from './pipeline/advance.ts';
5
+ export { attemptRowSchema } from './rows/attempt-row-schema.ts';
6
+ export { attemptSessionRowSchema } from './rows/attempt-session-row-schema.ts';
7
+ export { buildCloseOutSchema } from './closeouts/build-close-out-schema.ts';
8
+ export { buildItemViews } from './items/build-item-views.ts';
9
+ export { collectRetries } from './items/collect-retries.ts';
10
+ export { collectSettled } from './items/collect-settled.ts';
11
+ export { closeOutAnswerSchema } from './closeouts/close-out-answer-schema.ts';
12
+ export { callerIdentitySchema } from './rows/caller-identity-schema.ts';
13
+ export { closeOutSchema } from './closeouts/close-out-schema.ts';
14
+ export { collectSeatSync, type SeatSync } from './dispatch/collect-seat-sync.ts';
15
+ export { costToLandSchema } from './reports/cost-to-land-schema.ts';
16
+ export { criterionSchema } from './rows/criterion-schema.ts';
17
+ export { decisionRowSchema } from './rows/decision-row-schema.ts';
18
+ export { defineAdmission } from './planning/define-admission.ts';
19
+ export { defineGate } from './planning/define-gate.ts';
20
+ export { definePhase } from './rules/define-phase.ts';
21
+ export { defineSignal } from './planning/define-signal.ts';
22
+ export { buildPhase, deriveItemState } from './items/derive-item-state.ts';
23
+ export { designCloseOutSchema } from './closeouts/design-close-out-schema.ts';
24
+ export { evidenceRowSchema } from './rows/evidence-row-schema.ts';
25
+ export { findPosition } from './pipeline/find-position.ts';
26
+ export { formatKeyPath } from './utils/format-key-path.ts';
27
+ export { frictionSchema } from './closeouts/friction-schema.ts';
28
+ export { isFilterMatch } from './planning/is-filter-match.ts';
29
+ export { itemRowSchema } from './rows/item-row-schema.ts';
30
+ export { itemViewSchema } from './rows/item-view-schema.ts';
31
+ export { leverRowSchema } from './rows/lever-row-schema.ts';
32
+ export { limitFillSchema } from './planning/limit-fill-schema.ts';
33
+ export { limitSchema } from './rows/limit-schema.ts';
34
+ export { limitSeatRowSchema } from './rows/limit-seat-row-schema.ts';
35
+ export { loadRejectionSchema } from './rules/load-rejection-schema.ts';
36
+ export { liveLevers } from './items/live-levers.ts';
37
+ export { noteRowSchema } from './rows/note-row-schema.ts';
38
+ export { noticeRowSchema } from './rows/notice-row-schema.ts';
39
+ export { outboxFactSchema } from './facts/outbox-fact-schema.ts';
40
+ export { positionSchema } from './pipeline/position-schema.ts';
41
+ export { parseNewFact } from './facts/parse-new-fact.ts';
42
+ export { pickSeatTake, type SeatTakeAnswer } from './dispatch/pick-seat-take.ts';
43
+ export { pullRequestRowSchema } from './rows/pull-request-row-schema.ts';
44
+ export { relationRowSchema } from './rows/relation-row-schema.ts';
45
+ export { reviewCloseOutSchema } from './closeouts/review-close-out-schema.ts';
46
+ export { rowSchemas } from './rows/row-schemas.ts';
47
+ export { signalKey } from './planning/signal-key.ts';
48
+ export { spawnRequestSchema } from './rows/spawn-request-schema.ts';
49
+ export { stageTimeSchema } from './reports/stage-time-schema.ts';
50
+ export { toJSONValue } from './utils/to-json-value.ts';
51
+ export { triageCloseOutSchema } from './closeouts/triage-close-out-schema.ts';
52
+ export { workFactSchemas } from './facts/work-fact-schemas.ts';
53
+ export { costBases, phaseSteps, stageSteps } from './reports/constants.ts';
54
+ export { engineHoldReasons, engineOutcomes } from './pipeline/constants.ts';
55
+ export type { Actor, ActorRef, AgentSessionId, AtcSessionId, AttemptId, AttemptRow, AttemptSessionRow, AttemptState, CallerIdentity, ClosingCause, CommitSha, ConceptPin, Criterion, CriterionId, DecisionId, DecisionRow, DerivedState, DesignMode, Effort, EngineOutcome, EvidenceKind, EvidenceRow, EvidenceSource, FactId, FaultRecord, FieldValues, ForcedFailure, Instant, ItemFields, ItemId, ItemKindName, ItemRow, ItemState, ItemView, KeptSession, KnownFailure, LeaseRow, LeverKind, LeverRow, LimitCount, LimitName, LimitSeatRow, LiveAttemptState, Minutes, NoteRow, NoticeRow, ObservationBoundary, OutcomeName, PhaseName, PipelineName, PoolName, Product, PullRequestRef, PullRequestRow, Recipe, RecipeHash, RecipeMaterial, RecipeName, RelationRow, RelationTypeName, RepoName, ResolvedRecipe, RulesVersion, RunnerId, RunnerRow, SessionMode, SnapshotHash, SourceName, StreamName, WaitingReason, WorkerKindName, } from './types.ts';
56
+ export type { HoldReason, Position, RetryLever, RulesHoldReason, Settled, } from './pipeline/types.ts';
57
+ export type { AcceptanceInput, BuildCloseOut, BuildInput, CloseOut, CloseOutAnswer, CloseOutContext, CloseOutParse, CloseOutParser, CloseOutProblem, CloseOutWorld, CriterionText, DesignCloseOut, DesignRef, Effect, Finding, Friction, FrictionTargetKind, NoslopSummary, OpenItem, PullRequestLink, RelationDraft, ReviewCloseOut, ReviewInput, TriageCloseOut, } from './closeouts/types.ts';
58
+ export type { Claim } from './dispatch/types.ts';
59
+ export type { AnyNewFact, EntityRef, FactEnvelope, FactType, NewFact, OutboxFact, RelationPayload, WorkFacts, } from './facts/types.ts';
60
+ export type { Admission, AdmissionGrant, AdmissionName, Decision, Fault, Filter, Frame, FrameItem, FrameValues, Gate, GateName, Hold, Lift, Limit, LimitFill, Pick, PlanContext, Pool, PropagationLine, SeatRef, SeatRelease, SeatTake, Signal, SignalKey, SignalName, Snapshot, StartPick, View, ViewName, Wait, WaitReason, Waiver, WaiverName, Wake, WakePick, } from './planning/types.ts';
61
+ export type { ApplyResult, Attention, CallerProof, CapacityBackoff, ClaimStore, Clock, FactSink, ForgetOutcome, Forge, HoldNotice, ItemDetailRows, ItemFilter, NewId, NoticeOutcome, Notifier, OutboxReader, PepysAnswer, PepysReader, SinkAnswer, PullRequestReading, RowWrite, SessionFault, SessionReading, SpawnRequest, StartOutcome, StopOutcome, StoreChange, StoreReader, StoreTx, SuspendOutcome, TableName, Tables, WakeSource, WorkerKind, } from './ports/types.ts';
62
+ export type { CostToLand, StageTime } from './reports/types.ts';
63
+ export type { OutboxStatus } from './reports/outbox-status.ts';
64
+ export type { ItemSetRows, ItemWithLevers } from './items/types.ts';
65
+ export type { Concept, ConceptEntry, ConceptName, Edge, FilterField, ItemRules, KindRules, LoadedRules, LoadRejection, LoadRejectionReason, LoadResult, ParamKindName, ParamKinds, PhaseInputContext, PhaseKind, Pipeline, PipelineStep, PlainKinds, PluginKindName, PluginRef, Registered, Registry, RelationType, Resolved, Schema, SettleInput, Settlement, SignalRef, SkillsPin, SleepRules, } from './rules/types.ts';
@@ -0,0 +1,4 @@
1
+ import type { ItemRules } from '../rules/types.ts';
2
+ import type { Instant } from '../types.ts';
3
+ import type { ItemSetRows, ItemWithLevers } from './types.ts';
4
+ export declare function buildItemViews(rows: ItemSetRows, now: Instant, rules: ItemRules): ItemWithLevers[];
@@ -0,0 +1,3 @@
1
+ import type { RetryLever } from '../pipeline/types.ts';
2
+ import type { LeverRow } from '../types.ts';
3
+ export declare function collectRetries(levers: readonly LeverRow[]): RetryLever[];
@@ -0,0 +1,3 @@
1
+ import type { Settled } from '../pipeline/types.ts';
2
+ import type { AttemptRow } from '../types.ts';
3
+ export declare function collectSettled(attempts: readonly AttemptRow[]): Settled[];
@@ -0,0 +1,17 @@
1
+ import type { Position } from '../pipeline/types.ts';
2
+ import type { AttemptRow, DerivedState, ItemId, ItemRow, ItemState, LeaseRow, PhaseName, PullRequestRow, RelationRow } from '../types.ts';
3
+ interface DeriveItemStateInput {
4
+ readonly item: ItemRow;
5
+ readonly position: Position;
6
+ readonly liveLease: LeaseRow | null;
7
+ readonly phases: ReadonlyMap<PhaseName, {
8
+ readonly needsAcceptance: boolean;
9
+ }>;
10
+ readonly attempts: readonly AttemptRow[];
11
+ readonly pullRequests: readonly PullRequestRow[];
12
+ readonly relations: readonly RelationRow[];
13
+ readonly blockerStates: ReadonlyMap<ItemId, ItemState>;
14
+ }
15
+ export declare function deriveItemState(input: DeriveItemStateInput): DerivedState;
16
+ export declare const buildPhase = "build";
17
+ export {};
@@ -1,2 +1,2 @@
1
- import type { Instant, LeverRow } from './types/core.ts';
1
+ import type { Instant, LeverRow } from '../types.ts';
2
2
  export declare function liveLevers(levers: readonly LeverRow[], now: Instant): LeverRow[];
@@ -0,0 +1,12 @@
1
+ import type { AttemptRow, ItemRow, ItemView, LeaseRow, LeverRow, PullRequestRow, RelationRow } from '../types.ts';
2
+ export interface ItemSetRows {
3
+ readonly items: readonly ItemRow[];
4
+ readonly relations: readonly RelationRow[];
5
+ readonly levers: readonly LeverRow[];
6
+ readonly attempts: readonly AttemptRow[];
7
+ readonly liveLeases: readonly LeaseRow[];
8
+ readonly pullRequests: readonly PullRequestRow[];
9
+ }
10
+ export interface ItemWithLevers extends ItemView {
11
+ readonly levers: readonly LeverRow[];
12
+ }
@@ -0,0 +1,10 @@
1
+ import type { Pipeline } from '../rules/types.ts';
2
+ import type { Position, Settled } from './types.ts';
3
+ interface AdvanceInput {
4
+ readonly pipeline: Pipeline;
5
+ readonly settled: Settled;
6
+ readonly counted: readonly Settled[];
7
+ readonly round: number;
8
+ }
9
+ export declare function advance(input: AdvanceInput): Position;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const engineOutcomes: readonly ["lost", "unsettleable"];
2
+ export declare const engineHoldReasons: readonly ["attempts used up", "rounds used up", "outcome not in rules"];
@@ -0,0 +1 @@
1
+ export declare function countTrailing<T>(list: readonly T[], test: (item: T) => boolean): number;
@@ -0,0 +1,9 @@
1
+ import type { Pipeline } from '../rules/types.ts';
2
+ import type { Position, RetryLever, Settled } from './types.ts';
3
+ interface FindPositionInput {
4
+ readonly pipeline: Pipeline | null;
5
+ readonly attempts: readonly Settled[];
6
+ readonly retries: readonly RetryLever[];
7
+ }
8
+ export declare function findPosition(input: FindPositionInput): Position;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { Pipeline, PipelineStep } from '../rules/types.ts';
2
+ import type { PhaseName } from '../types.ts';
3
+ export declare function findStep(pipeline: Pipeline, phase: PhaseName): PipelineStep | undefined;
@@ -0,0 +1,9 @@
1
+ import type { RetryLever, Settled } from './types.ts';
2
+ export type TimedEvent = {
3
+ readonly kind: 'settled';
4
+ readonly settled: Settled;
5
+ } | {
6
+ readonly kind: 'retry';
7
+ readonly lever: RetryLever;
8
+ };
9
+ export declare function mergeByTime(attempts: readonly Settled[], retries: readonly RetryLever[]): TimedEvent[];
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ import type { Position } from './types.ts';
3
+ export declare const positionSchema: z.ZodType<Position>;
@@ -0,0 +1,28 @@
1
+ import type { z } from 'zod';
2
+ import type { brandSchemas } from '../rows/brand-schemas.ts';
3
+ import type { Instant, PhaseName } from '../types.ts';
4
+ export type Position = {
5
+ readonly kind: 'phase';
6
+ readonly phase: PhaseName;
7
+ readonly round: number;
8
+ } | {
9
+ readonly kind: 'end';
10
+ readonly reason: string;
11
+ } | {
12
+ readonly kind: 'hold';
13
+ readonly reason: HoldReason;
14
+ readonly then: PhaseName;
15
+ readonly round: number;
16
+ };
17
+ export type HoldReason = 'attempts used up' | 'rounds used up' | 'outcome not in rules' | RulesHoldReason;
18
+ export type RulesHoldReason = z.output<typeof brandSchemas.rulesHoldReason>;
19
+ export interface Settled {
20
+ readonly phase: PhaseName;
21
+ readonly outcome: string;
22
+ readonly endedAt: Instant;
23
+ readonly failure?: string | null;
24
+ }
25
+ export interface RetryLever {
26
+ readonly at: Instant;
27
+ readonly phase: PhaseName | null;
28
+ }
@@ -0,0 +1,3 @@
1
+ import type { Registered } from '../rules/types.ts';
2
+ import type { Admission } from './types.ts';
3
+ export declare function defineAdmission<P>(admission: Admission<P>): Registered<'admission'>;
@@ -0,0 +1,3 @@
1
+ import type { Registered } from '../rules/types.ts';
2
+ import type { Gate } from './types.ts';
3
+ export declare function defineGate<P>(gate: Gate<P>): Registered<'gate'>;
@@ -0,0 +1,3 @@
1
+ import type { Registered } from '../rules/types.ts';
2
+ import type { Signal } from './types.ts';
3
+ export declare function defineSignal<P>(signal: Signal<P>): Registered<'signal'>;
@@ -0,0 +1,3 @@
1
+ import type { FieldValues } from '../types.ts';
2
+ import type { Filter } from './types.ts';
3
+ export declare function isFilterMatch(filter: Filter, fields: FieldValues): boolean;
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ import type { LimitFill } from './types.ts';
3
+ export declare const limitFillSchema: z.ZodType<LimitFill>;
@@ -1,3 +1,3 @@
1
1
  import type { JsonValue } from '@boxxy/content-hash';
2
- import type { SignalKey, SignalName } from './types/planning.ts';
2
+ import type { SignalKey, SignalName } from './types.ts';
3
3
  export declare function signalKey(name: SignalName, params: JsonValue): SignalKey;