@smthrs/journal 0.0.0-stage → 1.0.0-rc.4

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 (257) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/LICENSE +21 -0
  3. package/README.md +206 -2
  4. package/dist/cjs/CallFact.d.ts +129 -0
  5. package/dist/cjs/CallFact.d.ts.map +1 -0
  6. package/dist/cjs/CallFact.js +106 -0
  7. package/dist/cjs/CallFact.js.map +7 -0
  8. package/dist/cjs/Consensus.d.ts +440 -0
  9. package/dist/cjs/Consensus.d.ts.map +1 -0
  10. package/dist/cjs/Consensus.js +251 -0
  11. package/dist/cjs/Consensus.js.map +7 -0
  12. package/dist/cjs/EngineEvent.d.ts +890 -0
  13. package/dist/cjs/EngineEvent.d.ts.map +1 -0
  14. package/dist/cjs/EngineEvent.js +383 -0
  15. package/dist/cjs/EngineEvent.js.map +7 -0
  16. package/dist/cjs/ExecutionFact.d.ts +216 -0
  17. package/dist/cjs/ExecutionFact.d.ts.map +1 -0
  18. package/dist/cjs/ExecutionFact.js +303 -0
  19. package/dist/cjs/ExecutionFact.js.map +7 -0
  20. package/dist/cjs/Journal.d.ts +617 -0
  21. package/dist/cjs/Journal.d.ts.map +1 -0
  22. package/dist/cjs/Journal.js +190 -0
  23. package/dist/cjs/Journal.js.map +7 -0
  24. package/dist/cjs/JournalEvent.d.ts +421 -0
  25. package/dist/cjs/JournalEvent.d.ts.map +1 -0
  26. package/dist/cjs/JournalEvent.js +281 -0
  27. package/dist/cjs/JournalEvent.js.map +7 -0
  28. package/dist/cjs/JournalGeneration.d.ts +34 -0
  29. package/dist/cjs/JournalGeneration.d.ts.map +1 -0
  30. package/dist/cjs/JournalGeneration.js +72 -0
  31. package/dist/cjs/JournalGeneration.js.map +7 -0
  32. package/dist/cjs/JournalMetrics.d.ts +72 -0
  33. package/dist/cjs/JournalMetrics.d.ts.map +1 -0
  34. package/dist/cjs/JournalMetrics.js +55 -0
  35. package/dist/cjs/JournalMetrics.js.map +7 -0
  36. package/dist/cjs/Migrations.d.ts +42 -0
  37. package/dist/cjs/Migrations.d.ts.map +1 -0
  38. package/dist/cjs/Migrations.js +58 -0
  39. package/dist/cjs/Migrations.js.map +7 -0
  40. package/dist/cjs/OwnerId.d.ts +40 -0
  41. package/dist/cjs/OwnerId.d.ts.map +1 -0
  42. package/dist/cjs/OwnerId.js +40 -0
  43. package/dist/cjs/OwnerId.js.map +7 -0
  44. package/dist/cjs/Projection.d.ts +29 -0
  45. package/dist/cjs/Projection.d.ts.map +1 -0
  46. package/dist/cjs/Projection.js +25 -0
  47. package/dist/cjs/Projection.js.map +7 -0
  48. package/dist/cjs/RedactedLogger.d.ts +121 -0
  49. package/dist/cjs/RedactedLogger.d.ts.map +1 -0
  50. package/dist/cjs/RedactedLogger.js +235 -0
  51. package/dist/cjs/RedactedLogger.js.map +7 -0
  52. package/dist/cjs/Redaction.d.ts +350 -0
  53. package/dist/cjs/Redaction.d.ts.map +1 -0
  54. package/dist/cjs/Redaction.js +928 -0
  55. package/dist/cjs/Redaction.js.map +7 -0
  56. package/dist/cjs/SqlConsensus.d.ts +44 -0
  57. package/dist/cjs/SqlConsensus.d.ts.map +1 -0
  58. package/dist/cjs/SqlConsensus.js +243 -0
  59. package/dist/cjs/SqlConsensus.js.map +7 -0
  60. package/dist/cjs/SqlJournal.d.ts +173 -0
  61. package/dist/cjs/SqlJournal.d.ts.map +1 -0
  62. package/dist/cjs/SqlJournal.js +1568 -0
  63. package/dist/cjs/SqlJournal.js.map +7 -0
  64. package/dist/cjs/StepFact.d.ts +66 -0
  65. package/dist/cjs/StepFact.d.ts.map +1 -0
  66. package/dist/cjs/StepFact.js +68 -0
  67. package/dist/cjs/StepFact.js.map +7 -0
  68. package/dist/cjs/index.d.ts +95 -0
  69. package/dist/cjs/index.d.ts.map +1 -0
  70. package/dist/cjs/index.js +63 -0
  71. package/dist/cjs/index.js.map +7 -0
  72. package/dist/cjs/internal/JournalInternalFault.d.ts +37 -0
  73. package/dist/cjs/internal/JournalInternalFault.d.ts.map +1 -0
  74. package/dist/cjs/internal/JournalInternalFault.js +43 -0
  75. package/dist/cjs/internal/JournalInternalFault.js.map +7 -0
  76. package/dist/cjs/migrations/0001_initial.d.ts +15 -0
  77. package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
  78. package/dist/cjs/migrations/0001_initial.js +54 -0
  79. package/dist/cjs/migrations/0001_initial.js.map +7 -0
  80. package/dist/cjs/migrations/0002_checkpoints.d.ts +27 -0
  81. package/dist/cjs/migrations/0002_checkpoints.d.ts.map +1 -0
  82. package/dist/cjs/migrations/0002_checkpoints.js +48 -0
  83. package/dist/cjs/migrations/0002_checkpoints.js.map +7 -0
  84. package/dist/cjs/migrations/0003_startup_index.d.ts +15 -0
  85. package/dist/cjs/migrations/0003_startup_index.d.ts.map +1 -0
  86. package/dist/cjs/migrations/0003_startup_index.js +40 -0
  87. package/dist/cjs/migrations/0003_startup_index.js.map +7 -0
  88. package/dist/cjs/migrations/0004_dedup.d.ts +15 -0
  89. package/dist/cjs/migrations/0004_dedup.d.ts.map +1 -0
  90. package/dist/cjs/migrations/0004_dedup.js +57 -0
  91. package/dist/cjs/migrations/0004_dedup.js.map +7 -0
  92. package/dist/cjs/migrations/0005_run_event_type.d.ts +15 -0
  93. package/dist/cjs/migrations/0005_run_event_type.d.ts.map +1 -0
  94. package/dist/cjs/migrations/0005_run_event_type.js +40 -0
  95. package/dist/cjs/migrations/0005_run_event_type.js.map +7 -0
  96. package/dist/cjs/migrations/0006_consensus.d.ts +22 -0
  97. package/dist/cjs/migrations/0006_consensus.d.ts.map +1 -0
  98. package/dist/cjs/migrations/0006_consensus.js +84 -0
  99. package/dist/cjs/migrations/0006_consensus.js.map +7 -0
  100. package/dist/cjs/package.json +1 -0
  101. package/dist/cjs/test/Notifying.d.ts +65 -0
  102. package/dist/cjs/test/Notifying.d.ts.map +1 -0
  103. package/dist/cjs/test/Notifying.js +62 -0
  104. package/dist/cjs/test/Notifying.js.map +7 -0
  105. package/dist/cjs/test/TestJournal.d.ts +43 -0
  106. package/dist/cjs/test/TestJournal.d.ts.map +1 -0
  107. package/dist/cjs/test/TestJournal.js +43 -0
  108. package/dist/cjs/test/TestJournal.js.map +7 -0
  109. package/dist/esm/CallFact.d.ts +129 -0
  110. package/dist/esm/CallFact.d.ts.map +1 -0
  111. package/dist/esm/CallFact.js +96 -0
  112. package/dist/esm/CallFact.js.map +1 -0
  113. package/dist/esm/Consensus.d.ts +440 -0
  114. package/dist/esm/Consensus.d.ts.map +1 -0
  115. package/dist/esm/Consensus.js +454 -0
  116. package/dist/esm/Consensus.js.map +1 -0
  117. package/dist/esm/EngineEvent.d.ts +890 -0
  118. package/dist/esm/EngineEvent.d.ts.map +1 -0
  119. package/dist/esm/EngineEvent.js +614 -0
  120. package/dist/esm/EngineEvent.js.map +1 -0
  121. package/dist/esm/ExecutionFact.d.ts +216 -0
  122. package/dist/esm/ExecutionFact.d.ts.map +1 -0
  123. package/dist/esm/ExecutionFact.js +374 -0
  124. package/dist/esm/ExecutionFact.js.map +1 -0
  125. package/dist/esm/Journal.d.ts +617 -0
  126. package/dist/esm/Journal.d.ts.map +1 -0
  127. package/dist/esm/Journal.js +323 -0
  128. package/dist/esm/Journal.js.map +1 -0
  129. package/dist/esm/JournalEvent.d.ts +421 -0
  130. package/dist/esm/JournalEvent.d.ts.map +1 -0
  131. package/dist/esm/JournalEvent.js +517 -0
  132. package/dist/esm/JournalEvent.js.map +1 -0
  133. package/dist/esm/JournalGeneration.d.ts +34 -0
  134. package/dist/esm/JournalGeneration.d.ts.map +1 -0
  135. package/dist/esm/JournalGeneration.js +65 -0
  136. package/dist/esm/JournalGeneration.js.map +1 -0
  137. package/dist/esm/JournalMetrics.d.ts +72 -0
  138. package/dist/esm/JournalMetrics.d.ts.map +1 -0
  139. package/dist/esm/JournalMetrics.js +79 -0
  140. package/dist/esm/JournalMetrics.js.map +1 -0
  141. package/dist/esm/Migrations.d.ts +42 -0
  142. package/dist/esm/Migrations.d.ts.map +1 -0
  143. package/dist/esm/Migrations.js +59 -0
  144. package/dist/esm/Migrations.js.map +1 -0
  145. package/dist/esm/OwnerId.d.ts +40 -0
  146. package/dist/esm/OwnerId.d.ts.map +1 -0
  147. package/dist/esm/OwnerId.js +33 -0
  148. package/dist/esm/OwnerId.js.map +1 -0
  149. package/dist/esm/Projection.d.ts +29 -0
  150. package/dist/esm/Projection.d.ts.map +1 -0
  151. package/dist/esm/Projection.js +13 -0
  152. package/dist/esm/Projection.js.map +1 -0
  153. package/dist/esm/RedactedLogger.d.ts +121 -0
  154. package/dist/esm/RedactedLogger.d.ts.map +1 -0
  155. package/dist/esm/RedactedLogger.js +445 -0
  156. package/dist/esm/RedactedLogger.js.map +1 -0
  157. package/dist/esm/Redaction.d.ts +350 -0
  158. package/dist/esm/Redaction.d.ts.map +1 -0
  159. package/dist/esm/Redaction.js +1584 -0
  160. package/dist/esm/Redaction.js.map +1 -0
  161. package/dist/esm/SqlConsensus.d.ts +44 -0
  162. package/dist/esm/SqlConsensus.d.ts.map +1 -0
  163. package/dist/esm/SqlConsensus.js +252 -0
  164. package/dist/esm/SqlConsensus.js.map +1 -0
  165. package/dist/esm/SqlJournal.d.ts +173 -0
  166. package/dist/esm/SqlJournal.d.ts.map +1 -0
  167. package/dist/esm/SqlJournal.js +1858 -0
  168. package/dist/esm/SqlJournal.js.map +1 -0
  169. package/dist/esm/StepFact.d.ts +66 -0
  170. package/dist/esm/StepFact.d.ts.map +1 -0
  171. package/dist/esm/StepFact.js +50 -0
  172. package/dist/esm/StepFact.js.map +1 -0
  173. package/dist/esm/index.d.ts +95 -0
  174. package/dist/esm/index.d.ts.map +1 -0
  175. package/dist/esm/index.js +95 -0
  176. package/dist/esm/index.js.map +1 -0
  177. package/dist/esm/internal/JournalInternalFault.d.ts +37 -0
  178. package/dist/esm/internal/JournalInternalFault.d.ts.map +1 -0
  179. package/dist/esm/internal/JournalInternalFault.js +28 -0
  180. package/dist/esm/internal/JournalInternalFault.js.map +1 -0
  181. package/dist/esm/migrations/0001_initial.d.ts +15 -0
  182. package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
  183. package/dist/esm/migrations/0001_initial.js +32 -0
  184. package/dist/esm/migrations/0001_initial.js.map +1 -0
  185. package/dist/esm/migrations/0002_checkpoints.d.ts +27 -0
  186. package/dist/esm/migrations/0002_checkpoints.d.ts.map +1 -0
  187. package/dist/esm/migrations/0002_checkpoints.js +38 -0
  188. package/dist/esm/migrations/0002_checkpoints.js.map +1 -0
  189. package/dist/esm/migrations/0003_startup_index.d.ts +15 -0
  190. package/dist/esm/migrations/0003_startup_index.d.ts.map +1 -0
  191. package/dist/esm/migrations/0003_startup_index.js +18 -0
  192. package/dist/esm/migrations/0003_startup_index.js.map +1 -0
  193. package/dist/esm/migrations/0004_dedup.d.ts +15 -0
  194. package/dist/esm/migrations/0004_dedup.d.ts.map +1 -0
  195. package/dist/esm/migrations/0004_dedup.js +38 -0
  196. package/dist/esm/migrations/0004_dedup.js.map +1 -0
  197. package/dist/esm/migrations/0005_run_event_type.d.ts +15 -0
  198. package/dist/esm/migrations/0005_run_event_type.d.ts.map +1 -0
  199. package/dist/esm/migrations/0005_run_event_type.js +18 -0
  200. package/dist/esm/migrations/0005_run_event_type.js.map +1 -0
  201. package/dist/esm/migrations/0006_consensus.d.ts +22 -0
  202. package/dist/esm/migrations/0006_consensus.d.ts.map +1 -0
  203. package/dist/esm/migrations/0006_consensus.js +69 -0
  204. package/dist/esm/migrations/0006_consensus.js.map +1 -0
  205. package/dist/esm/test/Notifying.d.ts +65 -0
  206. package/dist/esm/test/Notifying.d.ts.map +1 -0
  207. package/dist/esm/test/Notifying.js +62 -0
  208. package/dist/esm/test/Notifying.js.map +1 -0
  209. package/dist/esm/test/TestJournal.d.ts +43 -0
  210. package/dist/esm/test/TestJournal.d.ts.map +1 -0
  211. package/dist/esm/test/TestJournal.js +27 -0
  212. package/dist/esm/test/TestJournal.js.map +1 -0
  213. package/docs/README.md +164 -0
  214. package/docs/api.md +639 -0
  215. package/docs/concepts/compaction.md +157 -0
  216. package/docs/concepts/idempotency.md +127 -0
  217. package/docs/concepts/owner-fence.md +124 -0
  218. package/docs/concepts/redaction.md +218 -0
  219. package/docs/concepts/state-event-authority.md +159 -0
  220. package/docs/concepts/two-channels.md +167 -0
  221. package/docs/guides/commit-state-and-entry.md +114 -0
  222. package/docs/guides/compact-a-run.md +134 -0
  223. package/docs/guides/fold-a-projection.md +106 -0
  224. package/docs/guides/read-a-run.md +139 -0
  225. package/docs/guides/redact-log-output.md +94 -0
  226. package/docs/guides/testing.md +124 -0
  227. package/docs/guides/write-lifecycle-events.md +110 -0
  228. package/docs/installation.md +133 -0
  229. package/docs/quickstart.md +143 -0
  230. package/docs/troubleshooting.md +214 -0
  231. package/package.json +263 -3
  232. package/src/CallFact.ts +117 -0
  233. package/src/Consensus.ts +683 -0
  234. package/src/EngineEvent.ts +823 -0
  235. package/src/ExecutionFact.ts +433 -0
  236. package/src/Journal.ts +688 -0
  237. package/src/JournalEvent.ts +654 -0
  238. package/src/JournalGeneration.ts +77 -0
  239. package/src/JournalMetrics.ts +89 -0
  240. package/src/Migrations.ts +62 -0
  241. package/src/OwnerId.ts +42 -0
  242. package/src/Projection.ts +31 -0
  243. package/src/RedactedLogger.ts +483 -0
  244. package/src/Redaction.ts +1784 -0
  245. package/src/SqlConsensus.ts +344 -0
  246. package/src/SqlJournal.ts +2732 -0
  247. package/src/StepFact.ts +69 -0
  248. package/src/index.ts +109 -0
  249. package/src/internal/JournalInternalFault.ts +40 -0
  250. package/src/migrations/0001_initial.ts +41 -0
  251. package/src/migrations/0002_checkpoints.ts +46 -0
  252. package/src/migrations/0003_startup_index.ts +19 -0
  253. package/src/migrations/0004_dedup.ts +43 -0
  254. package/src/migrations/0005_run_event_type.ts +19 -0
  255. package/src/migrations/0006_consensus.ts +83 -0
  256. package/src/test/Notifying.ts +101 -0
  257. package/src/test/TestJournal.ts +52 -0
@@ -0,0 +1,890 @@
1
+ /**
2
+ * Versioned engine history contracts over the open journal. These schemas do
3
+ * not change journal admission or make history the engine's recovery store.
4
+ *
5
+ * @since 1.0.0
6
+ */
7
+ import * as Cause from "effect/Cause";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Schema from "effect/Schema";
10
+ import * as Event from "./JournalEvent.ts";
11
+ /**
12
+ * Required lineage coordinates for a root or derived run.
13
+ *
14
+ * @category schemas
15
+ * @since 1.0.0
16
+ */
17
+ export declare const Lineage: Schema.Union<readonly [Schema.Struct<{
18
+ readonly kind: Schema.Literal<"root">;
19
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
20
+ readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/LineageId">;
21
+ readonly rootRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
22
+ readonly round: Schema.Literal<0>;
23
+ readonly parentRunId: Schema.Null;
24
+ }>, Schema.Struct<{
25
+ readonly kind: Schema.Literals<readonly ["child", "fork", "continuation"]>;
26
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
27
+ readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/LineageId">;
28
+ readonly rootRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
29
+ readonly round: Schema.Int;
30
+ readonly parentRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
31
+ }>]>;
32
+ /**
33
+ * Required lineage coordinates for a root or derived run.
34
+ *
35
+ * @category models
36
+ * @since 1.0.0
37
+ */
38
+ export type Lineage = typeof Lineage.Type;
39
+ /**
40
+ * Encoded values only: class instances must first pass their own codec.
41
+ *
42
+ * @category schemas
43
+ * @since 1.0.0
44
+ */
45
+ export declare const Success: Schema.TaggedStruct<"Success", {
46
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
47
+ }>;
48
+ /**
49
+ * Failure channels stay distinct, including interruption and encoding failure.
50
+ *
51
+ * @category schemas
52
+ * @since 1.0.0
53
+ */
54
+ export declare const Failure: Schema.TaggedStruct<"Failure", {
55
+ readonly reason: Schema.Literals<readonly ["error", "defect", "interrupted", "encoding"]>;
56
+ readonly detail: Schema.Codec<Schema.Json, Schema.Json, never, never>;
57
+ }>;
58
+ /**
59
+ * Encoded success or a classified failure.
60
+ *
61
+ * @category schemas
62
+ * @since 1.0.0
63
+ */
64
+ export declare const ResultEnvelope: Schema.Union<readonly [Schema.TaggedStruct<"Success", {
65
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
66
+ }>, Schema.TaggedStruct<"Failure", {
67
+ readonly reason: Schema.Literals<readonly ["error", "defect", "interrupted", "encoding"]>;
68
+ readonly detail: Schema.Codec<Schema.Json, Schema.Json, never, never>;
69
+ }>]>;
70
+ /**
71
+ * Encoded success or a classified failure.
72
+ *
73
+ * @category models
74
+ * @since 1.0.0
75
+ */
76
+ export type ResultEnvelope = typeof ResultEnvelope.Type;
77
+ /**
78
+ * Completion and its outcome are inseparable; live states cannot carry either.
79
+ *
80
+ * @category schemas
81
+ * @since 1.0.0
82
+ */
83
+ export declare const AttemptLifecycle: Schema.Union<readonly [Schema.Struct<{
84
+ readonly heartbeatAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
85
+ readonly checkpoint: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
86
+ readonly finishedAtMs: Schema.optionalKey<Schema.Never>;
87
+ readonly result: Schema.optionalKey<Schema.Never>;
88
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
89
+ readonly state: Schema.Literal<"running">;
90
+ }>, Schema.Struct<{
91
+ readonly heartbeatAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
92
+ readonly checkpoint: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
93
+ readonly finishedAtMs: Schema.optionalKey<Schema.Never>;
94
+ readonly result: Schema.optionalKey<Schema.Never>;
95
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
96
+ readonly state: Schema.Literal<"suspended">;
97
+ }>, Schema.Struct<{
98
+ readonly finishedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
99
+ readonly result: Schema.TaggedStruct<"Success", {
100
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
101
+ }>;
102
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
103
+ readonly state: Schema.Literal<"succeeded">;
104
+ }>, Schema.Struct<{
105
+ readonly finishedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
106
+ readonly result: Schema.TaggedStruct<"Failure", {
107
+ readonly reason: Schema.Literals<readonly ["error", "defect", "interrupted", "encoding"]>;
108
+ readonly detail: Schema.Codec<Schema.Json, Schema.Json, never, never>;
109
+ }>;
110
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
111
+ readonly state: Schema.Literal<"failed">;
112
+ }>]>;
113
+ /**
114
+ * Wall clocks can move backwards; completion need not be after start.
115
+ *
116
+ * @category models
117
+ * @since 1.0.0
118
+ */
119
+ export type AttemptLifecycle = typeof AttemptLifecycle.Type;
120
+ /**
121
+ * Complete identity and state of one versioned attempt event.
122
+ *
123
+ * @category schemas
124
+ * @since 1.0.0
125
+ */
126
+ export declare const AttemptPayload: Schema.Struct<{
127
+ readonly version: Schema.Literal<2>;
128
+ readonly lineage: Schema.Union<readonly [Schema.Struct<{
129
+ readonly kind: Schema.Literal<"root">;
130
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
131
+ readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/LineageId">;
132
+ readonly rootRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
133
+ readonly round: Schema.Literal<0>;
134
+ readonly parentRunId: Schema.Null;
135
+ }>, Schema.Struct<{
136
+ readonly kind: Schema.Literals<readonly ["child", "fork", "continuation"]>;
137
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
138
+ readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/LineageId">;
139
+ readonly rootRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
140
+ readonly round: Schema.Int;
141
+ readonly parentRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
142
+ }>]>;
143
+ readonly executionId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
144
+ readonly stepKeyDigest: Schema.brand<Schema.String, "@smthrs/journal/DispatchId">;
145
+ readonly attempt: Schema.Int;
146
+ readonly lifecycle: Schema.Union<readonly [Schema.Struct<{
147
+ readonly heartbeatAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
148
+ readonly checkpoint: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
149
+ readonly finishedAtMs: Schema.optionalKey<Schema.Never>;
150
+ readonly result: Schema.optionalKey<Schema.Never>;
151
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
152
+ readonly state: Schema.Literal<"running">;
153
+ }>, Schema.Struct<{
154
+ readonly heartbeatAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
155
+ readonly checkpoint: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
156
+ readonly finishedAtMs: Schema.optionalKey<Schema.Never>;
157
+ readonly result: Schema.optionalKey<Schema.Never>;
158
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
159
+ readonly state: Schema.Literal<"suspended">;
160
+ }>, Schema.Struct<{
161
+ readonly finishedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
162
+ readonly result: Schema.TaggedStruct<"Success", {
163
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
164
+ }>;
165
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
166
+ readonly state: Schema.Literal<"succeeded">;
167
+ }>, Schema.Struct<{
168
+ readonly finishedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
169
+ readonly result: Schema.TaggedStruct<"Failure", {
170
+ readonly reason: Schema.Literals<readonly ["error", "defect", "interrupted", "encoding"]>;
171
+ readonly detail: Schema.Codec<Schema.Json, Schema.Json, never, never>;
172
+ }>;
173
+ readonly startedAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
174
+ readonly state: Schema.Literal<"failed">;
175
+ }>]>;
176
+ }>;
177
+ /**
178
+ * Complete identity and state of one versioned attempt event.
179
+ *
180
+ * @category models
181
+ * @since 1.0.0
182
+ */
183
+ export type AttemptPayload = typeof AttemptPayload.Type;
184
+ /**
185
+ * Durable wait identities; ownership and cancellation remain independent facts.
186
+ *
187
+ * @category schemas
188
+ * @since 1.0.0
189
+ */
190
+ export declare const Wait: Schema.Union<readonly [Schema.TaggedStruct<"Deferred", {
191
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
192
+ }>, Schema.TaggedStruct<"Clock", {
193
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
194
+ readonly dueAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
195
+ }>]>;
196
+ /**
197
+ * A complete execution observation, without operational ownership leases.
198
+ *
199
+ * @category schemas
200
+ * @since 1.0.0
201
+ */
202
+ export declare const ExecutionLifecycle: Schema.Union<readonly [Schema.Struct<{
203
+ readonly state: Schema.Literal<"running">;
204
+ readonly waits: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"Deferred", {
205
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
206
+ }>, Schema.TaggedStruct<"Clock", {
207
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
208
+ readonly dueAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
209
+ }>]>>;
210
+ }>, Schema.Struct<{
211
+ readonly state: Schema.Literal<"suspended">;
212
+ readonly waits: Schema.NonEmptyArray<Schema.Union<readonly [Schema.TaggedStruct<"Deferred", {
213
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
214
+ }>, Schema.TaggedStruct<"Clock", {
215
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
216
+ readonly dueAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
217
+ }>]>>;
218
+ }>, Schema.Struct<{
219
+ readonly state: Schema.Literal<"completed">;
220
+ readonly result: Schema.Union<readonly [Schema.TaggedStruct<"Success", {
221
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
222
+ }>, Schema.TaggedStruct<"Failure", {
223
+ readonly reason: Schema.Literals<readonly ["error", "defect", "interrupted", "encoding"]>;
224
+ readonly detail: Schema.Codec<Schema.Json, Schema.Json, never, never>;
225
+ }>]>;
226
+ }>]>;
227
+ /**
228
+ * Versioned execution, deferred and clock observations. Every variant records
229
+ * its semantic identity and encoded value independently of diagnostics.
230
+ *
231
+ * @category schemas
232
+ * @since 1.0.0
233
+ */
234
+ export declare const StatePayload: Schema.Struct<{
235
+ readonly version: Schema.Literal<2>;
236
+ readonly lineage: Schema.Union<readonly [Schema.Struct<{
237
+ readonly kind: Schema.Literal<"root">;
238
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
239
+ readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/LineageId">;
240
+ readonly rootRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
241
+ readonly round: Schema.Literal<0>;
242
+ readonly parentRunId: Schema.Null;
243
+ }>, Schema.Struct<{
244
+ readonly kind: Schema.Literals<readonly ["child", "fork", "continuation"]>;
245
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
246
+ readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/LineageId">;
247
+ readonly rootRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
248
+ readonly round: Schema.Int;
249
+ readonly parentRunId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
250
+ }>]>;
251
+ readonly executionId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
252
+ readonly event: Schema.Union<readonly [Schema.TaggedStruct<"Execution", {
253
+ readonly lifecycle: Schema.Union<readonly [Schema.Struct<{
254
+ readonly state: Schema.Literal<"running">;
255
+ readonly waits: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"Deferred", {
256
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
257
+ }>, Schema.TaggedStruct<"Clock", {
258
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
259
+ readonly dueAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
260
+ }>]>>;
261
+ }>, Schema.Struct<{
262
+ readonly state: Schema.Literal<"suspended">;
263
+ readonly waits: Schema.NonEmptyArray<Schema.Union<readonly [Schema.TaggedStruct<"Deferred", {
264
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
265
+ }>, Schema.TaggedStruct<"Clock", {
266
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
267
+ readonly dueAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
268
+ }>]>>;
269
+ }>, Schema.Struct<{
270
+ readonly state: Schema.Literal<"completed">;
271
+ readonly result: Schema.Union<readonly [Schema.TaggedStruct<"Success", {
272
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
273
+ }>, Schema.TaggedStruct<"Failure", {
274
+ readonly reason: Schema.Literals<readonly ["error", "defect", "interrupted", "encoding"]>;
275
+ readonly detail: Schema.Codec<Schema.Json, Schema.Json, never, never>;
276
+ }>]>;
277
+ }>]>;
278
+ }>, Schema.TaggedStruct<"DeferredCompleted", {
279
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
280
+ readonly result: Schema.Union<readonly [Schema.TaggedStruct<"Success", {
281
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
282
+ }>, Schema.TaggedStruct<"Failure", {
283
+ readonly reason: Schema.Literals<readonly ["error", "defect", "interrupted", "encoding"]>;
284
+ readonly detail: Schema.Codec<Schema.Json, Schema.Json, never, never>;
285
+ }>]>;
286
+ }>, Schema.TaggedStruct<"ClockScheduled", {
287
+ readonly clockId: Schema.brand<Schema.String, "@smthrs/journal/CommandId">;
288
+ readonly waitId: Schema.brand<Schema.String, "@smthrs/journal/WaitId">;
289
+ readonly dueAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
290
+ }>]>;
291
+ }>;
292
+ /**
293
+ * Versioned execution, deferred and clock observations.
294
+ *
295
+ * @category models
296
+ * @since 1.0.0
297
+ */
298
+ export type StatePayload = typeof StatePayload.Type;
299
+ /**
300
+ * Event family for complete execution, deferred and clock observations.
301
+ *
302
+ * @category constants
303
+ * @since 1.0.0
304
+ */
305
+ export declare const stateEventType = "flows.engine.v2.state-event";
306
+ /**
307
+ * New identity prevents old readers mistaking complete state for historical markers.
308
+ *
309
+ * @category constants
310
+ * @since 1.0.0
311
+ */
312
+ export declare const attemptEventType = "flows.engine.v2.attempt-lifecycle";
313
+ declare const EventError_base: Schema.Class<EventError, Schema.TaggedStruct<"@smthrs/journal/EngineEventError", {
314
+ readonly code: Schema.Literals<readonly ["malformed", "unsupported", "foreign", "transition"]>;
315
+ readonly message: Schema.String;
316
+ readonly cause: Schema.Unknown;
317
+ }>, Cause.YieldableError>;
318
+ /**
319
+ * Malformed, foreign, unsupported or inconsistent event evidence.
320
+ *
321
+ * @category errors
322
+ * @since 1.0.0
323
+ */
324
+ export declare class EventError extends EventError_base {
325
+ }
326
+ /**
327
+ * Every consumer chooses its source allowlist and unknown-namespace policy.
328
+ *
329
+ * @category models
330
+ * @since 1.0.0
331
+ */
332
+ export interface Consumer {
333
+ readonly runId: Event.RunId;
334
+ readonly lineageId: Event.LineageId;
335
+ readonly rootRunId: Event.RunId;
336
+ readonly round: number;
337
+ readonly parentRunId: Event.RunId | null;
338
+ readonly sources: ReadonlyArray<Event.SourceId>;
339
+ readonly unknown: "ignore" | "surface";
340
+ }
341
+ /**
342
+ * A known event or the explicitly selected extension outcome.
343
+ *
344
+ * @category models
345
+ * @since 1.0.0
346
+ */
347
+ export type Decoded = {
348
+ readonly _tag: "Attempt";
349
+ readonly entry: Event.Entry;
350
+ readonly payload: AttemptPayload;
351
+ } | {
352
+ readonly _tag: "State";
353
+ readonly entry: Event.Entry;
354
+ readonly payload: StatePayload;
355
+ } | {
356
+ readonly _tag: "Ignored";
357
+ } | {
358
+ readonly _tag: "Unknown";
359
+ readonly entry: Event.Entry;
360
+ };
361
+ /**
362
+ * Decode untrusted committed input. Unknown events in the known engine namespace
363
+ * are unsupported errors, never ignored. Original schema/accessor errors stay
364
+ * in cause; foreign identity includes the conflicting evidence in cause.
365
+ *
366
+ * @category decoders
367
+ * @since 1.0.0
368
+ */
369
+ export declare const decodeEntry: (input: unknown, consumer: Consumer) => Effect.Effect<Decoded, EventError>;
370
+ /**
371
+ * Construct a versioned submission, validating before journal redaction.
372
+ *
373
+ * @category constructors
374
+ * @since 1.0.0
375
+ */
376
+ export declare const attempt: (payload: AttemptPayload, sourceId: Event.SourceId, sourceSeq: Event.SourceSeq, diagnostics?: Schema.Json) => Event.Input;
377
+ /**
378
+ * Construct a versioned execution, deferred or clock submission. Existing
379
+ * unversioned writers are unchanged and cannot manufacture missing lineage.
380
+ *
381
+ * @category constructors
382
+ * @since 1.0.0
383
+ */
384
+ export declare const stateEvent: (payload: StatePayload, sourceId: Event.SourceId, sourceSeq: Event.SourceSeq, diagnostics?: Schema.Json) => Event.Input;
385
+ /**
386
+ * Historical attempt markers deliberately remain incomplete evidence. No
387
+ * result, timestamp, round or lineage root is invented for old rows.
388
+ *
389
+ * @category schemas
390
+ * @since 1.0.0
391
+ */
392
+ export declare const CurrentAttempt: Schema.Union<readonly [Schema.Struct<{
393
+ readonly eventType: Schema.Literal<"flows.engine.attempt-started">;
394
+ readonly payload: Schema.Struct<{
395
+ readonly version: Schema.optionalKey<Schema.Never>;
396
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
397
+ readonly stepKeyDigest: Schema.brand<Schema.String, "@smthrs/journal/DispatchId">;
398
+ readonly attempt: Schema.Int;
399
+ readonly tier: Schema.Literals<readonly ["sealed", "compensable", "irreversible"]>;
400
+ }>;
401
+ }>, Schema.Struct<{
402
+ readonly eventType: Schema.Literal<"flows.engine.attempt-finished">;
403
+ readonly payload: Schema.Struct<{
404
+ readonly version: Schema.optionalKey<Schema.Never>;
405
+ readonly runId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
406
+ readonly stepKeyDigest: Schema.brand<Schema.String, "@smthrs/journal/DispatchId">;
407
+ readonly attempt: Schema.Int;
408
+ readonly state: Schema.Literals<readonly ["succeeded", "failed"]>;
409
+ }>;
410
+ }>]>;
411
+ /**
412
+ * Decode current markers using their recorded lineage, without upgrading bytes.
413
+ *
414
+ * @category decoders
415
+ * @since 1.0.0
416
+ */
417
+ export declare const decodeCurrentAttempt: (input: unknown, consumer: Consumer) => Effect.Effect<{
418
+ entry: Event.Entry;
419
+ marker: {
420
+ readonly eventType: "flows.engine.attempt-started";
421
+ readonly payload: {
422
+ readonly runId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
423
+ readonly stepKeyDigest: string & import("effect/Brand").Brand<"@smthrs/journal/DispatchId">;
424
+ readonly attempt: number;
425
+ readonly tier: "sealed" | "compensable" | "irreversible";
426
+ readonly version?: never;
427
+ };
428
+ } | {
429
+ readonly eventType: "flows.engine.attempt-finished";
430
+ readonly payload: {
431
+ readonly runId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
432
+ readonly state: "succeeded" | "failed";
433
+ readonly stepKeyDigest: string & import("effect/Brand").Brand<"@smthrs/journal/DispatchId">;
434
+ readonly attempt: number;
435
+ readonly version?: never;
436
+ };
437
+ };
438
+ lineageId: string & import("effect/Brand").Brand<"@smthrs/journal/LineageId">;
439
+ }, EventError, never>;
440
+ /**
441
+ * Where a declaration was written, as a durable record may carry it.
442
+ *
443
+ * Repo-relative by contract: a journal is read on machines that are not the
444
+ * one that wrote it, so an absolute path is at best noise and at worst an
445
+ * operator's home directory published into a run's history. A writer that
446
+ * cannot make a path relative omits the field.
447
+ *
448
+ * @category schemas
449
+ * @since 1.0.0
450
+ */
451
+ export declare const DeclaredAt: Schema.Struct<{
452
+ readonly path: Schema.NonEmptyString;
453
+ readonly line: Schema.Int;
454
+ }>;
455
+ /**
456
+ * A declaration path as {@link DeclaredAt} may carry it: relative to the
457
+ * root, or nothing.
458
+ *
459
+ * It lives beside the schema that refuses an absolute path, because obeying
460
+ * that refusal is the writer's one job and every writer obeys it the same
461
+ * way. A path outside the root is omitted rather than recorded with `..`
462
+ * segments, because a reader resolving those would have to know the root,
463
+ * which is exactly the machine-specific fact this strips. A root that is the
464
+ * filesystem itself strips nothing, so it is read as no root.
465
+ *
466
+ * @category accessors
467
+ * @since 1.0.0
468
+ */
469
+ export declare const relativePath: (root: string | undefined, path: string) => string | undefined;
470
+ /**
471
+ * One node of the graph a run was driven from.
472
+ *
473
+ * `kind` is open text because the two executors name kinds differently and
474
+ * both are true: the plan scheduler's node is a `step`, an `agent` or a
475
+ * `merge`, while the interpreter's is the authoring variant it was observed
476
+ * at. A closed union here would force one of them to lie.
477
+ *
478
+ * @category schemas
479
+ * @since 1.0.0
480
+ */
481
+ export declare const NodeSummary: Schema.Struct<{
482
+ readonly id: Schema.NonEmptyString;
483
+ readonly kind: Schema.String;
484
+ readonly dependsOn: Schema.$Array<Schema.NonEmptyString>;
485
+ readonly tier: Schema.Literals<readonly ["sealed", "compensable", "irreversible"]>;
486
+ readonly key: Schema.optionalKey<Schema.String>;
487
+ readonly generation: Schema.optionalKey<Schema.Int>;
488
+ readonly action: Schema.optionalKey<Schema.String>;
489
+ readonly effects: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
490
+ readonly declaredAt: Schema.optionalKey<Schema.Struct<{
491
+ readonly path: Schema.NonEmptyString;
492
+ readonly line: Schema.Int;
493
+ }>>;
494
+ }>;
495
+ /**
496
+ * One edge of that graph, with the reason the builder drew it.
497
+ *
498
+ * @category schemas
499
+ * @since 1.0.0
500
+ */
501
+ export declare const EdgeSummary: Schema.Struct<{
502
+ readonly from: Schema.NonEmptyString;
503
+ readonly to: Schema.NonEmptyString;
504
+ readonly reason: Schema.Literals<readonly ["value", "continuation", "failure"]>;
505
+ }>;
506
+ /**
507
+ * The immutable name of a tree a host read declaration sites out of.
508
+ *
509
+ * Exactly the forty lowercase hex digits the only producer emits: a jj
510
+ * working-copy commit id, or a git commit for a tree that still matches one
511
+ * (`SourceRevision.objectId`). It is narrowed here rather than left as text
512
+ * because a reader puts it straight into a contents route's `?ref=`, and
513
+ * `DeclaredAt` beside it refuses an absolute path for the same class of
514
+ * reason: a field that only ever holds one shape should refuse the others at
515
+ * the boundary rather than at whatever spawns a process downstream.
516
+ *
517
+ * @category schemas
518
+ * @since 1.0.0
519
+ */
520
+ export declare const SourceRevision: Schema.NonEmptyString;
521
+ /**
522
+ * The graph, or one page of it, carried beside a plan record.
523
+ *
524
+ * `edges` is optional because only one writer can answer it honestly. A plan
525
+ * names its edges through each node's `dependsOn` and knows no reason for
526
+ * them; an interpreter knows the reason it drew each one. A writer without
527
+ * reasons omits the field rather than labelling every edge `value`.
528
+ *
529
+ * @category schemas
530
+ * @since 1.0.0
531
+ */
532
+ export declare const NodeGraph: Schema.Struct<{
533
+ readonly nodes: Schema.$Array<Schema.Struct<{
534
+ readonly id: Schema.NonEmptyString;
535
+ readonly kind: Schema.String;
536
+ readonly dependsOn: Schema.$Array<Schema.NonEmptyString>;
537
+ readonly tier: Schema.Literals<readonly ["sealed", "compensable", "irreversible"]>;
538
+ readonly key: Schema.optionalKey<Schema.String>;
539
+ readonly generation: Schema.optionalKey<Schema.Int>;
540
+ readonly action: Schema.optionalKey<Schema.String>;
541
+ readonly effects: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
542
+ readonly declaredAt: Schema.optionalKey<Schema.Struct<{
543
+ readonly path: Schema.NonEmptyString;
544
+ readonly line: Schema.Int;
545
+ }>>;
546
+ }>>;
547
+ readonly edges: Schema.optionalKey<Schema.$Array<Schema.Struct<{
548
+ readonly from: Schema.NonEmptyString;
549
+ readonly to: Schema.NonEmptyString;
550
+ readonly reason: Schema.Literals<readonly ["value", "continuation", "failure"]>;
551
+ }>>>;
552
+ /**
553
+ * The revision of the tree the nodes on this page were read out of.
554
+ *
555
+ * A `declaredAt` is a path and a line, and neither says which bytes were
556
+ * at that line: a working tree moves, so the same path after an edit or a
557
+ * branch switch is a different file. Only the writer can answer this —
558
+ * like the root a path is made relative to — so it travels with the page
559
+ * the sites travel on, and a reader can ask for the file AT this revision
560
+ * instead of whatever is on disk when they look.
561
+ *
562
+ * Optional because only a writer served out of a version-controlled tree
563
+ * can name one. A writer that cannot says nothing, and a reader that has
564
+ * nothing shows no code rather than code it cannot bind (D-068).
565
+ */
566
+ readonly sourceRevision: Schema.optionalKey<Schema.NonEmptyString>;
567
+ }>;
568
+ /**
569
+ * A plan was recorded and a run is about to be driven under it.
570
+ *
571
+ * `nodes` is the node COUNT the record has always carried. The node list
572
+ * arrives beside it as `graph`, optional and paged, because a journal entry
573
+ * has a byte bound: what does not fit follows as {@link SubgraphAppended}
574
+ * pages rather than being clipped.
575
+ *
576
+ * Everything an executor cannot honestly answer is optional rather than
577
+ * invented. The interpreter drives a graph with no plan id, no plan digest
578
+ * and no store to record an outcome with, and saying so is the point of this
579
+ * schema.
580
+ *
581
+ * @category schemas
582
+ * @since 1.0.0
583
+ */
584
+ export declare const PlanRecordedPayload: Schema.Struct<{
585
+ readonly planId: Schema.optionalKey<Schema.NonEmptyString>;
586
+ readonly flow: Schema.NonEmptyString;
587
+ readonly digest: Schema.optionalKey<Schema.String>;
588
+ readonly baseDigest: Schema.optionalKey<Schema.String>;
589
+ readonly generation: Schema.Int;
590
+ readonly nodes: Schema.Int;
591
+ readonly outcome: Schema.optionalKey<Schema.String>;
592
+ readonly page: Schema.optionalKey<Schema.Int>;
593
+ readonly pages: Schema.optionalKey<Schema.Int>;
594
+ readonly graph: Schema.optionalKey<Schema.Struct<{
595
+ readonly nodes: Schema.$Array<Schema.Struct<{
596
+ readonly id: Schema.NonEmptyString;
597
+ readonly kind: Schema.String;
598
+ readonly dependsOn: Schema.$Array<Schema.NonEmptyString>;
599
+ readonly tier: Schema.Literals<readonly ["sealed", "compensable", "irreversible"]>;
600
+ readonly key: Schema.optionalKey<Schema.String>;
601
+ readonly generation: Schema.optionalKey<Schema.Int>;
602
+ readonly action: Schema.optionalKey<Schema.String>;
603
+ readonly effects: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
604
+ readonly declaredAt: Schema.optionalKey<Schema.Struct<{
605
+ readonly path: Schema.NonEmptyString;
606
+ readonly line: Schema.Int;
607
+ }>>;
608
+ }>>;
609
+ readonly edges: Schema.optionalKey<Schema.$Array<Schema.Struct<{
610
+ readonly from: Schema.NonEmptyString;
611
+ readonly to: Schema.NonEmptyString;
612
+ readonly reason: Schema.Literals<readonly ["value", "continuation", "failure"]>;
613
+ }>>>;
614
+ /**
615
+ * The revision of the tree the nodes on this page were read out of.
616
+ *
617
+ * A `declaredAt` is a path and a line, and neither says which bytes were
618
+ * at that line: a working tree moves, so the same path after an edit or a
619
+ * branch switch is a different file. Only the writer can answer this —
620
+ * like the root a path is made relative to — so it travels with the page
621
+ * the sites travel on, and a reader can ask for the file AT this revision
622
+ * instead of whatever is on disk when they look.
623
+ *
624
+ * Optional because only a writer served out of a version-controlled tree
625
+ * can name one. A writer that cannot says nothing, and a reader that has
626
+ * nothing shows no code rather than code it cannot bind (D-068).
627
+ */
628
+ readonly sourceRevision: Schema.optionalKey<Schema.NonEmptyString>;
629
+ }>>;
630
+ }>;
631
+ /**
632
+ * An elaboration appended a pre-keyed subgraph to the same plan, or the next
633
+ * page of a graph too large for one record.
634
+ *
635
+ * @category schemas
636
+ * @since 1.0.0
637
+ */
638
+ export declare const SubgraphAppendedPayload: Schema.Struct<{
639
+ readonly planId: Schema.optionalKey<Schema.NonEmptyString>;
640
+ readonly flow: Schema.optionalKey<Schema.NonEmptyString>;
641
+ readonly digest: Schema.optionalKey<Schema.String>;
642
+ readonly baseDigest: Schema.optionalKey<Schema.String>;
643
+ readonly generation: Schema.Int;
644
+ readonly nodeIds: Schema.$Array<Schema.NonEmptyString>;
645
+ readonly page: Schema.optionalKey<Schema.Int>;
646
+ readonly pages: Schema.optionalKey<Schema.Int>;
647
+ readonly graph: Schema.optionalKey<Schema.Struct<{
648
+ readonly nodes: Schema.$Array<Schema.Struct<{
649
+ readonly id: Schema.NonEmptyString;
650
+ readonly kind: Schema.String;
651
+ readonly dependsOn: Schema.$Array<Schema.NonEmptyString>;
652
+ readonly tier: Schema.Literals<readonly ["sealed", "compensable", "irreversible"]>;
653
+ readonly key: Schema.optionalKey<Schema.String>;
654
+ readonly generation: Schema.optionalKey<Schema.Int>;
655
+ readonly action: Schema.optionalKey<Schema.String>;
656
+ readonly effects: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
657
+ readonly declaredAt: Schema.optionalKey<Schema.Struct<{
658
+ readonly path: Schema.NonEmptyString;
659
+ readonly line: Schema.Int;
660
+ }>>;
661
+ }>>;
662
+ readonly edges: Schema.optionalKey<Schema.$Array<Schema.Struct<{
663
+ readonly from: Schema.NonEmptyString;
664
+ readonly to: Schema.NonEmptyString;
665
+ readonly reason: Schema.Literals<readonly ["value", "continuation", "failure"]>;
666
+ }>>>;
667
+ /**
668
+ * The revision of the tree the nodes on this page were read out of.
669
+ *
670
+ * A `declaredAt` is a path and a line, and neither says which bytes were
671
+ * at that line: a working tree moves, so the same path after an edit or a
672
+ * branch switch is a different file. Only the writer can answer this —
673
+ * like the root a path is made relative to — so it travels with the page
674
+ * the sites travel on, and a reader can ask for the file AT this revision
675
+ * instead of whatever is on disk when they look.
676
+ *
677
+ * Optional because only a writer served out of a version-controlled tree
678
+ * can name one. A writer that cannot says nothing, and a reader that has
679
+ * nothing shows no code rather than code it cannot bind (D-068).
680
+ */
681
+ readonly sourceRevision: Schema.optionalKey<Schema.NonEmptyString>;
682
+ }>>;
683
+ }>;
684
+ /**
685
+ * A plan node was admitted and its work is about to start.
686
+ *
687
+ * @category schemas
688
+ * @since 1.0.0
689
+ */
690
+ export declare const NodeScheduledPayload: Schema.Struct<{
691
+ readonly planId: Schema.optionalKey<Schema.NonEmptyString>;
692
+ readonly nodeId: Schema.NonEmptyString;
693
+ readonly kind: Schema.String;
694
+ readonly planKey: Schema.optionalKey<Schema.String>;
695
+ readonly dispatchKey: Schema.optionalKey<Schema.String>;
696
+ readonly attempt: Schema.Int;
697
+ readonly priority: Schema.optionalKey<Schema.Int>;
698
+ readonly waited: Schema.optionalKey<Schema.Int>;
699
+ readonly action: Schema.optionalKey<Schema.String>;
700
+ }>;
701
+ /**
702
+ * A bounded look at what a node settled with.
703
+ *
704
+ * `preview` is JSON text, redacted before it was encoded and cut to a fixed
705
+ * ceiling afterwards, so a long value costs a durable row a known number of
706
+ * bytes rather than however many it happens to hold. `truncated` says the cut
707
+ * happened, which is also the warning that the text is a PREFIX of JSON and
708
+ * no longer parses. `bytes` is the size of the encoding the preview was cut
709
+ * from, so a reader can say how much was left out without being shown it; a
710
+ * value too large for a writer to redact at all is named by the size of its
711
+ * own encoding, with an empty preview and the flag set.
712
+ *
713
+ * Redaction comes first and truncation second on purpose: cutting the text
714
+ * first can split a credential across the boundary, and a textual redactor
715
+ * scanning the remains would no longer recognise it.
716
+ *
717
+ * @category schemas
718
+ * @since 1.0.0
719
+ */
720
+ export declare const NodeResultSummary: Schema.Struct<{
721
+ readonly preview: Schema.String;
722
+ readonly bytes: Schema.Int;
723
+ readonly truncated: Schema.Boolean;
724
+ }>;
725
+ /**
726
+ * A plan node reached an outcome.
727
+ *
728
+ * The outcomes are Skyframe's evaluation states: `built` ran,
729
+ * `clean` was served from records, `failed` raised, `skipped` was never
730
+ * reached, and `deferred` is a scheduling debt the plan scheduler alone
731
+ * records.
732
+ *
733
+ * `attempts` is the executor's own count. For the plan scheduler it is the
734
+ * node's; for the interpreter it is the highest durable attempt any of this
735
+ * node's dispatches ran as, because the interpreter settles each node once
736
+ * and a retry happens underneath it inside one dispatch.
737
+ *
738
+ * `stepKeyDigests` names the dispatches the node drove, and it is the join
739
+ * `flows.engine.attempt-started` could not make on its own: an attempt record
740
+ * carries a step key digest and no node id, so an attempt belongs to the node
741
+ * whose settlement claims its digest. A retried dispatch keeps ONE digest —
742
+ * the attempt is folded into no key — so the list is distinct dispatches, not
743
+ * attempts. A writer that derives no digests omits the field; a node that
744
+ * dispatched nothing records an empty list, which is a different statement.
745
+ *
746
+ * `result` is what the node settled with: the success value for `built` and
747
+ * `clean`, the typed failure for `failed`, bounded and redacted by the writer.
748
+ * Absent when the writer kept none.
749
+ *
750
+ * @category schemas
751
+ * @since 1.0.0
752
+ */
753
+ export declare const NodeSettledPayload: Schema.Struct<{
754
+ readonly planId: Schema.optionalKey<Schema.NonEmptyString>;
755
+ readonly nodeId: Schema.NonEmptyString;
756
+ readonly planKey: Schema.optionalKey<Schema.String>;
757
+ readonly dispatchKey: Schema.optionalKey<Schema.String>;
758
+ readonly stepKeyDigests: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
759
+ readonly outcome: Schema.Literals<readonly ["built", "clean", "failed", "skipped", "deferred"]>;
760
+ readonly attempts: Schema.Int;
761
+ readonly rebases: Schema.optionalKey<Schema.Int>;
762
+ readonly action: Schema.optionalKey<Schema.String>;
763
+ readonly result: Schema.optionalKey<Schema.Struct<{
764
+ readonly preview: Schema.String;
765
+ readonly bytes: Schema.Int;
766
+ readonly truncated: Schema.Boolean;
767
+ }>>;
768
+ }>;
769
+ /**
770
+ * A scheduled node's dispatch identity was invalidated and re-keyed.
771
+ *
772
+ * @category schemas
773
+ * @since 1.0.0
774
+ */
775
+ export declare const NodeInvalidatedPayload: Schema.Struct<{
776
+ readonly planId: Schema.NonEmptyString;
777
+ readonly nodeId: Schema.NonEmptyString;
778
+ readonly planKey: Schema.String;
779
+ readonly from: Schema.String;
780
+ readonly to: Schema.String;
781
+ readonly reason: Schema.Literal<"measured-inputs-changed">;
782
+ }>;
783
+ /**
784
+ * The reconciliation seam returned a verdict for a deviation.
785
+ *
786
+ * @category schemas
787
+ * @since 1.0.0
788
+ */
789
+ export declare const NodeReconciledPayload: Schema.Struct<{
790
+ readonly planId: Schema.NonEmptyString;
791
+ readonly nodeId: Schema.NonEmptyString;
792
+ readonly trigger: Schema.String;
793
+ readonly verdict: Schema.Codec<Schema.Json, Schema.Json, never, never>;
794
+ }>;
795
+ /**
796
+ * Where a declaration was written, as a durable record carries it.
797
+ *
798
+ * @category models
799
+ * @since 1.0.0
800
+ */
801
+ export type DeclaredAt = typeof DeclaredAt.Type;
802
+ /**
803
+ * One node of the graph a run was driven from.
804
+ *
805
+ * @category models
806
+ * @since 1.0.0
807
+ */
808
+ export type NodeSummary = typeof NodeSummary.Type;
809
+ /**
810
+ * One edge of the graph a run was driven from.
811
+ *
812
+ * @category models
813
+ * @since 1.0.0
814
+ */
815
+ export type EdgeSummary = typeof EdgeSummary.Type;
816
+ /**
817
+ * The graph, or one page of it, carried beside a plan record.
818
+ *
819
+ * @category models
820
+ * @since 1.0.0
821
+ */
822
+ export type NodeGraph = typeof NodeGraph.Type;
823
+ /**
824
+ * A plan was recorded and a run is about to be driven under it.
825
+ *
826
+ * @category models
827
+ * @since 1.0.0
828
+ */
829
+ export type PlanRecordedPayload = typeof PlanRecordedPayload.Type;
830
+ /**
831
+ * An elaboration appended a subgraph, or the next page of a large graph.
832
+ *
833
+ * @category models
834
+ * @since 1.0.0
835
+ */
836
+ export type SubgraphAppendedPayload = typeof SubgraphAppendedPayload.Type;
837
+ /**
838
+ * A plan node was admitted and its work is about to start.
839
+ *
840
+ * @category models
841
+ * @since 1.0.0
842
+ */
843
+ export type NodeScheduledPayload = typeof NodeScheduledPayload.Type;
844
+ /**
845
+ * A bounded look at what a node settled with.
846
+ *
847
+ * @category models
848
+ * @since 1.0.0
849
+ */
850
+ export type NodeResultSummary = typeof NodeResultSummary.Type;
851
+ /**
852
+ * A plan node reached an outcome.
853
+ *
854
+ * @category models
855
+ * @since 1.0.0
856
+ */
857
+ export type NodeSettledPayload = typeof NodeSettledPayload.Type;
858
+ /**
859
+ * A scheduled node's dispatch identity was invalidated and re-keyed.
860
+ *
861
+ * @category models
862
+ * @since 1.0.0
863
+ */
864
+ export type NodeInvalidatedPayload = typeof NodeInvalidatedPayload.Type;
865
+ /**
866
+ * The reconciliation seam's verdict for one deviation.
867
+ *
868
+ * @category models
869
+ * @since 1.0.0
870
+ */
871
+ export type NodeReconciledPayload = typeof NodeReconciledPayload.Type;
872
+ /**
873
+ * The event type each node and plan payload is recorded under.
874
+ *
875
+ * Readers and writers share these identities, so a value here is stored
876
+ * history and changing one requires migrating it.
877
+ *
878
+ * @category constants
879
+ * @since 1.0.0
880
+ */
881
+ export declare const nodeEventTypes: {
882
+ readonly planRecorded: "flows.engine.plan-recorded";
883
+ readonly subgraphAppended: "flows.engine.subgraph-appended";
884
+ readonly nodeScheduled: "flows.engine.node-scheduled";
885
+ readonly nodeSettled: "flows.engine.node-settled";
886
+ readonly nodeInvalidated: "flows.engine.node-invalidated";
887
+ readonly nodeReconciled: "flows.engine.node-reconciled";
888
+ };
889
+ export {};
890
+ //# sourceMappingURL=EngineEvent.d.ts.map