looply-cli 0.0.0-stage → 0.3.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 (793) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +137 -3
  3. package/dist/.src-hash +1 -0
  4. package/dist/acceptance-observe.d.ts +108 -0
  5. package/dist/acceptance-observe.d.ts.map +1 -0
  6. package/dist/acceptance-observe.js +152 -0
  7. package/dist/acceptance-observe.js.map +1 -0
  8. package/dist/agent-cmd.d.ts +131 -0
  9. package/dist/agent-cmd.d.ts.map +1 -0
  10. package/dist/agent-cmd.js +154 -0
  11. package/dist/agent-cmd.js.map +1 -0
  12. package/dist/agent-contained.d.ts +114 -0
  13. package/dist/agent-contained.d.ts.map +1 -0
  14. package/dist/agent-contained.js +292 -0
  15. package/dist/agent-contained.js.map +1 -0
  16. package/dist/agent-driver.d.ts +130 -0
  17. package/dist/agent-driver.d.ts.map +1 -0
  18. package/dist/agent-driver.js +170 -0
  19. package/dist/agent-driver.js.map +1 -0
  20. package/dist/agent-envelope.d.ts +94 -0
  21. package/dist/agent-envelope.d.ts.map +1 -0
  22. package/dist/agent-envelope.js +214 -0
  23. package/dist/agent-envelope.js.map +1 -0
  24. package/dist/agent-exec.d.ts +182 -0
  25. package/dist/agent-exec.d.ts.map +1 -0
  26. package/dist/agent-exec.js +125 -0
  27. package/dist/agent-exec.js.map +1 -0
  28. package/dist/agent-runtime.d.ts +23 -0
  29. package/dist/agent-runtime.d.ts.map +1 -0
  30. package/dist/agent-runtime.js +143 -0
  31. package/dist/agent-runtime.js.map +1 -0
  32. package/dist/approval-gate-read.d.ts +66 -0
  33. package/dist/approval-gate-read.d.ts.map +1 -0
  34. package/dist/approval-gate-read.js +138 -0
  35. package/dist/approval-gate-read.js.map +1 -0
  36. package/dist/approval-resolution.d.ts +87 -0
  37. package/dist/approval-resolution.d.ts.map +1 -0
  38. package/dist/approval-resolution.js +100 -0
  39. package/dist/approval-resolution.js.map +1 -0
  40. package/dist/approval-resumes.d.ts +102 -0
  41. package/dist/approval-resumes.d.ts.map +1 -0
  42. package/dist/approval-resumes.js +167 -0
  43. package/dist/approval-resumes.js.map +1 -0
  44. package/dist/ask-brain.d.ts +167 -0
  45. package/dist/ask-brain.d.ts.map +1 -0
  46. package/dist/ask-brain.js +355 -0
  47. package/dist/ask-brain.js.map +1 -0
  48. package/dist/autonomy-authority.d.ts +80 -0
  49. package/dist/autonomy-authority.d.ts.map +1 -0
  50. package/dist/autonomy-authority.js +82 -0
  51. package/dist/autonomy-authority.js.map +1 -0
  52. package/dist/autonomy-controller.d.ts +321 -0
  53. package/dist/autonomy-controller.d.ts.map +1 -0
  54. package/dist/autonomy-controller.js +517 -0
  55. package/dist/autonomy-controller.js.map +1 -0
  56. package/dist/autonomy-store.d.ts +327 -0
  57. package/dist/autonomy-store.d.ts.map +1 -0
  58. package/dist/autonomy-store.js +581 -0
  59. package/dist/autonomy-store.js.map +1 -0
  60. package/dist/autonomy-tick.d.ts +257 -0
  61. package/dist/autonomy-tick.d.ts.map +1 -0
  62. package/dist/autonomy-tick.js +616 -0
  63. package/dist/autonomy-tick.js.map +1 -0
  64. package/dist/bin.d.ts +3 -0
  65. package/dist/bin.d.ts.map +1 -0
  66. package/dist/bin.js +2727 -0
  67. package/dist/bin.js.map +1 -0
  68. package/dist/brain-advice.d.ts +21 -0
  69. package/dist/brain-advice.d.ts.map +1 -0
  70. package/dist/brain-advice.js +51 -0
  71. package/dist/brain-advice.js.map +1 -0
  72. package/dist/candidate-replay-runtime.d.ts +125 -0
  73. package/dist/candidate-replay-runtime.d.ts.map +1 -0
  74. package/dist/candidate-replay-runtime.js +188 -0
  75. package/dist/candidate-replay-runtime.js.map +1 -0
  76. package/dist/checkout-carry.d.ts +76 -0
  77. package/dist/checkout-carry.d.ts.map +1 -0
  78. package/dist/checkout-carry.js +125 -0
  79. package/dist/checkout-carry.js.map +1 -0
  80. package/dist/citation-readers.d.ts +26 -0
  81. package/dist/citation-readers.d.ts.map +1 -0
  82. package/dist/citation-readers.js +102 -0
  83. package/dist/citation-readers.js.map +1 -0
  84. package/dist/command-receipts.d.ts +79 -0
  85. package/dist/command-receipts.d.ts.map +1 -0
  86. package/dist/command-receipts.js +143 -0
  87. package/dist/command-receipts.js.map +1 -0
  88. package/dist/command-runner.d.ts +32 -0
  89. package/dist/command-runner.d.ts.map +1 -0
  90. package/dist/command-runner.js +108 -0
  91. package/dist/command-runner.js.map +1 -0
  92. package/dist/compatible-sets.d.ts +67 -0
  93. package/dist/compatible-sets.d.ts.map +1 -0
  94. package/dist/compatible-sets.js +81 -0
  95. package/dist/compatible-sets.js.map +1 -0
  96. package/dist/compile-check.d.ts +31 -0
  97. package/dist/compile-check.d.ts.map +1 -0
  98. package/dist/compile-check.js +34 -0
  99. package/dist/compile-check.js.map +1 -0
  100. package/dist/compile-store.d.ts +16 -0
  101. package/dist/compile-store.d.ts.map +1 -0
  102. package/dist/compile-store.js +21 -0
  103. package/dist/compile-store.js.map +1 -0
  104. package/dist/completion.d.ts +106 -0
  105. package/dist/completion.d.ts.map +1 -0
  106. package/dist/completion.js +131 -0
  107. package/dist/completion.js.map +1 -0
  108. package/dist/config.d.ts +549 -0
  109. package/dist/config.d.ts.map +1 -0
  110. package/dist/config.js +763 -0
  111. package/dist/config.js.map +1 -0
  112. package/dist/control-file.d.ts +142 -0
  113. package/dist/control-file.d.ts.map +1 -0
  114. package/dist/control-file.js +144 -0
  115. package/dist/control-file.js.map +1 -0
  116. package/dist/coordinator-state.d.ts +131 -0
  117. package/dist/coordinator-state.d.ts.map +1 -0
  118. package/dist/coordinator-state.js +380 -0
  119. package/dist/coordinator-state.js.map +1 -0
  120. package/dist/coordinator.d.ts +95 -0
  121. package/dist/coordinator.d.ts.map +1 -0
  122. package/dist/coordinator.js +97 -0
  123. package/dist/coordinator.js.map +1 -0
  124. package/dist/cursor-store.d.ts +53 -0
  125. package/dist/cursor-store.d.ts.map +1 -0
  126. package/dist/cursor-store.js +98 -0
  127. package/dist/cursor-store.js.map +1 -0
  128. package/dist/daemon-cmd.d.ts +239 -0
  129. package/dist/daemon-cmd.d.ts.map +1 -0
  130. package/dist/daemon-cmd.js +1751 -0
  131. package/dist/daemon-cmd.js.map +1 -0
  132. package/dist/daemon-lock.d.ts +140 -0
  133. package/dist/daemon-lock.d.ts.map +1 -0
  134. package/dist/daemon-lock.js +352 -0
  135. package/dist/daemon-lock.js.map +1 -0
  136. package/dist/daemon-recovery.d.ts +78 -0
  137. package/dist/daemon-recovery.d.ts.map +1 -0
  138. package/dist/daemon-recovery.js +161 -0
  139. package/dist/daemon-recovery.js.map +1 -0
  140. package/dist/daemon.d.ts +368 -0
  141. package/dist/daemon.d.ts.map +1 -0
  142. package/dist/daemon.js +601 -0
  143. package/dist/daemon.js.map +1 -0
  144. package/dist/declared-response-shape.d.ts +93 -0
  145. package/dist/declared-response-shape.d.ts.map +1 -0
  146. package/dist/declared-response-shape.js +200 -0
  147. package/dist/declared-response-shape.js.map +1 -0
  148. package/dist/declared-surfaces.d.ts +16 -0
  149. package/dist/declared-surfaces.d.ts.map +1 -0
  150. package/dist/declared-surfaces.js +19 -0
  151. package/dist/declared-surfaces.js.map +1 -0
  152. package/dist/depends-review.d.ts +113 -0
  153. package/dist/depends-review.d.ts.map +1 -0
  154. package/dist/depends-review.js +110 -0
  155. package/dist/depends-review.js.map +1 -0
  156. package/dist/doctor.d.ts +91 -0
  157. package/dist/doctor.d.ts.map +1 -0
  158. package/dist/doctor.js +71 -0
  159. package/dist/doctor.js.map +1 -0
  160. package/dist/edge-approval.d.ts +105 -0
  161. package/dist/edge-approval.d.ts.map +1 -0
  162. package/dist/edge-approval.js +100 -0
  163. package/dist/edge-approval.js.map +1 -0
  164. package/dist/evidence-cache.d.ts +45 -0
  165. package/dist/evidence-cache.d.ts.map +1 -0
  166. package/dist/evidence-cache.js +90 -0
  167. package/dist/evidence-cache.js.map +1 -0
  168. package/dist/evidence-cmd.d.ts +133 -0
  169. package/dist/evidence-cmd.d.ts.map +1 -0
  170. package/dist/evidence-cmd.js +347 -0
  171. package/dist/evidence-cmd.js.map +1 -0
  172. package/dist/evidence-facts.d.ts +40 -0
  173. package/dist/evidence-facts.d.ts.map +1 -0
  174. package/dist/evidence-facts.js +114 -0
  175. package/dist/evidence-facts.js.map +1 -0
  176. package/dist/exclusive-lock.d.ts +52 -0
  177. package/dist/exclusive-lock.d.ts.map +1 -0
  178. package/dist/exclusive-lock.js +150 -0
  179. package/dist/exclusive-lock.js.map +1 -0
  180. package/dist/exec-domains.d.ts +140 -0
  181. package/dist/exec-domains.d.ts.map +1 -0
  182. package/dist/exec-domains.js +287 -0
  183. package/dist/exec-domains.js.map +1 -0
  184. package/dist/exemption-store.d.ts +197 -0
  185. package/dist/exemption-store.d.ts.map +1 -0
  186. package/dist/exemption-store.js +266 -0
  187. package/dist/exemption-store.js.map +1 -0
  188. package/dist/explicit-start-gate.d.ts +96 -0
  189. package/dist/explicit-start-gate.d.ts.map +1 -0
  190. package/dist/explicit-start-gate.js +103 -0
  191. package/dist/explicit-start-gate.js.map +1 -0
  192. package/dist/fs-trouble.d.ts +70 -0
  193. package/dist/fs-trouble.d.ts.map +1 -0
  194. package/dist/fs-trouble.js +98 -0
  195. package/dist/fs-trouble.js.map +1 -0
  196. package/dist/gate.d.ts +278 -0
  197. package/dist/gate.d.ts.map +1 -0
  198. package/dist/gate.js +278 -0
  199. package/dist/gate.js.map +1 -0
  200. package/dist/git-driver.d.ts +519 -0
  201. package/dist/git-driver.d.ts.map +1 -0
  202. package/dist/git-driver.js +900 -0
  203. package/dist/git-driver.js.map +1 -0
  204. package/dist/git-push-executor.d.ts +41 -0
  205. package/dist/git-push-executor.d.ts.map +1 -0
  206. package/dist/git-push-executor.js +142 -0
  207. package/dist/git-push-executor.js.map +1 -0
  208. package/dist/glob.d.ts +26 -0
  209. package/dist/glob.d.ts.map +1 -0
  210. package/dist/glob.js +93 -0
  211. package/dist/glob.js.map +1 -0
  212. package/dist/goal-adaptive.d.ts +295 -0
  213. package/dist/goal-adaptive.d.ts.map +1 -0
  214. package/dist/goal-adaptive.js +393 -0
  215. package/dist/goal-adaptive.js.map +1 -0
  216. package/dist/goal-compile.d.ts +342 -0
  217. package/dist/goal-compile.d.ts.map +1 -0
  218. package/dist/goal-compile.js +444 -0
  219. package/dist/goal-compile.js.map +1 -0
  220. package/dist/goal-depends-executor.d.ts +55 -0
  221. package/dist/goal-depends-executor.d.ts.map +1 -0
  222. package/dist/goal-depends-executor.js +202 -0
  223. package/dist/goal-depends-executor.js.map +1 -0
  224. package/dist/goal-execution-evidence.d.ts +135 -0
  225. package/dist/goal-execution-evidence.d.ts.map +1 -0
  226. package/dist/goal-execution-evidence.js +159 -0
  227. package/dist/goal-execution-evidence.js.map +1 -0
  228. package/dist/goal-gap.d.ts +140 -0
  229. package/dist/goal-gap.d.ts.map +1 -0
  230. package/dist/goal-gap.js +197 -0
  231. package/dist/goal-gap.js.map +1 -0
  232. package/dist/goal-met-target.d.ts +98 -0
  233. package/dist/goal-met-target.d.ts.map +1 -0
  234. package/dist/goal-met-target.js +92 -0
  235. package/dist/goal-met-target.js.map +1 -0
  236. package/dist/goal-ownership.d.ts +416 -0
  237. package/dist/goal-ownership.d.ts.map +1 -0
  238. package/dist/goal-ownership.js +576 -0
  239. package/dist/goal-ownership.js.map +1 -0
  240. package/dist/goal-runs.d.ts +82 -0
  241. package/dist/goal-runs.d.ts.map +1 -0
  242. package/dist/goal-runs.js +120 -0
  243. package/dist/goal-runs.js.map +1 -0
  244. package/dist/goal-store.d.ts +146 -0
  245. package/dist/goal-store.d.ts.map +1 -0
  246. package/dist/goal-store.js +294 -0
  247. package/dist/goal-store.js.map +1 -0
  248. package/dist/goal-view.d.ts +156 -0
  249. package/dist/goal-view.d.ts.map +1 -0
  250. package/dist/goal-view.js +499 -0
  251. package/dist/goal-view.js.map +1 -0
  252. package/dist/governed-approvals.d.ts +152 -0
  253. package/dist/governed-approvals.d.ts.map +1 -0
  254. package/dist/governed-approvals.js +246 -0
  255. package/dist/governed-approvals.js.map +1 -0
  256. package/dist/governed-broker.d.ts +169 -0
  257. package/dist/governed-broker.d.ts.map +1 -0
  258. package/dist/governed-broker.js +196 -0
  259. package/dist/governed-broker.js.map +1 -0
  260. package/dist/governed-run.d.ts +220 -0
  261. package/dist/governed-run.d.ts.map +1 -0
  262. package/dist/governed-run.js +406 -0
  263. package/dist/governed-run.js.map +1 -0
  264. package/dist/grant-reconcile.d.ts +63 -0
  265. package/dist/grant-reconcile.d.ts.map +1 -0
  266. package/dist/grant-reconcile.js +121 -0
  267. package/dist/grant-reconcile.js.map +1 -0
  268. package/dist/index-for-head.d.ts +56 -0
  269. package/dist/index-for-head.d.ts.map +1 -0
  270. package/dist/index-for-head.js +103 -0
  271. package/dist/index-for-head.js.map +1 -0
  272. package/dist/index.d.ts +39 -0
  273. package/dist/index.d.ts.map +1 -0
  274. package/dist/index.js +55 -0
  275. package/dist/index.js.map +1 -0
  276. package/dist/init-detect.d.ts +39 -0
  277. package/dist/init-detect.d.ts.map +1 -0
  278. package/dist/init-detect.js +188 -0
  279. package/dist/init-detect.js.map +1 -0
  280. package/dist/integration-deps.d.ts +62 -0
  281. package/dist/integration-deps.d.ts.map +1 -0
  282. package/dist/integration-deps.js +251 -0
  283. package/dist/integration-deps.js.map +1 -0
  284. package/dist/integration-runtime.d.ts +458 -0
  285. package/dist/integration-runtime.d.ts.map +1 -0
  286. package/dist/integration-runtime.js +681 -0
  287. package/dist/integration-runtime.js.map +1 -0
  288. package/dist/integration.d.ts +45 -0
  289. package/dist/integration.d.ts.map +1 -0
  290. package/dist/integration.js +87 -0
  291. package/dist/integration.js.map +1 -0
  292. package/dist/integrator.d.ts +84 -0
  293. package/dist/integrator.d.ts.map +1 -0
  294. package/dist/integrator.js +193 -0
  295. package/dist/integrator.js.map +1 -0
  296. package/dist/lane-claims.d.ts +174 -0
  297. package/dist/lane-claims.d.ts.map +1 -0
  298. package/dist/lane-claims.js +218 -0
  299. package/dist/lane-claims.js.map +1 -0
  300. package/dist/lane-coverage.d.ts +87 -0
  301. package/dist/lane-coverage.d.ts.map +1 -0
  302. package/dist/lane-coverage.js +129 -0
  303. package/dist/lane-coverage.js.map +1 -0
  304. package/dist/ledger-replay.d.ts +115 -0
  305. package/dist/ledger-replay.d.ts.map +1 -0
  306. package/dist/ledger-replay.js +155 -0
  307. package/dist/ledger-replay.js.map +1 -0
  308. package/dist/ledger-store.d.ts +68 -0
  309. package/dist/ledger-store.d.ts.map +1 -0
  310. package/dist/ledger-store.js +111 -0
  311. package/dist/ledger-store.js.map +1 -0
  312. package/dist/loop-safety-observer.d.ts +132 -0
  313. package/dist/loop-safety-observer.d.ts.map +1 -0
  314. package/dist/loop-safety-observer.js +76 -0
  315. package/dist/loop-safety-observer.js.map +1 -0
  316. package/dist/loop-safety-store.d.ts +339 -0
  317. package/dist/loop-safety-store.d.ts.map +1 -0
  318. package/dist/loop-safety-store.js +800 -0
  319. package/dist/loop-safety-store.js.map +1 -0
  320. package/dist/machine-store.d.ts +54 -0
  321. package/dist/machine-store.d.ts.map +1 -0
  322. package/dist/machine-store.js +149 -0
  323. package/dist/machine-store.js.map +1 -0
  324. package/dist/mcp-main.d.ts +2 -0
  325. package/dist/mcp-main.d.ts.map +1 -0
  326. package/dist/mcp-main.js +116 -0
  327. package/dist/mcp-main.js.map +1 -0
  328. package/dist/mcp-server.d.ts +72 -0
  329. package/dist/mcp-server.d.ts.map +1 -0
  330. package/dist/mcp-server.js +259 -0
  331. package/dist/mcp-server.js.map +1 -0
  332. package/dist/model-routing.d.ts +75 -0
  333. package/dist/model-routing.d.ts.map +1 -0
  334. package/dist/model-routing.js +108 -0
  335. package/dist/model-routing.js.map +1 -0
  336. package/dist/model-transport.d.ts +188 -0
  337. package/dist/model-transport.d.ts.map +1 -0
  338. package/dist/model-transport.js +625 -0
  339. package/dist/model-transport.js.map +1 -0
  340. package/dist/notify-cadence.d.ts +55 -0
  341. package/dist/notify-cadence.d.ts.map +1 -0
  342. package/dist/notify-cadence.js +68 -0
  343. package/dist/notify-cadence.js.map +1 -0
  344. package/dist/notify-channel.d.ts +69 -0
  345. package/dist/notify-channel.d.ts.map +1 -0
  346. package/dist/notify-channel.js +151 -0
  347. package/dist/notify-channel.js.map +1 -0
  348. package/dist/notify.d.ts +71 -0
  349. package/dist/notify.d.ts.map +1 -0
  350. package/dist/notify.js +125 -0
  351. package/dist/notify.js.map +1 -0
  352. package/dist/observation-inventory.d.ts +65 -0
  353. package/dist/observation-inventory.d.ts.map +1 -0
  354. package/dist/observation-inventory.js +139 -0
  355. package/dist/observation-inventory.js.map +1 -0
  356. package/dist/owned-children.d.ts +45 -0
  357. package/dist/owned-children.d.ts.map +1 -0
  358. package/dist/owned-children.js +64 -0
  359. package/dist/owned-children.js.map +1 -0
  360. package/dist/packet-for-goal.d.ts +19 -0
  361. package/dist/packet-for-goal.d.ts.map +1 -0
  362. package/dist/packet-for-goal.js +32 -0
  363. package/dist/packet-for-goal.js.map +1 -0
  364. package/dist/pair-cmd.d.ts +85 -0
  365. package/dist/pair-cmd.d.ts.map +1 -0
  366. package/dist/pair-cmd.js +205 -0
  367. package/dist/pair-cmd.js.map +1 -0
  368. package/dist/partial-asker.d.ts +96 -0
  369. package/dist/partial-asker.d.ts.map +1 -0
  370. package/dist/partial-asker.js +117 -0
  371. package/dist/partial-asker.js.map +1 -0
  372. package/dist/pdf-text-lines.d.ts +17 -0
  373. package/dist/pdf-text-lines.d.ts.map +1 -0
  374. package/dist/pdf-text-lines.js +70 -0
  375. package/dist/pdf-text-lines.js.map +1 -0
  376. package/dist/pdf-text-worker.d.ts +2 -0
  377. package/dist/pdf-text-worker.d.ts.map +1 -0
  378. package/dist/pdf-text-worker.js +81 -0
  379. package/dist/pdf-text-worker.js.map +1 -0
  380. package/dist/pdf-text.d.ts +56 -0
  381. package/dist/pdf-text.d.ts.map +1 -0
  382. package/dist/pdf-text.js +64 -0
  383. package/dist/pdf-text.js.map +1 -0
  384. package/dist/pending-action.d.ts +154 -0
  385. package/dist/pending-action.d.ts.map +1 -0
  386. package/dist/pending-action.js +148 -0
  387. package/dist/pending-action.js.map +1 -0
  388. package/dist/preemptor.d.ts +40 -0
  389. package/dist/preemptor.d.ts.map +1 -0
  390. package/dist/preemptor.js +49 -0
  391. package/dist/preemptor.js.map +1 -0
  392. package/dist/programme-mode.d.ts +29 -0
  393. package/dist/programme-mode.d.ts.map +1 -0
  394. package/dist/programme-mode.js +50 -0
  395. package/dist/programme-mode.js.map +1 -0
  396. package/dist/progress-view.d.ts +14 -0
  397. package/dist/progress-view.d.ts.map +1 -0
  398. package/dist/progress-view.js +114 -0
  399. package/dist/progress-view.js.map +1 -0
  400. package/dist/project-graph-builder.d.ts +81 -0
  401. package/dist/project-graph-builder.d.ts.map +1 -0
  402. package/dist/project-graph-builder.js +246 -0
  403. package/dist/project-graph-builder.js.map +1 -0
  404. package/dist/project-graph-runtime.d.ts +86 -0
  405. package/dist/project-graph-runtime.d.ts.map +1 -0
  406. package/dist/project-graph-runtime.js +112 -0
  407. package/dist/project-graph-runtime.js.map +1 -0
  408. package/dist/project-index-builder.d.ts +96 -0
  409. package/dist/project-index-builder.d.ts.map +1 -0
  410. package/dist/project-index-builder.js +298 -0
  411. package/dist/project-index-builder.js.map +1 -0
  412. package/dist/project-index-facts.d.ts +51 -0
  413. package/dist/project-index-facts.d.ts.map +1 -0
  414. package/dist/project-index-facts.js +117 -0
  415. package/dist/project-index-facts.js.map +1 -0
  416. package/dist/project-index-store.d.ts +97 -0
  417. package/dist/project-index-store.d.ts.map +1 -0
  418. package/dist/project-index-store.js +140 -0
  419. package/dist/project-index-store.js.map +1 -0
  420. package/dist/project-memory-store.d.ts +127 -0
  421. package/dist/project-memory-store.d.ts.map +1 -0
  422. package/dist/project-memory-store.js +302 -0
  423. package/dist/project-memory-store.js.map +1 -0
  424. package/dist/proposal-store.d.ts +14 -0
  425. package/dist/proposal-store.d.ts.map +1 -0
  426. package/dist/proposal-store.js +19 -0
  427. package/dist/proposal-store.js.map +1 -0
  428. package/dist/prover.d.ts +80 -0
  429. package/dist/prover.d.ts.map +1 -0
  430. package/dist/prover.js +137 -0
  431. package/dist/prover.js.map +1 -0
  432. package/dist/provider-identity-store.d.ts +34 -0
  433. package/dist/provider-identity-store.d.ts.map +1 -0
  434. package/dist/provider-identity-store.js +72 -0
  435. package/dist/provider-identity-store.js.map +1 -0
  436. package/dist/provider-identity.d.ts +104 -0
  437. package/dist/provider-identity.d.ts.map +1 -0
  438. package/dist/provider-identity.js +167 -0
  439. package/dist/provider-identity.js.map +1 -0
  440. package/dist/provider-limit.d.ts +79 -0
  441. package/dist/provider-limit.d.ts.map +1 -0
  442. package/dist/provider-limit.js +148 -0
  443. package/dist/provider-limit.js.map +1 -0
  444. package/dist/provider-preflight.d.ts +171 -0
  445. package/dist/provider-preflight.d.ts.map +1 -0
  446. package/dist/provider-preflight.js +395 -0
  447. package/dist/provider-preflight.js.map +1 -0
  448. package/dist/provider-state.d.ts +120 -0
  449. package/dist/provider-state.d.ts.map +1 -0
  450. package/dist/provider-state.js +182 -0
  451. package/dist/provider-state.js.map +1 -0
  452. package/dist/providers.d.ts +132 -0
  453. package/dist/providers.d.ts.map +1 -0
  454. package/dist/providers.js +161 -0
  455. package/dist/providers.js.map +1 -0
  456. package/dist/publication-recorder.d.ts +117 -0
  457. package/dist/publication-recorder.d.ts.map +1 -0
  458. package/dist/publication-recorder.js +124 -0
  459. package/dist/publication-recorder.js.map +1 -0
  460. package/dist/pursuit-delivery.d.ts +24 -0
  461. package/dist/pursuit-delivery.d.ts.map +1 -0
  462. package/dist/pursuit-delivery.js +38 -0
  463. package/dist/pursuit-delivery.js.map +1 -0
  464. package/dist/queue-store.d.ts +132 -0
  465. package/dist/queue-store.d.ts.map +1 -0
  466. package/dist/queue-store.js +185 -0
  467. package/dist/queue-store.js.map +1 -0
  468. package/dist/queue-summary.d.ts +14 -0
  469. package/dist/queue-summary.d.ts.map +1 -0
  470. package/dist/queue-summary.js +82 -0
  471. package/dist/queue-summary.js.map +1 -0
  472. package/dist/queue-view.d.ts +20 -0
  473. package/dist/queue-view.d.ts.map +1 -0
  474. package/dist/queue-view.js +163 -0
  475. package/dist/queue-view.js.map +1 -0
  476. package/dist/queue-write-lease.d.ts +106 -0
  477. package/dist/queue-write-lease.d.ts.map +1 -0
  478. package/dist/queue-write-lease.js +282 -0
  479. package/dist/queue-write-lease.js.map +1 -0
  480. package/dist/rails-home.d.ts +162 -0
  481. package/dist/rails-home.d.ts.map +1 -0
  482. package/dist/rails-home.js +452 -0
  483. package/dist/rails-home.js.map +1 -0
  484. package/dist/rails-migrations.d.ts +75 -0
  485. package/dist/rails-migrations.d.ts.map +1 -0
  486. package/dist/rails-migrations.js +199 -0
  487. package/dist/rails-migrations.js.map +1 -0
  488. package/dist/rails-stores.d.ts +49 -0
  489. package/dist/rails-stores.d.ts.map +1 -0
  490. package/dist/rails-stores.js +100 -0
  491. package/dist/rails-stores.js.map +1 -0
  492. package/dist/reaper.d.ts +69 -0
  493. package/dist/reaper.d.ts.map +1 -0
  494. package/dist/reaper.js +152 -0
  495. package/dist/reaper.js.map +1 -0
  496. package/dist/record-store.d.ts +36 -0
  497. package/dist/record-store.d.ts.map +1 -0
  498. package/dist/record-store.js +78 -0
  499. package/dist/record-store.js.map +1 -0
  500. package/dist/recovery-io.d.ts +50 -0
  501. package/dist/recovery-io.d.ts.map +1 -0
  502. package/dist/recovery-io.js +122 -0
  503. package/dist/recovery-io.js.map +1 -0
  504. package/dist/recovery.d.ts +146 -0
  505. package/dist/recovery.d.ts.map +1 -0
  506. package/dist/recovery.js +110 -0
  507. package/dist/recovery.js.map +1 -0
  508. package/dist/redraw.d.ts +34 -0
  509. package/dist/redraw.d.ts.map +1 -0
  510. package/dist/redraw.js +62 -0
  511. package/dist/redraw.js.map +1 -0
  512. package/dist/rejected-evidence.d.ts +255 -0
  513. package/dist/rejected-evidence.d.ts.map +1 -0
  514. package/dist/rejected-evidence.js +324 -0
  515. package/dist/rejected-evidence.js.map +1 -0
  516. package/dist/report-cmd.d.ts +32 -0
  517. package/dist/report-cmd.d.ts.map +1 -0
  518. package/dist/report-cmd.js +201 -0
  519. package/dist/report-cmd.js.map +1 -0
  520. package/dist/repos-cmd.d.ts +80 -0
  521. package/dist/repos-cmd.d.ts.map +1 -0
  522. package/dist/repos-cmd.js +240 -0
  523. package/dist/repos-cmd.js.map +1 -0
  524. package/dist/request-body-shape.d.ts +93 -0
  525. package/dist/request-body-shape.d.ts.map +1 -0
  526. package/dist/request-body-shape.js +407 -0
  527. package/dist/request-body-shape.js.map +1 -0
  528. package/dist/requirement-claims.d.ts +89 -0
  529. package/dist/requirement-claims.d.ts.map +1 -0
  530. package/dist/requirement-claims.js +92 -0
  531. package/dist/requirement-claims.js.map +1 -0
  532. package/dist/retention-apply-runtime.d.ts +105 -0
  533. package/dist/retention-apply-runtime.d.ts.map +1 -0
  534. package/dist/retention-apply-runtime.js +269 -0
  535. package/dist/retention-apply-runtime.js.map +1 -0
  536. package/dist/reverify.d.ts +41 -0
  537. package/dist/reverify.d.ts.map +1 -0
  538. package/dist/reverify.js +69 -0
  539. package/dist/reverify.js.map +1 -0
  540. package/dist/round-records.d.ts +65 -0
  541. package/dist/round-records.d.ts.map +1 -0
  542. package/dist/round-records.js +61 -0
  543. package/dist/round-records.js.map +1 -0
  544. package/dist/round-runner.d.ts +924 -0
  545. package/dist/round-runner.d.ts.map +1 -0
  546. package/dist/round-runner.js +1693 -0
  547. package/dist/round-runner.js.map +1 -0
  548. package/dist/run-approval.d.ts +180 -0
  549. package/dist/run-approval.d.ts.map +1 -0
  550. package/dist/run-approval.js +199 -0
  551. package/dist/run-approval.js.map +1 -0
  552. package/dist/run-cmd.d.ts +359 -0
  553. package/dist/run-cmd.d.ts.map +1 -0
  554. package/dist/run-cmd.js +4418 -0
  555. package/dist/run-cmd.js.map +1 -0
  556. package/dist/run-delivery.d.ts +71 -0
  557. package/dist/run-delivery.d.ts.map +1 -0
  558. package/dist/run-delivery.js +104 -0
  559. package/dist/run-delivery.js.map +1 -0
  560. package/dist/run-ended.d.ts +75 -0
  561. package/dist/run-ended.d.ts.map +1 -0
  562. package/dist/run-ended.js +27 -0
  563. package/dist/run-ended.js.map +1 -0
  564. package/dist/run-ending-locator.d.ts +125 -0
  565. package/dist/run-ending-locator.d.ts.map +1 -0
  566. package/dist/run-ending-locator.js +133 -0
  567. package/dist/run-ending-locator.js.map +1 -0
  568. package/dist/run-launcher.d.ts +459 -0
  569. package/dist/run-launcher.d.ts.map +1 -0
  570. package/dist/run-launcher.js +652 -0
  571. package/dist/run-launcher.js.map +1 -0
  572. package/dist/run-lease.d.ts +208 -0
  573. package/dist/run-lease.d.ts.map +1 -0
  574. package/dist/run-lease.js +301 -0
  575. package/dist/run-lease.js.map +1 -0
  576. package/dist/run-refusal-marks.d.ts +189 -0
  577. package/dist/run-refusal-marks.d.ts.map +1 -0
  578. package/dist/run-refusal-marks.js +249 -0
  579. package/dist/run-refusal-marks.js.map +1 -0
  580. package/dist/run-start-marks.d.ts +153 -0
  581. package/dist/run-start-marks.d.ts.map +1 -0
  582. package/dist/run-start-marks.js +269 -0
  583. package/dist/run-start-marks.js.map +1 -0
  584. package/dist/scan-cmd.d.ts +14 -0
  585. package/dist/scan-cmd.d.ts.map +1 -0
  586. package/dist/scan-cmd.js +270 -0
  587. package/dist/scan-cmd.js.map +1 -0
  588. package/dist/scan-events.d.ts +50 -0
  589. package/dist/scan-events.d.ts.map +1 -0
  590. package/dist/scan-events.js +91 -0
  591. package/dist/scan-events.js.map +1 -0
  592. package/dist/scan.d.ts +191 -0
  593. package/dist/scan.d.ts.map +1 -0
  594. package/dist/scan.js +417 -0
  595. package/dist/scan.js.map +1 -0
  596. package/dist/scope-rule.d.ts +148 -0
  597. package/dist/scope-rule.d.ts.map +1 -0
  598. package/dist/scope-rule.js +121 -0
  599. package/dist/scope-rule.js.map +1 -0
  600. package/dist/self-repo-id.d.ts +18 -0
  601. package/dist/self-repo-id.d.ts.map +1 -0
  602. package/dist/self-repo-id.js +70 -0
  603. package/dist/self-repo-id.js.map +1 -0
  604. package/dist/serve-cmd.d.ts +115 -0
  605. package/dist/serve-cmd.d.ts.map +1 -0
  606. package/dist/serve-cmd.js +505 -0
  607. package/dist/serve-cmd.js.map +1 -0
  608. package/dist/serve.d.ts +167 -0
  609. package/dist/serve.d.ts.map +1 -0
  610. package/dist/serve.js +336 -0
  611. package/dist/serve.js.map +1 -0
  612. package/dist/server-client.d.ts +766 -0
  613. package/dist/server-client.d.ts.map +1 -0
  614. package/dist/server-client.js +475 -0
  615. package/dist/server-client.js.map +1 -0
  616. package/dist/session-adapter-runtime.d.ts +195 -0
  617. package/dist/session-adapter-runtime.d.ts.map +1 -0
  618. package/dist/session-adapter-runtime.js +373 -0
  619. package/dist/session-adapter-runtime.js.map +1 -0
  620. package/dist/session-checkpoint-runtime.d.ts +62 -0
  621. package/dist/session-checkpoint-runtime.d.ts.map +1 -0
  622. package/dist/session-checkpoint-runtime.js +268 -0
  623. package/dist/session-checkpoint-runtime.js.map +1 -0
  624. package/dist/session-control-transport.d.ts +106 -0
  625. package/dist/session-control-transport.d.ts.map +1 -0
  626. package/dist/session-control-transport.js +232 -0
  627. package/dist/session-control-transport.js.map +1 -0
  628. package/dist/session-observation-store.d.ts +98 -0
  629. package/dist/session-observation-store.d.ts.map +1 -0
  630. package/dist/session-observation-store.js +155 -0
  631. package/dist/session-observation-store.js.map +1 -0
  632. package/dist/session-observe-runtime.d.ts +123 -0
  633. package/dist/session-observe-runtime.d.ts.map +1 -0
  634. package/dist/session-observe-runtime.js +317 -0
  635. package/dist/session-observe-runtime.js.map +1 -0
  636. package/dist/session-store.d.ts +98 -0
  637. package/dist/session-store.d.ts.map +1 -0
  638. package/dist/session-store.js +116 -0
  639. package/dist/session-store.js.map +1 -0
  640. package/dist/sessions-cmd.d.ts +202 -0
  641. package/dist/sessions-cmd.d.ts.map +1 -0
  642. package/dist/sessions-cmd.js +609 -0
  643. package/dist/sessions-cmd.js.map +1 -0
  644. package/dist/settings-overlay.d.ts +53 -0
  645. package/dist/settings-overlay.d.ts.map +1 -0
  646. package/dist/settings-overlay.js +175 -0
  647. package/dist/settings-overlay.js.map +1 -0
  648. package/dist/setup-prompt.d.ts +34 -0
  649. package/dist/setup-prompt.d.ts.map +1 -0
  650. package/dist/setup-prompt.js +92 -0
  651. package/dist/setup-prompt.js.map +1 -0
  652. package/dist/setup.d.ts +103 -0
  653. package/dist/setup.d.ts.map +1 -0
  654. package/dist/setup.js +283 -0
  655. package/dist/setup.js.map +1 -0
  656. package/dist/shared-grants.d.ts +164 -0
  657. package/dist/shared-grants.d.ts.map +1 -0
  658. package/dist/shared-grants.js +242 -0
  659. package/dist/shared-grants.js.map +1 -0
  660. package/dist/signals.d.ts +55 -0
  661. package/dist/signals.d.ts.map +1 -0
  662. package/dist/signals.js +85 -0
  663. package/dist/signals.js.map +1 -0
  664. package/dist/source-cmd.d.ts +201 -0
  665. package/dist/source-cmd.d.ts.map +1 -0
  666. package/dist/source-cmd.js +684 -0
  667. package/dist/source-cmd.js.map +1 -0
  668. package/dist/source-verdict.d.ts +99 -0
  669. package/dist/source-verdict.d.ts.map +1 -0
  670. package/dist/source-verdict.js +182 -0
  671. package/dist/source-verdict.js.map +1 -0
  672. package/dist/spend-ledger.d.ts +350 -0
  673. package/dist/spend-ledger.d.ts.map +1 -0
  674. package/dist/spend-ledger.js +546 -0
  675. package/dist/spend-ledger.js.map +1 -0
  676. package/dist/stale-run-sweep.d.ts +79 -0
  677. package/dist/stale-run-sweep.d.ts.map +1 -0
  678. package/dist/stale-run-sweep.js +116 -0
  679. package/dist/stale-run-sweep.js.map +1 -0
  680. package/dist/start-attempts.d.ts +385 -0
  681. package/dist/start-attempts.d.ts.map +1 -0
  682. package/dist/start-attempts.js +613 -0
  683. package/dist/start-attempts.js.map +1 -0
  684. package/dist/status-cmd.d.ts +28 -0
  685. package/dist/status-cmd.d.ts.map +1 -0
  686. package/dist/status-cmd.js +116 -0
  687. package/dist/status-cmd.js.map +1 -0
  688. package/dist/stop-follow-up.d.ts +107 -0
  689. package/dist/stop-follow-up.d.ts.map +1 -0
  690. package/dist/stop-follow-up.js +172 -0
  691. package/dist/stop-follow-up.js.map +1 -0
  692. package/dist/surface-lease.d.ts +118 -0
  693. package/dist/surface-lease.d.ts.map +1 -0
  694. package/dist/surface-lease.js +485 -0
  695. package/dist/surface-lease.js.map +1 -0
  696. package/dist/sync.d.ts +54 -0
  697. package/dist/sync.d.ts.map +1 -0
  698. package/dist/sync.js +93 -0
  699. package/dist/sync.js.map +1 -0
  700. package/dist/syncing-ledger.d.ts +45 -0
  701. package/dist/syncing-ledger.d.ts.map +1 -0
  702. package/dist/syncing-ledger.js +53 -0
  703. package/dist/syncing-ledger.js.map +1 -0
  704. package/dist/temp-fixtures.d.ts +68 -0
  705. package/dist/temp-fixtures.d.ts.map +1 -0
  706. package/dist/temp-fixtures.js +38 -0
  707. package/dist/temp-fixtures.js.map +1 -0
  708. package/dist/token-window.d.ts +84 -0
  709. package/dist/token-window.d.ts.map +1 -0
  710. package/dist/token-window.js +143 -0
  711. package/dist/token-window.js.map +1 -0
  712. package/dist/tool-bridge.d.ts +177 -0
  713. package/dist/tool-bridge.d.ts.map +1 -0
  714. package/dist/tool-bridge.js +329 -0
  715. package/dist/tool-bridge.js.map +1 -0
  716. package/dist/tool-call-record.d.ts +197 -0
  717. package/dist/tool-call-record.d.ts.map +1 -0
  718. package/dist/tool-call-record.js +276 -0
  719. package/dist/tool-call-record.js.map +1 -0
  720. package/dist/tool-protocol.d.ts +135 -0
  721. package/dist/tool-protocol.d.ts.map +1 -0
  722. package/dist/tool-protocol.js +104 -0
  723. package/dist/tool-protocol.js.map +1 -0
  724. package/dist/tool-worker.d.ts +3 -0
  725. package/dist/tool-worker.d.ts.map +1 -0
  726. package/dist/tool-worker.js +478 -0
  727. package/dist/tool-worker.js.map +1 -0
  728. package/dist/toolchain-mirror.d.ts +86 -0
  729. package/dist/toolchain-mirror.d.ts.map +1 -0
  730. package/dist/toolchain-mirror.js +307 -0
  731. package/dist/toolchain-mirror.js.map +1 -0
  732. package/dist/trusted-git.d.ts +243 -0
  733. package/dist/trusted-git.d.ts.map +1 -0
  734. package/dist/trusted-git.js +920 -0
  735. package/dist/trusted-git.js.map +1 -0
  736. package/dist/ui.d.ts +76 -0
  737. package/dist/ui.d.ts.map +1 -0
  738. package/dist/ui.js +118 -0
  739. package/dist/ui.js.map +1 -0
  740. package/dist/untrusted-exec.d.ts +275 -0
  741. package/dist/untrusted-exec.d.ts.map +1 -0
  742. package/dist/untrusted-exec.js +479 -0
  743. package/dist/untrusted-exec.js.map +1 -0
  744. package/dist/untrusted-gate.d.ts +73 -0
  745. package/dist/untrusted-gate.d.ts.map +1 -0
  746. package/dist/untrusted-gate.js +226 -0
  747. package/dist/untrusted-gate.js.map +1 -0
  748. package/dist/uploader.d.ts +153 -0
  749. package/dist/uploader.d.ts.map +1 -0
  750. package/dist/uploader.js +204 -0
  751. package/dist/uploader.js.map +1 -0
  752. package/dist/verifier.d.ts +66 -0
  753. package/dist/verifier.d.ts.map +1 -0
  754. package/dist/verifier.js +170 -0
  755. package/dist/verifier.js.map +1 -0
  756. package/dist/verify-apply.d.ts +26 -0
  757. package/dist/verify-apply.d.ts.map +1 -0
  758. package/dist/verify-apply.js +36 -0
  759. package/dist/verify-apply.js.map +1 -0
  760. package/dist/verify-cmd.d.ts +44 -0
  761. package/dist/verify-cmd.d.ts.map +1 -0
  762. package/dist/verify-cmd.js +125 -0
  763. package/dist/verify-cmd.js.map +1 -0
  764. package/dist/verify-pass.d.ts +73 -0
  765. package/dist/verify-pass.d.ts.map +1 -0
  766. package/dist/verify-pass.js +103 -0
  767. package/dist/verify-pass.js.map +1 -0
  768. package/dist/welcome.d.ts +43 -0
  769. package/dist/welcome.d.ts.map +1 -0
  770. package/dist/welcome.js +116 -0
  771. package/dist/welcome.js.map +1 -0
  772. package/dist/workspace-provisioner.d.ts +65 -0
  773. package/dist/workspace-provisioner.d.ts.map +1 -0
  774. package/dist/workspace-provisioner.js +66 -0
  775. package/dist/workspace-provisioner.js.map +1 -0
  776. package/dist/workspace-quarantine.d.ts +64 -0
  777. package/dist/workspace-quarantine.d.ts.map +1 -0
  778. package/dist/workspace-quarantine.js +156 -0
  779. package/dist/workspace-quarantine.js.map +1 -0
  780. package/dist/workspace-residue-sweep.d.ts +113 -0
  781. package/dist/workspace-residue-sweep.d.ts.map +1 -0
  782. package/dist/workspace-residue-sweep.js +158 -0
  783. package/dist/workspace-residue-sweep.js.map +1 -0
  784. package/dist/workspace.d.ts +639 -0
  785. package/dist/workspace.d.ts.map +1 -0
  786. package/dist/workspace.js +2026 -0
  787. package/dist/workspace.js.map +1 -0
  788. package/package.json +52 -4
  789. package/win/CredProbe.cs +64 -0
  790. package/win/FakeClaude.cs +56 -0
  791. package/win/HandleProbe.cs +116 -0
  792. package/win/TokenProbe.cs +53 -0
  793. package/win/appcontainer.ps1 +500 -0
@@ -0,0 +1,189 @@
1
+ import { type RunRefusalCode } from '@looply/core';
2
+ import type { LedgerFs } from './ledger-store';
3
+ /**
4
+ * Why a command's run refused, carried from the run process to the daemon.
5
+ *
6
+ * The run process knows exactly why it would not start — the goal's work is
7
+ * finished, or it is stalled, or the goal was abandoned, or the queue holds a
8
+ * plan for a version this Start has been overtaken by. It says so in the
9
+ * message of the `RunRefused` it throws, and `bin.ts` writes that message to
10
+ * stderr on its way out.
11
+ *
12
+ * Nobody was listening. The daemon spawns the run with `stdio: 'ignore'`
13
+ * (run-launcher.ts), because the child is detached and outlives the parent — so
14
+ * the words went nowhere at all, and the launcher reported the only thing it
15
+ * could see: `the run exited — exit 3`. That reached the server as a bare
16
+ * `outcome: 'refused'` with no reason, which made "your goal is done" and "your
17
+ * goal is wedged" the same answer on the phone. This file is the missing
18
+ * channel.
19
+ *
20
+ * WHY A FILE, and not the child's output: there is no output. Changing the
21
+ * spawn to pipe stderr would mean holding streams open on a deliberately
22
+ * detached process, and then treating whatever a run happens to print — agent
23
+ * transcripts, git errors, stack traces — as a client-readable string. A
24
+ * refusal is a decision, not a log line, so it is written down as one, and only
25
+ * an intentional `RunRefused` is ever written here.
26
+ *
27
+ * The shape is deliberately {@link RunStartMarks}': written by the RUN process,
28
+ * read by the DAEMON, keyed by the command that asked, capped, schema-tagged,
29
+ * and discarded rather than thrown over if it cannot be read. One writer and
30
+ * one reader per file, so neither can lose the other's updates.
31
+ */
32
+ export declare const RUN_REFUSAL_MARKS_SCHEMA = 1;
33
+ export interface RunRefusalMark {
34
+ /**
35
+ * The request whose run refused. The identity of the attempt, as with starts.
36
+ *
37
+ * NAMED `commandId` FOR THE DISK, not because it is a server command. It
38
+ * carries whatever execution identity asked for the run — a command id when a
39
+ * person tapped Start, `autonomyStartId(C, N)` when a controller spent an
40
+ * ordinal. Renaming the field would be silently destructive: `isMark` below
41
+ * drops rows one by one and `load` still succeeds on the untouched schema
42
+ * tag, so every existing refusal would vanish with no error and no log line.
43
+ */
44
+ commandId: string;
45
+ /** The `RunRefused` message, verbatim — this is what a person ends up reading. */
46
+ reason: string;
47
+ /** When the run refused, from the run's own clock. */
48
+ at: string;
49
+ /**
50
+ * WHY, as a machine reads it.
51
+ *
52
+ * The run knows exactly which refusal this is — it throws `RunRefused` with a
53
+ * `RunRefusalCode` at every site — and until 6D2A that knowledge died at the
54
+ * process boundary: `bin.ts` recorded the message and dropped the code, so the
55
+ * only thing that survived to the daemon was an English sentence.
56
+ *
57
+ * That was tolerable while the sole reader was a phone, which wants the
58
+ * sentence anyway. It is not tolerable for a controller, whose next move
59
+ * differs completely between "the goal is met" and "only a person can move
60
+ * this" — and which must never decide that by matching words.
61
+ *
62
+ * OPTIONAL, so every record written before this field existed is still a
63
+ * valid mark rather than a row silently dropped by the guard below. A refusal
64
+ * with no code is readable and reportable; it simply may not drive a terminal
65
+ * decision.
66
+ */
67
+ code?: RunRefusalCode;
68
+ /**
69
+ * The run's branch, when the run had one (M5-2).
70
+ *
71
+ * A terminal refusal is the run's LAST word, and for `goal_satisfied` the
72
+ * word that matters next is whose branch carries the work: the daemon, when
73
+ * it integrates for itself, will not close the grant until the lane has
74
+ * published that branch, and this is the only place the name crosses the
75
+ * process boundary.
76
+ *
77
+ * OPTIONAL, like `code`, so every mark written before it existed is still a
78
+ * mark. Absent means UNKNOWN — a branch that cannot be named cannot be shown
79
+ * published, so a grant whose caller asks for the third key is held and told
80
+ * why; a caller that does not ask never reads this field.
81
+ */
82
+ branch?: string;
83
+ /**
84
+ * WHAT KEY 2 SAW, for a `goal_satisfied` refusal only (L4b).
85
+ *
86
+ * The claim "this goal was met" crosses to the server as one state word, and
87
+ * the facts it rests on — which run delivered, at which commit, and how each
88
+ * required gate step came out — stayed on this machine. This is the same
89
+ * channel the branch rides (M5-2), so the daemon can hand them on when it
90
+ * settles the pursuit, instead of a fixed sentence.
91
+ *
92
+ * OPTIONAL, and a malformed one is DROPPED rather than the whole mark: the
93
+ * refusal is still true and its code still drives the controller; only the
94
+ * supporting facts are lost, and losing them must not cost the decision.
95
+ */
96
+ delivery?: RunDelivery;
97
+ }
98
+ /** One gate step's outcome as key 2 recorded it. `skipped` is not `passed`. */
99
+ export type DeliveredCheck = 'passed' | 'failed' | 'skipped';
100
+ /** The delivering run, the commit HEAD was on, and the required steps' outcomes. */
101
+ export interface RunDelivery {
102
+ runId: string;
103
+ sha: string;
104
+ checks: Record<string, DeliveredCheck>;
105
+ }
106
+ /** A delivery this build can read, or null. Exported so the server-bound copy is judged by the same rule. */
107
+ export declare function readDelivery(v: unknown): RunDelivery | null;
108
+ /**
109
+ * How many to keep. Smaller than the start marks' fifty because a refusal is
110
+ * read once, on the poll after the child exits, and never needed again.
111
+ */
112
+ export declare const MAX_REFUSALS = 50;
113
+ /**
114
+ * A ceiling on the stored reason.
115
+ *
116
+ * Not defensive theatre: `Command.reason` is client-readable and this file is
117
+ * meant to stay a few kilobytes for ever, so the one place the machine decides
118
+ * what a client will read is the right place to bound it. Every reason today is
119
+ * a template with bounded interpolations — state counts, a goal id, a version,
120
+ * an item id — so this should never fire; it exists so that a future refusal
121
+ * built from something larger cannot quietly turn a dedupe file into a log.
122
+ */
123
+ export declare const MAX_REASON = 500;
124
+ export declare class RunRefusalMarks {
125
+ private readonly stateDir;
126
+ private readonly fs;
127
+ /** A discarded file is worth saying once, not silently. */
128
+ private readonly log?;
129
+ /** Distinguishes two writes from ONE process; the pid distinguishes processes. */
130
+ private static writes;
131
+ private refusals;
132
+ constructor(stateDir: string, fs: LedgerFs,
133
+ /** A discarded file is worth saying once, not silently. */
134
+ log?: ((line: string) => void) | undefined);
135
+ private get path();
136
+ /**
137
+ * THE APPEND-ONLY LOG BESIDE THE CAPPED INDEX.
138
+ *
139
+ * 🔴 THE SAME LOST-UPDATE CLASS THE START MARKS HAD, for the same reason:
140
+ * this channel is now PROJECT-scoped, so every concurrent run in the project
141
+ * writes it, and the index is a whole-document rewrite. Two runs refusing in
142
+ * the same instant lose one of the two reasons — and a lost reason is a
143
+ * refusal reported in the plainer wording with no `code`, which strips a
144
+ * caller of the right to conclude anything about the goal.
145
+ *
146
+ * ⚠️ THE INDEX IS KEPT, NOT REPLACED: it bounds the file and an older build
147
+ * reads it. `load` merges both.
148
+ */
149
+ private get logPath();
150
+ /**
151
+ * Read what is on disk.
152
+ *
153
+ * Anything unreadable or wrongly shaped is DISCARDED rather than thrown over,
154
+ * exactly like the start marks and the goal mirror. Losing this file costs a
155
+ * reason, never a decision: the launcher still knows the child exited 3 and
156
+ * still reports the refusal terminally, just with the plainer wording it used
157
+ * before this file existed. It can never turn a refusal into a success.
158
+ */
159
+ load(): Promise<void>;
160
+ /**
161
+ * Fold the append-only log into what the index said.
162
+ *
163
+ * ⚠️ THE INDEX WINS ON CONFLICT. `record` REPLACES a command's earlier
164
+ * refusal, so the index holds the newest for every command it knows; the log
165
+ * only supplies commands the index lost entirely.
166
+ */
167
+ private mergeLog;
168
+ /**
169
+ * Why this command's run refused, if it did.
170
+ *
171
+ * By command id and nothing else. A refusal belongs to the request that
172
+ * produced it: the same rule that stops one command inheriting another's
173
+ * proof of starting stops it inheriting another's reason for not.
174
+ */
175
+ find(commandId: string): RunRefusalMark | null;
176
+ all(): RunRefusalMark[];
177
+ /**
178
+ * Write down why a command's run refused.
179
+ *
180
+ * The LAST refusal wins, where a start mark keeps the first. The asymmetry is
181
+ * real rather than an oversight: a run cannot start twice for one request, so
182
+ * the first start mark is the only true one — but a command redelivered after
183
+ * a daemon restart is genuinely launched again, and the second attempt may
184
+ * refuse for a different reason than the first. Reporting the older one would
185
+ * describe a machine that no longer exists.
186
+ */
187
+ record(mark: RunRefusalMark): Promise<void>;
188
+ }
189
+ //# sourceMappingURL=run-refusal-marks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-refusal-marks.d.ts","sourceRoot":"","sources":["../src/run-refusal-marks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;OASG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;AAED,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE7D,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACxC;AAID,6GAA6G;AAC7G,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAY3D;AAOD;;;GAGG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,qBAAa,eAAe;IAOxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,2DAA2D;IAC3D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;IATvB,kFAAkF;IAClF,OAAO,CAAC,MAAM,CAAC,MAAM,CAAK;IAE1B,OAAO,CAAC,QAAQ,CAAwB;gBAGrB,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,QAAQ;IAC7B,2DAA2D;IAC1C,GAAG,CAAC,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,aAAA;IAG/C,OAAO,KAAK,IAAI,GAEf;IAED;;;;;;;;;;;;OAYG;IACH,OAAO,KAAK,OAAO,GAElB;IAED;;;;;;;;OAQG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAwB3B;;;;;;OAMG;YACW,QAAQ;IAuBtB;;;;;;OAMG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAI9C,GAAG,IAAI,cAAc,EAAE;IAIvB;;;;;;;;;OASG;IACG,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAsBlD"}
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RunRefusalMarks = exports.MAX_REASON = exports.MAX_REFUSALS = exports.RUN_REFUSAL_MARKS_SCHEMA = void 0;
4
+ exports.readDelivery = readDelivery;
5
+ const core_1 = require("@looply/core");
6
+ /**
7
+ * Why a command's run refused, carried from the run process to the daemon.
8
+ *
9
+ * The run process knows exactly why it would not start — the goal's work is
10
+ * finished, or it is stalled, or the goal was abandoned, or the queue holds a
11
+ * plan for a version this Start has been overtaken by. It says so in the
12
+ * message of the `RunRefused` it throws, and `bin.ts` writes that message to
13
+ * stderr on its way out.
14
+ *
15
+ * Nobody was listening. The daemon spawns the run with `stdio: 'ignore'`
16
+ * (run-launcher.ts), because the child is detached and outlives the parent — so
17
+ * the words went nowhere at all, and the launcher reported the only thing it
18
+ * could see: `the run exited — exit 3`. That reached the server as a bare
19
+ * `outcome: 'refused'` with no reason, which made "your goal is done" and "your
20
+ * goal is wedged" the same answer on the phone. This file is the missing
21
+ * channel.
22
+ *
23
+ * WHY A FILE, and not the child's output: there is no output. Changing the
24
+ * spawn to pipe stderr would mean holding streams open on a deliberately
25
+ * detached process, and then treating whatever a run happens to print — agent
26
+ * transcripts, git errors, stack traces — as a client-readable string. A
27
+ * refusal is a decision, not a log line, so it is written down as one, and only
28
+ * an intentional `RunRefused` is ever written here.
29
+ *
30
+ * The shape is deliberately {@link RunStartMarks}': written by the RUN process,
31
+ * read by the DAEMON, keyed by the command that asked, capped, schema-tagged,
32
+ * and discarded rather than thrown over if it cannot be read. One writer and
33
+ * one reader per file, so neither can lose the other's updates.
34
+ */
35
+ exports.RUN_REFUSAL_MARKS_SCHEMA = 1;
36
+ const DELIVERED_CHECKS = ['passed', 'failed', 'skipped'];
37
+ /** A delivery this build can read, or null. Exported so the server-bound copy is judged by the same rule. */
38
+ function readDelivery(v) {
39
+ if (typeof v !== 'object' || v === null)
40
+ return null;
41
+ const d = v;
42
+ if (typeof d['runId'] !== 'string' || typeof d['sha'] !== 'string')
43
+ return null;
44
+ const c = d['checks'];
45
+ if (typeof c !== 'object' || c === null || Array.isArray(c))
46
+ return null;
47
+ const checks = {};
48
+ for (const [step, outcome] of Object.entries(c)) {
49
+ if (typeof outcome !== 'string' || !DELIVERED_CHECKS.includes(outcome))
50
+ return null;
51
+ checks[step] = outcome;
52
+ }
53
+ return { runId: d['runId'], sha: d['sha'], checks };
54
+ }
55
+ /**
56
+ * How many to keep. Smaller than the start marks' fifty because a refusal is
57
+ * read once, on the poll after the child exits, and never needed again.
58
+ */
59
+ exports.MAX_REFUSALS = 50;
60
+ /**
61
+ * A ceiling on the stored reason.
62
+ *
63
+ * Not defensive theatre: `Command.reason` is client-readable and this file is
64
+ * meant to stay a few kilobytes for ever, so the one place the machine decides
65
+ * what a client will read is the right place to bound it. Every reason today is
66
+ * a template with bounded interpolations — state counts, a goal id, a version,
67
+ * an item id — so this should never fire; it exists so that a future refusal
68
+ * built from something larger cannot quietly turn a dedupe file into a log.
69
+ */
70
+ exports.MAX_REASON = 500;
71
+ class RunRefusalMarks {
72
+ stateDir;
73
+ fs;
74
+ log;
75
+ /** Distinguishes two writes from ONE process; the pid distinguishes processes. */
76
+ static writes = 0;
77
+ refusals = [];
78
+ constructor(stateDir, fs,
79
+ /** A discarded file is worth saying once, not silently. */
80
+ log) {
81
+ this.stateDir = stateDir;
82
+ this.fs = fs;
83
+ this.log = log;
84
+ }
85
+ get path() {
86
+ return `${this.stateDir}/run-refusals.json`;
87
+ }
88
+ /**
89
+ * THE APPEND-ONLY LOG BESIDE THE CAPPED INDEX.
90
+ *
91
+ * 🔴 THE SAME LOST-UPDATE CLASS THE START MARKS HAD, for the same reason:
92
+ * this channel is now PROJECT-scoped, so every concurrent run in the project
93
+ * writes it, and the index is a whole-document rewrite. Two runs refusing in
94
+ * the same instant lose one of the two reasons — and a lost reason is a
95
+ * refusal reported in the plainer wording with no `code`, which strips a
96
+ * caller of the right to conclude anything about the goal.
97
+ *
98
+ * ⚠️ THE INDEX IS KEPT, NOT REPLACED: it bounds the file and an older build
99
+ * reads it. `load` merges both.
100
+ */
101
+ get logPath() {
102
+ return `${this.stateDir}/run-refusals.jsonl`;
103
+ }
104
+ /**
105
+ * Read what is on disk.
106
+ *
107
+ * Anything unreadable or wrongly shaped is DISCARDED rather than thrown over,
108
+ * exactly like the start marks and the goal mirror. Losing this file costs a
109
+ * reason, never a decision: the launcher still knows the child exited 3 and
110
+ * still reports the refusal terminally, just with the plainer wording it used
111
+ * before this file existed. It can never turn a refusal into a success.
112
+ */
113
+ async load() {
114
+ const text = await this.fs.readFile(this.path);
115
+ if (text === null) {
116
+ this.refusals = [];
117
+ return;
118
+ }
119
+ try {
120
+ const parsed = JSON.parse(text);
121
+ if (typeof parsed !== 'object' ||
122
+ parsed === null ||
123
+ parsed.schema !== exports.RUN_REFUSAL_MARKS_SCHEMA ||
124
+ !Array.isArray(parsed.refusals)) {
125
+ throw new Error('not a refusal file');
126
+ }
127
+ this.refusals = parsed.refusals.filter(isMark).map(sanitise);
128
+ }
129
+ catch (e) {
130
+ this.log?.(`run-refusals: discarding an unreadable file (${e.message})`);
131
+ this.refusals = [];
132
+ }
133
+ await this.mergeLog();
134
+ }
135
+ /**
136
+ * Fold the append-only log into what the index said.
137
+ *
138
+ * ⚠️ THE INDEX WINS ON CONFLICT. `record` REPLACES a command's earlier
139
+ * refusal, so the index holds the newest for every command it knows; the log
140
+ * only supplies commands the index lost entirely.
141
+ */
142
+ async mergeLog() {
143
+ let text;
144
+ try {
145
+ text = await this.fs.readFile(this.logPath);
146
+ }
147
+ catch {
148
+ return;
149
+ }
150
+ if (text === null)
151
+ return;
152
+ const known = new Set(this.refusals.map((m) => m.commandId));
153
+ for (const line of text.split('\n')) {
154
+ const trimmed = line.trim();
155
+ if (trimmed === '')
156
+ continue;
157
+ try {
158
+ const parsed = JSON.parse(trimmed);
159
+ if (!isMark(parsed) || known.has(parsed.commandId))
160
+ continue;
161
+ known.add(parsed.commandId);
162
+ this.refusals.push(sanitise(parsed));
163
+ }
164
+ catch {
165
+ // A fragment from a torn write. Skipped by itself.
166
+ }
167
+ }
168
+ }
169
+ /**
170
+ * Why this command's run refused, if it did.
171
+ *
172
+ * By command id and nothing else. A refusal belongs to the request that
173
+ * produced it: the same rule that stops one command inheriting another's
174
+ * proof of starting stops it inheriting another's reason for not.
175
+ */
176
+ find(commandId) {
177
+ return this.refusals.find((m) => m.commandId === commandId) ?? null;
178
+ }
179
+ all() {
180
+ return [...this.refusals];
181
+ }
182
+ /**
183
+ * Write down why a command's run refused.
184
+ *
185
+ * The LAST refusal wins, where a start mark keeps the first. The asymmetry is
186
+ * real rather than an oversight: a run cannot start twice for one request, so
187
+ * the first start mark is the only true one — but a command redelivered after
188
+ * a daemon restart is genuinely launched again, and the second attempt may
189
+ * refuse for a different reason than the first. Reporting the older one would
190
+ * describe a machine that no longer exists.
191
+ */
192
+ async record(mark) {
193
+ const trimmed = { ...mark, reason: mark.reason.slice(0, exports.MAX_REASON) };
194
+ // Newest first, so the cap drops the oldest.
195
+ const next = [trimmed, ...this.refusals.filter((m) => m.commandId !== mark.commandId)].slice(0, exports.MAX_REFUSALS);
196
+ const body = { schema: exports.RUN_REFUSAL_MARKS_SCHEMA, refusals: next };
197
+ await this.fs.mkdir(this.stateDir);
198
+ // The durable write first, and it is the append. See `logPath`.
199
+ await this.fs.appendFile(this.logPath, `\n${JSON.stringify(trimmed)}\n`);
200
+ // Temp-then-rename, the same contract as every other store here: the daemon
201
+ // reads this file from another process and must never catch half of it.
202
+ // The temp name is PRIVATE TO THIS WRITER. A shared `run-refusals.json.tmp` is
203
+ // two processes writing one path: the second truncates and rewrites what
204
+ // the first is midway through, and then both rename it into place. The
205
+ // rename is atomic and the file it renames is a splice of two writes, and
206
+ // nothing downstream can tell.
207
+ const tmp = `${this.path}.${process.pid}.${(RunRefusalMarks.writes += 1)}.tmp`;
208
+ await this.fs.writeFile(tmp, JSON.stringify(body, null, 2) + '\n');
209
+ await this.fs.rename(tmp, this.path);
210
+ // Committed to memory only after the durable write, so a failed write
211
+ // cannot leave this object claiming a mark the file does not have.
212
+ this.refusals = next;
213
+ }
214
+ }
215
+ exports.RunRefusalMarks = RunRefusalMarks;
216
+ function isMark(v) {
217
+ if (typeof v !== 'object' || v === null)
218
+ return false;
219
+ const m = v;
220
+ if (typeof m['commandId'] !== 'string' || typeof m['reason'] !== 'string')
221
+ return false;
222
+ if (typeof m['at'] !== 'string')
223
+ return false;
224
+ // Absent is fine — that is every record written before 6D2A, and a mark with
225
+ // no code is still a true refusal. PRESENT AND UNRECOGNISED is not: a word
226
+ // this build does not know would be handed to a decision table that has no
227
+ // entry for it, so the row is rejected and the refusal degrades to reason-only
228
+ // rather than to a guess.
229
+ if (m['code'] !== undefined && !(0, core_1.isRunRefusalCode)(m['code']))
230
+ return false;
231
+ // The same rule for the branch (M5-2): absent is every older mark; present
232
+ // and not a string is a row this build cannot read, not a branch to guess at.
233
+ if (m['branch'] !== undefined && typeof m['branch'] !== 'string')
234
+ return false;
235
+ // A delivery this build cannot read is stripped in `sanitise`, never fatal
236
+ // to the mark — see `RunRefusalMark.delivery`.
237
+ return true;
238
+ }
239
+ /** Drop an unreadable delivery, keep the refusal. */
240
+ function sanitise(m) {
241
+ if (m.delivery === undefined)
242
+ return m;
243
+ const d = readDelivery(m.delivery);
244
+ if (d !== null)
245
+ return { ...m, delivery: d };
246
+ const { delivery: _dropped, ...rest } = m;
247
+ return rest;
248
+ }
249
+ //# sourceMappingURL=run-refusal-marks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-refusal-marks.js","sourceRoot":"","sources":["../src/run-refusal-marks.ts"],"names":[],"mappings":";;;AAkHA,oCAYC;AA9HD,uCAAqE;AAGrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEU,QAAA,wBAAwB,GAAG,CAAC,CAAC;AA8E1C,MAAM,gBAAgB,GAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAE5E,6GAA6G;AAC7G,SAAgB,YAAY,CAAC,CAAU;IACrC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACrD,MAAM,CAAC,GAAG,CAA4B,CAAC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run.
4
+ *
5
+ * The daemon used to treat "the child it spawned was still alive 750ms later"
6
+ * as evidence that a run had started, and acked the command terminally on it.
7
+ * It is not evidence. A goal-bound run resolves its goal, takes the lease,
8
+ * adopts items and verifies drafts before a Run exists — verification alone
9
+ * calls an agent and can take minutes, and can still end in "nothing to do".
10
+ * Every one of those paths exits without a Run, long after the window closed,
11
+ * leaving a command acked done that nothing will ever carry out.
12
+ *
13
+ * So the run process says so itself, at the only moment that means anything:
14
+ * when `run.started` is durably appended to the ledger. That event IS the
15
+ * accepted start boundary — the server creates its Run row from it, and it is
16
+ * emitted after the dirty-tree check and after the branch exists.
17
+ *
18
+ * WHY A SEPARATE FILE, and not the ledger the mark is derived from: the daemon
19
+ * needs to answer "did command C produce a run" cheaply, on every poll, for a
20
+ * command whose run may have finished hours ago. The ledger answers it only by
21
+ * scanning, and grows without bound. This is a small, capped index over one
22
+ * question. It is also written by the RUN process, where `commands.json` is
23
+ * written by the daemon — one writer each, so neither can lose the other's
24
+ * updates.
25
+ */
26
+ export declare const RUN_START_MARKS_SCHEMA = 1;
27
+ export interface RunStartMark {
28
+ /** The start-run command that asked for this run. The identity of the request. */
29
+ commandId: string;
30
+ runId: string;
31
+ /** When `run.started` was appended, from the run's own clock. */
32
+ at: string;
33
+ /**
34
+ * WHERE THE RUN IS EXECUTING — the checkout whose `.looply/state` holds its
35
+ * ledger. Absent on marks written by builds before this field existed and
36
+ * read as "the project's own checkout", which is the only place those
37
+ * builds could have been running.
38
+ *
39
+ * 🔴 THE DURABLE LINK FROM A REQUEST TO ITS LEDGER. The registry record
40
+ * carries the workspace too, but a run gives that record back on its way out
41
+ * — AFTER writing `run.ended` — so for a run that ended normally the record
42
+ * is gone by the time the daemon asks where the ending is. The mark is
43
+ * written once, at registration, and is never released; it is the one
44
+ * project-scoped fact that survives the run and names its checkout.
45
+ */
46
+ workspace?: string;
47
+ }
48
+ /**
49
+ * How many to keep.
50
+ *
51
+ * Enough that a daemon which was down for a long time still finds the mark for
52
+ * anything the redelivery window could still be offering, and small enough that
53
+ * the file stays a few kilobytes for ever.
54
+ */
55
+ export declare const MAX_MARKS = 50;
56
+ export declare class RunStartMarks {
57
+ private readonly stateDir;
58
+ private readonly fs;
59
+ /** A discarded file is worth saying once, not silently. */
60
+ private readonly log?;
61
+ /** Distinguishes two writes from ONE process; the pid distinguishes processes. */
62
+ private static writes;
63
+ private marks;
64
+ /** Whether `load` has run. Recording before it would truncate the file. */
65
+ private loaded;
66
+ constructor(stateDir: string, fs: LedgerFs,
67
+ /** A discarded file is worth saying once, not silently. */
68
+ log?: ((line: string) => void) | undefined);
69
+ private get path();
70
+ /**
71
+ * THE APPEND-ONLY LOG BESIDE THE CAPPED INDEX.
72
+ *
73
+ * 🔴 THE INDEX IS A WHOLE-DOCUMENT REWRITE, AND THIS FILE IS NOW SHARED BY
74
+ * EVERY CONCURRENT RUN IN THE PROJECT.
75
+ *
76
+ * The comment in `bin.ts` predicted precisely this: "A later phase that
77
+ * launches into workspaces must move this channel to project scope AND make
78
+ * it append-only first: it is a whole-document rewrite, so sharing it between
79
+ * concurrent runs without that is the lost-update class." This is that phase.
80
+ *
81
+ * Two runs that cross their start boundary in the same instant both read the
82
+ * index, both add themselves, and both rename their own copy into place. One
83
+ * mark survives. The daemon then reads no mark for the other request,
84
+ * concludes its Start "never began", and after three attempts escalates a
85
+ * perfectly healthy goal to `human_required` — the same visible failure the
86
+ * scope bug produced, arrived at by a race instead of a path.
87
+ *
88
+ * ⚠️ THE INDEX IS KEPT, NOT REPLACED. It is what bounds the file at
89
+ * `MAX_MARKS` and what an older build reads. The log is the durable truth and
90
+ * `load` merges both, so a mark the index lost is still found.
91
+ *
92
+ * ⚠️ LED BY A NEWLINE, for the reason `coordinator.recordActions` wrote down:
93
+ * a torn write must cost one record rather than two.
94
+ */
95
+ private get logPath();
96
+ /**
97
+ * Read what is on disk.
98
+ *
99
+ * Anything unreadable or wrongly shaped is DISCARDED rather than thrown over,
100
+ * exactly like the goal mirror. The cost of being wrong here is bounded and
101
+ * safe: without a mark the daemon cannot prove a run started, so it keeps the
102
+ * command queued rather than acking it — and the lease still stops a second
103
+ * runner. Losing this file delays an ack; it can never duplicate a run.
104
+ */
105
+ load(): Promise<void>;
106
+ /**
107
+ * Fold the append-only log into what the index said.
108
+ *
109
+ * ⚠️ THE LOG WINS ON PRESENCE, NOT ON ORDER. A mark is a fact that a request
110
+ * produced a run; there is no version of it to be newer or older. So a
111
+ * commandId already known keeps the entry it has, and one the index lost is
112
+ * added — which is the whole repair.
113
+ *
114
+ * ⚠️ A FRAGMENT FROM A TORN WRITE IS SKIPPED ALONE, which is what the leading
115
+ * newline buys, and an unreadable log leaves the index exactly as it was.
116
+ */
117
+ private mergeLog;
118
+ /** The run this command produced, if it produced one. */
119
+ find(commandId: string): RunStartMark | null;
120
+ /**
121
+ * The mark that names this run, if one does — the daemon's way from a runId
122
+ * back to the checkout that run is (or was) executing in.
123
+ */
124
+ findByRun(runId: string): RunStartMark | null;
125
+ all(): RunStartMark[];
126
+ /**
127
+ * Record that a command's run crossed the boundary.
128
+ *
129
+ * Re-recording the same command is a no-op rather than a second entry: the
130
+ * first mark is the one that is true, and a run cannot start twice for one
131
+ * request.
132
+ */
133
+ record(mark: RunStartMark): Promise<void>;
134
+ }
135
+ /** The one method the runner needs of its ledger. */
136
+ export interface AppendsEvents {
137
+ append(input: AnyEventInput): Promise<unknown>;
138
+ }
139
+ /**
140
+ * A ledger that records the start mark when the run crosses the boundary.
141
+ *
142
+ * A decorator rather than a hook on RoundRunner, so the runner gains nothing at
143
+ * all: it appends `run.started` because that is what starting a run means, and
144
+ * this notices. The runner has no idea a command exists, which is the same
145
+ * reason it has no idea a goal does.
146
+ *
147
+ * The mark is written AFTER the event is durably appended. The other order
148
+ * would claim a run that the ledger might then fail to record.
149
+ */
150
+ export declare function markingStartsOn(inner: AppendsEvents, marks: RunStartMarks, commandId: string, onError?: (e: Error) => void,
151
+ /** The checkout the run executes in, so a late mark still names its ledger. */
152
+ workspace?: string): AppendsEvents;
153
+ //# sourceMappingURL=run-start-marks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-start-marks.d.ts","sourceRoot":"","sources":["../src/run-start-marks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,qBAAa,aAAa;IAStB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,2DAA2D;IAC3D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;IAXvB,kFAAkF;IAClF,OAAO,CAAC,MAAM,CAAC,MAAM,CAAK;IAE1B,OAAO,CAAC,KAAK,CAAsB;IACnC,2EAA2E;IAC3E,OAAO,CAAC,MAAM,CAAS;gBAGJ,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,QAAQ;IAC7B,2DAA2D;IAC1C,GAAG,CAAC,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,aAAA;IAG/C,OAAO,KAAK,IAAI,GAEf;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAO,KAAK,OAAO,GAElB;IAED;;;;;;;;OAQG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB3B;;;;;;;;;;OAUG;YACW,QAAQ;IAuBtB,yDAAyD;IACzD,IAAI,CAAC,SAAS,EAAE,MAAM,GA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