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
@@ -10,13 +10,13 @@ import { invocationAuditV2PersistenceEnabled } from "../../clinkx-workflows/dist
10
10
  import { assertContextBuilderAnchorSufficiency } from "./anchors.js";
11
11
  import { writeContextBuilderFinalArtifacts, } from "./bundle.js";
12
12
  import { CONTEXT_BUILDER_INTERNAL_CAP_DEFAULTS, getSharedContextBuilderSemaphore, resolveContextBuilderRunsDir, } from "./config.js";
13
- import { buildContextBuilderCuratorPacket, buildContextBuilderFinalizerPacket, CONTEXT_BUILDER_DELEGATE_PACKET_CAP_PROFILE_DEFAULTS, contextBuilderCandidateId, countDelegatePacketObligationTruncation, } from "./delegate-packet.js";
13
+ import { buildContextBuilderCuratorPacket, buildContextBuilderFinalizerPacket, CONTEXT_BUILDER_DELEGATE_PACKET_CAP_PROFILE_DEFAULTS, CONTEXT_BUILDER_REVIEW_EVIDENCE_PRUNED_OMISSION_REASON, contextBuilderCandidateId, countDelegatePacketObligationTruncation, } from "./delegate-packet.js";
14
14
  import { reconstructContextBuilderDelegateSelection, reconstructContextBuilderDelegateSelectionWithReport, } from "./delegate-reconstruction.js";
15
15
  import { assertNoDisabledFinalizerInvocationOverrides, resolveContextBuilderFinalizerEffectiveEnabled, } from "./delegate-finalizer-effective.js";
16
16
  import { runContextBuilderDelegateCall, } from "./delegate.js";
17
17
  import { recordContextInvocationAudit } from "./invocation-sidecar.js";
18
18
  import { classifyFinalizerExternalGaps, } from "./external-gaps.js";
19
- import { ContextBuilderFinalizerRejectionError, MAX_FINALIZER_EXTERNAL_GAPS, validateContextBuilderCuratorOutput, validateContextBuilderDelegateCoverageSelection, validateContextBuilderFinalizerOutput, } from "./delegate-validation.js";
19
+ import { ContextBuilderFinalizerRejectionError, MAX_FINALIZER_EXTERNAL_GAPS, validateContextBuilderCuratorOutput, findContextBuilderDelegateCoverageGaps, validateContextBuilderFinalizerOutput, } from "./delegate-validation.js";
20
20
  import { discoverContextBuilderCandidates, mergeLineRanges, secretRedactionWarning, } from "./discovery.js";
21
21
  import { createScanProgressPublisher } from "./discovery-progress.js";
22
22
  import { withContextBuilderDiscoveryWatchdog } from "./discovery-watchdog.js";
@@ -40,7 +40,7 @@ import { admitJournalContextGeneration } from "./session-log-identity.js";
40
40
  import { estimateContextBuilderTokensFromUtf8Bytes } from "./token-estimate.js";
41
41
  let defaultAdapterRegistry;
42
42
  const artifactOnlyAllowedRoots = new Set();
43
- const CONTEXT_BUILDER_DELEGATE_PROMPT_VERSION = "cb-delegate-v6-gap-ancestors";
43
+ const CONTEXT_BUILDER_DELEGATE_PROMPT_VERSION = "cb-delegate-v7-advisory-coverage";
44
44
  const MAX_DELEGATE_MINIMUM_OUTPUT_SELECTIONS = 24;
45
45
  export async function handleContextBuilder(args, options = {}) {
46
46
  const input = parseContextBuilderInput(args);
@@ -545,17 +545,44 @@ function evaluateSelectionCoverage(input) {
545
545
  selectedRanges: input.selected,
546
546
  });
547
547
  }
548
- function delegateCoverageSelectionFailure(selected, candidates, coveragePolicy) {
549
- try {
550
- validateContextBuilderDelegateCoverageSelection(selected.map((file) => ({
551
- candidate_id: contextBuilderCandidateId(file.root_index, file.path),
552
- ranges: file.ranges,
553
- })), candidates, coveragePolicy);
554
- return null;
548
+ // D7: review coverage gaps are non-fatal. One aggregated warning per stage, so
549
+ // a wide no-focus search cannot flood the receipt; terminal review_deep_v1
550
+ // coverage reports the consequence as `degraded`.
551
+ function delegateCoverageSelectionWarnings(selected, candidates, coveragePolicy) {
552
+ const gaps = findContextBuilderDelegateCoverageGaps(selected.map((file) => ({
553
+ candidate_id: contextBuilderCandidateId(file.root_index, file.path),
554
+ ranges: file.ranges,
555
+ })), candidates, coveragePolicy);
556
+ if (gaps.length === 0) {
557
+ return [];
555
558
  }
556
- catch (error) {
557
- return error instanceof Error ? error.message : String(error);
559
+ const shown = gaps.slice(0, REVIEW_EVIDENCE_WARNING_MAX_ENTRIES);
560
+ const dropped = gaps.length - shown.length;
561
+ return [
562
+ delegateWarning(DELEGATE_REVIEW_COVERAGE_GAP_WARNING_CODE, `delegate selection leaves ${gaps.length} review coverage gap(s); review_deep_v1 coverage is degraded: ${shown.join("; ")}${dropped > 0 ? ` (+${dropped} more)` : ""}`),
563
+ ];
564
+ }
565
+ // Warnings are bounded to MAX_DIAGNOSTIC_TEXT_LENGTH on output; a few entries
566
+ // plus the total count keep the message useful within that bound.
567
+ const REVIEW_EVIDENCE_WARNING_MAX_ENTRIES = 3;
568
+ const DELEGATE_REVIEW_COVERAGE_GAP_WARNING_CODE = "delegate_review_coverage_gap";
569
+ const DELEGATE_PACKET_REVIEW_EVIDENCE_PRUNED_WARNING_CODE = "delegate_packet_review_evidence_pruned";
570
+ const DELEGATE_EXTERNAL_GAP_UNRESOLVED_WARNING_CODE = "delegate_external_gap_unresolved";
571
+ // The packet aggregates pruned protected review evidence into one omission;
572
+ // surface it as a non-fatal warning (D7) instead of a delegate failure.
573
+ function packetReviewEvidencePrunedWarning(packet) {
574
+ const pruned = packet.omissions.find((omission) => omission.reason === CONTEXT_BUILDER_REVIEW_EVIDENCE_PRUNED_OMISSION_REASON);
575
+ if (pruned == null) {
576
+ return undefined;
558
577
  }
578
+ const paths = pruned.paths ?? [];
579
+ const total = paths.length + (pruned.omitted_path_count ?? 0);
580
+ const shown = boundContextBuilderPathList(paths, REVIEW_EVIDENCE_WARNING_MAX_ENTRIES);
581
+ const dropped = total - shown.length;
582
+ return {
583
+ code: DELEGATE_PACKET_REVIEW_EVIDENCE_PRUNED_WARNING_CODE,
584
+ message: `delegate packet could not carry ${total} review target or regression-link path(s); review_deep_v1 coverage may be degraded: ${shown.join(", ")}${dropped > 0 ? ` (+${dropped} more)` : ""}`,
585
+ };
559
586
  }
560
587
  async function rejectArtifactOnlySourceRoots(inputRoots, input) {
561
588
  if (artifactOnlyAllowedRoots.size === 0) {
@@ -876,6 +903,7 @@ async function resolveDelegateSelection(input) {
876
903
  delegatePacketSize = curatorPacket.metrics.packet_estimated_tokens;
877
904
  delegatePacketCompaction = curatorPacket.metrics.compaction;
878
905
  recordPacketEvidenceWarning(curatorPacket.evidence_warning);
906
+ recordPacketEvidenceWarning(packetReviewEvidencePrunedWarning(curatorPacket));
879
907
  recordPacketEvidenceWarning(packetObligationTruncationWarning(input.discovery.review_obligations, curatorPacket.coverage_policy));
880
908
  const curatorPacketRequestedOmissions = curatorPacket.omissions.filter(isRequestedEvidenceOmission);
881
909
  if (curatorPacketRequestedOmissions.length > 0) {
@@ -968,7 +996,6 @@ async function resolveDelegateSelection(input) {
968
996
  candidates: curatorPacket.candidates,
969
997
  budget: input.input.budget,
970
998
  allowSecrets: input.input.allow_secrets,
971
- coveragePolicy: curatorPacket.coverage_policy,
972
999
  });
973
1000
  curatorProposal = augmentCuratorProposalWithDeterministicBaseline(validatedCuratorProposal, curatorPacket, input.input.budget.max_files);
974
1001
  curatorSelection = reconstructContextBuilderDelegateSelection({
@@ -1051,23 +1078,12 @@ async function resolveDelegateSelection(input) {
1051
1078
  const omissionCount = input.baselineOmissions.length +
1052
1079
  input.discovery.omissions.length +
1053
1080
  repairedSelection.selection.omissions.length;
1054
- const delegateEvidenceCoverageFailure = delegateCoverageSelectionFailure(restoreDroppedDegenerateReviewTargetsForValidation({
1081
+ warnings.push(...delegateCoverageSelectionWarnings(restoreDroppedDegenerateReviewTargetsForValidation({
1055
1082
  preRepairSelected: curatorSelection.selected,
1056
1083
  postRepairSelected: repairedSelection.selection.selected,
1057
1084
  candidates: curatorPacket.candidates,
1058
1085
  coveragePolicy: curatorPacket.coverage_policy,
1059
- }), curatorPacket.candidates, curatorPacket.coverage_policy);
1060
- if (delegateEvidenceCoverageFailure != null) {
1061
- return handleDelegateRuntimeFailure({
1062
- delegate,
1063
- discoveryMetrics: input.discovery.metrics,
1064
- reason: `post-repair evidence coverage failed: ${delegateEvidenceCoverageFailure}`,
1065
- deterministicSelection: input.deterministicSelection,
1066
- omissionCount,
1067
- candidateFallbackCount,
1068
- observability: currentDelegateObservability(),
1069
- });
1070
- }
1086
+ }), curatorPacket.candidates, curatorPacket.coverage_policy));
1071
1087
  // Re-verify required-focus presence against the actual returned selection.
1072
1088
  // The curator-only branch does not fold required-focus ranges, so it checks
1073
1089
  // whole-file presence here; range coverage is re-verified only in the
@@ -1122,6 +1138,7 @@ async function resolveDelegateSelection(input) {
1122
1138
  delegatePacketSize = finalizerPacket.metrics.packet_estimated_tokens;
1123
1139
  delegatePacketCompaction = finalizerPacket.metrics.compaction;
1124
1140
  recordPacketEvidenceWarning(finalizerPacket.evidence_warning);
1141
+ recordPacketEvidenceWarning(packetReviewEvidencePrunedWarning(finalizerPacket));
1125
1142
  recordPacketEvidenceWarning(packetObligationTruncationWarning(input.discovery.review_obligations, finalizerPacket.coverage_policy));
1126
1143
  const finalizerPacketRequestedOmissions = finalizerPacket.omissions.filter(isRequestedEvidenceOmission);
1127
1144
  if (finalizerPacketRequestedOmissions.length > 0) {
@@ -1190,7 +1207,6 @@ async function resolveDelegateSelection(input) {
1190
1207
  budget: input.input.budget,
1191
1208
  minScore: delegate.finalizer.min_score,
1192
1209
  allowSecrets: input.input.allow_secrets,
1193
- coveragePolicy: finalizerPacket.coverage_policy,
1194
1210
  });
1195
1211
  const externalGaps = classifyFinalizerExternalGaps({
1196
1212
  gaps: finalizerProposal.external_gaps,
@@ -1205,14 +1221,21 @@ async function resolveDelegateSelection(input) {
1205
1221
  : { excludedRealRoots: input.excludedRealRoots }),
1206
1222
  });
1207
1223
  // A rejected gap means the finalizer mis-described the packet (it named
1208
- // in-packet or focused evidence, or a path that is not local at all);
1209
- // that is invalid output under either gap policy.
1210
- const externalGapFailure = externalGaps.rejected.length > 0
1211
- ? formatExternalGapRejectionFailure(externalGaps.rejected)
1212
- : externalGaps.external.length > 0 &&
1213
- delegate.external_gap_policy === "fail"
1224
+ // in-packet or focused evidence, or a path that is not provably local);
1225
+ // that is invalid output under either gap policy. The one exception (D7):
1226
+ // under degrade, a confirmed in-root ENOENT is plausible missing evidence
1227
+ // (e.g. a file the change should have added), so it warns instead.
1228
+ const degradeGaps = delegate.external_gap_policy === "degrade";
1229
+ const unresolvedExternalGaps = degradeGaps
1230
+ ? externalGaps.rejected.filter(isUnresolvedExternalGap)
1231
+ : [];
1232
+ const fatalRejectedGaps = externalGaps.rejected.filter((gap) => !unresolvedExternalGaps.includes(gap));
1233
+ const externalGapFailure = fatalRejectedGaps.length > 0
1234
+ ? formatExternalGapRejectionFailure(fatalRejectedGaps, { degrade: degradeGaps })
1235
+ : externalGaps.external.length > 0 && !degradeGaps
1214
1236
  ? formatExternalGapPolicyFailure(externalGaps.external)
1215
1237
  : null;
1238
+ const degradedByGaps = externalGaps.external.length > 0 || unresolvedExternalGaps.length > 0;
1216
1239
  if (externalGapFailure != null) {
1217
1240
  return handleDelegateRuntimeFailure({
1218
1241
  delegate,
@@ -1310,20 +1333,7 @@ async function resolveDelegateSelection(input) {
1310
1333
  budget: input.input.budget,
1311
1334
  expandSelectedFiles: false,
1312
1335
  });
1313
- const delegateEvidenceCoverageFailure = delegateCoverageSelectionFailure(repairedSelection.selection.selected, finalizerPacket.candidates, finalizerPacket.coverage_policy);
1314
- if (delegateEvidenceCoverageFailure != null) {
1315
- return handleDelegateRuntimeFailure({
1316
- delegate,
1317
- discoveryMetrics: input.discovery.metrics,
1318
- reason: `post-repair evidence coverage failed: ${delegateEvidenceCoverageFailure}`,
1319
- deterministicSelection: input.deterministicSelection,
1320
- omissionCount: input.baselineOmissions.length +
1321
- input.discovery.omissions.length +
1322
- repairedSelection.selection.omissions.length,
1323
- candidateFallbackCount,
1324
- observability: currentDelegateObservability(),
1325
- });
1326
- }
1336
+ const reviewCoverageWarnings = delegateCoverageSelectionWarnings(repairedSelection.selection.selected, finalizerPacket.candidates, finalizerPacket.coverage_policy);
1327
1337
  // D1 backstop: required-first reconstruction plus the completeness gate
1328
1338
  // above should make this unreachable. It fails closed if a server-side
1329
1339
  // change ever lets a non-degenerate required-focus file vanish while
@@ -1390,7 +1400,9 @@ async function resolveDelegateSelection(input) {
1390
1400
  }));
1391
1401
  warnings.push(...packetEvidenceWarnings);
1392
1402
  appendDelegateRepairWarnings(warnings, repairedSelection);
1403
+ warnings.push(...reviewCoverageWarnings);
1393
1404
  warnings.push(...externalGapWarnings(externalGaps.external));
1405
+ warnings.push(...unresolvedExternalGapWarnings(unresolvedExternalGaps));
1394
1406
  const openQuestions = curatorProposal.open_questions.map((question) => sanitizeDiagnosticText(question));
1395
1407
  const omissionCount = input.baselineOmissions.length +
1396
1408
  input.discovery.omissions.length +
@@ -1407,8 +1419,8 @@ async function resolveDelegateSelection(input) {
1407
1419
  enabled: true,
1408
1420
  // partial WITHOUT fallback is the degrade signature: the curated
1409
1421
  // selection is used as-is, but conclusions resting on the reported
1410
- // external gaps are conditional.
1411
- status: externalGaps.external.length === 0 ? "succeeded" : "partial",
1422
+ // external (or unresolved) gaps are conditional.
1423
+ status: degradedByGaps ? "partial" : "succeeded",
1412
1424
  failure_policy: delegate.failure_policy,
1413
1425
  fallback_used: false,
1414
1426
  curator: delegateProviderReceiptMetadata(delegate.curator),
@@ -2274,18 +2286,16 @@ function totalSelectedRangeLines(ranges) {
2274
2286
  return ranges.reduce((total, range) => total + Math.max(0, range.end_line - range.start_line + 1), 0);
2275
2287
  }
2276
2288
  /**
2277
- * Renders the server-enforced coverage obligations as explicit prompt rules.
2289
+ * Renders the review coverage obligations as explicit prompt rules.
2278
2290
  *
2279
- * The obligations are already present in the serialized packet, but the packet
2280
- * alone never told the delegate they were MANDATORY, so a schema-valid proposal
2281
- * could miss one and be rejected by
2282
- * {@link validateContextBuilderDelegateCoverageSelection}.
2291
+ * D7: obligations are advisory. Only caller focus is required evidence; a
2292
+ * selection that leaves a target uncovered is accepted, warned about, and
2293
+ * reported as degraded review coverage. The rules still ask for coverage
2294
+ * because degraded coverage is the worse bundle.
2283
2295
  *
2284
- * Branch selection here tracks that validator's branch selection: it enters the
2285
- * obligation branch on `obligations != null`, NOT on a non-empty target list.
2286
- * Branching on `targets.length > 0` instead would render the satisfiable
2287
- * evidence-class contract for a packet the validator rejects outright, i.e.
2288
- * instruct the delegate to do something that provably cannot pass.
2296
+ * Branch selection here tracks {@link findContextBuilderDelegateCoverageGaps}:
2297
+ * it enters the obligation branch on `obligations != null`, NOT on a non-empty
2298
+ * target list, so the rendered contract always matches what the server checks.
2289
2299
  */
2290
2300
  function packetCoverageObligationRules(packet) {
2291
2301
  if (packet == null || typeof packet !== "object") {
@@ -2307,19 +2317,17 @@ function packetCoverageObligationRules(packet) {
2307
2317
  if (obligations != null && typeof obligations === "object") {
2308
2318
  const targets = obligations["targets"];
2309
2319
  if (!Array.isArray(targets) || targets.length === 0) {
2310
- // The validator rejects a present-but-empty target list unconditionally,
2311
- // so no instruction rendered here could be satisfied. Stay silent rather
2312
- // than describe a contract the delegate cannot meet. (The server building
2313
- // a packet it will always reject is a separate defect; do not paper over
2314
- // it by rendering the evidence-class rules the validator will not apply.)
2320
+ // A present-but-empty target list can never report satisfied coverage,
2321
+ // so there is nothing a delegate could act on. Stay silent rather than
2322
+ // render the evidence-class rules the server will not apply here.
2315
2323
  return [];
2316
2324
  }
2317
2325
  return [
2318
- "Coverage obligations (mandatory, server-enforced):",
2319
- "- packet.coverage_policy.obligations.targets is required coverage, not a suggestion. Server validation rejects your output if any obligation below is unmet, even when every other rule is satisfied.",
2320
- "- For EVERY target: selected MUST contain that target's candidate_id with at least one range that overlaps one of that target's ranges.",
2321
- "- For EVERY target whose regression_links is non-empty: selected MUST also contain at least ONE of those links' candidate_id with an overlapping range. One linked candidate per target is sufficient; you do not need all of them.",
2322
- "- Obligations hold even when the task reads narrower than the obligation set. Add the obligation candidates alongside your task-driven picks rather than dropping them.",
2326
+ "Review coverage obligations (strongly preferred; the server does not reject output for them):",
2327
+ "- packet.coverage_policy.obligations.targets lists the review targets this run should cover. Output that leaves a target uncovered is accepted, but the run then reports degraded review coverage.",
2328
+ "- For every target: include that target's candidate_id with at least one range that overlaps one of that target's ranges.",
2329
+ "- For every target whose regression_links is non-empty: also include at least ONE of those links' candidate_id with an overlapping range. One linked candidate per target is sufficient; you do not need all of them.",
2330
+ "- Keep these candidates even when the task reads narrower than the obligation set; add them alongside your task-driven picks.",
2323
2331
  ];
2324
2332
  }
2325
2333
  const classes = requiredClasses.filter((entry) => typeof entry === "string");
@@ -2327,9 +2335,9 @@ function packetCoverageObligationRules(packet) {
2327
2335
  return [];
2328
2336
  }
2329
2337
  return [
2330
- "Coverage obligations (mandatory, server-enforced):",
2331
- `- packet.coverage_policy.required_when_available lists required evidence classes: ${classes.join(", ")}.`,
2332
- "- For every listed class that ANY packet candidate carries in its evidence_classes, selected MUST include at least one candidate carrying that class. Server validation rejects your output otherwise.",
2338
+ "Review coverage obligations (strongly preferred; the server does not reject output for them):",
2339
+ `- packet.coverage_policy.required_when_available lists the review evidence classes: ${classes.join(", ")}.`,
2340
+ "- For every listed class that ANY packet candidate carries in its evidence_classes, include at least one candidate carrying that class; otherwise the run reports degraded review coverage.",
2333
2341
  ];
2334
2342
  }
2335
2343
  /**
@@ -2454,7 +2462,9 @@ function finalizerExternalGapRules(policy) {
2454
2462
  return [
2455
2463
  "External gaps:",
2456
2464
  `- Evidence the task needs that is ABSENT from packet.candidates goes in external_gaps as [{"path":"<root-relative path>","reason":"<why the task needs it>"}] (at most ${MAX_FINALIZER_EXTERNAL_GAPS} entries). Never lower score for it.`,
2457
- "- Never list a path that is in packet.candidates or under a focus path in external_gaps; the server verifies every entry and rejects the whole answer if one is wrong.",
2465
+ policy === "degrade"
2466
+ ? "- Never list a path that is in packet.candidates or under a focus path in external_gaps; the server verifies every entry and rejects the whole answer if one is wrong. A listed path that does not exist under the source roots is kept only as an unresolved warning."
2467
+ : "- Never list a path that is in packet.candidates or under a focus path in external_gaps; the server verifies every entry and rejects the whole answer if one is wrong.",
2458
2468
  "- Never list a directory that contains a packet.candidates path or a focus path; name the specific missing file instead.",
2459
2469
  "- If evidence present in packet.candidates is insufficient, that is still approved:false with concrete omissions, not an external gap.",
2460
2470
  policy === "degrade"
@@ -2540,115 +2550,6 @@ export function renderDelegatePrompt(stage, packet, options) {
2540
2550
  "Return the JSON object now. If candidates exist, selected must be non-empty.",
2541
2551
  ].join("\n");
2542
2552
  }
2543
- /**
2544
- * True when `selections` would clear the packet's coverage obligations.
2545
- *
2546
- * Mirrors {@link validateContextBuilderDelegateCoverageSelection}: every target
2547
- * needs an overlapping selected range, and a target with regression links needs
2548
- * an overlapping range from at least ONE of them (the link check is disjunctive).
2549
- */
2550
- function selectionsSatisfyPacketObligations(selections, packet) {
2551
- if (packet == null || typeof packet !== "object") {
2552
- return true;
2553
- }
2554
- const policy = packet["coverage_policy"];
2555
- if (policy == null || typeof policy !== "object") {
2556
- return true;
2557
- }
2558
- const policyRecord = policy;
2559
- if (policyRecord["policy_id"] !== "review_deep_v1") {
2560
- return true;
2561
- }
2562
- const requiredClasses = policyRecord["required_when_available"];
2563
- if (!Array.isArray(requiredClasses) || requiredClasses.length === 0) {
2564
- return true;
2565
- }
2566
- const obligations = policyRecord["obligations"];
2567
- if (obligations == null || typeof obligations !== "object") {
2568
- // The validator does NOT concede this branch: it falls through to the
2569
- // evidence-class check and still rejects a selection that omits an
2570
- // available required class. Returning true here would advertise an example
2571
- // the validator rejects. Unreachable through the current packet builder
2572
- // (normalizeCoveragePolicy attaches obligations for every review_deep_v1
2573
- // policy), but the two must not disagree — that divergence is the bug
2574
- // generator this whole change exists to close.
2575
- const candidates = packet["candidates"];
2576
- if (!Array.isArray(candidates)) {
2577
- return true;
2578
- }
2579
- const selectedIds = new Set(selections.map((selection) => selection.candidate_id));
2580
- const evidenceClassesOf = (candidate) => {
2581
- if (candidate == null || typeof candidate !== "object") {
2582
- return [];
2583
- }
2584
- const classes = candidate["evidence_classes"];
2585
- return Array.isArray(classes) ? classes : [];
2586
- };
2587
- return requiredClasses.every((evidenceClass) => {
2588
- const available = candidates.some((candidate) => evidenceClassesOf(candidate).includes(evidenceClass));
2589
- if (!available) {
2590
- return true;
2591
- }
2592
- return candidates.some((candidate) => {
2593
- const id = candidate != null && typeof candidate === "object"
2594
- ? candidate["id"]
2595
- : undefined;
2596
- return (typeof id === "string" &&
2597
- selectedIds.has(id) &&
2598
- evidenceClassesOf(candidate).includes(evidenceClass));
2599
- });
2600
- });
2601
- }
2602
- const targets = obligations["targets"];
2603
- if (!Array.isArray(targets)) {
2604
- return true;
2605
- }
2606
- if (targets.length === 0) {
2607
- // The validator rejects a present-but-empty target list unconditionally, so
2608
- // no example can be valid.
2609
- return false;
2610
- }
2611
- const selectedById = new Map(selections.map((selection) => [selection.candidate_id, selection.ranges]));
2612
- const covers = (value) => {
2613
- if (value == null || typeof value !== "object") {
2614
- return false;
2615
- }
2616
- const record = value;
2617
- const candidateId = record["candidate_id"];
2618
- if (typeof candidateId !== "string") {
2619
- return false;
2620
- }
2621
- const selectedRanges = selectedById.get(candidateId);
2622
- if (selectedRanges == null || selectedRanges.length === 0) {
2623
- return false;
2624
- }
2625
- const obligationRanges = record["ranges"];
2626
- if (!Array.isArray(obligationRanges) || obligationRanges.length === 0) {
2627
- return false;
2628
- }
2629
- return obligationRanges.some((range) => {
2630
- if (range == null || typeof range !== "object") {
2631
- return false;
2632
- }
2633
- const start = range["start_line"];
2634
- const end = range["end_line"];
2635
- if (typeof start !== "number" || typeof end !== "number") {
2636
- return false;
2637
- }
2638
- return selectedRanges.some((selectedRange) => selectedRange.start_line <= end && start <= selectedRange.end_line);
2639
- });
2640
- };
2641
- return targets.every((target) => {
2642
- if (!covers(target)) {
2643
- return false;
2644
- }
2645
- const links = target["regression_links"];
2646
- if (!Array.isArray(links) || links.length === 0) {
2647
- return true;
2648
- }
2649
- return links.some((link) => covers(link));
2650
- });
2651
- }
2652
2553
  /** The packet's `budget.max_files`, when it carries a usable one. */
2653
2554
  function packetBudgetMaxFiles(packet) {
2654
2555
  if (packet == null || typeof packet !== "object") {
@@ -2681,12 +2582,9 @@ function buildMinimumDelegateOutput(stage, packet, minScore) {
2681
2582
  if (minimumSelections.length === 0) {
2682
2583
  return null;
2683
2584
  }
2684
- // Neither bound ranks obligations first, so a required target can fall outside
2685
- // the cap — offering an example that fails coverage validation. Withhold the
2686
- // example rather than advertise an invalid one.
2687
- if (!selectionsSatisfyPacketObligations(minimumSelections, packet)) {
2688
- return null;
2689
- }
2585
+ // Review coverage obligations are advisory (D7), so an example that leaves a
2586
+ // target uncovered is still valid output; it degrades coverage rather than
2587
+ // failing. Offering it beats an unsure delegate emitting an empty selection.
2690
2588
  const selected = minimumSelections.map((selection) => ({
2691
2589
  candidate_id: selection.candidate_id,
2692
2590
  ranges: selection.ranges.map((range) => ({
@@ -2882,6 +2780,8 @@ function finalizerScoreDiagnostic(json, minScore) {
2882
2780
  : `; min_score=${minScore}`;
2883
2781
  }
2884
2782
  const FINALIZER_REJECTION_LEVERS = 'levers: add missing path(s) to focus_paths (workflow: cb_focus_paths); exclude vendor/generated dirs via exclude_globs (workflow: cb_exclude_globs); or set external_gap_policy:"degrade" (workflow: cb_delegate.external_gap_policy)';
2783
+ // Same levers minus the one already in effect.
2784
+ const FINALIZER_REJECTION_LEVERS_UNDER_DEGRADE = "levers: add missing path(s) to focus_paths (workflow: cb_focus_paths) or exclude vendor/generated dirs via exclude_globs (workflow: cb_exclude_globs)";
2885
2785
  // Verdict-first text for a finalizer veto: what the finalizer said (approval,
2886
2786
  // its own omission list) leads, because that is what the caller acts on; the
2887
2787
  // score and packet diagnostics trail. Each omission is provider text, so it is
@@ -2919,12 +2819,23 @@ function formatExternalGapEntries(entries) {
2919
2819
  const dropped = entries.length - shown.length;
2920
2820
  return `${entries.length}: ${shown.join("; ")}${dropped > 0 ? ` (+${dropped} more external gaps)` : ""}`;
2921
2821
  }
2922
- function formatExternalGapRejectionFailure(rejected) {
2822
+ function formatExternalGapRejectionFailure(rejected, options) {
2923
2823
  return [
2924
- `finalizer_validation: external_gaps rejected=${formatExternalGapEntries(rejected.map((gap) => ({ path: gap.path, detail: gap.why })))}`,
2925
- FINALIZER_REJECTION_LEVERS,
2824
+ `finalizer_validation: external_gaps rejected=${formatExternalGapEntries(rejected.map((gap) => ({
2825
+ path: gap.path,
2826
+ detail: gap.existence == null ? gap.why : `${gap.why}: ${gap.existence}`,
2827
+ })))}`,
2828
+ options.degrade ? FINALIZER_REJECTION_LEVERS_UNDER_DEGRADE : FINALIZER_REJECTION_LEVERS,
2926
2829
  ].join("; ");
2927
2830
  }
2831
+ function isUnresolvedExternalGap(gap) {
2832
+ return gap.why === "nonexistent_or_outside_roots" && gap.existence === "enoent";
2833
+ }
2834
+ // Not rendered under "Known missing evidence": the path was never local, so the
2835
+ // bundle cannot vouch for it beyond this flag. The reason is provider prose.
2836
+ function unresolvedExternalGapWarnings(unresolved) {
2837
+ return unresolved.map((gap) => delegateWarning(DELEGATE_EXTERNAL_GAP_UNRESOLVED_WARNING_CODE, `finalizer named evidence that does not exist under the source roots: ${gap.path}; conclusions depending on it are conditional`));
2838
+ }
2928
2839
  function formatExternalGapPolicyFailure(external) {
2929
2840
  return [
2930
2841
  `finalizer_validation: external_gap_policy=fail; external_gaps=${formatExternalGapEntries(external.map((gap) => ({ path: gap.path, detail: gap.provenance })))}`,
@@ -3053,8 +2964,14 @@ function reconcileContextBuilderWarnings(input) {
3053
2964
  // never be stale against the selection; their reason text is provider
3054
2965
  // prose and may happen to use omission vocabulary. The corrective-retry
3055
2966
  // notice names no evidence at all, so it is never stale either.
2967
+ // Unresolved gaps name paths that never existed locally; review coverage
2968
+ // and packet-pruned review evidence are computed against the final
2969
+ // packet/selection, so none of them can be stale either.
3056
2970
  if (warning.code === "delegate_external_gaps" ||
3057
2971
  warning.code === "delegate_external_gap" ||
2972
+ warning.code === DELEGATE_EXTERNAL_GAP_UNRESOLVED_WARNING_CODE ||
2973
+ warning.code === DELEGATE_REVIEW_COVERAGE_GAP_WARNING_CODE ||
2974
+ warning.code === DELEGATE_PACKET_REVIEW_EVIDENCE_PRUNED_WARNING_CODE ||
3058
2975
  warning.code === DELEGATE_JSON_CORRECTIVE_RETRY_WARNING_CODE) {
3059
2976
  return true;
3060
2977
  }