clinkx 1.2.0 → 1.4.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 (371) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +17 -8
  3. package/clinkx-workflows/dist/architecture-arena/admission.d.ts +16 -0
  4. package/clinkx-workflows/dist/architecture-arena/admission.js +107 -0
  5. package/clinkx-workflows/dist/architecture-arena/admission.js.map +1 -0
  6. package/clinkx-workflows/dist/architecture-arena/contract.d.ts +1368 -0
  7. package/clinkx-workflows/dist/architecture-arena/contract.js +254 -0
  8. package/clinkx-workflows/dist/architecture-arena/contract.js.map +1 -0
  9. package/clinkx-workflows/dist/architecture-arena/runtime.d.ts +53 -0
  10. package/clinkx-workflows/dist/architecture-arena/runtime.js +511 -0
  11. package/clinkx-workflows/dist/architecture-arena/runtime.js.map +1 -0
  12. package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +17 -1
  13. package/clinkx-workflows/dist/architecture-comparison/admission.js +27 -4
  14. package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -1
  15. package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +59 -62
  16. package/clinkx-workflows/dist/architecture-comparison/contract.js +4 -21
  17. package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -1
  18. package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +4 -3
  19. package/clinkx-workflows/dist/architecture-comparison/runtime.js +22 -67
  20. package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -1
  21. package/clinkx-workflows/dist/artifacts.d.ts +19 -4
  22. package/clinkx-workflows/dist/artifacts.js +16 -7
  23. package/clinkx-workflows/dist/artifacts.js.map +1 -1
  24. package/clinkx-workflows/dist/backend.d.ts +30 -0
  25. package/clinkx-workflows/dist/child-env.d.ts +3 -0
  26. package/clinkx-workflows/dist/child-env.js +11 -0
  27. package/clinkx-workflows/dist/child-env.js.map +1 -1
  28. package/clinkx-workflows/dist/clink-client.d.ts +8 -2
  29. package/clinkx-workflows/dist/clink-client.js +4 -2
  30. package/clinkx-workflows/dist/clink-client.js.map +1 -1
  31. package/clinkx-workflows/dist/context-preflight.d.ts +6 -0
  32. package/clinkx-workflows/dist/context-preflight.js.map +1 -1
  33. package/clinkx-workflows/dist/council-execution-policy.d.ts +3 -1
  34. package/clinkx-workflows/dist/council-execution-policy.js +4 -0
  35. package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
  36. package/clinkx-workflows/dist/dashboard/api-routes.d.ts +21 -0
  37. package/clinkx-workflows/dist/dashboard/api-routes.js +27 -0
  38. package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -1
  39. package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +13 -0
  40. package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -1
  41. package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +27 -0
  42. package/clinkx-workflows/dist/dashboard/auth/controller.js +262 -23
  43. package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -1
  44. package/clinkx-workflows/dist/dashboard/auth/settings-step-up.d.ts +62 -0
  45. package/clinkx-workflows/dist/dashboard/auth/settings-step-up.js +70 -0
  46. package/clinkx-workflows/dist/dashboard/auth/settings-step-up.js.map +1 -0
  47. package/clinkx-workflows/dist/dashboard/contracts.d.ts +586 -586
  48. package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +28 -28
  49. package/clinkx-workflows/dist/dashboard/request-admission.d.ts +6 -0
  50. package/clinkx-workflows/dist/dashboard/request-admission.js +9 -0
  51. package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -1
  52. package/clinkx-workflows/dist/dashboard/server-factory.js +15 -1
  53. package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -1
  54. package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +32 -32
  55. package/clinkx-workflows/dist/dashboard/settings-contract.d.ts +1806 -0
  56. package/clinkx-workflows/dist/dashboard/settings-contract.js +630 -0
  57. package/clinkx-workflows/dist/dashboard/settings-contract.js.map +1 -0
  58. package/clinkx-workflows/dist/dashboard/settings-process-reader.d.ts +48 -0
  59. package/clinkx-workflows/dist/dashboard/settings-process-reader.js +195 -0
  60. package/clinkx-workflows/dist/dashboard/settings-process-reader.js.map +1 -0
  61. package/clinkx-workflows/dist/dashboard/settings-routes.d.ts +87 -0
  62. package/clinkx-workflows/dist/dashboard/settings-routes.js +690 -0
  63. package/clinkx-workflows/dist/dashboard/settings-routes.js.map +1 -0
  64. package/clinkx-workflows/dist/dashboard-ui/assets/index-DSOtuS0p.js +122 -0
  65. package/clinkx-workflows/dist/dashboard-ui/assets/style-C5guUjwN.css +1 -0
  66. package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
  67. package/clinkx-workflows/dist/delegate-signature.d.ts +4 -3
  68. package/clinkx-workflows/dist/delegate-signature.js +4 -3
  69. package/clinkx-workflows/dist/delegate-signature.js.map +1 -1
  70. package/clinkx-workflows/dist/durable-file-core.d.ts +76 -0
  71. package/clinkx-workflows/dist/durable-file-core.js +146 -0
  72. package/clinkx-workflows/dist/durable-file-core.js.map +1 -0
  73. package/clinkx-workflows/dist/durable-file.d.ts +13 -0
  74. package/clinkx-workflows/dist/durable-file.js +22 -0
  75. package/clinkx-workflows/dist/durable-file.js.map +1 -0
  76. package/clinkx-workflows/dist/engine.d.ts +42 -7
  77. package/clinkx-workflows/dist/engine.js +196 -24
  78. package/clinkx-workflows/dist/engine.js.map +1 -1
  79. package/clinkx-workflows/dist/index.js +68 -2
  80. package/clinkx-workflows/dist/index.js.map +1 -1
  81. package/clinkx-workflows/dist/ping-pong/admission.d.ts +127 -0
  82. package/clinkx-workflows/dist/ping-pong/admission.js +522 -0
  83. package/clinkx-workflows/dist/ping-pong/admission.js.map +1 -0
  84. package/clinkx-workflows/dist/ping-pong/contract.d.ts +2539 -0
  85. package/clinkx-workflows/dist/ping-pong/contract.js +819 -0
  86. package/clinkx-workflows/dist/ping-pong/contract.js.map +1 -0
  87. package/clinkx-workflows/dist/ping-pong/control.d.ts +67 -0
  88. package/clinkx-workflows/dist/ping-pong/control.js +12 -0
  89. package/clinkx-workflows/dist/ping-pong/control.js.map +1 -0
  90. package/clinkx-workflows/dist/ping-pong/runtime-handle.d.ts +24 -0
  91. package/clinkx-workflows/dist/ping-pong/runtime-handle.js +55 -0
  92. package/clinkx-workflows/dist/ping-pong/runtime-handle.js.map +1 -0
  93. package/clinkx-workflows/dist/ping-pong/runtime.d.ts +235 -0
  94. package/clinkx-workflows/dist/ping-pong/runtime.js +1183 -0
  95. package/clinkx-workflows/dist/ping-pong/runtime.js.map +1 -0
  96. package/clinkx-workflows/dist/ping-pong/settle.d.ts +57 -0
  97. package/clinkx-workflows/dist/ping-pong/settle.js +58 -0
  98. package/clinkx-workflows/dist/ping-pong/settle.js.map +1 -0
  99. package/clinkx-workflows/dist/ping-pong/sidecar.d.ts +65 -0
  100. package/clinkx-workflows/dist/ping-pong/sidecar.js +138 -0
  101. package/clinkx-workflows/dist/ping-pong/sidecar.js.map +1 -0
  102. package/clinkx-workflows/dist/plan-review/publication.d.ts +2 -1
  103. package/clinkx-workflows/dist/plan-review/publication.js +5 -6
  104. package/clinkx-workflows/dist/plan-review/publication.js.map +1 -1
  105. package/clinkx-workflows/dist/plan-review/snapshot.d.ts +3 -2
  106. package/clinkx-workflows/dist/plan-review/snapshot.js +8 -8
  107. package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -1
  108. package/clinkx-workflows/dist/recipe-host.d.ts +315 -0
  109. package/clinkx-workflows/dist/recipe-host.js +183 -0
  110. package/clinkx-workflows/dist/recipe-host.js.map +1 -0
  111. package/clinkx-workflows/dist/recipe-seats.d.ts +96 -0
  112. package/clinkx-workflows/dist/recipe-seats.js +163 -0
  113. package/clinkx-workflows/dist/recipe-seats.js.map +1 -0
  114. package/clinkx-workflows/dist/recipe-shared/evidence.d.ts +67 -0
  115. package/clinkx-workflows/dist/recipe-shared/evidence.js +111 -0
  116. package/clinkx-workflows/dist/recipe-shared/evidence.js.map +1 -0
  117. package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
  118. package/clinkx-workflows/dist/reducers/index.js +30 -0
  119. package/clinkx-workflows/dist/reducers/index.js.map +1 -1
  120. package/clinkx-workflows/dist/run-lock-reclaim.d.ts +44 -0
  121. package/clinkx-workflows/dist/run-lock-reclaim.js +86 -0
  122. package/clinkx-workflows/dist/run-lock-reclaim.js.map +1 -0
  123. package/clinkx-workflows/dist/settings/audit.d.ts +101 -0
  124. package/clinkx-workflows/dist/settings/audit.js +318 -0
  125. package/clinkx-workflows/dist/settings/audit.js.map +1 -0
  126. package/clinkx-workflows/dist/settings/bootstrap.d.ts +35 -0
  127. package/clinkx-workflows/dist/settings/bootstrap.js +52 -0
  128. package/clinkx-workflows/dist/settings/bootstrap.js.map +1 -0
  129. package/clinkx-workflows/dist/settings/codec.d.ts +51 -0
  130. package/clinkx-workflows/dist/settings/codec.js +410 -0
  131. package/clinkx-workflows/dist/settings/codec.js.map +1 -0
  132. package/clinkx-workflows/dist/settings/durable-write.d.ts +48 -0
  133. package/clinkx-workflows/dist/settings/durable-write.js +31 -0
  134. package/clinkx-workflows/dist/settings/durable-write.js.map +1 -0
  135. package/clinkx-workflows/dist/settings/index.d.ts +20 -0
  136. package/clinkx-workflows/dist/settings/index.js +23 -0
  137. package/clinkx-workflows/dist/settings/index.js.map +1 -0
  138. package/clinkx-workflows/dist/settings/loader.d.ts +80 -0
  139. package/clinkx-workflows/dist/settings/loader.js +577 -0
  140. package/clinkx-workflows/dist/settings/loader.js.map +1 -0
  141. package/clinkx-workflows/dist/settings/lock.d.ts +108 -0
  142. package/clinkx-workflows/dist/settings/lock.js +344 -0
  143. package/clinkx-workflows/dist/settings/lock.js.map +1 -0
  144. package/clinkx-workflows/dist/settings/paths.d.ts +65 -0
  145. package/clinkx-workflows/dist/settings/paths.js +173 -0
  146. package/clinkx-workflows/dist/settings/paths.js.map +1 -0
  147. package/clinkx-workflows/dist/settings/process-heartbeat.d.ts +47 -0
  148. package/clinkx-workflows/dist/settings/process-heartbeat.js +305 -0
  149. package/clinkx-workflows/dist/settings/process-heartbeat.js.map +1 -0
  150. package/clinkx-workflows/dist/settings/registry.d.ts +178 -0
  151. package/clinkx-workflows/dist/settings/registry.js +1285 -0
  152. package/clinkx-workflows/dist/settings/registry.js.map +1 -0
  153. package/clinkx-workflows/dist/settings/schema.d.ts +404 -0
  154. package/clinkx-workflows/dist/settings/schema.js +415 -0
  155. package/clinkx-workflows/dist/settings/schema.js.map +1 -0
  156. package/clinkx-workflows/dist/settings/store.d.ts +157 -0
  157. package/clinkx-workflows/dist/settings/store.js +842 -0
  158. package/clinkx-workflows/dist/settings/store.js.map +1 -0
  159. package/clinkx-workflows/dist/state-schema.d.ts +11 -0
  160. package/clinkx-workflows/dist/state-schema.js +4 -1
  161. package/clinkx-workflows/dist/state-schema.js.map +1 -1
  162. package/clinkx-workflows/dist/state.d.ts +178 -3
  163. package/clinkx-workflows/dist/state.js +618 -83
  164. package/clinkx-workflows/dist/state.js.map +1 -1
  165. package/clinkx-workflows/dist/stdio-entry.d.ts +2 -0
  166. package/clinkx-workflows/dist/stdio-entry.js +52 -0
  167. package/clinkx-workflows/dist/stdio-entry.js.map +1 -0
  168. package/clinkx-workflows/dist/transport.d.ts +2 -1
  169. package/clinkx-workflows/dist/transport.js +5 -0
  170. package/clinkx-workflows/dist/transport.js.map +1 -1
  171. package/clinkx-workflows/dist/validators/architecture-arena.d.ts +6 -0
  172. package/clinkx-workflows/dist/validators/architecture-arena.js +16 -0
  173. package/clinkx-workflows/dist/validators/architecture-arena.js.map +1 -0
  174. package/clinkx-workflows/dist/validators/index.js +4 -0
  175. package/clinkx-workflows/dist/validators/index.js.map +1 -1
  176. package/clinkx-workflows/dist/validators/ping-pong.d.ts +6 -0
  177. package/clinkx-workflows/dist/validators/ping-pong.js +10 -0
  178. package/clinkx-workflows/dist/validators/ping-pong.js.map +1 -0
  179. package/clinkx-workflows/dist/workflow-tools.d.ts +51 -5
  180. package/clinkx-workflows/dist/workflow-tools.js +785 -34
  181. package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
  182. package/clinkx-workflows/dist/workflow-verification-contract.d.ts +4 -4
  183. package/clinkx-workflows/templates/architecture-arena/candidate.txt +39 -0
  184. package/clinkx-workflows/templates/architecture-arena/judge.txt +34 -0
  185. package/clinkx-workflows/templates/ping-pong/implement.txt +14 -0
  186. package/clinkx-workflows/templates/ping-pong/remediate.txt +14 -0
  187. package/clinkx-workflows/templates/ping-pong/review.txt +27 -0
  188. package/clinkx-workflows/workflows/architecture-arena.yaml +127 -0
  189. package/clinkx-workflows/workflows/ping-pong.yaml +158 -0
  190. package/dist/context-builder/bundle.js +4 -3
  191. package/dist/context-builder/bundle.js.map +1 -1
  192. package/dist/context-builder/delegate-packet.d.ts +1 -0
  193. package/dist/context-builder/delegate-packet.js +66 -7
  194. package/dist/context-builder/delegate-packet.js.map +1 -1
  195. package/dist/context-builder/delegate-validation.d.ts +12 -3
  196. package/dist/context-builder/delegate-validation.js +23 -13
  197. package/dist/context-builder/delegate-validation.js.map +1 -1
  198. package/dist/context-builder/external-gaps.d.ts +14 -3
  199. package/dist/context-builder/external-gaps.js +124 -18
  200. package/dist/context-builder/external-gaps.js.map +1 -1
  201. package/dist/context-builder/handler.js +108 -191
  202. package/dist/context-builder/handler.js.map +1 -1
  203. package/dist/context-builder/review-coverage.js +27 -1
  204. package/dist/context-builder/review-coverage.js.map +1 -1
  205. package/dist/context-builder/secrets.js +1 -1
  206. package/dist/context-builder/secrets.js.map +1 -1
  207. package/dist/context-builder/versions.d.ts +10 -4
  208. package/dist/context-builder/versions.js +10 -4
  209. package/dist/context-builder/versions.js.map +1 -1
  210. package/dist/context-builder/workflow-runner.js +33 -24
  211. package/dist/context-builder/workflow-runner.js.map +1 -1
  212. package/dist/dashboard-cli.d.ts +2 -0
  213. package/dist/dashboard-cli.js +197 -58
  214. package/dist/dashboard-cli.js.map +1 -1
  215. package/dist/dashboard-companion/client.d.ts +10 -0
  216. package/dist/dashboard-companion/client.js +43 -1
  217. package/dist/dashboard-companion/client.js.map +1 -1
  218. package/dist/dashboard-companion/config.d.ts +19 -1
  219. package/dist/dashboard-companion/config.js +104 -3
  220. package/dist/dashboard-companion/config.js.map +1 -1
  221. package/dist/dashboard-companion/protocol.d.ts +16 -0
  222. package/dist/dashboard-companion/protocol.js +55 -1
  223. package/dist/dashboard-companion/protocol.js.map +1 -1
  224. package/dist/dashboard-companion/workstation-binding.d.ts +69 -0
  225. package/dist/dashboard-companion/workstation-binding.js +192 -0
  226. package/dist/dashboard-companion/workstation-binding.js.map +1 -0
  227. package/dist/dashboard-gateway/admin-cli.d.ts +10 -0
  228. package/dist/dashboard-gateway/admin-cli.js +266 -0
  229. package/dist/dashboard-gateway/admin-cli.js.map +1 -0
  230. package/dist/dashboard-gateway/config.d.ts +50 -0
  231. package/dist/dashboard-gateway/config.js +235 -1
  232. package/dist/dashboard-gateway/config.js.map +1 -1
  233. package/dist/dashboard-gateway/connection-registry.d.ts +100 -0
  234. package/dist/dashboard-gateway/connection-registry.js +228 -0
  235. package/dist/dashboard-gateway/connection-registry.js.map +1 -0
  236. package/dist/dashboard-gateway/control-plane/account-auth.d.ts +78 -0
  237. package/dist/dashboard-gateway/control-plane/account-auth.js +198 -0
  238. package/dist/dashboard-gateway/control-plane/account-auth.js.map +1 -0
  239. package/dist/dashboard-gateway/control-plane/billing.d.ts +264 -0
  240. package/dist/dashboard-gateway/control-plane/billing.js +787 -0
  241. package/dist/dashboard-gateway/control-plane/billing.js.map +1 -0
  242. package/dist/dashboard-gateway/control-plane/contracts.d.ts +1293 -0
  243. package/dist/dashboard-gateway/control-plane/contracts.js +280 -0
  244. package/dist/dashboard-gateway/control-plane/contracts.js.map +1 -0
  245. package/dist/dashboard-gateway/control-plane/cookies.d.ts +13 -0
  246. package/dist/dashboard-gateway/control-plane/cookies.js +46 -0
  247. package/dist/dashboard-gateway/control-plane/cookies.js.map +1 -0
  248. package/dist/dashboard-gateway/control-plane/credentials.d.ts +63 -0
  249. package/dist/dashboard-gateway/control-plane/credentials.js +66 -0
  250. package/dist/dashboard-gateway/control-plane/credentials.js.map +1 -0
  251. package/dist/dashboard-gateway/control-plane/entitlements.d.ts +118 -0
  252. package/dist/dashboard-gateway/control-plane/entitlements.js +329 -0
  253. package/dist/dashboard-gateway/control-plane/entitlements.js.map +1 -0
  254. package/dist/dashboard-gateway/control-plane/errors.d.ts +17 -0
  255. package/dist/dashboard-gateway/control-plane/errors.js +23 -0
  256. package/dist/dashboard-gateway/control-plane/errors.js.map +1 -0
  257. package/dist/dashboard-gateway/control-plane/hosts.d.ts +6 -0
  258. package/dist/dashboard-gateway/control-plane/hosts.js +16 -0
  259. package/dist/dashboard-gateway/control-plane/hosts.js.map +1 -0
  260. package/dist/dashboard-gateway/control-plane/http.d.ts +34 -0
  261. package/dist/dashboard-gateway/control-plane/http.js +331 -0
  262. package/dist/dashboard-gateway/control-plane/http.js.map +1 -0
  263. package/dist/dashboard-gateway/control-plane/schema.d.ts +9 -0
  264. package/dist/dashboard-gateway/control-plane/schema.js +247 -0
  265. package/dist/dashboard-gateway/control-plane/schema.js.map +1 -0
  266. package/dist/dashboard-gateway/control-plane/secrets.d.ts +20 -0
  267. package/dist/dashboard-gateway/control-plane/secrets.js +39 -0
  268. package/dist/dashboard-gateway/control-plane/secrets.js.map +1 -0
  269. package/dist/dashboard-gateway/control-plane/store.d.ts +579 -0
  270. package/dist/dashboard-gateway/control-plane/store.js +1115 -0
  271. package/dist/dashboard-gateway/control-plane/store.js.map +1 -0
  272. package/dist/dashboard-gateway/cookie-boundary.d.ts +60 -0
  273. package/dist/dashboard-gateway/cookie-boundary.js +205 -0
  274. package/dist/dashboard-gateway/cookie-boundary.js.map +1 -0
  275. package/dist/dashboard-gateway/index.js +271 -494
  276. package/dist/dashboard-gateway/index.js.map +1 -1
  277. package/dist/dashboard-gateway/main.js +7 -2
  278. package/dist/dashboard-gateway/main.js.map +1 -1
  279. package/dist/dashboard-gateway/routing.d.ts +43 -0
  280. package/dist/dashboard-gateway/routing.js +65 -0
  281. package/dist/dashboard-gateway/routing.js.map +1 -0
  282. package/dist/dashboard-gateway/tenant-gateway.d.ts +56 -0
  283. package/dist/dashboard-gateway/tenant-gateway.js +989 -0
  284. package/dist/dashboard-gateway/tenant-gateway.js.map +1 -0
  285. package/dist/dashboard-gateway/tenant-main.d.ts +41 -0
  286. package/dist/dashboard-gateway/tenant-main.js +303 -0
  287. package/dist/dashboard-gateway/tenant-main.js.map +1 -0
  288. package/dist/dashboard-gateway/tunnel-errors.d.ts +16 -0
  289. package/dist/dashboard-gateway/tunnel-errors.js +22 -0
  290. package/dist/dashboard-gateway/tunnel-errors.js.map +1 -0
  291. package/dist/dashboard-gateway/tunnel-http.d.ts +21 -0
  292. package/dist/dashboard-gateway/tunnel-http.js +195 -0
  293. package/dist/dashboard-gateway/tunnel-http.js.map +1 -0
  294. package/dist/elaris/config.d.ts +10 -0
  295. package/dist/elaris/config.js +27 -1
  296. package/dist/elaris/config.js.map +1 -1
  297. package/dist/elaris/tools.js +4 -1
  298. package/dist/elaris/tools.js.map +1 -1
  299. package/dist/handler.d.ts +6 -0
  300. package/dist/handler.js +17 -1
  301. package/dist/handler.js.map +1 -1
  302. package/dist/index.d.ts +0 -31
  303. package/dist/index.js +41 -404
  304. package/dist/index.js.map +1 -1
  305. package/dist/lib.d.ts +17 -0
  306. package/dist/lib.js +17 -0
  307. package/dist/lib.js.map +1 -0
  308. package/dist/local-clink-backend.d.ts +2 -1
  309. package/dist/local-clink-backend.js +28 -4
  310. package/dist/local-clink-backend.js.map +1 -1
  311. package/dist/parsers/extract.d.ts +19 -1
  312. package/dist/parsers/extract.js +68 -3
  313. package/dist/parsers/extract.js.map +1 -1
  314. package/dist/pipeline.d.ts +17 -1
  315. package/dist/pipeline.js +34 -6
  316. package/dist/pipeline.js.map +1 -1
  317. package/dist/process-group.d.ts +65 -0
  318. package/dist/process-group.js +153 -0
  319. package/dist/process-group.js.map +1 -0
  320. package/dist/progress-report/lock.d.ts +17 -59
  321. package/dist/progress-report/lock.js +25 -329
  322. package/dist/progress-report/lock.js.map +1 -1
  323. package/dist/progress-report/schema.d.ts +23 -23
  324. package/dist/project-verification/files.js +1 -1
  325. package/dist/project-verification/files.js.map +1 -1
  326. package/dist/project-verification/process.js +23 -44
  327. package/dist/project-verification/process.js.map +1 -1
  328. package/dist/project-verification/service.js +9 -1
  329. package/dist/project-verification/service.js.map +1 -1
  330. package/dist/prompt.d.ts +7 -0
  331. package/dist/prompt.js +18 -1
  332. package/dist/prompt.js.map +1 -1
  333. package/dist/recipe-host/git-trust.d.ts +43 -0
  334. package/dist/recipe-host/git-trust.js +360 -0
  335. package/dist/recipe-host/git-trust.js.map +1 -0
  336. package/dist/recipe-host/git.d.ts +42 -0
  337. package/dist/recipe-host/git.js +207 -0
  338. package/dist/recipe-host/git.js.map +1 -0
  339. package/dist/recipe-host/native-recipe-host.d.ts +127 -0
  340. package/dist/recipe-host/native-recipe-host.js +880 -0
  341. package/dist/recipe-host/native-recipe-host.js.map +1 -0
  342. package/dist/recipe-host/seat-cwd.d.ts +16 -0
  343. package/dist/recipe-host/seat-cwd.js +170 -0
  344. package/dist/recipe-host/seat-cwd.js.map +1 -0
  345. package/dist/runner.d.ts +43 -1
  346. package/dist/runner.js +234 -35
  347. package/dist/runner.js.map +1 -1
  348. package/dist/server.js +84 -5
  349. package/dist/server.js.map +1 -1
  350. package/dist/settings-cli/clients.d.ts +137 -0
  351. package/dist/settings-cli/clients.js +1124 -0
  352. package/dist/settings-cli/clients.js.map +1 -0
  353. package/dist/settings-cli/commands.d.ts +67 -0
  354. package/dist/settings-cli/commands.js +726 -0
  355. package/dist/settings-cli/commands.js.map +1 -0
  356. package/dist/settings-cli/format.d.ts +34 -0
  357. package/dist/settings-cli/format.js +40 -0
  358. package/dist/settings-cli/format.js.map +1 -0
  359. package/dist/settings-cli/main.d.ts +18 -0
  360. package/dist/settings-cli/main.js +256 -0
  361. package/dist/settings-cli/main.js.map +1 -0
  362. package/dist/stdio-main.d.ts +73 -0
  363. package/dist/stdio-main.js +455 -0
  364. package/dist/stdio-main.js.map +1 -0
  365. package/docs/configuration.md +362 -40
  366. package/docs/engineering-recipes.md +291 -0
  367. package/docs/security.md +234 -6
  368. package/docs/verification/project-checks.md +24 -2
  369. package/package.json +6 -2
  370. package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +0 -115
  371. package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +0 -1
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Children owned by this server, drained by `killAllActive` at shutdown.
3
+ * Shared by the provider runner and host git so both are swept.
4
+ */
5
+ export const activeProcesses = new Set();
6
+ /** Bounded wait for the group to vanish after a sweep's SIGKILL. */
7
+ export const GROUP_EXIT_CONFIRM_WAIT_MS = 1_000;
8
+ const GROUP_EXIT_PROBE_INTERVAL_MS = 10;
9
+ function isEsrch(err) {
10
+ return err?.code === "ESRCH";
11
+ }
12
+ /**
13
+ * The one place a child's process group is probed or signalled. After any
14
+ * ESRCH the handle is retired and never addresses the numeric PGID again:
15
+ * once the group is empty the id can be reused, and a probe or signal would
16
+ * reach whoever holds it now.
17
+ */
18
+ export class ProcessGroupHandle {
19
+ probeFirst;
20
+ /** Undefined when the pid cannot name a group we own (missing, <= 1, non-integer). */
21
+ pgid;
22
+ #state = "live";
23
+ #inflight;
24
+ #unconfirmedListeners = new Set();
25
+ /**
26
+ * @param probeFirst escalate only through `sweep` (SIGKILL only a group seen
27
+ * alive, never past EPERM) instead of an unconditional SIGKILL.
28
+ */
29
+ constructor(pid, probeFirst = false) {
30
+ this.probeFirst = probeFirst;
31
+ // kill(-1) signals every process the user owns and kill(-0)/kill(0) the
32
+ // caller's own group.
33
+ this.pgid = pid !== undefined && Number.isSafeInteger(pid) && pid > 1 ? pid : undefined;
34
+ }
35
+ get state() {
36
+ return this.#state;
37
+ }
38
+ signal(sig) {
39
+ if (this.#state === "retired")
40
+ return "retired";
41
+ if (this.pgid === undefined)
42
+ return "failed";
43
+ try {
44
+ process.kill(-this.pgid, sig);
45
+ return "sent";
46
+ }
47
+ catch (err) {
48
+ if (isEsrch(err)) {
49
+ this.#state = "retired";
50
+ return "retired";
51
+ }
52
+ return "failed";
53
+ }
54
+ }
55
+ /**
56
+ * Probe every GROUP_EXIT_PROBE_INTERVAL_MS for at most `waitMs`. The first
57
+ * probe that shows the group alive triggers one group SIGKILL. ESRCH is the
58
+ * only proof of exit. EPERM never triggers SIGKILL and never means exited,
59
+ * but it is not terminal either: on macOS a group holding only unreaped
60
+ * zombies answers EPERM briefly before ESRCH. A sweep requested while one is
61
+ * in flight joins it rather than starting a second escalation.
62
+ */
63
+ sweep(waitMs = GROUP_EXIT_CONFIRM_WAIT_MS) {
64
+ if (this.#state === "retired")
65
+ return Promise.resolve({ exited: true });
66
+ if (this.pgid === undefined)
67
+ return Promise.resolve({ exited: false });
68
+ if (this.#inflight !== undefined)
69
+ return this.#inflight;
70
+ const run = this.#runSweep(this.pgid, waitMs).then((result) => {
71
+ this.#inflight = undefined;
72
+ // Retirement is absorbing: a concurrent ESRCH outranks this sweep's outcome.
73
+ if (this.#state === "retired")
74
+ return { exited: true };
75
+ if (!result.exited) {
76
+ this.#state = "unconfirmed";
77
+ for (const listener of [...this.#unconfirmedListeners])
78
+ listener();
79
+ }
80
+ return result;
81
+ });
82
+ this.#inflight = run;
83
+ return run;
84
+ }
85
+ /** Called after every sweep that ends without proof of exit. */
86
+ onUnconfirmed(listener) {
87
+ this.#unconfirmedListeners.add(listener);
88
+ return () => {
89
+ this.#unconfirmedListeners.delete(listener);
90
+ };
91
+ }
92
+ async #runSweep(pgid, waitMs) {
93
+ const deadline = Date.now() + waitMs;
94
+ let killSent = false;
95
+ for (;;) {
96
+ // A concurrent `signal()` can retire the group while this sweep sleeps.
97
+ if (this.#state === "retired")
98
+ return { exited: true };
99
+ let alive = false;
100
+ try {
101
+ process.kill(-pgid, 0);
102
+ alive = true;
103
+ }
104
+ catch (err) {
105
+ if (isEsrch(err)) {
106
+ this.#state = "retired";
107
+ return { exited: true };
108
+ }
109
+ // EPERM (or anything other than ESRCH) proves nothing about exit.
110
+ }
111
+ if (alive && !killSent) {
112
+ killSent = true;
113
+ try {
114
+ process.kill(-pgid, "SIGKILL");
115
+ }
116
+ catch (err) {
117
+ if (isEsrch(err)) {
118
+ this.#state = "retired";
119
+ return { exited: true };
120
+ }
121
+ // Otherwise the next probe decides.
122
+ }
123
+ }
124
+ if (Date.now() >= deadline)
125
+ return { exited: false };
126
+ await new Promise((r) => setTimeout(r, GROUP_EXIT_PROBE_INTERVAL_MS));
127
+ }
128
+ }
129
+ }
130
+ const handles = new WeakMap();
131
+ /** Record the group handle for a just-spawned `detached` child. */
132
+ export function trackProcessGroup(child, options) {
133
+ const handle = new ProcessGroupHandle(child.pid, options.probeFirst);
134
+ handles.set(child, handle);
135
+ return handle;
136
+ }
137
+ /** The child's handle; children registered without tracking get a plain one. */
138
+ export function processGroupHandleFor(child) {
139
+ let handle = handles.get(child);
140
+ if (handle === undefined) {
141
+ handle = new ProcessGroupHandle(child.pid);
142
+ handles.set(child, handle);
143
+ }
144
+ return handle;
145
+ }
146
+ /**
147
+ * One-shot sweep of the group led by `pid`, with no retained state. Supervised
148
+ * children use their tracked handle instead so retirement is shared.
149
+ */
150
+ export function confirmProcessGroupExit(pid, waitMs = GROUP_EXIT_CONFIRM_WAIT_MS) {
151
+ return new ProcessGroupHandle(pid, true).sweep(waitMs);
152
+ }
153
+ //# sourceMappingURL=process-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-group.js","sourceRoot":"","sources":["../src/process-group.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAgB,CAAC;AAqBvD,oEAAoE;AACpE,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAChD,MAAM,4BAA4B,GAAG,EAAE,CA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AU,iBAAiB,CAC/B,KAAmB,EACnB,OAAgC;IAEhC,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,qBAAqB,CAAC,KAAmB;IACvD,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAAW,EACX,SAAiB,0BAA0B;IAE3C,OAAO,IAAI,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC"}
@@ -1,26 +1,10 @@
1
- export declare const LOCK_FILENAME = ".lock";
2
- /** Give up rather than block an MCP request forever on a contended session. */
3
- export declare const LOCK_ACQUIRE_TIMEOUT_MS = 10000;
4
- /**
5
- * How often a holder refreshes its own lock's mtime. This is what makes a lock
6
- * observably ALIVE to a reader that cannot probe our PID, and it is also what
7
- * lets a stolen-from holder notice and abort. Matches the interval the workflow
8
- * `run.lock` and the dashboard credential store already use.
9
- */
10
- export declare const LOCK_HEARTBEAT_MS = 10000;
11
- /**
12
- * Floor for the foreign-host staleness window. A lock is only judged abandoned
13
- * on heartbeat evidence once it has missed several beats AND at least this long
14
- * has passed, so ordinary scheduling jitter never looks like death.
15
- */
16
- export declare const LOCK_HEARTBEAT_STALE_FLOOR_MS = 60000;
1
+ export { LOCK_FILENAME, LOCK_ACQUIRE_TIMEOUT_MS } from "../../clinkx-workflows/dist/settings/lock.js";
17
2
  /**
18
3
  * A holder's live claim on the critical section.
19
4
  *
20
- * `assertHeld` is not decoration. Reclamation is racy in principle — see the
21
- * residuals below — so any caller that is about to make a durable change must
22
- * re-establish ownership immediately beforehand, which collapses the window in
23
- * which a stolen-from holder can still commit down to the syscall that follows.
5
+ * `assertHeld` is not decoration: callers that are about to make a durable
6
+ * change must re-establish ownership immediately beforehand. See the shared
7
+ * lock core for the full rationale.
24
8
  */
25
9
  export interface SessionLockGuard {
26
10
  assertHeld(): Promise<void>;
@@ -28,46 +12,20 @@ export interface SessionLockGuard {
28
12
  /**
29
13
  * Run `fn` while holding an exclusive cross-process lock on `sessionDir`.
30
14
  *
31
- * THE EXCLUSION PRIMITIVE. `open(path, "wx")` is `O_CREAT | O_EXCL`, which the
32
- * kernel guarantees is atomic against every other creator on the same
33
- * filesystem — including a second ClinkX server process, which is the real case
34
- * here (a `clinkx` and a `clinkx-test` server are routinely connected at once).
35
- * A revision compare-and-swap alone is NOT a substitute: read -> compare ->
36
- * replace has a window between the compare and the rename, so the CAS detects a
37
- * lost update while this is what prevents one.
38
- *
39
- * RECLAMATION REQUIRES PROOF, NOT AGE. `O_EXCL` arbitrates creation only, so an
40
- * unconditional unlink of a lock merely judged old is unsafe: two contenders can
41
- * both judge the same abandoned lock, the first can unlink-recreate-and-enter,
42
- * and the second's already-justified unlink then deletes the FIRST's live lock
43
- * and lets it enter too. Both would then read the same revision, both pass the
44
- * CAS, and one write would be silently lost. So a lock is reclaimed only on
45
- * positive evidence of death: a dead PID on this host, or — for a lock written
46
- * on another host, where no probe is possible — a heartbeat that has been
47
- * missing for several declared intervals. Every other case waits. A holder that
48
- * declared no heartbeat is never reclaimed on silence, which is what keeps a
49
- * lock written by an older producer safe. Evidence alone is still not enough to
50
- * make two simultaneous reclaimers safe, so the unlink itself is serialized
51
- * behind a second `O_EXCL` file (`reclaimAbandonedLock`).
52
- *
53
- * Release is ownership-checked: the holder re-reads the lock body and unlinks
54
- * only if the token is still its own, so a holder that was stolen from does not
55
- * normally delete the new owner's lock. Node exposes no atomic
56
- * compare-and-unlink, so that check is read-then-unlink and a steal landing
57
- * inside that window is still possible; the guarantee is "will not", not
58
- * "cannot".
15
+ * Thin wrapper (P9/R1): the exclusion primitive, the fail-closed foreign-host
16
+ * rule, the link-published atomic lock body and the steal-lock-serialized
17
+ * reclaim all live in ONE place — the settings lock in clinkx-workflows — so
18
+ * the two surfaces cannot drift apart again. This module only adapts that core
19
+ * to the progress-report surface: `warn` goes to the root logger, and
20
+ * `SettingsLockError` (the cw package must not import root error classes)
21
+ * maps onto `ExecutionError` with the message kept verbatim, including the
22
+ * lock path and the manual `rm` recovery step a foreign-host timeout names.
59
23
  *
60
- * Honest residuals, all accepted under a single-user local-filesystem model:
61
- * `O_EXCL` is not reliable on some network filesystems (NFSv2/v3); a PID can be
62
- * recycled, so a probe can report a live process that is not the original
63
- * holder; and a holder suspended (SIGSTOP, a paused container) stops beating and
64
- * looks abandoned to a foreign-host reader. These are the same class of residual
65
- * the repo already accepts for `run.lock` and `contained-file.ts`. The steal
66
- * lock adds one of its own: a process that dies while holding `.lock.steal`
67
- * leaves it behind, which disables AUTOMATIC RECLAMATION for that session —
68
- * normal acquisition and release are unaffected — until an operator removes the
69
- * file. That is strictly the better failure mode: a session that needs a manual
70
- * unwedge, rather than two writers in the critical section.
24
+ * A legacy lock body written by an older build of THIS module is still
25
+ * reclaimed: lock identity is `token`/`pid`/`hostname`, which the old
26
+ * snake_case body (`acquired_at`, `heartbeat_interval_ms`) already carries,
27
+ * and the shared core tolerates the missing camelCase `startedAt` — pinned by
28
+ * a test so same-host dead-PID reclaim keeps working across an upgrade.
71
29
  */
72
30
  export declare function withSessionLock<T>(sessionDir: string, fn: (guard: SessionLockGuard) => Promise<T>, options?: {
73
31
  readonly acquireTimeoutMs?: number;
@@ -1,343 +1,39 @@
1
- import { randomBytes } from "node:crypto";
2
- import { open, readFile, stat, unlink, utimes } from "node:fs/promises";
3
- import { hostname } from "node:os";
4
- import { join } from "node:path";
5
1
  import { ExecutionError } from "../errors.js";
6
2
  import { logger } from "../logger.js";
7
- export const LOCK_FILENAME = ".lock";
8
- /** Give up rather than block an MCP request forever on a contended session. */
9
- export const LOCK_ACQUIRE_TIMEOUT_MS = 10_000;
10
- /**
11
- * How often a holder refreshes its own lock's mtime. This is what makes a lock
12
- * observably ALIVE to a reader that cannot probe our PID, and it is also what
13
- * lets a stolen-from holder notice and abort. Matches the interval the workflow
14
- * `run.lock` and the dashboard credential store already use.
15
- */
16
- export const LOCK_HEARTBEAT_MS = 10_000;
17
- /**
18
- * Floor for the foreign-host staleness window. A lock is only judged abandoned
19
- * on heartbeat evidence once it has missed several beats AND at least this long
20
- * has passed, so ordinary scheduling jitter never looks like death.
21
- */
22
- export const LOCK_HEARTBEAT_STALE_FLOOR_MS = 60_000;
23
- /** An mtime this far in the future means clock skew, not liveness evidence. */
24
- const LOCK_FUTURE_MTIME_TOLERANCE_MS = 60_000;
25
- const RETRY_BASE_MS = 15;
26
- const RETRY_JITTER_MS = 20;
27
- function sleep(ms) {
28
- return new Promise((resolve) => {
29
- setTimeout(resolve, ms);
30
- });
31
- }
32
- async function readLockBody(lockPath) {
33
- try {
34
- const raw = await readFile(lockPath, "utf8");
35
- const parsed = JSON.parse(raw);
36
- if (typeof parsed !== "object" || parsed === null)
37
- return null;
38
- const record = parsed;
39
- const token = record["token"];
40
- const pid = record["pid"];
41
- const host = record["hostname"];
42
- if (typeof token !== "string" || token === "")
43
- return null;
44
- const interval = record["heartbeat_interval_ms"];
45
- return {
46
- token,
47
- pid: typeof pid === "number" && Number.isInteger(pid) && pid > 0 ? pid : 0,
48
- hostname: typeof host === "string" ? host : "",
49
- acquired_at: typeof record["acquired_at"] === "string" ? record["acquired_at"] : "",
50
- heartbeat_interval_ms: typeof interval === "number" && Number.isFinite(interval) && interval > 0 ? interval : 0,
51
- };
52
- }
53
- catch {
54
- // Absent, unreadable, or unparseable: never provably ours, never provably dead.
55
- return null;
56
- }
57
- }
58
- async function readLockToken(lockPath) {
59
- return (await readLockBody(lockPath))?.token ?? null;
60
- }
61
- /** Serializes the one destructive step in this module. See `reclaimAbandonedLock`. */
62
- const STEAL_LOCK_SUFFIX = ".steal";
63
- function stealPathFor(lockPath) {
64
- return `${lockPath}${STEAL_LOCK_SUFFIX}`;
65
- }
66
- /**
67
- * Delete an abandoned lock, but only ever one contender at a time.
68
- *
69
- * Reclamation is the one destructive step here, so it gets its own `O_EXCL`
70
- * file. Without it two contenders can both observe the SAME dead lock and both
71
- * authorize an unlink; the first unlinks, recreates and enters, and the second's
72
- * already-authorized unlink then lands on the winner's LIVE lock and lets it
73
- * enter too. Both would read the same revision, both pass the CAS, and one
74
- * update would be silently lost. Re-reading the token narrows that window but
75
- * cannot close it, because the winner's unlink+create can land between the
76
- * loser's read and its unlink. Holding the steal lock across the re-read makes
77
- * the check-and-delete indivisible with respect to other reclaimers.
78
- *
79
- * Reports the REAL outcome, which is also the caller's "progress was made"
80
- * signal. Reporting success on an unlink that did not happen would be worse
81
- * than useless: the caller skips its backoff and immediately re-observes the
82
- * same undeletable lock, so a lock that is readable but cannot be removed spins
83
- * for the whole deadline at full CPU, emitting one untruthful "reclaiming"
84
- * warn per iteration into the MCP client's captured stderr.
85
- */
86
- async function reclaimAbandonedLock(lockPath, observedToken) {
87
- const stealPath = stealPathFor(lockPath);
88
- let handle;
89
- try {
90
- handle = await open(stealPath, "wx", 0o600);
91
- }
92
- catch (err) {
93
- // Another contender is already reclaiming (or the steal lock is stranded);
94
- // either way this contender waits rather than racing it. The errno is
95
- // carried out because EEXIST (a real contender) and EACCES/EROFS/ENOSPC/
96
- // ENOENT (the steal lock was never created at all) need different operator
97
- // advice, and only the former makes "remove that file" sound guidance.
98
- return {
99
- kind: "steal_lock_unavailable",
100
- code: err.code ?? "unknown",
101
- };
102
- }
103
- try {
104
- // Re-read UNDER the steal lock: if the winner already replaced the dead
105
- // lock, the token no longer matches and we must not touch it.
106
- if ((await readLockToken(lockPath)) !== observedToken)
107
- return { kind: "superseded" };
108
- try {
109
- await unlink(lockPath);
110
- return { kind: "reclaimed" };
111
- }
112
- catch (err) {
113
- // ENOENT means somebody else already removed it, which IS progress.
114
- // Anything else (an immutable flag, EPERM, a read-only mount) is a
115
- // failure and must not be dressed up as a reclamation.
116
- const code = err.code;
117
- return code === "ENOENT" ? { kind: "reclaimed" } : { kind: "unlink_failed", code: code ?? "unknown" };
118
- }
119
- }
120
- finally {
121
- // A close() that rejects (EIO, ENOSPC) must not skip the unlink: stranding
122
- // our OWN steal lock would trigger by accident the exact residual this
123
- // design documents as its worst failure mode, and would escape
124
- // `withSessionLock` as a raw unwrapped errno.
125
- await handle.close().catch(() => undefined);
126
- await unlink(stealPath).catch((err) => {
127
- // Stranding this file disables automatic reclamation for the session until
128
- // an operator removes it. That residual is documented, but swallowing it
129
- // silently means it only ever surfaces to a LATER contender's timeout.
130
- logger.warn({ stealPath, err: err.message }, "progress-report: could not remove the reclaim lock; automatic reclamation is disabled for this session until it is deleted");
131
- });
132
- }
133
- }
134
- /** Alive unless the OS positively says the process is gone. */
135
- function sameHostProcessIsDead(pid) {
136
- if (pid <= 0)
137
- return false;
138
- try {
139
- process.kill(pid, 0);
140
- return false;
141
- }
142
- catch (err) {
143
- // EPERM means it exists and belongs to someone else — alive, not dead.
144
- return err.code === "ESRCH";
145
- }
146
- }
147
- /**
148
- * Decide whether the lock on disk may be reclaimed. Reclamation requires
149
- * POSITIVE EVIDENCE OF DEATH; every ambiguity resolves to "unknown", which
150
- * waits. A bare mtime age is never sufficient on its own.
151
- */
152
- async function observeLock(lockPath) {
153
- const body = await readLockBody(lockPath);
154
- if (body === null) {
155
- return { kind: "unknown", why: "lock body is absent, unreadable, or malformed" };
156
- }
157
- // Same host: the PID probe is the strongest possible evidence, so it wins
158
- // outright and no heartbeat is consulted.
159
- if (body.hostname !== "" && body.hostname === hostname()) {
160
- return sameHostProcessIsDead(body.pid)
161
- ? { kind: "abandoned", token: body.token, why: `owner pid ${String(body.pid)} is gone` }
162
- : { kind: "live" };
163
- }
164
- // Foreign host (or an unrecorded one): we cannot probe the process, so the
165
- // only admissible evidence is a heartbeat the holder promised to send.
166
- if (body.heartbeat_interval_ms <= 0) {
167
- return { kind: "unknown", why: "holder declared no heartbeat, so silence proves nothing" };
168
- }
169
- const stats = await stat(lockPath).catch(() => null);
170
- if (stats === null) {
171
- return { kind: "unknown", why: "lock vanished while being observed" };
172
- }
173
- const ageMs = Date.now() - stats.mtimeMs;
174
- if (ageMs < -LOCK_FUTURE_MTIME_TOLERANCE_MS) {
175
- return { kind: "unknown", why: "lock mtime is in the future; clocks disagree" };
176
- }
177
- const staleAfterMs = Math.max(LOCK_HEARTBEAT_STALE_FLOOR_MS, body.heartbeat_interval_ms * 6);
178
- return ageMs > staleAfterMs
179
- ? {
180
- kind: "abandoned",
181
- token: body.token,
182
- why: `no heartbeat for ${String(Math.round(ageMs))}ms (stale after ${String(staleAfterMs)}ms)`,
183
- }
184
- : { kind: "live" };
185
- }
3
+ import { SettingsLockError, withSettingsLock, } from "../../clinkx-workflows/dist/settings/lock.js";
4
+ export { LOCK_FILENAME, LOCK_ACQUIRE_TIMEOUT_MS } from "../../clinkx-workflows/dist/settings/lock.js";
186
5
  /**
187
6
  * Run `fn` while holding an exclusive cross-process lock on `sessionDir`.
188
7
  *
189
- * THE EXCLUSION PRIMITIVE. `open(path, "wx")` is `O_CREAT | O_EXCL`, which the
190
- * kernel guarantees is atomic against every other creator on the same
191
- * filesystem — including a second ClinkX server process, which is the real case
192
- * here (a `clinkx` and a `clinkx-test` server are routinely connected at once).
193
- * A revision compare-and-swap alone is NOT a substitute: read -> compare ->
194
- * replace has a window between the compare and the rename, so the CAS detects a
195
- * lost update while this is what prevents one.
8
+ * Thin wrapper (P9/R1): the exclusion primitive, the fail-closed foreign-host
9
+ * rule, the link-published atomic lock body and the steal-lock-serialized
10
+ * reclaim all live in ONE place — the settings lock in clinkx-workflows — so
11
+ * the two surfaces cannot drift apart again. This module only adapts that core
12
+ * to the progress-report surface: `warn` goes to the root logger, and
13
+ * `SettingsLockError` (the cw package must not import root error classes)
14
+ * maps onto `ExecutionError` with the message kept verbatim, including the
15
+ * lock path and the manual `rm` recovery step a foreign-host timeout names.
196
16
  *
197
- * RECLAMATION REQUIRES PROOF, NOT AGE. `O_EXCL` arbitrates creation only, so an
198
- * unconditional unlink of a lock merely judged old is unsafe: two contenders can
199
- * both judge the same abandoned lock, the first can unlink-recreate-and-enter,
200
- * and the second's already-justified unlink then deletes the FIRST's live lock
201
- * and lets it enter too. Both would then read the same revision, both pass the
202
- * CAS, and one write would be silently lost. So a lock is reclaimed only on
203
- * positive evidence of death: a dead PID on this host, or — for a lock written
204
- * on another host, where no probe is possible — a heartbeat that has been
205
- * missing for several declared intervals. Every other case waits. A holder that
206
- * declared no heartbeat is never reclaimed on silence, which is what keeps a
207
- * lock written by an older producer safe. Evidence alone is still not enough to
208
- * make two simultaneous reclaimers safe, so the unlink itself is serialized
209
- * behind a second `O_EXCL` file (`reclaimAbandonedLock`).
210
- *
211
- * Release is ownership-checked: the holder re-reads the lock body and unlinks
212
- * only if the token is still its own, so a holder that was stolen from does not
213
- * normally delete the new owner's lock. Node exposes no atomic
214
- * compare-and-unlink, so that check is read-then-unlink and a steal landing
215
- * inside that window is still possible; the guarantee is "will not", not
216
- * "cannot".
217
- *
218
- * Honest residuals, all accepted under a single-user local-filesystem model:
219
- * `O_EXCL` is not reliable on some network filesystems (NFSv2/v3); a PID can be
220
- * recycled, so a probe can report a live process that is not the original
221
- * holder; and a holder suspended (SIGSTOP, a paused container) stops beating and
222
- * looks abandoned to a foreign-host reader. These are the same class of residual
223
- * the repo already accepts for `run.lock` and `contained-file.ts`. The steal
224
- * lock adds one of its own: a process that dies while holding `.lock.steal`
225
- * leaves it behind, which disables AUTOMATIC RECLAMATION for that session —
226
- * normal acquisition and release are unaffected — until an operator removes the
227
- * file. That is strictly the better failure mode: a session that needs a manual
228
- * unwedge, rather than two writers in the critical section.
17
+ * A legacy lock body written by an older build of THIS module is still
18
+ * reclaimed: lock identity is `token`/`pid`/`hostname`, which the old
19
+ * snake_case body (`acquired_at`, `heartbeat_interval_ms`) already carries,
20
+ * and the shared core tolerates the missing camelCase `startedAt` — pinned by
21
+ * a test so same-host dead-PID reclaim keeps working across an upgrade.
229
22
  */
230
23
  export async function withSessionLock(sessionDir, fn, options = {}) {
231
- const lockPath = join(sessionDir, LOCK_FILENAME);
232
- const token = randomBytes(16).toString("hex");
233
- const acquireTimeoutMs = options.acquireTimeoutMs ?? LOCK_ACQUIRE_TIMEOUT_MS;
234
- const deadline = Date.now() + acquireTimeoutMs;
235
- // Carried into the timeout message. Without it every failure reads "locked by
236
- // another writer", including the one case where there provably is no other
237
- // writer — a stranded `.lock.steal` blocking the reclamation of a dead
238
- // holder's lock — which points the operator at the wrong file for the single
239
- // failure mode this design introduces.
240
- let lastObservation = "the lock was not observed before the deadline";
241
- for (;;) {
242
- if (Date.now() >= deadline) {
243
- throw new ExecutionError(`progress report session is locked by another writer and did not release within ${String(acquireTimeoutMs)}ms; ${lastObservation}`);
244
- }
245
- let created = false;
246
- try {
247
- const handle = await open(lockPath, "wx", 0o600);
248
- try {
249
- const body = {
250
- token,
251
- pid: process.pid,
252
- hostname: hostname(),
253
- acquired_at: new Date().toISOString(),
254
- heartbeat_interval_ms: LOCK_HEARTBEAT_MS,
255
- };
256
- created = true;
257
- await handle.writeFile(JSON.stringify(body), "utf8");
258
- }
259
- finally {
260
- await handle.close();
261
- }
262
- break;
263
- }
264
- catch (err) {
265
- const code = err.code;
266
- if (code !== "EEXIST") {
267
- // We created the lock but could not write its body (ENOSPC, EIO). Leaving
268
- // it behind would strand every future writer behind a fresh-looking lock
269
- // that nobody owns and no PID probe can ever clear.
270
- if (created)
271
- await unlink(lockPath).catch(() => undefined);
272
- throw err;
273
- }
274
- const observation = await observeLock(lockPath);
275
- if (observation.kind === "abandoned") {
276
- const outcome = await reclaimAbandonedLock(lockPath, observation.token);
277
- if (outcome.kind === "reclaimed") {
278
- lastObservation = `the lock was abandoned (${observation.why}) and was reclaimed`;
279
- logger.warn({ lockPath, reason: observation.why }, "progress-report: reclaiming abandoned session lock");
280
- // Real progress was made, so retry immediately rather than sleeping.
281
- continue;
282
- }
283
- // Reclamation was declined or lost: fall through to the backoff, so a
284
- // repeatedly-failing reclaim waits out the deadline instead of spinning.
285
- lastObservation =
286
- outcome.kind === "steal_lock_unavailable"
287
- ? outcome.code === "EEXIST"
288
- ? `the lock looks abandoned (${observation.why}) but reclamation was declined because the reclaim lock ${stealPathFor(lockPath)} already exists — if no writer is running, remove that file`
289
- : `the lock looks abandoned (${observation.why}) but the reclaim lock ${stealPathFor(lockPath)} could not be created (${outcome.code})`
290
- : outcome.kind === "superseded"
291
- ? `the lock looked abandoned (${observation.why}) but another writer replaced it first`
292
- : `the lock looks abandoned (${observation.why}) but it could not be deleted (${outcome.code})`;
293
- }
294
- else {
295
- lastObservation =
296
- observation.kind === "live"
297
- ? "the lock is held by a writer that still looks alive"
298
- : `the lock could not be judged abandoned: ${observation.why}`;
299
- }
300
- await sleep(RETRY_BASE_MS + Math.floor(Math.random() * RETRY_JITTER_MS));
301
- }
302
- }
303
- let ownershipLost = false;
304
- let beating;
305
- const heartbeat = setInterval(() => {
306
- if (ownershipLost || beating !== undefined)
307
- return;
308
- const beat = (async () => {
309
- const current = await readLockToken(lockPath);
310
- if (current !== null && current !== token) {
311
- // PROVEN loss: a complete, readable body whose token is not ours. An
312
- // unreadable or absent lock is NOT proof and must not revoke our claim.
313
- ownershipLost = true;
314
- logger.warn({ lockPath }, "progress-report: session lock was taken from us");
315
- return;
316
- }
317
- const at = new Date();
318
- await utimes(lockPath, at, at).catch(() => undefined);
319
- })().finally(() => {
320
- beating = undefined;
321
- });
322
- beating = beat;
323
- }, LOCK_HEARTBEAT_MS);
324
- heartbeat.unref();
325
- const guard = {
326
- async assertHeld() {
327
- if (ownershipLost || (await readLockToken(lockPath)) !== token) {
328
- throw new ExecutionError("progress report session lock was reclaimed by another writer mid-update; nothing was written — re-read the report and retry");
329
- }
330
- },
331
- };
332
24
  try {
333
- return await fn(guard);
25
+ return await withSettingsLock(sessionDir, fn, {
26
+ acquireTimeoutMs: options.acquireTimeoutMs,
27
+ warn: (fields, message) => {
28
+ logger.warn({ ...fields, component: "progress-report-lock" }, message);
29
+ },
30
+ });
334
31
  }
335
- finally {
336
- clearInterval(heartbeat);
337
- await beating?.catch(() => undefined);
338
- if ((await readLockToken(lockPath)) === token) {
339
- await unlink(lockPath).catch(() => undefined);
32
+ catch (err) {
33
+ if (err instanceof SettingsLockError) {
34
+ throw new ExecutionError(err.message);
340
35
  }
36
+ throw err;
341
37
  }
342
38
  }
343
39
  //# sourceMappingURL=lock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/progress-report/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,8BA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