clinkx 1.1.2 → 1.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 (309) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +67 -14
  3. package/clinkx-workflows/dist/allowed-roots.js +2 -0
  4. package/clinkx-workflows/dist/allowed-roots.js.map +1 -1
  5. package/clinkx-workflows/dist/architecture-arena/admission.d.ts +16 -0
  6. package/clinkx-workflows/dist/architecture-arena/admission.js +107 -0
  7. package/clinkx-workflows/dist/architecture-arena/admission.js.map +1 -0
  8. package/clinkx-workflows/dist/architecture-arena/contract.d.ts +1368 -0
  9. package/clinkx-workflows/dist/architecture-arena/contract.js +254 -0
  10. package/clinkx-workflows/dist/architecture-arena/contract.js.map +1 -0
  11. package/clinkx-workflows/dist/architecture-arena/runtime.d.ts +53 -0
  12. package/clinkx-workflows/dist/architecture-arena/runtime.js +511 -0
  13. package/clinkx-workflows/dist/architecture-arena/runtime.js.map +1 -0
  14. package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +17 -1
  15. package/clinkx-workflows/dist/architecture-comparison/admission.js +27 -4
  16. package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -1
  17. package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +59 -62
  18. package/clinkx-workflows/dist/architecture-comparison/contract.js +4 -21
  19. package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -1
  20. package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +4 -3
  21. package/clinkx-workflows/dist/architecture-comparison/runtime.js +22 -67
  22. package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -1
  23. package/clinkx-workflows/dist/artifacts.d.ts +19 -4
  24. package/clinkx-workflows/dist/artifacts.js +16 -7
  25. package/clinkx-workflows/dist/artifacts.js.map +1 -1
  26. package/clinkx-workflows/dist/backend.d.ts +30 -0
  27. package/clinkx-workflows/dist/child-env.d.ts +3 -1
  28. package/clinkx-workflows/dist/child-env.js +6 -2
  29. package/clinkx-workflows/dist/child-env.js.map +1 -1
  30. package/clinkx-workflows/dist/clink-client.d.ts +8 -2
  31. package/clinkx-workflows/dist/clink-client.js +4 -2
  32. package/clinkx-workflows/dist/clink-client.js.map +1 -1
  33. package/clinkx-workflows/dist/config.d.ts +28 -5
  34. package/clinkx-workflows/dist/config.js +137 -20
  35. package/clinkx-workflows/dist/config.js.map +1 -1
  36. package/clinkx-workflows/dist/contained-file.js +9 -0
  37. package/clinkx-workflows/dist/contained-file.js.map +1 -1
  38. package/clinkx-workflows/dist/context-preflight.d.ts +6 -0
  39. package/clinkx-workflows/dist/context-preflight.js.map +1 -1
  40. package/clinkx-workflows/dist/council-execution-policy.d.ts +3 -1
  41. package/clinkx-workflows/dist/council-execution-policy.js +4 -0
  42. package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
  43. package/clinkx-workflows/dist/dashboard/contracts.d.ts +586 -586
  44. package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +28 -28
  45. package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +32 -32
  46. package/clinkx-workflows/dist/dashboard/session-log-identity.js +2 -1
  47. package/clinkx-workflows/dist/dashboard/session-log-identity.js.map +1 -1
  48. package/clinkx-workflows/dist/dashboard-ui/assets/index-DRId2DVA.js +119 -0
  49. package/clinkx-workflows/dist/dashboard-ui/assets/style-CHAw57y5.css +1 -0
  50. package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
  51. package/clinkx-workflows/dist/delegate-signature.d.ts +4 -3
  52. package/clinkx-workflows/dist/delegate-signature.js +4 -3
  53. package/clinkx-workflows/dist/delegate-signature.js.map +1 -1
  54. package/clinkx-workflows/dist/durable-file.d.ts +69 -0
  55. package/clinkx-workflows/dist/durable-file.js +145 -0
  56. package/clinkx-workflows/dist/durable-file.js.map +1 -0
  57. package/clinkx-workflows/dist/engine.d.ts +42 -7
  58. package/clinkx-workflows/dist/engine.js +196 -24
  59. package/clinkx-workflows/dist/engine.js.map +1 -1
  60. package/clinkx-workflows/dist/ping-pong/admission.d.ts +127 -0
  61. package/clinkx-workflows/dist/ping-pong/admission.js +522 -0
  62. package/clinkx-workflows/dist/ping-pong/admission.js.map +1 -0
  63. package/clinkx-workflows/dist/ping-pong/contract.d.ts +2539 -0
  64. package/clinkx-workflows/dist/ping-pong/contract.js +819 -0
  65. package/clinkx-workflows/dist/ping-pong/contract.js.map +1 -0
  66. package/clinkx-workflows/dist/ping-pong/control.d.ts +67 -0
  67. package/clinkx-workflows/dist/ping-pong/control.js +12 -0
  68. package/clinkx-workflows/dist/ping-pong/control.js.map +1 -0
  69. package/clinkx-workflows/dist/ping-pong/runtime-handle.d.ts +24 -0
  70. package/clinkx-workflows/dist/ping-pong/runtime-handle.js +55 -0
  71. package/clinkx-workflows/dist/ping-pong/runtime-handle.js.map +1 -0
  72. package/clinkx-workflows/dist/ping-pong/runtime.d.ts +235 -0
  73. package/clinkx-workflows/dist/ping-pong/runtime.js +1183 -0
  74. package/clinkx-workflows/dist/ping-pong/runtime.js.map +1 -0
  75. package/clinkx-workflows/dist/ping-pong/settle.d.ts +57 -0
  76. package/clinkx-workflows/dist/ping-pong/settle.js +58 -0
  77. package/clinkx-workflows/dist/ping-pong/settle.js.map +1 -0
  78. package/clinkx-workflows/dist/ping-pong/sidecar.d.ts +65 -0
  79. package/clinkx-workflows/dist/ping-pong/sidecar.js +138 -0
  80. package/clinkx-workflows/dist/ping-pong/sidecar.js.map +1 -0
  81. package/clinkx-workflows/dist/plan-review/publication.d.ts +2 -1
  82. package/clinkx-workflows/dist/plan-review/publication.js +5 -6
  83. package/clinkx-workflows/dist/plan-review/publication.js.map +1 -1
  84. package/clinkx-workflows/dist/plan-review/snapshot.d.ts +3 -2
  85. package/clinkx-workflows/dist/plan-review/snapshot.js +8 -8
  86. package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -1
  87. package/clinkx-workflows/dist/recipe-host.d.ts +315 -0
  88. package/clinkx-workflows/dist/recipe-host.js +183 -0
  89. package/clinkx-workflows/dist/recipe-host.js.map +1 -0
  90. package/clinkx-workflows/dist/recipe-seats.d.ts +96 -0
  91. package/clinkx-workflows/dist/recipe-seats.js +163 -0
  92. package/clinkx-workflows/dist/recipe-seats.js.map +1 -0
  93. package/clinkx-workflows/dist/recipe-shared/evidence.d.ts +67 -0
  94. package/clinkx-workflows/dist/recipe-shared/evidence.js +111 -0
  95. package/clinkx-workflows/dist/recipe-shared/evidence.js.map +1 -0
  96. package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
  97. package/clinkx-workflows/dist/reducers/index.js +30 -0
  98. package/clinkx-workflows/dist/reducers/index.js.map +1 -1
  99. package/clinkx-workflows/dist/root-path-validation.d.ts +12 -0
  100. package/clinkx-workflows/dist/root-path-validation.js +63 -0
  101. package/clinkx-workflows/dist/root-path-validation.js.map +1 -0
  102. package/clinkx-workflows/dist/rosters.d.ts +1 -0
  103. package/clinkx-workflows/dist/rosters.js +16 -6
  104. package/clinkx-workflows/dist/rosters.js.map +1 -1
  105. package/clinkx-workflows/dist/run-lock-reclaim.d.ts +44 -0
  106. package/clinkx-workflows/dist/run-lock-reclaim.js +86 -0
  107. package/clinkx-workflows/dist/run-lock-reclaim.js.map +1 -0
  108. package/clinkx-workflows/dist/server.js +5 -2
  109. package/clinkx-workflows/dist/server.js.map +1 -1
  110. package/clinkx-workflows/dist/state-schema.d.ts +24 -0
  111. package/clinkx-workflows/dist/state-schema.js +4 -1
  112. package/clinkx-workflows/dist/state-schema.js.map +1 -1
  113. package/clinkx-workflows/dist/state.d.ts +185 -4
  114. package/clinkx-workflows/dist/state.js +684 -88
  115. package/clinkx-workflows/dist/state.js.map +1 -1
  116. package/clinkx-workflows/dist/transport.d.ts +2 -1
  117. package/clinkx-workflows/dist/transport.js +5 -0
  118. package/clinkx-workflows/dist/transport.js.map +1 -1
  119. package/clinkx-workflows/dist/validators/architecture-arena.d.ts +6 -0
  120. package/clinkx-workflows/dist/validators/architecture-arena.js +16 -0
  121. package/clinkx-workflows/dist/validators/architecture-arena.js.map +1 -0
  122. package/clinkx-workflows/dist/validators/index.js +4 -0
  123. package/clinkx-workflows/dist/validators/index.js.map +1 -1
  124. package/clinkx-workflows/dist/validators/ping-pong.d.ts +6 -0
  125. package/clinkx-workflows/dist/validators/ping-pong.js +10 -0
  126. package/clinkx-workflows/dist/validators/ping-pong.js.map +1 -0
  127. package/clinkx-workflows/dist/workflow-completion.d.ts +83 -0
  128. package/clinkx-workflows/dist/workflow-completion.js +250 -0
  129. package/clinkx-workflows/dist/workflow-completion.js.map +1 -0
  130. package/clinkx-workflows/dist/workflow-tools.d.ts +53 -6
  131. package/clinkx-workflows/dist/workflow-tools.js +1123 -65
  132. package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
  133. package/clinkx-workflows/dist/workflow-verification-contract.d.ts +4 -4
  134. package/clinkx-workflows/templates/architecture-arena/candidate.txt +39 -0
  135. package/clinkx-workflows/templates/architecture-arena/judge.txt +34 -0
  136. package/clinkx-workflows/templates/ping-pong/implement.txt +14 -0
  137. package/clinkx-workflows/templates/ping-pong/remediate.txt +14 -0
  138. package/clinkx-workflows/templates/ping-pong/review.txt +27 -0
  139. package/clinkx-workflows/workflows/architecture-arena.yaml +127 -0
  140. package/clinkx-workflows/workflows/ping-pong.yaml +158 -0
  141. package/dist/allowed-roots.d.ts +1 -1
  142. package/dist/allowed-roots.js +124 -14
  143. package/dist/allowed-roots.js.map +1 -1
  144. package/dist/context-builder/bundle.js +4 -3
  145. package/dist/context-builder/bundle.js.map +1 -1
  146. package/dist/context-builder/config.d.ts +1 -0
  147. package/dist/context-builder/config.js +21 -9
  148. package/dist/context-builder/config.js.map +1 -1
  149. package/dist/context-builder/delegate-packet.d.ts +1 -0
  150. package/dist/context-builder/delegate-packet.js +66 -7
  151. package/dist/context-builder/delegate-packet.js.map +1 -1
  152. package/dist/context-builder/delegate-validation.d.ts +12 -3
  153. package/dist/context-builder/delegate-validation.js +23 -13
  154. package/dist/context-builder/delegate-validation.js.map +1 -1
  155. package/dist/context-builder/external-gaps.d.ts +14 -3
  156. package/dist/context-builder/external-gaps.js +124 -18
  157. package/dist/context-builder/external-gaps.js.map +1 -1
  158. package/dist/context-builder/handler.js +108 -191
  159. package/dist/context-builder/handler.js.map +1 -1
  160. package/dist/context-builder/mutation-lock.d.ts +4 -0
  161. package/dist/context-builder/mutation-lock.js +7 -1
  162. package/dist/context-builder/mutation-lock.js.map +1 -1
  163. package/dist/context-builder/review-coverage.js +27 -1
  164. package/dist/context-builder/review-coverage.js.map +1 -1
  165. package/dist/context-builder/secrets.js +1 -1
  166. package/dist/context-builder/secrets.js.map +1 -1
  167. package/dist/context-builder/storage.d.ts +10 -2
  168. package/dist/context-builder/storage.js +213 -16
  169. package/dist/context-builder/storage.js.map +1 -1
  170. package/dist/context-builder/versions.d.ts +10 -4
  171. package/dist/context-builder/versions.js +10 -4
  172. package/dist/context-builder/versions.js.map +1 -1
  173. package/dist/context-builder/workflow-runner.js +33 -24
  174. package/dist/context-builder/workflow-runner.js.map +1 -1
  175. package/dist/dashboard-cli.d.ts +8 -0
  176. package/dist/dashboard-cli.js +155 -86
  177. package/dist/dashboard-cli.js.map +1 -1
  178. package/dist/dashboard-companion/client.d.ts +10 -0
  179. package/dist/dashboard-companion/client.js +43 -1
  180. package/dist/dashboard-companion/client.js.map +1 -1
  181. package/dist/dashboard-companion/config.d.ts +19 -1
  182. package/dist/dashboard-companion/config.js +104 -3
  183. package/dist/dashboard-companion/config.js.map +1 -1
  184. package/dist/dashboard-companion/protocol.d.ts +16 -0
  185. package/dist/dashboard-companion/protocol.js +38 -1
  186. package/dist/dashboard-companion/protocol.js.map +1 -1
  187. package/dist/dashboard-companion/workstation-binding.d.ts +69 -0
  188. package/dist/dashboard-companion/workstation-binding.js +192 -0
  189. package/dist/dashboard-companion/workstation-binding.js.map +1 -0
  190. package/dist/dashboard-gateway/admin-cli.d.ts +10 -0
  191. package/dist/dashboard-gateway/admin-cli.js +266 -0
  192. package/dist/dashboard-gateway/admin-cli.js.map +1 -0
  193. package/dist/dashboard-gateway/config.d.ts +50 -0
  194. package/dist/dashboard-gateway/config.js +235 -1
  195. package/dist/dashboard-gateway/config.js.map +1 -1
  196. package/dist/dashboard-gateway/connection-registry.d.ts +100 -0
  197. package/dist/dashboard-gateway/connection-registry.js +228 -0
  198. package/dist/dashboard-gateway/connection-registry.js.map +1 -0
  199. package/dist/dashboard-gateway/control-plane/account-auth.d.ts +78 -0
  200. package/dist/dashboard-gateway/control-plane/account-auth.js +198 -0
  201. package/dist/dashboard-gateway/control-plane/account-auth.js.map +1 -0
  202. package/dist/dashboard-gateway/control-plane/billing.d.ts +264 -0
  203. package/dist/dashboard-gateway/control-plane/billing.js +787 -0
  204. package/dist/dashboard-gateway/control-plane/billing.js.map +1 -0
  205. package/dist/dashboard-gateway/control-plane/contracts.d.ts +1293 -0
  206. package/dist/dashboard-gateway/control-plane/contracts.js +280 -0
  207. package/dist/dashboard-gateway/control-plane/contracts.js.map +1 -0
  208. package/dist/dashboard-gateway/control-plane/cookies.d.ts +13 -0
  209. package/dist/dashboard-gateway/control-plane/cookies.js +46 -0
  210. package/dist/dashboard-gateway/control-plane/cookies.js.map +1 -0
  211. package/dist/dashboard-gateway/control-plane/credentials.d.ts +63 -0
  212. package/dist/dashboard-gateway/control-plane/credentials.js +66 -0
  213. package/dist/dashboard-gateway/control-plane/credentials.js.map +1 -0
  214. package/dist/dashboard-gateway/control-plane/entitlements.d.ts +118 -0
  215. package/dist/dashboard-gateway/control-plane/entitlements.js +329 -0
  216. package/dist/dashboard-gateway/control-plane/entitlements.js.map +1 -0
  217. package/dist/dashboard-gateway/control-plane/errors.d.ts +17 -0
  218. package/dist/dashboard-gateway/control-plane/errors.js +23 -0
  219. package/dist/dashboard-gateway/control-plane/errors.js.map +1 -0
  220. package/dist/dashboard-gateway/control-plane/hosts.d.ts +6 -0
  221. package/dist/dashboard-gateway/control-plane/hosts.js +16 -0
  222. package/dist/dashboard-gateway/control-plane/hosts.js.map +1 -0
  223. package/dist/dashboard-gateway/control-plane/http.d.ts +34 -0
  224. package/dist/dashboard-gateway/control-plane/http.js +331 -0
  225. package/dist/dashboard-gateway/control-plane/http.js.map +1 -0
  226. package/dist/dashboard-gateway/control-plane/schema.d.ts +9 -0
  227. package/dist/dashboard-gateway/control-plane/schema.js +247 -0
  228. package/dist/dashboard-gateway/control-plane/schema.js.map +1 -0
  229. package/dist/dashboard-gateway/control-plane/secrets.d.ts +20 -0
  230. package/dist/dashboard-gateway/control-plane/secrets.js +39 -0
  231. package/dist/dashboard-gateway/control-plane/secrets.js.map +1 -0
  232. package/dist/dashboard-gateway/control-plane/store.d.ts +579 -0
  233. package/dist/dashboard-gateway/control-plane/store.js +1115 -0
  234. package/dist/dashboard-gateway/control-plane/store.js.map +1 -0
  235. package/dist/dashboard-gateway/cookie-boundary.d.ts +60 -0
  236. package/dist/dashboard-gateway/cookie-boundary.js +205 -0
  237. package/dist/dashboard-gateway/cookie-boundary.js.map +1 -0
  238. package/dist/dashboard-gateway/index.js +271 -494
  239. package/dist/dashboard-gateway/index.js.map +1 -1
  240. package/dist/dashboard-gateway/main.js +7 -2
  241. package/dist/dashboard-gateway/main.js.map +1 -1
  242. package/dist/dashboard-gateway/routing.d.ts +43 -0
  243. package/dist/dashboard-gateway/routing.js +65 -0
  244. package/dist/dashboard-gateway/routing.js.map +1 -0
  245. package/dist/dashboard-gateway/tenant-gateway.d.ts +56 -0
  246. package/dist/dashboard-gateway/tenant-gateway.js +989 -0
  247. package/dist/dashboard-gateway/tenant-gateway.js.map +1 -0
  248. package/dist/dashboard-gateway/tenant-main.d.ts +41 -0
  249. package/dist/dashboard-gateway/tenant-main.js +303 -0
  250. package/dist/dashboard-gateway/tenant-main.js.map +1 -0
  251. package/dist/dashboard-gateway/tunnel-errors.d.ts +16 -0
  252. package/dist/dashboard-gateway/tunnel-errors.js +22 -0
  253. package/dist/dashboard-gateway/tunnel-errors.js.map +1 -0
  254. package/dist/dashboard-gateway/tunnel-http.d.ts +21 -0
  255. package/dist/dashboard-gateway/tunnel-http.js +175 -0
  256. package/dist/dashboard-gateway/tunnel-http.js.map +1 -0
  257. package/dist/handler.d.ts +6 -0
  258. package/dist/handler.js +17 -1
  259. package/dist/handler.js.map +1 -1
  260. package/dist/local-clink-backend.d.ts +2 -1
  261. package/dist/local-clink-backend.js +28 -4
  262. package/dist/local-clink-backend.js.map +1 -1
  263. package/dist/parsers/extract.d.ts +19 -1
  264. package/dist/parsers/extract.js +68 -3
  265. package/dist/parsers/extract.js.map +1 -1
  266. package/dist/pipeline.d.ts +17 -1
  267. package/dist/pipeline.js +34 -6
  268. package/dist/pipeline.js.map +1 -1
  269. package/dist/process-group.d.ts +65 -0
  270. package/dist/process-group.js +153 -0
  271. package/dist/process-group.js.map +1 -0
  272. package/dist/progress-report/schema.d.ts +23 -23
  273. package/dist/project-verification/files.js +1 -1
  274. package/dist/project-verification/files.js.map +1 -1
  275. package/dist/project-verification/process.js +23 -44
  276. package/dist/project-verification/process.js.map +1 -1
  277. package/dist/project-verification/service.js +9 -1
  278. package/dist/project-verification/service.js.map +1 -1
  279. package/dist/prompt.d.ts +7 -0
  280. package/dist/prompt.js +18 -1
  281. package/dist/prompt.js.map +1 -1
  282. package/dist/recipe-host/git-trust.d.ts +43 -0
  283. package/dist/recipe-host/git-trust.js +360 -0
  284. package/dist/recipe-host/git-trust.js.map +1 -0
  285. package/dist/recipe-host/git.d.ts +42 -0
  286. package/dist/recipe-host/git.js +207 -0
  287. package/dist/recipe-host/git.js.map +1 -0
  288. package/dist/recipe-host/native-recipe-host.d.ts +127 -0
  289. package/dist/recipe-host/native-recipe-host.js +880 -0
  290. package/dist/recipe-host/native-recipe-host.js.map +1 -0
  291. package/dist/recipe-host/seat-cwd.d.ts +16 -0
  292. package/dist/recipe-host/seat-cwd.js +170 -0
  293. package/dist/recipe-host/seat-cwd.js.map +1 -0
  294. package/dist/registry.d.ts +1 -1
  295. package/dist/registry.js +5 -1
  296. package/dist/registry.js.map +1 -1
  297. package/dist/runner.d.ts +43 -1
  298. package/dist/runner.js +234 -35
  299. package/dist/runner.js.map +1 -1
  300. package/dist/server.js +21 -6
  301. package/dist/server.js.map +1 -1
  302. package/docs/configuration.md +181 -15
  303. package/docs/engineering-recipes.md +291 -0
  304. package/docs/security.md +87 -0
  305. package/docs/verification/project-checks.md +24 -2
  306. package/package.json +5 -1
  307. package/scripts/provider-doctor-core.mjs +21 -5
  308. package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +0 -115
  309. package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 — 2026-11-03
4
+
5
+ ### Upgrade notes
6
+
7
+ - Drain or cancel ping-pong runs before downgrading from this release. Recipe sidecars and admission facts written by 1.3.0 carry strict-schema fields an older build cannot read (`stop_detail`, `candidate_witness`, `git_metadata_snapshot`, reviewer-operation `attempt`/`retry_reason`/`packet_digest`/`packet_file`/`packet_sha256`, `rejected_findings[].summary`, `pp_admission.context_roots`).
8
+ - Recipe worktrees are not containment: writers run with their stock write-capable adapter flags, reviewers are read-only by prompt only, and host verification runs writer-authored code. Ping-pong admission requires an unmarked `CLINKX_ALLOWED_ROOTS` entry covering `${CLINKX_HOME}/workspaces` that is not an ancestor of the state directory. See `docs/security.md` ("Recipe worktrees are not containment").
9
+ - The verification runtime digest now covers `dist/process-group.js`, so verification evidence retained from an earlier build reads as `inapplicable` under this one.
10
+
11
+ ### Added
12
+
13
+ - `architecture-arena` workflow: 2-4 design authors (`members`, each with an optional `stance`) and a required blind judge (`chairman`) over one frozen shared packet. Per-candidate byte caps are derived after the freeze; a missing, invalid or busy author blocks the judge, and a surviving subset is never compared. `architecture-comparison` v1 is unchanged.
14
+ - Native `ping-pong` workflow (root server only, `async:true` only): `members[0]` implements in a host-owned git worktree at the committed `HEAD`, `members[1..4]` review each round, and host verification runs a reviewed project-check manifest. After each review round the run pauses as a terminal `succeeded` execution, and the new `workflow_recipe_decide` tool admits or rejects every pending finding to start the next round, final verification, or a stop. `workflow_run_status` adds a `recipe` block (phase, pending findings, per-seat outcome and score, threshold, budgets, deadline and `deadline_expired`, worktrees, outcome, `stop_reason`, `stop_detail`). `resume_workflow` refuses recipe runs. Contracts: `docs/engineering-recipes.md` and `.ai/plans/arena-ping-pong-orchestration/CONTRACTS.md`.
15
+ - `list_workflows` marks `ping-pong` `async_only` and `root_only`; the standalone workflow server omits root-only workflows.
16
+ - Dashboard tenant mode (`CLINKX_DASHBOARD_GATEWAY_MODE=tenant`): one public gateway host serves many accounts through OIDC sign-in, one workspace per account, up to two workstations per workspace with per-workstation `clxd_` API keys, and operator-granted access (`CLINKX_DASHBOARD_GATEWAY_BILLING=off` or `stripe`). Single-user mode stays the default. See `docs/dashboard-multitenancy.md`.
17
+ - Hosted dashboard `/workspace` route, and the open workstation is kept across reloads.
18
+ - Opt-in, page-local WebMCP tools in the dashboard: report the visible view, list run identifiers, navigate, and (for a visible council target) prepare a prompt-builder draft through validated replacements with form-only undo. Default off; see `docs/dashboard-webmcp.md`.
19
+
20
+ ### Changed
21
+
22
+ - Recipe subprocess calls confirm process-group exit: the runner probes the group with `kill(-pid, 0)`, sends SIGKILL only to a group seen alive, and treats only ESRCH as proof; a group seen gone is never signalled again. Background processes a ping-pong seat leaves in its group are killed when the seat exits. Verification checks route their group signals through the same handle.
23
+ - A full root `clink` semaphore is a `transient` failure with a typed busy-before-spawn marker, persisted as optional `CallStateEntry.failureKind: "busy_before_spawn"`.
24
+ - Workflow run files and the recipe sidecar are written durably (temp file, fsync, rename, directory fsync), and same-host dead-PID `run.lock` reclaim is serialized behind `run.lock.steal`.
25
+ - `context_builder`: only caller focus is required evidence; review targets and regression links are advisory and degrade coverage instead of failing the delegate. Under `external_gap_policy:"degrade"`, a nonexistent gap path becomes a warning.
26
+ - For JSON-enforced calls, a result file that is not one valid JSON value falls back to a complete JSON document parsed from untruncated stdout.
27
+ - A child process that emits `'error'` after spawning now reports `"<cmd>" failed after spawn` instead of `Failed to spawn`.
28
+ - Dashboard hosted gate and prompt builder match design pass 2 (step track, button tiers, bracket actions, phone layout). Routes, data, API calls and accessible names are unchanged.
29
+
30
+ ### Fixed
31
+
32
+ - Dashboard UI bugs from the design parity audit, including shell button fonts, theme toggles that could drift, the jump palette, copy controls and run cards.
33
+ - A context-run reader flake when a run directory was recycled.
34
+
35
+ ## 1.2.0 — 2026-10-20
36
+
37
+ ### Upgrade notes
38
+
39
+ - There is no automatic migration. Durable data now lives under `~/.clinkx`; data written by earlier builds stays under `~/.local/state/clinkx-workflows` and `~/.local/state/clinkx/context-builder/runs` until you act. Pick one path from [Migrating to `CLINKX_HOME`](docs/configuration.md#migrating-to-clinkx_home): start fresh and keep the old directories as an archive; copy workflow state and user configuration into `~/.clinkx` with producers stopped, merging rather than overwriting; or pin the old directories with `CLINKX_WORKFLOWS_STATE_DIR` and `CLINKX_CONTEXT_BUILDER_RUNS_DIR`. Do not move `context-builder/runs`.
40
+ - Runs moved from the previous default stay non-resumable because the state path is part of their resume fingerprint. `CLINKX_HOME` itself is not part of that fingerprint.
41
+ - A dashboard that still mounts or reads the old directories shows only runs written before the upgrade. Point it at the producers' current directories and recreate the dashboard companion or local stack.
42
+ - `CLINKX_ALLOWED_ROOTS` entries that are dangling symlinks, inaccessible, or neither a directory nor a regular file now fail startup instead of being kept leniently. Fix or remove them before upgrading.
43
+
44
+ ### Added
45
+
46
+ - `workflow_run_wait({run_id, expected_execution_id?})` observes a local workflow execution until its cleanup fence, for a fixed 30-second server-owned budget per call, and returns the metadata-only status projection plus `wait:{outcome, execution_id?, budget_ms, elapsed_ms}`. Outcomes are `settled`, `budget_elapsed`, `not_owned`, `orphaned`, `not_found`, `identity_changed` and `identity_unavailable`; they are observation outcomes, not new run statuses. Re-arm `budget_elapsed` with the same pin; cancelling a wait detaches only that observation.
47
+ - Workflow executions carry an opaque `execution_id`: on the async `run_workflow` acknowledgement, and in one trailing identity block `{resolved_roster?, execution_id?}` on blocking `run_workflow` and `resume_workflow` results. It is a fence, not a capability. `workflow_run_status` accepts an optional `expected_execution_id`; a pinned read of a different or unprovable execution returns `isError` `identity_changed` / `identity_unavailable` with no result, and a persistently changing active state returns the retryable `state_read_unstable`. Unpinned calls are unchanged.
48
+ - The execution id is persisted in `state.json` (optional `executionId`, `state_version` stays 1), so a pin settles from disk after a ClinkX restart or eviction from the 128-entry settled window when the run is terminal, stamped with that id, carries a matching `executionCompletedAt` witness, and its `run.lock` is released. A run last written by an older ClinkX (which carries the id forward without the witness) fails closed as `identity_unavailable` instead of settling on that build's outcome. Contract: `.ai/plans/workflow-completion-wait/CONTRACT.md`.
49
+
50
+ ### Changed
51
+
52
+ - Durable ClinkX data now defaults to `~/.clinkx`, configurable with `CLINKX_HOME` (absolute; its canonical identity must not be a filesystem root, the effective home directory, or an ancestor of that home such as `/Users`). Workflow state moves from `~/.local/state/clinkx-workflows`; context-builder runs move from `~/.local/state/clinkx/context-builder/runs` to `~/.clinkx/context-builder/runs`; user adapters and rosters search `~/.clinkx/{adapters,rosters}` before the retained XDG config tier. Per-area overrides still take precedence, and temporary scratch paths are unchanged.
53
+ - `XDG_STATE_HOME` no longer controls durable storage. Standalone workflow children receive resolved `CLINKX_HOME` and `CLINKX_WORKFLOWS_STATE_DIR` after environment scrubbing. The parent's context-run override is scrubbed; child context artifacts use `CLINKX_HOME/context-builder/runs`.
54
+ - State and artifact roots remain automatically admitted even with an explicit workspace allowlist. Under the consolidated default, direct `clink` references can read adapters, rosters and context artifacts without context-builder secret filtering. Use a separate state override to keep configuration outside the automatic state grant. Deleting the whole ClinkX home also deletes user adapters and rosters.
55
+ - `CLINKX_WORKFLOWS_STATE_DIR` and `CLINKX_WORKFLOWS_ARTIFACTS_DIR` reject a filesystem root or an alias of one at every entrypoint, including the standalone workflow server and an unset artifacts override whose TMPDIR-derived default resolves to one; before, only the root server rejected it. A relative `CLINKX_WORKFLOWS_ARTIFACTS_DIR` is now rejected instead of resolving against the process cwd. A value equal to the effective home, an alias of it, or an ancestor of it is still accepted, but both STDIO servers log one startup warning because it is auto-admitted as an artifact-only allowed root. Generic `CLINKX_ALLOWED_ROOTS` entries and `CLINKX_CONTEXT_BUILDER_RUNS_DIR` rules are unchanged. See the storage-root policy table in `docs/configuration.md`.
56
+ - A `CLINKX_ALLOWED_ROOTS` entry that names an existing regular file is an exact-file grant: it resolves to the canonical file and admits only that file, not its siblings, name prefixes, or child paths. A dangling symlink, an inaccessible path (`EACCES`, `EPERM`, `ENOTDIR`, `ELOOP`), or an entry that is neither a directory nor a regular file fails startup with `CLINKX_ALLOWED_ROOTS entry "<entry>" is unusable: <reason>. Fix or remove this entry from CLINKX_ALLOWED_ROOTS.` (`-32602` on tool paths). Nonexistent plain entries are still accepted. Automatically produced state and artifact roots stay directory-only.
57
+ - The local and companion dashboard Compose files default the state and context-run bind sources to `${HOME}/.clinkx` and `${HOME}/.clinkx/context-builder/runs`. The workspace mount stays required, the sources must already exist, and the cloud file keeps explicit sources. One gateway deployment accepts one live companion; a second gets HTTP 409. `DASHBOARD_DEPLOYMENT_SLUG` only names Docker resources on one host.
58
+ - When the adapter registry fails to load on a JSON syntax error, `provider_doctor` names the broken file by searching in registry order: `CLINKX_CONFIG_PATH` when set, otherwise `$CLINKX_HOME/adapters`, then the XDG config tier, then the packaged adapters. `scripts/verified-repair/qualify-installed.mjs` derives its state directory from `getStateDir()` instead of a fixed path.
59
+
60
+ ### Fixed
61
+
62
+ - Home validation rejects symlink aliases to the effective home or filesystem root, including aliases in the default `.clinkx` path. Valid narrow symlinks and nonexistent first-run directories remain supported; accepted spelling is preserved for resume identity.
63
+ - Individual workspace, state, artifact and context-run roots reject commas in supplied, canonical and prospective canonical paths before allow-root serialization. Relevant path checks run before reconciliation scheduling or context-directory creation. These checks are snapshots, not protection against later symlink retargeting.
64
+ - A workflow context cache entry (`wfctx-*`) moved from another runs root no longer blocks its cache id. Its manifest names the old location, so it can never be admitted; eviction or a promotion conflict now renames it to `.stale-<runId>-<epochms>-<hex>`, the call rebuilds once, and the next identical call hits. Quarantined directories are deleted after the temp TTL (`min(cache TTL, 3600s)`). `wfpre-*`, `ctx_*` and named runs are not touched.
65
+
3
66
  ## 1.1.2 — 2026-10-09
4
67
 
5
68
  ### Added
package/README.md CHANGED
@@ -66,9 +66,11 @@ ClinkX starts the Codex CLI, sends the prompt and the file references, and retur
66
66
  | `workflow_verification_attach` | Re-inspects proof with the original owner-held digest and records its historical coverage on a workflow run. |
67
67
  | `list_workflows` | Lists the available workflows, CLIs, and roster presets. |
68
68
  | `run_workflow` | Starts a multi-stage workflow. Runs in blocking mode by default, or in the background with `async: true`. |
69
- | `workflow_run_status` | Reports the progress and result of a workflow run. |
70
- | `resume_workflow` | Continues a workflow run that stopped before completion. |
71
- | `cancel_workflow` | Cancels a workflow run. |
69
+ | `workflow_run_status` | Reports persisted progress and results; optional `expected_execution_id` guards the selected local execution. |
70
+ | `workflow_run_wait` | Observes local execution completion for up to 30 seconds without cancelling the worker when observation stops. |
71
+ | `resume_workflow` | Continues a workflow run that stopped before completion. Recipe runs (`ping-pong`) are not resumable this way. |
72
+ | `workflow_recipe_decide` | Records the main agent's admit/reject decision for a paused `ping-pong` recipe run and continues it (root server only). |
73
+ | `cancel_workflow` | Cancels a workflow run. A `ping-pong` run that already recorded its outcome keeps it, so a cancel answered `cancelling` can still end `succeeded`. |
72
74
  | `progress_report_start`, `progress_report_update`, `progress_report_get`, `progress_report_list` | Keep a live progress report that the dashboard shows. |
73
75
 
74
76
  Two more tool groups are off by default:
@@ -114,10 +116,11 @@ The `conf/adapters/hapi/` directory in the package holds optional templates that
114
116
  ClinkX reads adapter JSON files from these locations, in this order. ClinkX uses the first file with a given `name`.
115
117
 
116
118
  1. `CLINKX_CONFIG_PATH`, a file or a directory. When you set it, ClinkX reads only this location and does not load the included adapters. The location must also contain a `codex` adapter with a `json` role, or you must set `CLINKX_WORKFLOWS_CONTEXT_PREFLIGHT_ENABLED=false`.
117
- 2. `${XDG_CONFIG_HOME:-~/.config}/clinkx/adapters/*.json`.
118
- 3. The `conf/adapters/` directory inside the installed package.
119
+ 2. `${CLINKX_HOME:-~/.clinkx}/adapters/*.json`.
120
+ 3. `${XDG_CONFIG_HOME:-~/.config}/clinkx/adapters/*.json`.
121
+ 4. The `conf/adapters/` directory inside the installed package.
119
122
 
120
- To change an included adapter, copy its file to `~/.config/clinkx/adapters/` and edit the copy. The copy replaces the included file completely. ClinkX does not merge the two files. After you upgrade ClinkX, compare your copy with the new included file. Copy the new file again if necessary.
123
+ To change an included adapter, copy its file to `${CLINKX_HOME:-~/.clinkx}/adapters/` (or `~/.config/clinkx/adapters/`) and edit the copy. The copy replaces the included file completely. ClinkX does not merge the two files. After you upgrade ClinkX, compare your copy with the new included file. Copy the new file again if necessary.
121
124
 
122
125
  To add a CLI that is not included, write a new file in the same directory. This example adapter returns the prompt unchanged:
123
126
 
@@ -138,10 +141,11 @@ These are the variables that most installations set. Every variable has a defaul
138
141
 
139
142
  | Variable | Default | Function |
140
143
  |---|---|---|
141
- | `CLINKX_ALLOWED_ROOTS` | Current directory of the server process | Comma-separated list of directories that tool calls can reference. Set it so path checks do not depend on the directory in which the client starts ClinkX. |
144
+ | `CLINKX_ALLOWED_ROOTS` | Current directory of the server process | Comma-separated list of directories that tool calls can reference. An entry that is an existing file allows only that file. An entry that is a broken symlink, that ClinkX cannot access, or that is neither a directory nor a file stops the server at startup. Set it so path checks do not depend on the directory in which the client starts ClinkX. |
142
145
  | `CLINKX_WORKFLOWS_WORKSPACE_ROOT` | Current directory of the server process | Workspace for workflows. Set it to the same directory as the allowed root. |
143
- | `CLINKX_WORKFLOWS_STATE_DIR` | `${XDG_STATE_HOME:-~/.local/state}/clinkx-workflows` | Directory for workflow runs, progress reports, and dashboard state. |
144
- | `CLINKX_CONTEXT_BUILDER_RUNS_DIR` | `${XDG_STATE_HOME:-~/.local/state}/clinkx/context-builder/runs` | Directory for `context_builder` runs and bundles. |
146
+ | `CLINKX_HOME` | `~/.clinkx` | Root directory for durable state, context-builder runs, user adapters and rosters. |
147
+ | `CLINKX_WORKFLOWS_STATE_DIR` | `${CLINKX_HOME:-~/.clinkx}` | Directory for workflow runs, progress reports, and dashboard state. |
148
+ | `CLINKX_CONTEXT_BUILDER_RUNS_DIR` | `${CLINKX_HOME:-~/.clinkx}/context-builder/runs` | Directory for `context_builder` runs and bundles. |
145
149
  | `CLINKX_CONFIG_PATH` | not set | Replaces the adapter search path. See [Adapter files](#adapter-files). |
146
150
  | `CLINKX_ROSTERS_PATH` | not set | Replaces the roster-preset search path. See [Workflows](#workflows). |
147
151
  | `CLINKX_MAX_CONCURRENT` | `5` | Maximum number of `clink` processes at one time. ClinkX returns an error when the limit is reached. It does not queue requests. |
@@ -152,10 +156,15 @@ These are the variables that most installations set. Every variable has a defaul
152
156
  | `CLINKX_WORKFLOWS_CONTEXT_PREFLIGHT_ENABLED` | `true` | Set to `false` to run workflows without the Codex context step. |
153
157
  | `CLINKX_WORKFLOWS_RETAIN_SUCCEEDED_DAYS` | `1` | Days to keep completed blocking workflow runs on disk. `0` keeps them without limit. |
154
158
  | `CLINKX_WORKFLOWS_RETAIN_ASYNC_DAYS` | `1` | Days to keep completed background workflow runs on disk. `0` keeps them without limit. |
159
+ | `CLINKX_WORKFLOWS_RETAIN_FAILED_DAYS` | `30` | Days to keep failed workflow runs on disk. Recipe runs (`ping-pong`) use it for every final status. `0` keeps them without limit. |
155
160
  | `CLINKX_SERVER_IDLE_TIMEOUT_SECONDS` | `0` | Seconds of inactivity after which the server exits. `0` disables the timer. Active tool calls, workflows, and Codex turns reset it. |
156
161
  | `CLINKX_APP_SERVER_ENABLED` | `false` | Set to `true` to publish the Codex app-server tools. |
157
162
  | `CLINKX_ELARIS_ENABLED` | `false` | Set to `true` to publish the Elaris tools. |
158
163
 
164
+ `CLINKX_HOME` resolves to the explicit value, then `$HOME/.clinkx`, then the OS account home plus `/.clinkx` when `HOME` is unset or empty. It must be absolute and must not be a filesystem root, the home directory itself, or a parent of the home directory (for example `/Users`). The root server validates it at startup even when per-area overrides are set. `CLINKX_WORKFLOWS_STATE_DIR` and `CLINKX_WORKFLOWS_ARTIFACTS_DIR` must be absolute and must not be a filesystem root. If one of them is the home directory or a parent of it, the server starts but logs a warning.
165
+
166
+ Earlier versions kept data in `${XDG_STATE_HOME:-~/.local/state}`. ClinkX does not move this data. To keep, copy, or pin the old data, see [Migrating to `CLINKX_HOME`](docs/configuration.md#migrating-to-clinkx_home).
167
+
159
168
  ClinkX writes only MCP JSON-RPC to stdout. All logs go to stderr. The server detects the exit of its parent process and stops.
160
169
 
161
170
  ## Workflows
@@ -211,14 +220,58 @@ A roster preset names the members, the chairman, and the context delegate of a c
211
220
  The included `default-council` preset uses Codex, Claude, and GLM as members and Codex as chairman. ClinkX reads these locations in this order and uses the first file with a given name:
212
221
 
213
222
  1. `CLINKX_ROSTERS_PATH`, a file or a directory. When you set it, ClinkX reads only this location.
214
- 2. `${XDG_CONFIG_HOME:-~/.config}/clinkx/rosters/*.json`.
215
- 3. The `conf/rosters/` directory inside the installed package.
223
+ 2. `${CLINKX_HOME:-~/.clinkx}/rosters/*.json`.
224
+ 3. `${XDG_CONFIG_HOME:-~/.config}/clinkx/rosters/*.json`.
225
+ 4. The `conf/rosters/` directory inside the installed package.
216
226
 
217
- To write your own preset, copy `conf/rosters/default-council.json` to `~/.config/clinkx/rosters/<name>.json` and edit the copy. The file name is the preset name. The preset name must match `^[a-z0-9][a-z0-9_-]{0,63}$`. A request that gives `roster` together with `members`, `chairman`, `chairman_model`, `chairman_effort`, or a non-empty `cb_delegate` returns error `-32602` and starts no run.
227
+ To write your own preset, copy `conf/rosters/default-council.json` to `${CLINKX_HOME:-~/.clinkx}/rosters/<name>.json` (or `~/.config/clinkx/rosters/<name>.json`) and edit the copy. The file name is the preset name. The preset name must match `^[a-z0-9][a-z0-9_-]{0,63}$`. A request that gives `roster` together with `members`, `chairman`, `chairman_model`, `chairman_effort`, or a non-empty `cb_delegate` returns error `-32602` and starts no run.
218
228
 
219
229
  ### Background runs
220
230
 
221
- Pass `async: true` to `run_workflow` to get a `run_id` immediately. Call `workflow_run_status` with that `run_id` to see the stage progress. Pass `include_result: true` to get the final result. Use `cancel_workflow` to stop a run. Completed runs stay on disk for the retention period given above.
231
+ Pass `async: true` to `run_workflow` to get a `run_id` and an opaque
232
+ `execution_id` immediately. Use the identity to wait for that execution:
233
+
234
+ ```json
235
+ {
236
+ "run_id": "my-council-run",
237
+ "expected_execution_id": "<execution_id from launch>"
238
+ }
239
+ ```
240
+
241
+ Call `workflow_run_wait` with those arguments. It returns persisted status metadata
242
+ and a `wait` block with `outcome`, optional `execution_id`, `budget_ms`, and
243
+ `elapsed_ms`. On `budget_elapsed`, repeat the wait with the same identity. On
244
+ `settled`, fetch `workflow_run_status` with the same arguments plus
245
+ `include_result: true` to obtain the final result. The wait has a fixed server-owned
246
+ 30-second budget; it takes no caller timeout input, and `budget_ms` always reports
247
+ that configured budget. Stopping a wait only detaches that observation. Use
248
+ `cancel_workflow` to stop the worker.
249
+
250
+ A blocking `run_workflow` and `resume_workflow` also return the `execution_id`, in
251
+ a trailing content block `{resolved_roster?, execution_id?}`. Use the returned id
252
+ as the pin. Leave the pin out of a first wait only when no id was returned; it then
253
+ binds to the latest local execution and returns its identity. The id is a fence,
254
+ not a capability: it only selects which execution a read must match.
255
+
256
+ `settled` witnesses completion and cleanup in the owning server process, followed
257
+ by an identity-checked persisted read. `not_owned`, `orphaned` and `not_found`
258
+ return immediately. `not_owned` requires explicit persisted status recovery;
259
+ `orphaned` and `not_found` require checking the run. A run that is still being
260
+ admitted can briefly report `not_found` to an unpinned wait. A rejected start or
261
+ resume never replaces an earlier execution's pin. Identity
262
+ errors (`identity_changed` or `identity_unavailable`) must be surfaced without
263
+ dropping the pin to fetch another execution's result. A pinned
264
+ `workflow_run_status` can return `state_read_unstable` when the state file keeps
265
+ changing during the read; retry it with the same pin after a short pause. The server retains up to 128
266
+ settled metadata identities without active readers, without result text. Active
267
+ executions are never evicted; active observations stay protected until their
268
+ request ends. Eligible inactive settled entries are evicted FIFO. Each run's
269
+ state also records its execution id, so after a restart or eviction a pinned
270
+ wait or status still settles once that execution's state is terminal and its
271
+ run lock is released. A pin on a run that is unfinished, or still locked (for
272
+ example by a crashed owner on another host), reports `identity_unavailable`. Waits do not keep workers alive
273
+ after server exit, and this tool does not promise unsolicited client wakeups.
274
+ Completed runs stay on disk for the retention period given above.
222
275
 
223
276
  ## Context bundles
224
277
 
@@ -247,7 +300,7 @@ npx -p clinkx clinkx-workflows-dashboard --port 4180
247
300
 
248
301
  The dashboard listens on `127.0.0.1` and `::1` and prints `http://localhost:<port>`. Passkey sign-in is the default. On the first start, the dashboard prints one enrollment code. Register a passkey with that code, then sign in. For local tests only, `CLINKX_WORKFLOWS_DASHBOARD_AUTH_MODE=none` disables sign-in.
249
302
 
250
- Point the dashboard at the same `CLINKX_WORKFLOWS_STATE_DIR` as the ClinkX server. If the two directories differ, the dashboard shows a different run set, often an empty one. If you set `CLINKX_CONTEXT_BUILDER_RUNS_DIR` for the server, set the same value for the dashboard.
303
+ Point the dashboard at the same `CLINKX_WORKFLOWS_STATE_DIR` as the ClinkX server. If the two directories differ, the dashboard shows a different run set, often an empty one. If you set `CLINKX_CONTEXT_BUILDER_RUNS_DIR` for the server, set the same value for the dashboard. If the dashboard shows only runs from before an upgrade, it still reads the old directories.
251
304
 
252
305
  The dashboard does not start, cancel, or approve anything. The data that it shows can contain prompts, outputs, and file contents from your workspace. Access is local and needs a passkey, but any process that runs as the same OS user can read the state directory.
253
306
 
@@ -1,5 +1,7 @@
1
1
  import { sep } from "node:path";
2
+ import { assertRootRepresentable } from "./root-path-validation.js";
2
3
  export function artifactOnlyEnvEntry(root) {
4
+ assertRootRepresentable(root, "Allowed root");
3
5
  return root.endsWith(sep) ? `${root}.` : `${root}${sep}.`;
4
6
  }
5
7
  //# sourceMappingURL=allowed-roots.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"allowed-roots.js","sourceRoot":"","sources":["../src/allowed-roots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC;AAC5D,CAAC"}
1
+ {"version":3,"file":"allowed-roots.js","sourceRoot":"","sources":["../src/allowed-roots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,uBAAuB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { NormalizedWorkflowDefinition } from "../definition-normalizer.js";
2
+ import type { RecipeSeatPlan } from "../recipe-seats.js";
3
+ import { type FreezeAdmissionOptions } from "../architecture-comparison/admission.js";
4
+ /** Replaced in the author template with the seat's exploration direction. */
5
+ export declare const EXPLORATION_DIRECTION_MARKER = "[[EXPLORATION_DIRECTION]]";
6
+ export declare function arenaTopology(count: number): unknown;
7
+ /**
8
+ * Admission for `architecture-arena` (2-3, 2-4, 2-6 step one). Pure: returns
9
+ * the materialized definition (n ordinary author calls, judge route) and the
10
+ * variables carrying the server-owned seat plan. Runs before preflight and
11
+ * before any run state; every throw becomes `-32602`.
12
+ */
13
+ export declare function materializeArchitectureArena(definition: NormalizedWorkflowDefinition, variables: Readonly<Record<string, unknown>>, seatPlan: RecipeSeatPlan | undefined, admission?: FreezeAdmissionOptions): {
14
+ definition: NormalizedWorkflowDefinition;
15
+ variables: Record<string, unknown>;
16
+ };
@@ -0,0 +1,107 @@
1
+ import { createHash } from "node:crypto";
2
+ import { getMaxPromptBytes } from "../config.js";
3
+ import { DEFAULT_RESERVE_BYTES } from "../prompt-budget.js";
4
+ import { canonicalJson } from "../recipe-shared/evidence.js";
5
+ import { assertFreezeFileCapacity } from "../architecture-comparison/admission.js";
6
+ import { ARENA_AUTHOR_CALL_IDS, ARENA_MAX_CANDIDATES, ARENA_MIN_CANDIDATES, ARENA_SEAT_PLAN_VARIABLE, ARENA_WORKFLOW, ArenaSeatPlanSchema, MAX_JUDGE_BYTES, MAX_VIEW_BYTES, RouteSchema, } from "./contract.js";
7
+ /** Replaced in the author template with the seat's exploration direction. */
8
+ export const EXPLORATION_DIRECTION_MARKER = "[[EXPLORATION_DIRECTION]]";
9
+ const DEFAULT_DIRECTION = "No specific direction was assigned; design the candidate you judge strongest for the shared requirements.";
10
+ /** Seed topology in workflows/architecture-arena.yaml; authors are materialized from `candidates.author`. */
11
+ const SEED_TOPOLOGY = [["freeze", ["input"]], ["candidates", ["author"]], ["judge_view", ["view"]], ["judge", ["judge"]], ["comparison", ["record"]]];
12
+ export function arenaTopology(count) {
13
+ return [["freeze", ["input"]], ["candidates", ARENA_AUTHOR_CALL_IDS.slice(0, count)], ["judge_view", ["view"]], ["judge", ["judge"]], ["comparison", ["record"]]];
14
+ }
15
+ function route(seat) {
16
+ return RouteSchema.parse({
17
+ cli_name: seat.cli_name,
18
+ ...(seat.model !== undefined ? { model: seat.model } : {}),
19
+ ...(seat.effort !== undefined ? { effort: seat.effort } : {}),
20
+ });
21
+ }
22
+ /**
23
+ * Admission for `architecture-arena` (2-3, 2-4, 2-6 step one). Pure: returns
24
+ * the materialized definition (n ordinary author calls, judge route) and the
25
+ * variables carrying the server-owned seat plan. Runs before preflight and
26
+ * before any run state; every throw becomes `-32602`.
27
+ */
28
+ export function materializeArchitectureArena(definition, variables, seatPlan, admission) {
29
+ if (definition.name !== ARENA_WORKFLOW)
30
+ throw new Error("architecture arena admission received another workflow");
31
+ if (seatPlan?.workflow !== ARENA_WORKFLOW)
32
+ throw new Error("architecture-arena requires members (authors) and chairman (judge)");
33
+ const n = seatPlan.authors.length;
34
+ if (n < ARENA_MIN_CANDIDATES || n > ARENA_MAX_CANDIDATES)
35
+ throw new Error(`architecture-arena admits ${ARENA_MIN_CANDIDATES}-${ARENA_MAX_CANDIDATES} authors, got ${n}`);
36
+ const supplied = variables[ARENA_SEAT_PLAN_VARIABLE];
37
+ if (supplied !== undefined && supplied !== "")
38
+ throw new Error(`${ARENA_SEAT_PLAN_VARIABLE} is server-materialized from members and chairman; do not supply it`);
39
+ for (const name of ["user_request", "source_identity"]) {
40
+ const value = variables[name];
41
+ const cap = name === "user_request" ? 16 * 1024 : 2000;
42
+ if (typeof value !== "string" || value.trim() === "" || Buffer.byteLength(value, "utf8") > cap)
43
+ throw new Error(`${name} must be nonblank and at most ${cap} UTF-8 bytes`);
44
+ }
45
+ assertFreezeFileCapacity(definition, variables, admission);
46
+ const shape = definition.stages.map((stage) => [stage.id, stage.calls.map((call) => call.id)]);
47
+ if (canonicalJson(shape) !== canonicalJson(SEED_TOPOLOGY))
48
+ throw new Error("architecture-arena workflow topology does not match its v2 seed");
49
+ const judgeCall = definition.stages.find((stage) => stage.id === "judge").calls[0];
50
+ const worstCase = MAX_VIEW_BYTES + MAX_JUDGE_BYTES + DEFAULT_RESERVE_BYTES + Buffer.byteLength(judgeCall.prompt, "utf8");
51
+ if (worstCase > getMaxPromptBytes())
52
+ throw new Error(`architecture-arena worst-case judge input and response reserve (${worstCase} bytes) exceeds workflow prompt budget`);
53
+ const tokenLimit = variables["judge_prompt_token_limit"];
54
+ if (tokenLimit !== undefined && (!Number.isSafeInteger(tokenLimit) || tokenLimit < worstCase))
55
+ throw new Error(`judge_prompt_token_limit must cover the conservative byte-token upper bound ${worstCase}; shorten the contract or use a larger route`);
56
+ const plan = ArenaSeatPlanSchema.parse({
57
+ schema_version: "architecture-arena-seats-v2",
58
+ authors: seatPlan.authors.map((seat, index) => ({
59
+ member_index: index,
60
+ call_id: ARENA_AUTHOR_CALL_IDS[index],
61
+ route: route(seat),
62
+ ...(seat.stance !== undefined ? { stance: seat.stance } : {}),
63
+ })),
64
+ judge: route(seatPlan.judge),
65
+ });
66
+ const seed = definition.stages.find((stage) => stage.id === "candidates").calls[0];
67
+ if (!seed.prompt.includes(EXPLORATION_DIRECTION_MARKER))
68
+ throw new Error("architecture-arena author template lacks its exploration-direction marker");
69
+ const authors = plan.authors.map((author) => {
70
+ const { model: _model, effort: _effort, ...base } = seed;
71
+ // Stance never contains `{{`/`}}` (seat parser), so it cannot become a
72
+ // template placeholder; it is a direction, not an acceptance change. The
73
+ // callback keeps `$&`/`$$`-style replacement patterns in it literal.
74
+ const direction = author.stance ?? DEFAULT_DIRECTION;
75
+ const prompt = seed.prompt.replace(EXPLORATION_DIRECTION_MARKER, () => direction);
76
+ return {
77
+ ...base,
78
+ id: author.call_id,
79
+ ...author.route,
80
+ role: "json",
81
+ prompt,
82
+ template_hash: createHash("sha256").update(prompt, "utf8").digest("hex"),
83
+ };
84
+ });
85
+ const judgeRoute = plan.judge;
86
+ const stages = definition.stages.map((stage) => {
87
+ if (stage.id === "candidates")
88
+ return { ...stage, calls: authors };
89
+ return {
90
+ ...stage,
91
+ calls: stage.calls.map((call) => {
92
+ if (stage.id === "judge") {
93
+ const { model: _model, effort: _effort, ...base } = call;
94
+ return { ...base, ...judgeRoute, role: "json" };
95
+ }
96
+ // Reducers never dispatch; they carry the judge CLI only so the
97
+ // engine's advertised-CLI check sees no foreign adapter name.
98
+ return call.reducer === undefined ? call : { ...call, cli_name: judgeRoute.cli_name };
99
+ }),
100
+ };
101
+ });
102
+ return {
103
+ definition: { ...definition, stages },
104
+ variables: { ...variables, [ARENA_SEAT_PLAN_VARIABLE]: canonicalJson(plan) },
105
+ };
106
+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