@latysh-development/monolith 0.0.0-stage → 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -2
  3. package/dist/brief/cli.d.ts +30 -0
  4. package/dist/brief/cli.d.ts.map +1 -0
  5. package/dist/brief/cli.js +85 -0
  6. package/dist/brief/collect.d.ts +17 -0
  7. package/dist/brief/collect.d.ts.map +1 -0
  8. package/dist/brief/collect.js +302 -0
  9. package/dist/brief/config.d.ts +40 -0
  10. package/dist/brief/config.d.ts.map +1 -0
  11. package/dist/brief/config.js +85 -0
  12. package/dist/brief/constants.d.ts +10 -0
  13. package/dist/brief/constants.d.ts.map +1 -0
  14. package/dist/brief/constants.js +9 -0
  15. package/dist/brief/docs.d.ts +53 -0
  16. package/dist/brief/docs.d.ts.map +1 -0
  17. package/dist/brief/docs.js +229 -0
  18. package/dist/brief/freshness.d.ts +104 -0
  19. package/dist/brief/freshness.d.ts.map +1 -0
  20. package/dist/brief/freshness.js +263 -0
  21. package/dist/brief/git-signals.d.ts +17 -0
  22. package/dist/brief/git-signals.d.ts.map +1 -0
  23. package/dist/brief/git-signals.js +101 -0
  24. package/dist/brief/index.d.ts +11 -0
  25. package/dist/brief/index.d.ts.map +1 -0
  26. package/dist/brief/index.js +5 -0
  27. package/dist/brief/reconcile.d.ts +75 -0
  28. package/dist/brief/reconcile.d.ts.map +1 -0
  29. package/dist/brief/reconcile.js +259 -0
  30. package/dist/brief/render.d.ts +60 -0
  31. package/dist/brief/render.d.ts.map +1 -0
  32. package/dist/brief/render.js +407 -0
  33. package/dist/brief/sanitize.d.ts +38 -0
  34. package/dist/brief/sanitize.d.ts.map +1 -0
  35. package/dist/brief/sanitize.js +48 -0
  36. package/dist/brief/selectors.d.ts +36 -0
  37. package/dist/brief/selectors.d.ts.map +1 -0
  38. package/dist/brief/selectors.js +75 -0
  39. package/dist/brief/story.d.ts +18 -0
  40. package/dist/brief/story.d.ts.map +1 -0
  41. package/dist/brief/story.js +59 -0
  42. package/dist/brief/types.d.ts +110 -0
  43. package/dist/brief/types.d.ts.map +1 -0
  44. package/dist/brief/types.js +11 -0
  45. package/dist/cli/index.d.ts +3 -0
  46. package/dist/cli/index.d.ts.map +1 -0
  47. package/dist/cli/index.js +166 -0
  48. package/dist/cli/init-args.d.ts +16 -0
  49. package/dist/cli/init-args.d.ts.map +1 -0
  50. package/dist/cli/init-args.js +24 -0
  51. package/dist/cli/ui-args.d.ts +23 -0
  52. package/dist/cli/ui-args.d.ts.map +1 -0
  53. package/dist/cli/ui-args.js +66 -0
  54. package/dist/cli/ui.d.ts +40 -0
  55. package/dist/cli/ui.d.ts.map +1 -0
  56. package/dist/cli/ui.js +180 -0
  57. package/dist/coordinatorium/checkpoint.d.ts +44 -0
  58. package/dist/coordinatorium/checkpoint.d.ts.map +1 -0
  59. package/dist/coordinatorium/checkpoint.js +124 -0
  60. package/dist/coordinatorium/cli.d.ts +39 -0
  61. package/dist/coordinatorium/cli.d.ts.map +1 -0
  62. package/dist/coordinatorium/cli.js +203 -0
  63. package/dist/coordinatorium/errors.d.ts +112 -0
  64. package/dist/coordinatorium/errors.d.ts.map +1 -0
  65. package/dist/coordinatorium/errors.js +145 -0
  66. package/dist/coordinatorium/index.d.ts +11 -0
  67. package/dist/coordinatorium/index.d.ts.map +1 -0
  68. package/dist/coordinatorium/index.js +5 -0
  69. package/dist/coordinatorium/lock.d.ts +187 -0
  70. package/dist/coordinatorium/lock.d.ts.map +1 -0
  71. package/dist/coordinatorium/lock.js +659 -0
  72. package/dist/coordinatorium/mission.d.ts +32 -0
  73. package/dist/coordinatorium/mission.d.ts.map +1 -0
  74. package/dist/coordinatorium/mission.js +87 -0
  75. package/dist/coordinatorium/state-keeper.d.ts +115 -0
  76. package/dist/coordinatorium/state-keeper.d.ts.map +1 -0
  77. package/dist/coordinatorium/state-keeper.js +396 -0
  78. package/dist/coordinatorium/types.d.ts +69 -0
  79. package/dist/coordinatorium/types.d.ts.map +1 -0
  80. package/dist/coordinatorium/types.js +27 -0
  81. package/dist/durable/assess.d.ts +105 -0
  82. package/dist/durable/assess.d.ts.map +1 -0
  83. package/dist/durable/assess.js +239 -0
  84. package/dist/durable/canonical.d.ts +25 -0
  85. package/dist/durable/canonical.d.ts.map +1 -0
  86. package/dist/durable/canonical.js +78 -0
  87. package/dist/durable/cli.d.ts +37 -0
  88. package/dist/durable/cli.d.ts.map +1 -0
  89. package/dist/durable/cli.js +141 -0
  90. package/dist/durable/errors.d.ts +188 -0
  91. package/dist/durable/errors.d.ts.map +1 -0
  92. package/dist/durable/errors.js +317 -0
  93. package/dist/durable/fs-store.d.ts +233 -0
  94. package/dist/durable/fs-store.d.ts.map +1 -0
  95. package/dist/durable/fs-store.js +1393 -0
  96. package/dist/durable/index.d.ts +20 -0
  97. package/dist/durable/index.d.ts.map +1 -0
  98. package/dist/durable/index.js +13 -0
  99. package/dist/durable/log.d.ts +33 -0
  100. package/dist/durable/log.d.ts.map +1 -0
  101. package/dist/durable/log.js +157 -0
  102. package/dist/durable/memory-store.d.ts +51 -0
  103. package/dist/durable/memory-store.d.ts.map +1 -0
  104. package/dist/durable/memory-store.js +302 -0
  105. package/dist/durable/projection.d.ts +35 -0
  106. package/dist/durable/projection.d.ts.map +1 -0
  107. package/dist/durable/projection.js +328 -0
  108. package/dist/durable/prune-check.d.ts +17 -0
  109. package/dist/durable/prune-check.d.ts.map +1 -0
  110. package/dist/durable/prune-check.js +45 -0
  111. package/dist/durable/register.d.ts +100 -0
  112. package/dist/durable/register.d.ts.map +1 -0
  113. package/dist/durable/register.js +532 -0
  114. package/dist/durable/retention.d.ts +49 -0
  115. package/dist/durable/retention.d.ts.map +1 -0
  116. package/dist/durable/retention.js +59 -0
  117. package/dist/durable/runtime.d.ts +497 -0
  118. package/dist/durable/runtime.d.ts.map +1 -0
  119. package/dist/durable/runtime.js +1271 -0
  120. package/dist/durable/seams.d.ts +40 -0
  121. package/dist/durable/seams.d.ts.map +1 -0
  122. package/dist/durable/seams.js +21 -0
  123. package/dist/durable/testing.d.ts +11 -0
  124. package/dist/durable/testing.d.ts.map +1 -0
  125. package/dist/durable/testing.js +25 -0
  126. package/dist/durable/types.d.ts +442 -0
  127. package/dist/durable/types.d.ts.map +1 -0
  128. package/dist/durable/types.js +75 -0
  129. package/dist/graph/builder.d.ts +11 -0
  130. package/dist/graph/builder.d.ts.map +1 -0
  131. package/dist/graph/builder.js +153 -0
  132. package/dist/graph/identity.d.ts +37 -0
  133. package/dist/graph/identity.d.ts.map +1 -0
  134. package/dist/graph/identity.js +46 -0
  135. package/dist/graph/index.d.ts +7 -0
  136. package/dist/graph/index.d.ts.map +1 -0
  137. package/dist/graph/index.js +3 -0
  138. package/dist/graph/resolver.d.ts +41 -0
  139. package/dist/graph/resolver.d.ts.map +1 -0
  140. package/dist/graph/resolver.js +36 -0
  141. package/dist/graph/types.d.ts +42 -0
  142. package/dist/graph/types.d.ts.map +1 -0
  143. package/dist/graph/types.js +1 -0
  144. package/dist/http/index.d.ts +5 -0
  145. package/dist/http/index.d.ts.map +1 -0
  146. package/dist/http/index.js +2 -0
  147. package/dist/http/server.d.ts +76 -0
  148. package/dist/http/server.d.ts.map +1 -0
  149. package/dist/http/server.js +195 -0
  150. package/dist/http/ui-assets.d.ts +22 -0
  151. package/dist/http/ui-assets.d.ts.map +1 -0
  152. package/dist/http/ui-assets.js +100 -0
  153. package/dist/index.d.ts +31 -0
  154. package/dist/index.d.ts.map +1 -0
  155. package/dist/index.js +26 -0
  156. package/dist/init/index.d.ts +12 -0
  157. package/dist/init/index.d.ts.map +1 -0
  158. package/dist/init/index.js +90 -0
  159. package/dist/init/prompts.d.ts +3 -0
  160. package/dist/init/prompts.d.ts.map +1 -0
  161. package/dist/init/prompts.js +47 -0
  162. package/dist/init/scaffold.d.ts +25 -0
  163. package/dist/init/scaffold.d.ts.map +1 -0
  164. package/dist/init/scaffold.js +204 -0
  165. package/dist/init/types.d.ts +14 -0
  166. package/dist/init/types.d.ts.map +1 -0
  167. package/dist/init/types.js +1 -0
  168. package/dist/readmodel/dashboard.d.ts +40 -0
  169. package/dist/readmodel/dashboard.d.ts.map +1 -0
  170. package/dist/readmodel/dashboard.js +236 -0
  171. package/dist/readmodel/index.d.ts +3 -0
  172. package/dist/readmodel/index.d.ts.map +1 -0
  173. package/dist/readmodel/index.js +1 -0
  174. package/dist/readmodel/types.d.ts +104 -0
  175. package/dist/readmodel/types.d.ts.map +1 -0
  176. package/dist/readmodel/types.js +15 -0
  177. package/dist/root/index.d.ts +179 -0
  178. package/dist/root/index.d.ts.map +1 -0
  179. package/dist/root/index.js +418 -0
  180. package/dist/root/safe-write.d.ts +268 -0
  181. package/dist/root/safe-write.d.ts.map +1 -0
  182. package/dist/root/safe-write.js +966 -0
  183. package/dist/root/write-artifacts.d.ts +20 -0
  184. package/dist/root/write-artifacts.d.ts.map +1 -0
  185. package/dist/root/write-artifacts.js +42 -0
  186. package/dist/scriptorium/compile.d.ts +4 -0
  187. package/dist/scriptorium/compile.d.ts.map +1 -0
  188. package/dist/scriptorium/compile.js +185 -0
  189. package/dist/scriptorium/frontmatter.d.ts +13 -0
  190. package/dist/scriptorium/frontmatter.d.ts.map +1 -0
  191. package/dist/scriptorium/frontmatter.js +90 -0
  192. package/dist/scriptorium/index.d.ts +3 -0
  193. package/dist/scriptorium/index.d.ts.map +1 -0
  194. package/dist/scriptorium/index.js +1 -0
  195. package/dist/scriptorium/markdown.d.ts +31 -0
  196. package/dist/scriptorium/markdown.d.ts.map +1 -0
  197. package/dist/scriptorium/markdown.js +88 -0
  198. package/dist/scriptorium/types.d.ts +78 -0
  199. package/dist/scriptorium/types.d.ts.map +1 -0
  200. package/dist/scriptorium/types.js +1 -0
  201. package/dist/types/enforcement.d.ts +11 -0
  202. package/dist/types/enforcement.d.ts.map +1 -0
  203. package/dist/types/enforcement.js +1 -0
  204. package/dist/types/integrity.d.ts +33 -0
  205. package/dist/types/integrity.d.ts.map +1 -0
  206. package/dist/types/integrity.js +1 -0
  207. package/dist/types/project-definition.d.ts +30 -0
  208. package/dist/types/project-definition.d.ts.map +1 -0
  209. package/dist/types/project-definition.js +1 -0
  210. package/dist/ui/assets/cosmic-glass-bg-Dwx47zPu.webp +0 -0
  211. package/dist/ui/assets/index-C4NhMaq7.js +28 -0
  212. package/dist/ui/assets/index-DMZ7ZvZY.css +1 -0
  213. package/dist/ui/index.html +13 -0
  214. package/dist/validate/index.d.ts +6 -0
  215. package/dist/validate/index.d.ts.map +1 -0
  216. package/dist/validate/index.js +214 -0
  217. package/dist/version.d.ts +2 -0
  218. package/dist/version.d.ts.map +1 -0
  219. package/dist/version.js +1 -0
  220. package/package.json +67 -4
  221. package/templates/.gitkeep +0 -0
  222. package/templates/default-instance/instruction/.cursorrules +53 -0
  223. package/templates/default-instance/instruction/.windsurfrules +53 -0
  224. package/templates/default-instance/instruction/CLAUDE.md +53 -0
  225. package/templates/default-instance/monolith/context/boot/HANDOFF.md +49 -0
  226. package/templates/default-instance/monolith/context/boot/WORK_SESSION.md +30 -0
  227. package/templates/default-instance/monolith/context/execution/current-state.md +30 -0
  228. package/templates/default-instance/monolith/context/maps/dependency-map.md +38 -0
  229. package/templates/default-instance/monolith/context/maps/project-map.md +85 -0
  230. package/templates/default-instance/monolith/context/maps/roadmap-index.md +41 -0
  231. package/templates/default-instance/monolith/context/maps/routing-map.md +147 -0
  232. package/templates/default-instance/monolith/context/maps/semantic-map.md +73 -0
  233. package/templates/default-instance/monolith/context/models/model-registry.md +37 -0
  234. package/templates/default-instance/monolith/context/models/privacy-classification.md +35 -0
  235. package/templates/default-instance/monolith/context/templates/plan-template.md +56 -0
  236. package/templates/default-instance/monolith/governance/README.md +29 -0
  237. package/templates/default-instance/monolith/governance/RULE_SCHEMA.md +58 -0
  238. package/templates/default-instance/monolith/learning/INDEX.md +48 -0
  239. package/templates/default-instance/monolith/learning/injection-map.md +49 -0
  240. package/templates/default-instance/monolith/learning/taxonomy.md +30 -0
  241. package/templates/default-instance/monolith/memory/errors/README.md +26 -0
  242. package/templates/default-instance/monolith/memory/errors/SCHEMA.md +47 -0
  243. package/templates/default-instance/monolith/memory/errors/TAXONOMY.md +27 -0
  244. package/templates/default-instance/monolith/memory/long-term/architecture-principles.md +31 -0
  245. package/templates/default-instance/monolith/memory/long-term/decisions.md +36 -0
  246. package/templates/default-instance/monolith/memory/long-term/execution-history.md +20 -0
  247. package/templates/default-instance/monolith/memory/long-term/tech-debt.md +25 -0
  248. package/templates/default-instance/monolith/memory/working/active.md +41 -0
  249. package/templates/default-instance/monolith/memory/working/governance-result.md +0 -0
  250. package/templates/default-instance/monolith/memory/working/integrity-result.md +0 -0
  251. package/templates/default-instance/monolith/memory/working/story-index.md +28 -0
  252. package/templates/default-instance/monolith/protocols/boot/boot-sequence.md +59 -0
  253. package/templates/default-instance/monolith/protocols/cognition/cognitive-modes.md +90 -0
  254. package/templates/default-instance/monolith/protocols/cognition/dry-run.md +56 -0
  255. package/templates/default-instance/monolith/protocols/cognition/execution-trace-format.md +52 -0
  256. package/templates/default-instance/monolith/protocols/cognition/semantic-planning.md +51 -0
  257. package/templates/default-instance/monolith/protocols/execution/hybrid-execution.md +37 -0
  258. package/templates/default-instance/monolith/protocols/execution/local-llm-governance.md +42 -0
  259. package/templates/default-instance/monolith/protocols/governance/command-policy.md +51 -0
  260. package/templates/default-instance/monolith/protocols/governance/core-invariants.md +40 -0
  261. package/templates/default-instance/monolith/protocols/governance/memory-governance.md +54 -0
  262. package/templates/default-instance/monolith/protocols/governance/metadata-schema.md +62 -0
  263. package/templates/default-instance/monolith/protocols/governance/skills.md +53 -0
  264. package/templates/default-instance/monolith/protocols/governance/work-session.md +46 -0
  265. package/templates/default-instance/monolith/skills/INDEX.md +28 -0
  266. package/templates/default-instance/monolith/skills/current-status/SKILL.md +47 -0
  267. package/templates/default-instance/monolith/skills/finalize-story/SKILL.md +86 -0
  268. package/templates/default-instance/monolith/skills/global-status/SKILL.md +56 -0
  269. package/templates/default-instance/monolith/skills/self-improvement/SKILL.md +77 -0
  270. package/templates/default-instance/monolith/state.json +11 -0
  271. package/templates/default-instance/monolith/tests/INDEX.md +57 -0
  272. package/templates/default-instance/monolith/tests/scenarios/architecture-review.md +32 -0
  273. package/templates/default-instance/monolith/tests/scenarios/debug-failure.md +32 -0
  274. package/templates/default-instance/monolith/tests/scenarios/dry-run-activation.md +33 -0
  275. package/templates/default-instance/monolith/tests/scenarios/execution-trace-verification.md +31 -0
  276. package/templates/default-instance/monolith/tests/scenarios/finalize-story.md +35 -0
  277. package/templates/default-instance/monolith/tests/scenarios/implement-feature.md +36 -0
  278. package/templates/default-instance/monolith/tests/scenarios/local-llm-delegation.md +31 -0
  279. package/templates/default-instance/monolith/tests/scenarios/planning-request.md +32 -0
  280. package/templates/default-instance/monolith/tests/scenarios/sensitive-context-task.md +30 -0
  281. package/templates/default-instance/monolith/tests/scenarios/validator-verification.md +33 -0
  282. package/templates/default-instance/monolith/tests/validation/expected-behavior.md +70 -0
  283. package/templates/default-instance/monolith/tests/validators/INDEX.md +17 -0
  284. package/templates/default-instance/monolith/tests/validators/delegation-semantics.md +22 -0
  285. package/templates/default-instance/monolith/tests/validators/mode-consistency.md +25 -0
  286. package/templates/default-instance/monolith/tests/validators/privacy-routing.md +23 -0
  287. package/templates/default-instance/monolith/tests/validators/protocol-references.md +27 -0
  288. package/templates/default-instance/monolith/tests/validators/routing-integrity.md +30 -0
  289. package/templates/default-instance/projectroot/AGENTS.md +107 -0
  290. package/templates/default-instance/projectroot/monolith.config.json +32 -0
  291. package/templates/default-instance/projectroot/project.definition.mjs.template +41 -0
@@ -0,0 +1,497 @@
1
+ /**
2
+ * DurableTasks — the application-facing API of Durable State.
3
+ *
4
+ * Every state change is one event appended to the task's log by compare-and-
5
+ * set on the next sequence number (see `EventStore.append`). There is no
6
+ * lock and no in-memory authority: any process can load a task from the store,
7
+ * decide, and append; if another process appended first the attempt re-reads
8
+ * and decides again against the new state. Consequences:
9
+ *
10
+ * - no lost updates, no stale locks, nothing to recover after a crash —
11
+ * a crash leaves either the event (complete) or nothing;
12
+ * - every operation is idempotent where a retry after a crash is plausible
13
+ * (same id + same content is a no-op; same id + different content is an
14
+ * error), so "run the step again" is always safe at the state level;
15
+ * - a worker acts under a *fence* (owner + epoch): once someone else claims
16
+ * the task, the old worker's next write fails with `StaleFenceError`
17
+ * instead of interleaving with the new one;
18
+ * - results from outside arrive through `deliver(token, ...)`, which needs no
19
+ * live process, tolerates duplicates and any order, and never loses a
20
+ * payload it declines to apply.
21
+ *
22
+ * Side effects *outside* the store cannot be made exactly-once by a store.
23
+ * `runEffect` records intent before and outcome after, so after a crash the
24
+ * state says precisely which effects completed, which are known not to have
25
+ * run, and which are *in doubt* (needs reconciliation with the external system).
26
+ */
27
+ import { type Json } from './canonical.js';
28
+ import { type AssessOptions, type Assessment, type StateChange } from './assess.js';
29
+ import { type RetentionDecision, type RetentionPolicy } from './retention.js';
30
+ import { type AssumptionState, type Criticality, type EffectState, type EventStore, type PlanStepState, type StoreDiagnostic, type TaskEvent, type TaskState, type TaskStatus, type Tombstone } from './types.js';
31
+ export interface DurableTasksOptions {
32
+ store: EventStore;
33
+ now?: () => Date;
34
+ /** Source of ids for tasks/awaits created without an explicit id. */
35
+ newId?: () => string;
36
+ defaultLeaseMs?: number;
37
+ maxEventsPerTask?: number;
38
+ maxAppendAttempts?: number;
39
+ /** Tasks kept in the in-memory read cache (least recently used are dropped). Default 256. */
40
+ maxCachedTasks?: number;
41
+ /**
42
+ * Event slots above `maxEventsPerTask` that only lease changes (`claim`, `release`) and terminal events
43
+ * (`complete`, `fail`, `cancel`) may use, so a task that exhausted its ordinary budget can always be closed.
44
+ * The last slot is for a terminal event only. Default 16; 0 restores the strict ceiling.
45
+ */
46
+ terminalReserveEvents?: number;
47
+ /**
48
+ * How long a reference pinned by a task that is being created counts as "creation in progress" when nothing
49
+ * of that task was published yet. A creator that died between pinning and publishing must not block the
50
+ * referenced task's pruning forever. Default 10 minutes.
51
+ */
52
+ referenceGraceMs?: number;
53
+ }
54
+ /** Proof of the right to act on a task as its current worker. */
55
+ export interface Fence {
56
+ taskId: string;
57
+ owner: string;
58
+ epoch: number;
59
+ }
60
+ export interface CreateTaskInput {
61
+ /** Supply a deterministic id to make creation idempotent across retries and restarts. */
62
+ taskId?: string;
63
+ kind: string;
64
+ goal: string;
65
+ input?: unknown;
66
+ parentTaskId?: string;
67
+ dependsOn?: string[];
68
+ labels?: Record<string, string>;
69
+ }
70
+ export interface TaskSummary {
71
+ taskId: string;
72
+ kind: string;
73
+ goal: string;
74
+ status: TaskStatus;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ closedAt: string | null;
78
+ headSeq: number;
79
+ pendingAwaits: number;
80
+ leaseOwner: string | null;
81
+ parentTaskId: string | null;
82
+ }
83
+ export type DeliveryResult = {
84
+ kind: 'accepted';
85
+ taskId: string;
86
+ awaitId: string;
87
+ seq: number;
88
+ }
89
+ /** Same idempotency key seen before: nothing was written. */
90
+ | {
91
+ kind: 'duplicate';
92
+ taskId: string;
93
+ awaitId: string;
94
+ seq: number;
95
+ }
96
+ /** The await already had a different result. The delivery is kept in the log as `await.delivery_rejected`. */
97
+ | {
98
+ kind: 'conflict';
99
+ taskId: string;
100
+ awaitId: string;
101
+ /** The stored `await.delivery_rejected` event, or - when `recorded` is false - the event that resolved the await. */
102
+ seq: number;
103
+ /**
104
+ * False when the per-await / per-task cap on stored rejections was reached: the delivery was answered
105
+ * but, to keep the log bounded, not written.
106
+ */
107
+ recorded: boolean;
108
+ } | {
109
+ kind: 'ignored';
110
+ reason: 'task-closed' | 'task-pruned';
111
+ taskId: string;
112
+ } | {
113
+ kind: 'rejected';
114
+ reason: 'malformed-token' | 'unknown-task' | 'unknown-await' | 'bad-token';
115
+ };
116
+ export interface EffectOptions<T extends Json> {
117
+ description: string;
118
+ params?: unknown;
119
+ /**
120
+ * Asked when the previous attempt left the outcome unrecorded. Look at the external
121
+ * system (by the effect key, which should double as its idempotency key) and say what happened.
122
+ */
123
+ reconcile?: (effect: EffectState) => Promise<{
124
+ status: 'completed';
125
+ result: T;
126
+ } | {
127
+ status: 'not-executed';
128
+ }>;
129
+ /**
130
+ * Says what an exception thrown by `fn` proves. `'not-executed'`: the external operation certainly did not
131
+ * take effect. `'unknown'`: it may have (a timeout, a dropped connection, any error after the request left).
132
+ * Default: only `EffectNotExecutedError` is `'not-executed'`; everything else is `'unknown'`, because an
133
+ * exception is not evidence that the remote side did nothing.
134
+ */
135
+ classifyError?: (err: unknown) => 'not-executed' | 'unknown';
136
+ /**
137
+ * Whether a failure classified `'not-executed'` may be run again (default true). It has no effect on an
138
+ * `'unknown'` failure: that one is never run again blindly, whatever this says — it needs `reconcile`.
139
+ */
140
+ retryable?: boolean;
141
+ }
142
+ export interface EffectOutcome<T> {
143
+ result: T;
144
+ /** True when the recorded result was returned and the function was not called. */
145
+ replayed: boolean;
146
+ }
147
+ export interface ResumePacket {
148
+ formatVersion: 1;
149
+ generatedFromSeq: number;
150
+ task: {
151
+ taskId: string;
152
+ kind: string;
153
+ goal: string;
154
+ input: Json | null;
155
+ parentTaskId: string | null;
156
+ dependsOn: string[];
157
+ labels: Record<string, string>;
158
+ status: TaskStatus;
159
+ createdAt: string;
160
+ headSeq: number;
161
+ };
162
+ assessment: Assessment;
163
+ plan: PlanStepState[] | null;
164
+ decisions: TaskState['decisions'];
165
+ assumptions: AssumptionState[];
166
+ observations: TaskState['observations'][string][];
167
+ effects: EffectState[];
168
+ awaits: Array<TaskState['awaits'][string]>;
169
+ /** For every unconsumed result: what changed between sending the request and now. */
170
+ sinceSend: Array<{
171
+ awaitId: string;
172
+ basisSeq: number;
173
+ changes: StateChange[];
174
+ }>;
175
+ timeline: Array<{
176
+ seq: number;
177
+ type: string;
178
+ at: string;
179
+ actor: string | null;
180
+ key: string | null;
181
+ }>;
182
+ timelineTruncated: boolean;
183
+ }
184
+ export interface VerifyReport {
185
+ taskId: string;
186
+ ok: boolean;
187
+ headSeq: number | null;
188
+ status: TaskStatus | 'pruned' | null;
189
+ error: string | null;
190
+ diagnostics: StoreDiagnostic[];
191
+ }
192
+ export interface RetentionReport {
193
+ decisions: RetentionDecision[];
194
+ applied: Array<{
195
+ taskId: string;
196
+ action: 'prune' | 'compact';
197
+ detail: string;
198
+ }>;
199
+ }
200
+ /** A unique, human-readable worker identity: host, pid, random suffix. Use one per process incarnation. */
201
+ export declare function newOwnerId(): string;
202
+ export declare function parseToken(token: unknown): {
203
+ taskId: string;
204
+ awaitId: string;
205
+ nonce: string;
206
+ } | null;
207
+ export declare class DurableTasks {
208
+ private readonly store;
209
+ private readonly now;
210
+ private readonly newId;
211
+ private readonly defaultLeaseMs;
212
+ private readonly maxEvents;
213
+ private readonly maxAttempts;
214
+ private readonly maxCached;
215
+ private readonly terminalReserve;
216
+ private readonly referenceGraceMs;
217
+ /** Validated, incrementally extended view per task. A cache of the log, never an authority. */
218
+ private readonly cache;
219
+ /** Effect executions running in this runtime, so concurrent calls with one identity share one `fn` call. */
220
+ private readonly inflight;
221
+ constructor(opts: DurableTasksOptions);
222
+ private remember;
223
+ /** Brings the cached state up to the head of the log. Throws if the task is missing or pruned. */
224
+ private refresh;
225
+ private loadFull;
226
+ /**
227
+ * Read state -> decide -> append, repeated until the append wins its slot.
228
+ * `plan` must be a pure function of the state it is given: it is re-run
229
+ * against fresh state after every lost race.
230
+ */
231
+ private mutate;
232
+ /**
233
+ * How many events a task may hold before `type` is refused. Ordinary events stop at `maxEvents`; lease changes
234
+ * may use the reserve except its last slot; terminal events may use all of it. See `terminalReserveEvents`.
235
+ */
236
+ private eventLimitFor;
237
+ /**
238
+ * Runs a proposed event through the fold before anything is stored. A violation here means the *caller's*
239
+ * request does not fit the task's current state (the stored log was just verified and is fine), so it is
240
+ * a `ValidationError`, never a `LogCorruptError`: corruption is reserved for stored data that fails verification.
241
+ */
242
+ private precheck;
243
+ /**
244
+ * After an unknown publication outcome: is *our* event (same hash) the one in the slot? Matching bytes cannot prove
245
+ * that this call created the slot, so the answer is 'adopted', never 'appended' (Amendment-004G, F-G-3). A failing
246
+ * read propagates: the outcome stays unknown and no right is granted.
247
+ */
248
+ private resolveUnknown;
249
+ createTask(input: CreateTaskInput): Promise<{
250
+ taskId: string;
251
+ created: boolean;
252
+ state: TaskState;
253
+ }>;
254
+ /**
255
+ * True when `taskId` exists and is not pruned. A tombstone may be transient (a prune that found a referrer
256
+ * withdraws it right away), so a pruned answer is re-checked for a short while before it is believed.
257
+ */
258
+ private referenceIsLive;
259
+ /**
260
+ * Immediate feedback for the creator, NOT the safety net: a creator that is killed before it gets here leaves an
261
+ * active task behind, and that is made harmless by `claim` / discovery (see `blockingRequirement`). It runs without
262
+ * looking at any clock: a clock-dependent skip is what let a skewed creator keep a task whose parent was pruned.
263
+ * Only a parent that is GONE cancels the new task. A parent whose prune is merely unfinished is rolled back on the
264
+ * spot (this task is published and active, so it is a referrer the prune must respect) or, if that cannot be
265
+ * done now, left alone: `claim` refuses to run the task until the question is settled, and cancels nothing.
266
+ */
267
+ private assertReferencesSurvived;
268
+ /**
269
+ * What a required task is, as seen right now (a logical model; nothing of this is persisted):
270
+ * - `live` it exists and carries no tombstone.
271
+ * - `pending` a tombstone exists, but the prune is unfinished and may still be rolled back, or cannot be examined.
272
+ * This is a transient state. It is never a reason to cancel anybody.
273
+ * - `gone` it never existed, or its removal has started or finished: the prune is committed and irreversible.
274
+ *
275
+ * Why the tombstone alone proves nothing: a pruner publishes it BEFORE it looks for referrers, and a stopped
276
+ * (SIGSTOP) or killed pruner leaves it behind with all data in place. Only the data decides:
277
+ * - complete data + a referrer that is active ⇒ the pruner has not passed its referrer check (or never will);
278
+ * the prune is rolled back here (`withdrawTombstone`, idempotent, refused once any file was removed).
279
+ * - data gone or partly removed ⇒ the pruner passed its referrer check and committed.
280
+ * With `recover: false` nothing is written: an unfinished prune is reported as `pending`.
281
+ * No timeout takes part in this decision; `pending` is retried by the caller, never promoted to `gone`.
282
+ */
283
+ private requirementState;
284
+ /**
285
+ * The first task an ACTIVE task requires (`parentTaskId`, `dependsOn`) that is gone, else the first whose prune is
286
+ * pending, else `null`. This — not the presence of `task.created` in the log — is what permits execution. Why it
287
+ * is safe without any clock: a pruner publishes its tombstone and only then looks for referrers; this check runs
288
+ * after the task's `task.created` is published. So either the tombstone is visible here, or the pruner sees the
289
+ * task and backs off. Once the check has passed, no prune of the required task can succeed while this task is active.
290
+ */
291
+ private blockingRequirement;
292
+ /**
293
+ * Durable, idempotent cleanup of an orphan whose required task is GONE (never for a pending prune):
294
+ * `task.cancelled` (a terminal event, which also fits in the reserve).
295
+ * Best effort by design: if the write fails (crash, ENOSPC) the task stays active in the log but
296
+ * `blockingRequirement` keeps refusing it on every call, and the next discovery tries the write again.
297
+ */
298
+ private quarantine;
299
+ /**
300
+ * An active task that refers to `taskId`: either published (`parentTaskId` / `dependsOn`) or being created
301
+ * (a recent pin with no task behind it yet). `null` if nothing needs `taskId` any more.
302
+ */
303
+ private activeReferrer;
304
+ getState(taskId: string): Promise<TaskState>;
305
+ /** The state when the log had `seq` events. */
306
+ getStateAt(taskId: string, seq: number): Promise<TaskState>;
307
+ getLog(taskId: string): Promise<{
308
+ state: TaskState;
309
+ events: TaskEvent[];
310
+ diagnostics: StoreDiagnostic[];
311
+ }>;
312
+ listTasks(filter?: {
313
+ status?: TaskStatus;
314
+ kind?: string;
315
+ label?: [string, string];
316
+ }): Promise<TaskSummary[]>;
317
+ /**
318
+ * Become the task's current worker. Fails with `LeaseHeldError` while another
319
+ * owner's lease is live; an expired or released lease (a dead worker) can be
320
+ * taken over. Every claim increments the epoch, which fences out the previous holder.
321
+ */
322
+ claim(taskId: string, opts: {
323
+ owner: string;
324
+ leaseMs?: number;
325
+ }): Promise<Fence>;
326
+ private assertFence;
327
+ /** Mutation by the fenced worker. */
328
+ private fenced;
329
+ heartbeat(f: Fence, leaseMs?: number): Promise<void>;
330
+ /** Give the task up. Idempotent; a closed task or an already-superseded fence is a quiet no-op. */
331
+ release(f: Fence): Promise<void>;
332
+ declarePlan(f: Fence, steps: Array<{
333
+ id: string;
334
+ title: string;
335
+ dependsOn?: string[];
336
+ }>, reason?: string): Promise<void>;
337
+ /** Marks a step done. Idempotent: completing a done step is a no-op. */
338
+ completeStep(f: Fence, stepId: string, result?: unknown): Promise<void>;
339
+ skipStep(f: Fence, stepId: string, reason: string): Promise<void>;
340
+ /** Records why something was chosen. Same id + same content is a no-op. */
341
+ recordDecision(f: Fence, d: {
342
+ id: string;
343
+ summary: string;
344
+ rationale?: string;
345
+ basedOn?: string[];
346
+ }): Promise<void>;
347
+ /**
348
+ * Records something the plan relies on, together with the value it was
349
+ * based on. `assess` later compares it with the current value of the same
350
+ * key. `blocking` (default): if it changes, the plan is not to be trusted.
351
+ * `advisory`: if it changes, adapt.
352
+ */
353
+ recordAssumption(f: Fence, a: {
354
+ key: string;
355
+ statement: string;
356
+ value: unknown;
357
+ criticality?: Criticality;
358
+ evidence?: Array<{
359
+ ref: string;
360
+ note?: string;
361
+ }>;
362
+ /**
363
+ * Replace an active assumption that holds a DIFFERENT value. Off by default on purpose: a worker
364
+ * that is re-run after a restart re-states its assumptions, and silently overwriting the recorded
365
+ * value with today's one would erase exactly the change `assess` exists to detect.
366
+ */
367
+ supersede?: boolean;
368
+ }): Promise<void>;
369
+ retractAssumption(f: Fence, key: string, reason: string): Promise<void>;
370
+ /**
371
+ * Another agent or system reports a fact about the world. No fence: observers
372
+ * are not the task's worker. An observation equal to the latest one for the key is a no-op.
373
+ */
374
+ observe(taskId: string, o: {
375
+ key: string;
376
+ value: unknown;
377
+ source?: string;
378
+ }): Promise<void>;
379
+ /**
380
+ * Runs `fn` at most once *as far as the log can tell*, and records what happened.
381
+ * `key` should also be the idempotency key sent to the external system.
382
+ *
383
+ * - completed before: returns the recorded result, `fn` is not called;
384
+ * - intent recorded but no outcome (crash in between): calls `reconcile` if
385
+ * given, else throws `EffectInDoubtError` — it will not guess;
386
+ * - failed before and PROVABLY not executed (`EffectNotExecutedError` / `classifyError`): runs again
387
+ * if retryable (default), else `EffectFailedError`;
388
+ * - `fn` threw anything else: an exception does not prove the remote side did nothing (a timeout after
389
+ * the request was sent is the typical case), so the outcome is recorded as unknown and treated like an
390
+ * announced effect without outcome: `reconcile` or `EffectInDoubtError`, never an automatic re-run.
391
+ * This is "at most once as far as the log can tell", not exactly-once: only an idempotency key honoured
392
+ * by the external system (use `key` for it) makes a repeated call harmless.
393
+ *
394
+ * Concurrency. Calls with the same (fence, key) inside one runtime share a single execution: the
395
+ * later callers wait for it and receive its result (`replayed: true`) or its error. Between runtimes
396
+ * and processes the guarantee comes from the log: the announcement (`effect.intended`) is appended
397
+ * only if the effect is still exactly as this call found it, so of N callers that decided on the same
398
+ * state only one announces and runs `fn`; the others get `EffectConflictError` and `fn` is not
399
+ * called. A different owner finds the unfinished effect in doubt (its epoch is no longer current).
400
+ * A fence belongs to one worker; sharing one fence between processes is outside the contract
401
+ * (the compare-and-set still keeps `fn` single, but `reconcile` cannot tell a live peer from a dead one).
402
+ */
403
+ runEffect<T extends Json>(f: Fence, key: string, fn: () => Promise<T>, opts: EffectOptions<T>): Promise<EffectOutcome<T>>;
404
+ private executeEffect;
405
+ /**
406
+ * Announces that an answer is expected and returns the token the answer must
407
+ * carry. Idempotent per `awaitId`: a restarted worker that registers the same
408
+ * await again gets the same token and nothing new is written.
409
+ * `basisSeq` records where the log stood at send time, so "what did the task
410
+ * look like then, and what changed since" is always answerable.
411
+ */
412
+ registerAwait(f: Fence, a: {
413
+ awaitId?: string;
414
+ purpose: string;
415
+ stepId?: string;
416
+ request?: unknown;
417
+ deadlineAt?: Date | string;
418
+ }): Promise<{
419
+ awaitId: string;
420
+ token: string;
421
+ created: boolean;
422
+ }>;
423
+ /**
424
+ * Hand an externally produced result to the task it belongs to. Needs no
425
+ * live process and no fence — only the token. Safe to call repeatedly and in any order:
426
+ * - same `idempotencyKey` again → `duplicate`, nothing written;
427
+ * - a different result for an already resolved await → `conflict`; the payload is kept
428
+ * in the log (`await.delivery_rejected`) and does not replace the first one;
429
+ * - a result after the await's deadline passed → accepted, flagged `late`;
430
+ * - a result for a finished task → `ignored` (its log is sealed).
431
+ */
432
+ deliver(token: string, payload: unknown, opts: {
433
+ idempotencyKey: string;
434
+ source?: string;
435
+ }): Promise<DeliveryResult>;
436
+ /** Marks pending awaits whose deadline has passed as expired. Returns the awaits it expired. */
437
+ sweepDeadlines(taskId?: string): Promise<Array<{
438
+ taskId: string;
439
+ awaitId: string;
440
+ }>>;
441
+ complete(f: Fence, result?: unknown): Promise<void>;
442
+ fail(f: Fence, error: string, detail?: unknown): Promise<void>;
443
+ /** Administrative stop: no fence needed. Idempotent for an already cancelled task. */
444
+ cancel(taskId: string, reason: string, actor?: string): Promise<void>;
445
+ assess(taskId: string, opts?: Omit<AssessOptions, 'now'> & {
446
+ now?: Date;
447
+ }): Promise<Assessment>;
448
+ /**
449
+ * An active task whose required task is gone is reported as not claimable, with the reason; `claim` enforces it.
450
+ * A required task whose prune is pending also makes it not claimable, but the task is not cancelled.
451
+ * `recover`: roll back an unfinished prune of a required task (a write); `assess` / `resumePacket` do not.
452
+ */
453
+ private withRequirements;
454
+ /** Everything a resumed worker — or a reasoning component — needs, in one deterministic document. */
455
+ resumePacket(taskId: string, opts?: Omit<AssessOptions, 'now'> & {
456
+ now?: Date;
457
+ }): Promise<ResumePacket>;
458
+ private keyOf;
459
+ /**
460
+ * The wake-up query of a scheduler after a restart: active tasks nobody is
461
+ * working on that have something to do (`direct`, `adaptive`, `recovery`).
462
+ * Tasks that only wait for more results are not returned.
463
+ */
464
+ findResumable(opts?: {
465
+ observations?: (state: TaskState) => Record<string, unknown> | undefined;
466
+ }): Promise<Array<{
467
+ taskId: string;
468
+ mode: Assessment['mode'];
469
+ reasons: string[];
470
+ }>>;
471
+ /** Re-reads and re-verifies logs end to end (hash chain, sequence, fold). Never repairs. */
472
+ verify(taskId?: string): Promise<VerifyReport[]>;
473
+ /**
474
+ * Decide what retention would do. Nothing is changed. Tasks whose log fails
475
+ * verification are skipped (never pruned or compacted while corrupt).
476
+ */
477
+ planRetention(policy: RetentionPolicy): Promise<RetentionDecision[]>;
478
+ /** Executes a plan. Every destructive step re-checks its precondition against the live log. */
479
+ applyRetention(policy: RetentionPolicy): Promise<RetentionReport>;
480
+ /**
481
+ * Packs events up to `throughSeq` into verified segments. Returns the number of events packed.
482
+ * Also finishes an interrupted earlier compaction: loose copies that a published segment already covers
483
+ * are removed (only if byte-identical to the segment), even when there is nothing new to pack.
484
+ */
485
+ compact(taskId: string, opts: {
486
+ throughSeq: number;
487
+ }): Promise<number>;
488
+ /**
489
+ * Removes a finished task's log, leaving a tombstone. Refuses unless the
490
+ * task is terminal, past retention, and not referenced by an active task —
491
+ * checked now, against the live log, not against an earlier plan.
492
+ */
493
+ pruneTask(taskId: string, policy: Pick<RetentionPolicy, 'terminalRetentionMs'>): Promise<Tombstone>;
494
+ /** A referrer showed up after the tombstone was published: undo the prune if the data is still complete. */
495
+ private refuseAfterTombstone;
496
+ }
497
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/durable/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAuC,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAuC,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAyBzH,OAAO,EAAiB,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE7F,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAGhB,KAAK,UAAU,EAIf,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,YAAY,CAAC;AAGpB,M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