wicked-crew 0.18.20 → 0.18.21

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 (509) hide show
  1. package/dist/api/capture.d.ts +5 -2
  2. package/dist/api/capture.d.ts.map +1 -1
  3. package/dist/api/capture.js +13 -10
  4. package/dist/api/capture.js.map +1 -1
  5. package/dist/api/chat-context.d.ts +12 -0
  6. package/dist/api/chat-context.d.ts.map +1 -1
  7. package/dist/api/chat-context.js +61 -6
  8. package/dist/api/chat-context.js.map +1 -1
  9. package/dist/api/chat-freshness.js +2 -2
  10. package/dist/api/chat-freshness.js.map +1 -1
  11. package/dist/api/chat-jobs.d.ts +54 -0
  12. package/dist/api/chat-jobs.d.ts.map +1 -1
  13. package/dist/api/chat-jobs.js +199 -7
  14. package/dist/api/chat-jobs.js.map +1 -1
  15. package/dist/api/chat-proposals.d.ts +39 -6
  16. package/dist/api/chat-proposals.d.ts.map +1 -1
  17. package/dist/api/chat-proposals.js +161 -36
  18. package/dist/api/chat-proposals.js.map +1 -1
  19. package/dist/api/chat-requirements.d.ts.map +1 -1
  20. package/dist/api/chat-requirements.js +4 -1
  21. package/dist/api/chat-requirements.js.map +1 -1
  22. package/dist/api/chat-scope.d.ts +8 -0
  23. package/dist/api/chat-scope.d.ts.map +1 -1
  24. package/dist/api/chat-scope.js +26 -2
  25. package/dist/api/chat-scope.js.map +1 -1
  26. package/dist/api/cluster-status.d.ts +24 -12
  27. package/dist/api/cluster-status.d.ts.map +1 -1
  28. package/dist/api/cluster-status.js +81 -3
  29. package/dist/api/cluster-status.js.map +1 -1
  30. package/dist/api/codebase-archive.js +2 -2
  31. package/dist/api/codebase-archive.js.map +1 -1
  32. package/dist/api/delivery-cache.d.ts +2 -0
  33. package/dist/api/delivery-cache.d.ts.map +1 -1
  34. package/dist/api/delivery-cache.js +1 -2
  35. package/dist/api/delivery-cache.js.map +1 -1
  36. package/dist/api/delivery-index.d.ts +2 -2
  37. package/dist/api/delivery-index.d.ts.map +1 -1
  38. package/dist/api/delivery-index.js +1 -2
  39. package/dist/api/delivery-index.js.map +1 -1
  40. package/dist/api/eval-compare.d.ts +1 -1
  41. package/dist/api/eval-compare.js +1 -1
  42. package/dist/api/eval-sample.d.ts +7 -0
  43. package/dist/api/eval-sample.d.ts.map +1 -1
  44. package/dist/api/eval-sample.js +20 -0
  45. package/dist/api/eval-sample.js.map +1 -1
  46. package/dist/api/governance-steering.d.ts +13 -0
  47. package/dist/api/governance-steering.d.ts.map +1 -1
  48. package/dist/api/governance-steering.js +56 -7
  49. package/dist/api/governance-steering.js.map +1 -1
  50. package/dist/api/mcp.d.ts +3 -1
  51. package/dist/api/mcp.d.ts.map +1 -1
  52. package/dist/api/mcp.js +5 -2
  53. package/dist/api/mcp.js.map +1 -1
  54. package/dist/api/needs.d.ts +20 -0
  55. package/dist/api/needs.d.ts.map +1 -1
  56. package/dist/api/needs.js +120 -19
  57. package/dist/api/needs.js.map +1 -1
  58. package/dist/api/onboarding-capture.d.ts +21 -1
  59. package/dist/api/onboarding-capture.d.ts.map +1 -1
  60. package/dist/api/onboarding-capture.js +112 -8
  61. package/dist/api/onboarding-capture.js.map +1 -1
  62. package/dist/api/policy-landing.d.ts +36 -0
  63. package/dist/api/policy-landing.d.ts.map +1 -1
  64. package/dist/api/policy-landing.js +123 -4
  65. package/dist/api/policy-landing.js.map +1 -1
  66. package/dist/api/post-hoc-deliver.d.ts.map +1 -1
  67. package/dist/api/post-hoc-deliver.js +2 -1
  68. package/dist/api/post-hoc-deliver.js.map +1 -1
  69. package/dist/api/proposal-decisions.d.ts +44 -0
  70. package/dist/api/proposal-decisions.d.ts.map +1 -0
  71. package/dist/api/proposal-decisions.js +85 -0
  72. package/dist/api/proposal-decisions.js.map +1 -0
  73. package/dist/api/proposal-onboard.d.ts +29 -0
  74. package/dist/api/proposal-onboard.d.ts.map +1 -1
  75. package/dist/api/proposal-onboard.js +162 -11
  76. package/dist/api/proposal-onboard.js.map +1 -1
  77. package/dist/api/recording.d.ts.map +1 -1
  78. package/dist/api/recording.js +4 -5
  79. package/dist/api/recording.js.map +1 -1
  80. package/dist/api/redeliver.d.ts.map +1 -1
  81. package/dist/api/redeliver.js +11 -7
  82. package/dist/api/redeliver.js.map +1 -1
  83. package/dist/api/repo-input.d.ts.map +1 -1
  84. package/dist/api/repo-input.js +5 -2
  85. package/dist/api/repo-input.js.map +1 -1
  86. package/dist/api/repo-origins.d.ts +24 -0
  87. package/dist/api/repo-origins.d.ts.map +1 -0
  88. package/dist/api/repo-origins.js +71 -0
  89. package/dist/api/repo-origins.js.map +1 -0
  90. package/dist/api/requirements.d.ts +36 -1
  91. package/dist/api/requirements.d.ts.map +1 -1
  92. package/dist/api/requirements.js +73 -2
  93. package/dist/api/requirements.js.map +1 -1
  94. package/dist/api/review-change.d.ts +5 -6
  95. package/dist/api/review-change.d.ts.map +1 -1
  96. package/dist/api/review-change.js +45 -8
  97. package/dist/api/review-change.js.map +1 -1
  98. package/dist/api/routes.d.ts +33 -4
  99. package/dist/api/routes.d.ts.map +1 -1
  100. package/dist/api/routes.js +518 -182
  101. package/dist/api/routes.js.map +1 -1
  102. package/dist/api/run-sources.d.ts +11 -1
  103. package/dist/api/run-sources.d.ts.map +1 -1
  104. package/dist/api/run-sources.js +26 -3
  105. package/dist/api/run-sources.js.map +1 -1
  106. package/dist/api/run-timing-index.d.ts +46 -1
  107. package/dist/api/run-timing-index.d.ts.map +1 -1
  108. package/dist/api/run-timing-index.js +135 -1
  109. package/dist/api/run-timing-index.js.map +1 -1
  110. package/dist/api/runtime-state.d.ts +6 -0
  111. package/dist/api/runtime-state.d.ts.map +1 -1
  112. package/dist/api/runtime-state.js +14 -3
  113. package/dist/api/runtime-state.js.map +1 -1
  114. package/dist/api/seat-agents.d.ts.map +1 -1
  115. package/dist/api/seat-agents.js +3 -3
  116. package/dist/api/seat-agents.js.map +1 -1
  117. package/dist/api/seat-container-login.d.ts +6 -2
  118. package/dist/api/seat-container-login.d.ts.map +1 -1
  119. package/dist/api/seat-container-login.js +15 -7
  120. package/dist/api/seat-container-login.js.map +1 -1
  121. package/dist/api/seat-governance.d.ts +3 -2
  122. package/dist/api/seat-governance.d.ts.map +1 -1
  123. package/dist/api/seat-governance.js +31 -9
  124. package/dist/api/seat-governance.js.map +1 -1
  125. package/dist/api/seat-standing.d.ts +8 -0
  126. package/dist/api/seat-standing.d.ts.map +1 -1
  127. package/dist/api/seat-standing.js +26 -1
  128. package/dist/api/seat-standing.js.map +1 -1
  129. package/dist/api/server.d.ts +7 -0
  130. package/dist/api/server.d.ts.map +1 -1
  131. package/dist/api/server.js +93 -39
  132. package/dist/api/server.js.map +1 -1
  133. package/dist/api/start-on-login.d.ts +4 -0
  134. package/dist/api/start-on-login.d.ts.map +1 -0
  135. package/dist/api/start-on-login.js +35 -0
  136. package/dist/api/start-on-login.js.map +1 -0
  137. package/dist/api/steering-landing.d.ts +33 -8
  138. package/dist/api/steering-landing.d.ts.map +1 -1
  139. package/dist/api/steering-landing.js +235 -51
  140. package/dist/api/steering-landing.js.map +1 -1
  141. package/dist/api/system-snapshot.d.ts.map +1 -1
  142. package/dist/api/system-snapshot.js +5 -3
  143. package/dist/api/system-snapshot.js.map +1 -1
  144. package/dist/api/worktree-sweep.d.ts +7 -3
  145. package/dist/api/worktree-sweep.d.ts.map +1 -1
  146. package/dist/api/worktree-sweep.js +10 -6
  147. package/dist/api/worktree-sweep.js.map +1 -1
  148. package/dist/apps/exec/recall.d.ts.map +1 -1
  149. package/dist/apps/exec/recall.js +4 -4
  150. package/dist/apps/exec/recall.js.map +1 -1
  151. package/dist/apps/git.js +2 -2
  152. package/dist/apps/git.js.map +1 -1
  153. package/dist/apps/publish/manifest.d.ts +2 -0
  154. package/dist/apps/publish/manifest.d.ts.map +1 -1
  155. package/dist/apps/publish/manifest.js +8 -3
  156. package/dist/apps/publish/manifest.js.map +1 -1
  157. package/dist/apps/publish/run.d.ts +11 -1
  158. package/dist/apps/publish/run.d.ts.map +1 -1
  159. package/dist/apps/publish/run.js +97 -17
  160. package/dist/apps/publish/run.js.map +1 -1
  161. package/dist/apps/routes.d.ts +2 -0
  162. package/dist/apps/routes.d.ts.map +1 -1
  163. package/dist/apps/routes.js +45 -2
  164. package/dist/apps/routes.js.map +1 -1
  165. package/dist/apps/store.d.ts +24 -3
  166. package/dist/apps/store.d.ts.map +1 -1
  167. package/dist/apps/store.js +26 -9
  168. package/dist/apps/store.js.map +1 -1
  169. package/dist/apps/turns.d.ts +25 -2
  170. package/dist/apps/turns.d.ts.map +1 -1
  171. package/dist/apps/turns.js +276 -11
  172. package/dist/apps/turns.js.map +1 -1
  173. package/dist/apps-server/runners/sqlite-runner.mjs +39 -1
  174. package/dist/apps-server/server/lib/bundle/server.mjs +113 -13
  175. package/dist/core/adapter.d.ts +23 -8
  176. package/dist/core/adapter.d.ts.map +1 -1
  177. package/dist/core/adapter.js +59 -26
  178. package/dist/core/adapter.js.map +1 -1
  179. package/dist/core/ado-deliver-helper.d.ts +2 -1
  180. package/dist/core/ado-deliver-helper.d.ts.map +1 -1
  181. package/dist/core/ado-deliver-helper.js +26 -1
  182. package/dist/core/ado-deliver-helper.js.map +1 -1
  183. package/dist/core/assurance.d.ts +10 -0
  184. package/dist/core/assurance.d.ts.map +1 -1
  185. package/dist/core/assurance.js +23 -0
  186. package/dist/core/assurance.js.map +1 -1
  187. package/dist/core/deliver-text.d.ts +2 -0
  188. package/dist/core/deliver-text.d.ts.map +1 -1
  189. package/dist/core/deliver-text.js +1 -0
  190. package/dist/core/deliver-text.js.map +1 -1
  191. package/dist/core/deliver.d.ts +43 -1
  192. package/dist/core/deliver.d.ts.map +1 -1
  193. package/dist/core/deliver.js +131 -3
  194. package/dist/core/deliver.js.map +1 -1
  195. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  196. package/dist/core/estate-mcp-client.js +4 -8
  197. package/dist/core/estate-mcp-client.js.map +1 -1
  198. package/dist/core/exec.d.ts +24 -0
  199. package/dist/core/exec.d.ts.map +1 -1
  200. package/dist/core/exec.js +45 -2
  201. package/dist/core/exec.js.map +1 -1
  202. package/dist/core/linked-issues.d.ts +13 -2
  203. package/dist/core/linked-issues.d.ts.map +1 -1
  204. package/dist/core/linked-issues.js +135 -4
  205. package/dist/core/linked-issues.js.map +1 -1
  206. package/dist/core/redeliver.js +2 -2
  207. package/dist/core/redeliver.js.map +1 -1
  208. package/dist/core/repo-clone.d.ts +64 -0
  209. package/dist/core/repo-clone.d.ts.map +1 -0
  210. package/dist/core/repo-clone.js +306 -0
  211. package/dist/core/repo-clone.js.map +1 -0
  212. package/dist/core/run-identity.d.ts.map +1 -1
  213. package/dist/core/run-identity.js +3 -0
  214. package/dist/core/run-identity.js.map +1 -1
  215. package/dist/core/run-read-lane.d.ts +30 -0
  216. package/dist/core/run-read-lane.d.ts.map +1 -0
  217. package/dist/core/run-read-lane.js +103 -0
  218. package/dist/core/run-read-lane.js.map +1 -0
  219. package/dist/core/types.d.ts +10 -0
  220. package/dist/core/types.d.ts.map +1 -1
  221. package/dist/core/types.js.map +1 -1
  222. package/dist/core/walkthrough-root.d.ts.map +1 -1
  223. package/dist/core/walkthrough-root.js +3 -5
  224. package/dist/core/walkthrough-root.js.map +1 -1
  225. package/dist/core/wicked-home.d.ts +9 -0
  226. package/dist/core/wicked-home.d.ts.map +1 -0
  227. package/dist/core/wicked-home.js +25 -0
  228. package/dist/core/wicked-home.js.map +1 -0
  229. package/dist/decisions/consider.d.ts +2 -1
  230. package/dist/decisions/consider.d.ts.map +1 -1
  231. package/dist/decisions/consider.js +2 -2
  232. package/dist/decisions/consider.js.map +1 -1
  233. package/dist/decisions/land.d.ts +2 -0
  234. package/dist/decisions/land.d.ts.map +1 -1
  235. package/dist/decisions/land.js +16 -3
  236. package/dist/decisions/land.js.map +1 -1
  237. package/dist/decisions/rules-brief.d.ts +2 -1
  238. package/dist/decisions/rules-brief.d.ts.map +1 -1
  239. package/dist/decisions/rules-brief.js +3 -2
  240. package/dist/decisions/rules-brief.js.map +1 -1
  241. package/dist/editors/conformance-runtime.d.ts +0 -2
  242. package/dist/editors/conformance-runtime.d.ts.map +1 -1
  243. package/dist/editors/conformance-runtime.js +0 -4
  244. package/dist/editors/conformance-runtime.js.map +1 -1
  245. package/dist/editors/pack-install.d.ts +11 -15
  246. package/dist/editors/pack-install.d.ts.map +1 -1
  247. package/dist/editors/pack-install.js +51 -65
  248. package/dist/editors/pack-install.js.map +1 -1
  249. package/dist/editors/registry.d.ts +26 -12
  250. package/dist/editors/registry.d.ts.map +1 -1
  251. package/dist/editors/registry.js +35 -15
  252. package/dist/editors/registry.js.map +1 -1
  253. package/dist/editors/visuals.d.ts +4 -3
  254. package/dist/editors/visuals.d.ts.map +1 -1
  255. package/dist/editors/visuals.js +17 -7
  256. package/dist/editors/visuals.js.map +1 -1
  257. package/dist/evals/runner.js +1 -1
  258. package/dist/evals/runner.js.map +1 -1
  259. package/dist/evals/shape.d.ts +7 -1
  260. package/dist/evals/shape.d.ts.map +1 -1
  261. package/dist/evals/shape.js +26 -6
  262. package/dist/evals/shape.js.map +1 -1
  263. package/dist/evals/workflow.d.ts +16 -3
  264. package/dist/evals/workflow.d.ts.map +1 -1
  265. package/dist/evals/workflow.js +31 -6
  266. package/dist/evals/workflow.js.map +1 -1
  267. package/dist/insights/review-service.d.ts +24 -3
  268. package/dist/insights/review-service.d.ts.map +1 -1
  269. package/dist/insights/review-service.js +75 -12
  270. package/dist/insights/review-service.js.map +1 -1
  271. package/dist/insights/routes.d.ts +2 -1
  272. package/dist/insights/routes.d.ts.map +1 -1
  273. package/dist/insights/routes.js +19 -4
  274. package/dist/insights/routes.js.map +1 -1
  275. package/dist/insights/run-facts.d.ts +5 -0
  276. package/dist/insights/run-facts.d.ts.map +1 -1
  277. package/dist/insights/run-facts.js +15 -0
  278. package/dist/insights/run-facts.js.map +1 -1
  279. package/dist/insights/workflow.d.ts +2 -1
  280. package/dist/insights/workflow.d.ts.map +1 -1
  281. package/dist/insights/workflow.js +4 -4
  282. package/dist/insights/workflow.js.map +1 -1
  283. package/dist/inspect/service.d.ts +3 -2
  284. package/dist/inspect/service.d.ts.map +1 -1
  285. package/dist/inspect/service.js +4 -4
  286. package/dist/inspect/service.js.map +1 -1
  287. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  288. package/dist/interactive/bridge-pool.js +6 -4
  289. package/dist/interactive/bridge-pool.js.map +1 -1
  290. package/dist/interactive/chat-events.d.ts.map +1 -1
  291. package/dist/interactive/chat-events.js +7 -1
  292. package/dist/interactive/chat-events.js.map +1 -1
  293. package/dist/interactive/draft-events.d.ts +3 -0
  294. package/dist/interactive/draft-events.d.ts.map +1 -1
  295. package/dist/interactive/draft-events.js +5 -8
  296. package/dist/interactive/draft-events.js.map +1 -1
  297. package/dist/interactive/draft-skill.d.ts +56 -3
  298. package/dist/interactive/draft-skill.d.ts.map +1 -1
  299. package/dist/interactive/draft-skill.js +129 -20
  300. package/dist/interactive/draft-skill.js.map +1 -1
  301. package/dist/interactive/landing-guard.d.ts +30 -5
  302. package/dist/interactive/landing-guard.d.ts.map +1 -1
  303. package/dist/interactive/landing-guard.js +121 -5
  304. package/dist/interactive/landing-guard.js.map +1 -1
  305. package/dist/interactive/proposal-create.d.ts.map +1 -1
  306. package/dist/interactive/proposal-create.js +1 -0
  307. package/dist/interactive/proposal-create.js.map +1 -1
  308. package/dist/interactive/proposal-refine.d.ts.map +1 -1
  309. package/dist/interactive/proposal-refine.js +16 -1
  310. package/dist/interactive/proposal-refine.js.map +1 -1
  311. package/dist/interactive/review-events.js +1 -1
  312. package/dist/interactive/review-events.js.map +1 -1
  313. package/dist/interactive/run-units.d.ts.map +1 -1
  314. package/dist/interactive/run-units.js +3 -2
  315. package/dist/interactive/run-units.js.map +1 -1
  316. package/dist/interactive/source-packet.d.ts +8 -0
  317. package/dist/interactive/source-packet.d.ts.map +1 -1
  318. package/dist/interactive/source-packet.js +47 -6
  319. package/dist/interactive/source-packet.js.map +1 -1
  320. package/dist/knowledge/adapters/toolbox/supervisor.d.ts +21 -1
  321. package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
  322. package/dist/knowledge/adapters/toolbox/supervisor.js +76 -26
  323. package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
  324. package/dist/knowledge/estate-write.d.ts +5 -0
  325. package/dist/knowledge/estate-write.d.ts.map +1 -1
  326. package/dist/knowledge/estate-write.js +7 -0
  327. package/dist/knowledge/estate-write.js.map +1 -1
  328. package/dist/knowledge/projector.d.ts +60 -5
  329. package/dist/knowledge/projector.d.ts.map +1 -1
  330. package/dist/knowledge/projector.js +264 -21
  331. package/dist/knowledge/projector.js.map +1 -1
  332. package/dist/knowledge/shapes/map.d.ts.map +1 -1
  333. package/dist/knowledge/shapes/map.js +12 -2
  334. package/dist/knowledge/shapes/map.js.map +1 -1
  335. package/dist/knowledge/shapes/routes.d.ts +1 -1
  336. package/dist/knowledge/shapes/routes.d.ts.map +1 -1
  337. package/dist/knowledge/shapes/routes.js +42 -16
  338. package/dist/knowledge/shapes/routes.js.map +1 -1
  339. package/dist/knowledge/shapes/shapes.d.ts +60 -13
  340. package/dist/knowledge/shapes/shapes.d.ts.map +1 -1
  341. package/dist/knowledge/shapes/shapes.js +199 -31
  342. package/dist/knowledge/shapes/shapes.js.map +1 -1
  343. package/dist/knowledge/shapes/verified.d.ts.map +1 -1
  344. package/dist/knowledge/shapes/verified.js +3 -2
  345. package/dist/knowledge/shapes/verified.js.map +1 -1
  346. package/dist/knowledge/trackers/addresses.d.ts +27 -3
  347. package/dist/knowledge/trackers/addresses.d.ts.map +1 -1
  348. package/dist/knowledge/trackers/addresses.js +33 -5
  349. package/dist/knowledge/trackers/addresses.js.map +1 -1
  350. package/dist/knowledge/trackers/gate-pm.d.ts.map +1 -1
  351. package/dist/knowledge/trackers/gate-pm.js +4 -2
  352. package/dist/knowledge/trackers/gate-pm.js.map +1 -1
  353. package/dist/knowledge/trackers/projector.d.ts +3 -1
  354. package/dist/knowledge/trackers/projector.d.ts.map +1 -1
  355. package/dist/knowledge/trackers/projector.js +59 -8
  356. package/dist/knowledge/trackers/projector.js.map +1 -1
  357. package/dist/learn/scheduler.d.ts.map +1 -1
  358. package/dist/learn/scheduler.js +11 -2
  359. package/dist/learn/scheduler.js.map +1 -1
  360. package/dist/learnings/extract.d.ts +9 -3
  361. package/dist/learnings/extract.d.ts.map +1 -1
  362. package/dist/learnings/extract.js +62 -4
  363. package/dist/learnings/extract.js.map +1 -1
  364. package/dist/learnings/replacement-lineage.d.ts +3 -2
  365. package/dist/learnings/replacement-lineage.d.ts.map +1 -1
  366. package/dist/learnings/replacement-lineage.js +7 -6
  367. package/dist/learnings/replacement-lineage.js.map +1 -1
  368. package/dist/learnings/service.d.ts +12 -2
  369. package/dist/learnings/service.d.ts.map +1 -1
  370. package/dist/learnings/service.js +30 -5
  371. package/dist/learnings/service.js.map +1 -1
  372. package/dist/mcp/broker.d.ts.map +1 -1
  373. package/dist/mcp/broker.js +18 -4
  374. package/dist/mcp/broker.js.map +1 -1
  375. package/dist/mcp/estate-relay.d.ts +3 -0
  376. package/dist/mcp/estate-relay.d.ts.map +1 -1
  377. package/dist/mcp/estate-relay.js +5 -2
  378. package/dist/mcp/estate-relay.js.map +1 -1
  379. package/dist/mcp/invoke.js +2 -2
  380. package/dist/mcp/invoke.js.map +1 -1
  381. package/dist/mcp/redact.d.ts +1 -1
  382. package/dist/mcp/redact.d.ts.map +1 -1
  383. package/dist/mcp/redact.js +61 -4
  384. package/dist/mcp/redact.js.map +1 -1
  385. package/dist/mcp/registry-store.d.ts +25 -0
  386. package/dist/mcp/registry-store.d.ts.map +1 -1
  387. package/dist/mcp/registry-store.js +33 -0
  388. package/dist/mcp/registry-store.js.map +1 -1
  389. package/dist/mcp/registry.d.ts +25 -1
  390. package/dist/mcp/registry.d.ts.map +1 -1
  391. package/dist/mcp/registry.js +84 -5
  392. package/dist/mcp/registry.js.map +1 -1
  393. package/dist/mcp/rest.js +3 -3
  394. package/dist/mcp/rest.js.map +1 -1
  395. package/dist/mcp/run-fence.d.ts +2 -0
  396. package/dist/mcp/run-fence.d.ts.map +1 -1
  397. package/dist/mcp/run-fence.js +9 -0
  398. package/dist/mcp/run-fence.js.map +1 -1
  399. package/dist/mcp/upstream-error.d.ts +5 -1
  400. package/dist/mcp/upstream-error.d.ts.map +1 -1
  401. package/dist/mcp/upstream-error.js +5 -1
  402. package/dist/mcp/upstream-error.js.map +1 -1
  403. package/dist/projects/graph.d.ts +6 -4
  404. package/dist/projects/graph.d.ts.map +1 -1
  405. package/dist/projects/graph.js +173 -25
  406. package/dist/projects/graph.js.map +1 -1
  407. package/dist/projects/routes.d.ts +7 -1
  408. package/dist/projects/routes.d.ts.map +1 -1
  409. package/dist/projects/routes.js +13 -5
  410. package/dist/projects/routes.js.map +1 -1
  411. package/dist/projects/state-home-preflight.d.ts +5 -0
  412. package/dist/projects/state-home-preflight.d.ts.map +1 -1
  413. package/dist/projects/state-home-preflight.js +48 -8
  414. package/dist/projects/state-home-preflight.js.map +1 -1
  415. package/dist/projects/state-home-registry.d.ts.map +1 -1
  416. package/dist/projects/state-home-registry.js +6 -0
  417. package/dist/projects/state-home-registry.js.map +1 -1
  418. package/dist/projects/state-home.d.ts +6 -2
  419. package/dist/projects/state-home.d.ts.map +1 -1
  420. package/dist/projects/state-home.js +8 -5
  421. package/dist/projects/state-home.js.map +1 -1
  422. package/dist/qe/test-sets.d.ts +1 -1
  423. package/dist/qe/test-sets.d.ts.map +1 -1
  424. package/dist/qe/test-sets.js +2 -2
  425. package/dist/qe/test-sets.js.map +1 -1
  426. package/dist/schedules/routes.d.ts +5 -0
  427. package/dist/schedules/routes.d.ts.map +1 -1
  428. package/dist/schedules/routes.js +32 -5
  429. package/dist/schedules/routes.js.map +1 -1
  430. package/dist/schedules/scheduler.d.ts +8 -1
  431. package/dist/schedules/scheduler.d.ts.map +1 -1
  432. package/dist/schedules/scheduler.js +10 -1
  433. package/dist/schedules/scheduler.js.map +1 -1
  434. package/dist/schedules/store.d.ts +7 -0
  435. package/dist/schedules/store.d.ts.map +1 -1
  436. package/dist/schedules/store.js +19 -4
  437. package/dist/schedules/store.js.map +1 -1
  438. package/dist/skills/plugin-source.js +4 -4
  439. package/dist/skills/plugin-source.js.map +1 -1
  440. package/dist/sources/drivers/sqlite.d.ts +13 -0
  441. package/dist/sources/drivers/sqlite.d.ts.map +1 -1
  442. package/dist/sources/drivers/sqlite.js +11 -0
  443. package/dist/sources/drivers/sqlite.js.map +1 -1
  444. package/dist/sources/routes.d.ts.map +1 -1
  445. package/dist/sources/routes.js +1 -0
  446. package/dist/sources/routes.js.map +1 -1
  447. package/dist/sources/uploads.d.ts +22 -2
  448. package/dist/sources/uploads.d.ts.map +1 -1
  449. package/dist/sources/uploads.js +108 -10
  450. package/dist/sources/uploads.js.map +1 -1
  451. package/dist/standing-orders/parse.d.ts +8 -0
  452. package/dist/standing-orders/parse.d.ts.map +1 -1
  453. package/dist/standing-orders/parse.js +52 -5
  454. package/dist/standing-orders/parse.js.map +1 -1
  455. package/dist/studio/apps-standalone/fixture.js +3 -3
  456. package/dist/studio/assets/{KnowledgeGraph-dfq7Flyj.js → KnowledgeGraph-yP4WsnST.js} +1 -1
  457. package/dist/studio/assets/index-DNaLjJ7M.css +32 -0
  458. package/dist/studio/assets/index-DW53FKuT.js +1114 -0
  459. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  460. package/dist/studio/editors/wicked-apps/index.html +1 -1
  461. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  462. package/dist/studio/editors/wicked-deck/index.html +1 -1
  463. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  464. package/dist/studio/editors/wicked-doc/index.html +1 -1
  465. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  466. package/dist/studio/editors/wicked-insights/index.html +1 -1
  467. package/dist/studio/editors/wicked-page/editor.json +1 -1
  468. package/dist/studio/editors/wicked-page/index.html +1 -1
  469. package/dist/studio/editors/wicked-video/editor.json +1 -1
  470. package/dist/studio/editors/wicked-video/index.html +1 -1
  471. package/dist/studio/index.html +2 -2
  472. package/dist/studio/testid-inventory.json +1125 -208
  473. package/dist/team/routes.d.ts.map +1 -1
  474. package/dist/team/routes.js +2 -1
  475. package/dist/team/routes.js.map +1 -1
  476. package/dist/voice/tts.d.ts +12 -0
  477. package/dist/voice/tts.d.ts.map +1 -1
  478. package/dist/voice/tts.js +118 -28
  479. package/dist/voice/tts.js.map +1 -1
  480. package/dist/workflow-catalog/build-v2.d.ts +34 -0
  481. package/dist/workflow-catalog/build-v2.d.ts.map +1 -1
  482. package/dist/workflow-catalog/build-v2.js +131 -10
  483. package/dist/workflow-catalog/build-v2.js.map +1 -1
  484. package/dist/workflow-catalog/catalog-data.d.ts.map +1 -1
  485. package/dist/workflow-catalog/catalog-data.js +0 -2
  486. package/dist/workflow-catalog/catalog-data.js.map +1 -1
  487. package/dist/workflow-catalog/detect.d.ts +18 -3
  488. package/dist/workflow-catalog/detect.d.ts.map +1 -1
  489. package/dist/workflow-catalog/detect.js +43 -8
  490. package/dist/workflow-catalog/detect.js.map +1 -1
  491. package/dist/working-doc/event-lines.d.ts +5 -2
  492. package/dist/working-doc/event-lines.d.ts.map +1 -1
  493. package/dist/working-doc/event-lines.js +38 -7
  494. package/dist/working-doc/event-lines.js.map +1 -1
  495. package/dist/working-doc/sections.d.ts +3 -0
  496. package/dist/working-doc/sections.d.ts.map +1 -1
  497. package/dist/working-doc/sections.js +5 -0
  498. package/dist/working-doc/sections.js.map +1 -1
  499. package/dist/working-doc/service.d.ts +23 -3
  500. package/dist/working-doc/service.d.ts.map +1 -1
  501. package/dist/working-doc/service.js +93 -54
  502. package/dist/working-doc/service.js.map +1 -1
  503. package/endpoint-manifest.json +60 -3
  504. package/evals/corpora/shape-v1.json +25 -1
  505. package/evals/corpora/shape-v1.seat-fixture.json +25 -1
  506. package/package.json +4 -4
  507. package/runners/sqlite-runner.mjs +39 -1
  508. package/dist/studio/assets/index-Bame65hj.js +0 -1108
  509. package/dist/studio/assets/index-CtB1BJRI.css +0 -32
@@ -2,12 +2,13 @@ import { RuleChangedError, ruleRevision } from '../governance/rule-revision.js';
2
2
  import { registerRedeliverRoutes } from './redeliver.js';
3
3
  import { REVIEW_WORKFLOW } from '../insights/workflow.js';
4
4
  import { runUsageCost } from '../insights/run-facts.js';
5
+ import { NoIndependentReviewer } from '../insights/review-service.js';
5
6
  import { appsRuntimeDir, appsServerArtifact, containerEngineKnown } from '../apps/publish/artifacts.js';
6
7
  import { busSeamsOffWarning, busUnavailableWarning } from '../core/bus-notice.js';
7
8
  import { vaultBinWarning, vaultDiagnostics } from '../core/vault-bin.js';
8
9
  import { PlanSchema, toLaunchPlan } from './plan-schema.js';
9
10
  import { record, z } from '../zod.js';
10
- import { listRequirementsRead, setRepoMinimum, getRequirement, patchRequirement, readRequirementsGraph, REQUIREMENTS_NOT_GENERATED, } from './requirements.js';
11
+ import { listRequirementsRead, setRepoMinimum, getRequirement, patchRequirement, retireRequirement, readRequirementsGraph, REQUIREMENTS_NOT_GENERATED, } from './requirements.js';
11
12
  import { randomUUID } from 'node:crypto';
12
13
  import { homedir } from 'node:os';
13
14
  import { readFileSync, existsSync, mkdirSync, realpathSync } from 'node:fs';
@@ -82,9 +83,10 @@ import { InvalidDiffBaseError, MERGE_BASE_LITERAL, NotARegularFileError, Unresol
82
83
  import { DocRunIndex } from '../interactive/doc-run-index.js';
83
84
  import { listInteractiveDocs } from '../interactive/docs-index.js';
84
85
  import { SearchService, registerSearchRoutes } from './search-routes.js';
86
+ import { RepoOrigins, originOf } from './repo-origins.js';
85
87
  import { TestSetIndex } from '../qe/test-sets.js';
86
88
  import { estateExe, parseEstateTotals, projectGraphRefreshDiagnostics, readBlastRadiusPages, resolveProjectGraphBinding } from '../projects/graph.js';
87
- import { attachRepoToProject, registerProjectRoutes } from '../projects/routes.js';
89
+ import { attachRepoToProject, createProjectRecorded, registerProjectRoutes } from '../projects/routes.js';
88
90
  import { registerProjectAggregateRoutes } from './project-aggregates.js';
89
91
  import { composeLaunch, composePreflight, registerProductRoutes } from './product.js';
90
92
  import { buildWorkflowCatalogV2, parseCommand, resolveOption } from '../workflow-catalog/build-v2.js';
@@ -101,7 +103,7 @@ import { inventoryComplete, parseInventoryClaims } from '../core/inventory-claim
101
103
  import { ApproveEditSchema, approveEdited, captureLaunchRoots, editInFlight, FileProposalSchema, registerCaptureRoutes } from './capture.js';
102
104
  import { registerTestingRoutes } from './testing.js';
103
105
  import { registerDefaultEvalRoutes, runAndRecord } from '../evals/routes.js';
104
- import { prepareRunEvalsLaunch, RUN_EVALS_WORKFLOW } from '../evals/workflow.js';
106
+ import { prepareRunEvalsLaunch, RUN_EVALS_WORKFLOW, runEvalsScopeOf } from '../evals/workflow.js';
105
107
  import { DOMAIN_MAPPING } from '../projects/repo-watch.js';
106
108
  import { defaultReplaySet } from '../evals/replay.js';
107
109
  import { gardenRootFor } from '../learn/scheduler.js';
@@ -133,7 +135,7 @@ import { isHumanOperator } from './watch-routes.js';
133
135
  import { boundOrigin, InteractiveBridgePool } from '../interactive/bridge-pool.js';
134
136
  import { defaultInteractiveRoot } from '../interactive/bridge-root.js';
135
137
  import { composeDeliverText, configuredPublicOrigin, extractFollowUps, factsFromRun, reportsFromOutputs, FOLLOW_UPS_MAX, framedDeliverText, runUrlFor, } from '../core/deliver-text.js';
136
- import { deliverAuthorOf, deliverIdentityFor, defaultGhExec, deliverRepoFor, deliverTargetView, isGitHubLogin, pushIdentityOf, readDeliverOriginUrl, resolvePullRequest as resolvePullRequestViaGh, unverifiedTreesFrom, } from '../core/deliver.js';
138
+ import { deliverAuthorOf, deliverIdentityFor, defaultGhExec, deliverRepoFor, deliverTargetView, isGitHubLogin, pinnedGhExec, pinnedGitExec, pushIdentityOf, readDeliverOriginUrl, resolvePullRequest as resolvePullRequestViaGh, unverifiedTreesFrom, } from '../core/deliver.js';
137
139
  import { credentialsMissingIn, deliverCredentialsProbe, missingCredentials } from '../core/deliver-credentials.js';
138
140
  import { codebaseArchiveUrl } from './codebase-archive.js';
139
141
  import { projectRepoCandidates } from '../interactive/doc-grounding.js';
@@ -141,7 +143,7 @@ import { artifactStatus, beneathSupported, buildTurnContext, chatMount, ChatMess
141
143
  import { createDocInProcess, registerInteractiveProxy } from '../interactive/proxy-routes.js';
142
144
  import { CreateLauncher } from '../interactive/proposal-create.js';
143
145
  import { ThemeLauncher } from './proposal-theme.js';
144
- import { CHAT_GIT_PROTOCOLS, OnboardLauncher, probeGitUrl, shownGitUrl, withoutCredentials } from './proposal-onboard.js';
146
+ import { CHAT_GIT_PROTOCOLS, OnboardLauncher, probeGitUrl, withoutCredentials } from './proposal-onboard.js';
145
147
  import { RefineLauncher } from '../interactive/proposal-refine.js';
146
148
  import { lineageSteps, protectedEdits } from '../interactive/protected-edits.js';
147
149
  import { buildRunBrief } from './run-brief.js';
@@ -151,11 +153,11 @@ const BRIEF_COPY_MAX = 512 * 1024;
151
153
  import { registerInteractiveDocDelete } from '../interactive/doc-delete-routes.js';
152
154
  import { registerInteractiveDocChecks } from '../interactive/doc-checks-routes.js';
153
155
  import { crewStateHome, stateHomeOfDb, wickedWorkRoot } from '../projects/state-home.js';
154
- import { demoShowOf, factsOf, inputLines, jobInputsOfProposal, jobLaunchCommon, jobLaunchRoster, personPid, requestDigest, SELF_SEATED } from './chat-jobs.js';
156
+ import { demoShowOf, factsOf, inputLines, jobInputsOfProposal, jobLaunchCommon, jobLaunchRoster, jobRevisionLaunch, personPid, requestDigest, SELF_SEATED } from './chat-jobs.js';
155
157
  import { DocumentsRefused, documentsClause, RUN_DOCS_TOKENS_MAX, removeStagedDocuments, stagedDocumentsRemoved, stagedDocumentsOf, stageRunDocuments } from './run-documents.js';
156
158
  import { checkSourcePick, projectSources, RUN_SOURCES_MAX, runSourcesDeps, webScopeReason } from './run-sources.js';
157
159
  import { CATALOG_V2_CARDS } from '../workflow-catalog/catalog-data-v2.js';
158
- import { LaunchRefusal, ChatProposals, LaunchOnceRegistry, proposalRunId, RecordingStubDispatcher, RevisionEditsSchema, runCostFromEvents } from './chat-proposals.js';
160
+ import { CHAT_ENDED, LaunchRefusal, ChatProposals, LaunchOnceRegistry, liveInRuns, proposalRunId, RecordingStubDispatcher, RevisionEditsSchema, runCostFromEvents } from './chat-proposals.js';
159
161
  import { CATALOG_SEEDS } from '../workflow-catalog/catalog-data.js';
160
162
  import { registerInteractiveDocList } from '../interactive/doc-list-routes.js';
161
163
  import { REVIEWS_DIRNAME } from '../interactive/review-ledger.js';
@@ -168,6 +170,7 @@ import { pmRegistered, readPmIssues } from '../knowledge/trackers/issues.js';
168
170
  import { registerTrackerRoutes } from '../knowledge/trackers/routes.js';
169
171
  import { AuditLog } from './audit.js';
170
172
  import { auditFor } from './audit-view.js';
173
+ import { ProposalDecisionIndex, recordProposalDecision } from './proposal-decisions.js';
171
174
  import { AcpFoldCache, EngineVersionCache, FloorCacheCache, eventsDirOf, installedPackageVersion, hostSandboxLauncher, seatRosterFile, listStoreFiles, readStudioBundleVersion, } from './diagnostics.js';
172
175
  import { GovernanceDiagnostics } from './governance-health.js';
173
176
  import { ATTACHMENT_LIMITS, ATTACHMENT_MAX_MESSAGE_BYTES, AttachmentError, ChatAttachmentStore, attachmentWire, attachmentsBlock, boundaryOf, parseMultipart, stageForSeat } from './chat-attachments.js';
@@ -179,6 +182,8 @@ import { idleClis, probeSeatImages, SeatImageRebuilder, seatImageStatusVia } fro
179
182
  import { RunCostCache } from './needs.js';
180
183
  import { governanceStoreFix, legacyHomeOutboxPath } from '../core/governance-store.js';
181
184
  import { UsageError, replayOutboxInto } from '../cli/governance.js';
185
+ import { DEFAULT_DAEMON_PORT } from '../cli/port.js';
186
+ import { startOnLoginStatus } from './start-on-login.js';
182
187
  import { foldDeadletters } from './governance-health.js';
183
188
  import { RetryIndex } from './retry-index.js';
184
189
  import { SEAT_RECORD_DEFAULT_DAYS, SEAT_RECORD_MAX_DAYS, seatRecord } from './seat-record.js';
@@ -208,7 +213,7 @@ import { ingestDecision } from '../decisions/ingest.js';
208
213
  import { registerDecisionRoutes } from '../decisions/routes.js';
209
214
  import { ChatDecisionRecorder } from '../decisions/chat-recorder.js';
210
215
  import { ConsiderationService } from '../decisions/consider.js';
211
- import { gardenConformance, gardenPackCheck } from '../editors/pack-install.js';
216
+ import { engineConformance, gardenPackCheck } from '../editors/pack-install.js';
212
217
  import { conformanceProvisioner, conformanceRuntimeReady, conformanceRuntimeRoot, conformanceVenvDir, editorPluginLaunchListener, venvPython } from '../editors/conformance-runtime.js';
213
218
  import { EditorRegistry } from '../editors/registry.js';
214
219
  import { registerEditorRoutes, unitTokenProbe } from '../editors/routes.js';
@@ -290,6 +295,19 @@ export class LaunchReply {
290
295
  }
291
296
  }
292
297
  /** Keep correctable launch refusals typed, and preserve error codes in other launch failures. */
298
+ /**
299
+ * (crew#1442, coord on #1734) A held run's source pick, for a reshape that keeps it. A pick that can't be read (its
300
+ * store entry gone and the launch trail not read at boot) refuses the launch, 409 `sources_unavailable`, rather than
301
+ * launch it as if the held run had no pick.
302
+ */
303
+ export function heldSourcePick(picks, runId) {
304
+ try {
305
+ return picks.get(runId);
306
+ }
307
+ catch (err) {
308
+ throw jobRefusal(409, { code: 'sources_unavailable', error: `the held run's source pick could not be read: ${message(err)}` });
309
+ }
310
+ }
293
311
  export function jobRefusal(status, payload) {
294
312
  const b = payload;
295
313
  if (status >= 400 && status < 500 && typeof b?.code === 'string') {
@@ -409,6 +427,9 @@ function shapeMemoryItem(raw) {
409
427
  // the surface date-filters on. Absent on an item the store did not stamp; never fabricated.
410
428
  if (typeof r['created_at'] === 'number')
411
429
  item.created_at = r['created_at'];
430
+ // crew#1697: a retired row (`memory.list {retired: true}`) carries when it was retired.
431
+ if (typeof r['retired_at'] === 'number')
432
+ item.retired_at = r['retired_at'];
412
433
  return item;
413
434
  }
414
435
  /** Shape the estate `memory.coverage` result (`{ total, by_tier, by_kind }`) into the wire
@@ -805,6 +826,18 @@ const InjectSchema = z.strictObject({
805
826
  * thread says "You (by voice)". It grants nothing a typed note does not. */
806
827
  input: z.literal('voice').optional(),
807
828
  });
829
+ /** (crew#1392) Most characters of a dock steer's words its `run.injected` audit line keeps. */
830
+ export const INJECT_WORDS_MAX = 2_000;
831
+ /** A dock steer's words as the audit line keeps them: at most {@link INJECT_WORDS_MAX} characters, never half a pair. */
832
+ export function injectWords(message) {
833
+ if (message.length <= INJECT_WORDS_MAX)
834
+ return message;
835
+ let end = INJECT_WORDS_MAX;
836
+ const last = message.charCodeAt(end - 1);
837
+ if (last >= 0xd800 && last <= 0xdbff)
838
+ end -= 1;
839
+ return message.slice(0, end);
840
+ }
808
841
  export const ResumeSchema = z.strictObject({ ord: z.int().nonnegative().optional() });
809
842
  // The manual reassign lever (crew#442): `cli` omitted lets the engine's council re-pick, the
810
843
  // same shape the automatic stall-watchdog escalation uses for an unknown failover target.
@@ -846,10 +879,19 @@ export const RetireMemorySchema = z.strictObject({
846
879
  scope_prefix: z.string(),
847
880
  });
848
881
  /** `POST /memory/retire-item` body (studio#206): ONE memory, by its `memory_id` from `GET /memory`.
849
- * `.strict()`: a stray `scope_prefix` is a 400, never read as a wider erase than one row. */
882
+ * `.strict()`: a stray `scope_prefix` is a 400, never read as a wider erase than one row. The same body
883
+ * names the one memory for `POST /memory/erase-item` and `POST /memory/unretire` (crew#1697). */
850
884
  export const RetireMemoryItemSchema = z.strictObject({
851
885
  memory_id: z.string().min(1).max(512),
852
886
  });
887
+ /** `POST /knowledge/forget` body (crew#1697): estate `knowledge.forget`'s own arguments. Exactly one target is
888
+ * checked at the route (a 400 before any spawn); `.strict()`: an unknown field is a 400. */
889
+ export const ForgetKnowledgeSchema = z.strictObject({
890
+ id: z.string().optional(),
891
+ source: z.string().optional(),
892
+ scope_prefix: z.string().optional(),
893
+ confirm_erase_all: z.boolean().optional(),
894
+ });
853
895
  /** `POST /memory/edit` body (wicked-studio's Memory page): ONE memory's new words. `.strict()`: an
854
896
  * unknown field is a 400, never read as something wider than one memory. */
855
897
  export const EditMemorySchema = z.strictObject({
@@ -869,6 +911,30 @@ const memoryEditsInFlight = new Set();
869
911
  /** The error an estate from before wicked-estate#188 answers to `memory.erase {id}`: it knows only the
870
912
  * subtree erase, so it refuses the call (deleting nothing) for want of a `scope_prefix`. */
871
913
  const ESTATE_NO_ERASE_BY_ID = /scope_prefix \(non-empty\) required/i;
914
+ /** crew#1697: how an estate without a tool refuses it. Before wicked-estate#552/#553 `memory.retire`,
915
+ * `memory.unretire` and `knowledge.forget` are unknown tools (-32602 "unknown tool: …"); a memory implementer
916
+ * without retirement answers -32601 "… does not support retirement" / "… retirement is unsupported". Either way
917
+ * nothing was changed. A domain whose store did not open (-32601 "memory domain not available: <why>") is NOT
918
+ * this: it stays a 502 with its own words (codex review). */
919
+ const estateLacksTool = (err) => err instanceof EstateMcpError &&
920
+ ((err.code === -32602 && /unknown tool/i.test(err.message)) ||
921
+ (err.code === -32601 && /does not support retirement|retirement is unsupported/i.test(err.message)));
922
+ /** crew#1697: the count a one-memory estate tool answered (`deleted_count`, `retired_count`, `restored_count`):
923
+ * 0 or 1. Any other answer is estate misbehaving, thrown as an upstream fault (502). */
924
+ function oneMemoryCount(raw, tool, key) {
925
+ const n = typeof raw === 'object' && raw !== null ? raw[key] : undefined;
926
+ if (typeof n !== 'number')
927
+ throw new EstateMcpError(`${tool} returned an unexpected shape`);
928
+ if (n !== 0 && n !== 1)
929
+ throw new EstateMcpError(`${tool} {id} changed ${n} memories, expected 1`);
930
+ return n;
931
+ }
932
+ /** crew#1697: the 501 body for an estate that lacks a tool. */
933
+ function estateUpgrade(what, estatePr, unchanged) {
934
+ return { error: `this wicked-estate ${what} (it needs wicked-estate${estatePr}); upgrade wicked-estate-mcp — ${unchanged}`, code: 'estate_upgrade_required' };
935
+ }
936
+ /** crew#1697: estate's `knowledge.forget` refusing a target (live-source structure named by id): a conflict, not a fault. */
937
+ const ESTATE_FORGET_REFUSED = /knowledge\.forget refused/i;
872
938
  /**
873
939
  * A SKIN-OWNED settings key (crew#323): one lowercase segment under the `studio.` namespace,
874
940
  * e.g. `studio.appearance`, `studio.notifications`. The daemon never interprets these values —
@@ -1093,6 +1159,8 @@ runtime = {}) {
1093
1159
  : {}),
1094
1160
  };
1095
1161
  const { audit } = security;
1162
+ // crew#1261: who rejected a proposal and why, as crew recorded it (`GET /proposals` returns it on the row).
1163
+ const proposalDecisions = new ProposalDecisionIndex(audit, (m) => app.log.warn(m));
1096
1164
  const seatHealth = runtime.seatHealth ?? new SeatHealthTracker();
1097
1165
  const deliveryFreeze = runtime.deliveryFreeze ?? new DeliveryFreeze();
1098
1166
  registerDeliveryFreezeRoutes(app, { freeze: deliveryFreeze, audit });
@@ -1144,21 +1212,15 @@ runtime = {}) {
1144
1212
  'demo',
1145
1213
  ];
1146
1214
  const chatArtifactFlags = chatArtifactsStub
1147
- ? { context: true, instructions: true, proposals: true, create: true, refine: true, theme: true, demo: true, stub: true, stubOps, onboard: true }
1148
- : { context: true, instructions: true, proposals: true, create: realCreate, refine: realRefine, theme: true, demo: false, onboard: true };
1215
+ ? { context: true, instructions: true, proposals: true, create: true, refine: true, theme: true, demo: true, stub: true, stubOps, onboard: true, cutInView: true }
1216
+ : { context: true, instructions: true, proposals: true, create: realCreate, refine: realRefine, theme: true, demo: false, onboard: true, cutInView: true };
1149
1217
  const proposalLaunchers = new LaunchOnceRegistry();
1150
1218
  proposalLaunchers.register('theme', new ThemeLauncher());
1151
1219
  // crew-0182: what an onboard card is resolved and its Go is checked against (one set of reads for both).
1152
- const originOf = async (rootPath) => {
1153
- try {
1154
- const out = await execCapped('git', ['-C', rootPath, 'remote', 'get-url', 'origin'], { timeout: 5_000 });
1155
- return out.stdout.trim() || null;
1156
- }
1157
- catch {
1158
- return null;
1159
- }
1160
- };
1220
+ // crew#1744: the one `git_url` reader (GET /repos, the repo search; the daemon hands the review service the same).
1221
+ const repoOrigins = runtime.repoOrigins ?? new RepoOrigins();
1161
1222
  const onboardReads = {
1223
+ projects: async () => (await adapter.projectList()).filter((p) => p.id !== DEFAULT_PROJECT_ID && p.status !== 'archived').map((p) => ({ id: p.id, name: p.name })),
1162
1224
  repos: () => adapter.listRepos(),
1163
1225
  projectRepoRefs: async (projectId) => (await adapter.projectMembers(projectId)).filter((m) => m.member_kind === 'crew.repo').map((m) => m.member_ref),
1164
1226
  checkoutOf: (name) => homeless(join(wickedWorkRoot('repos'), name)),
@@ -1174,6 +1236,8 @@ runtime = {}) {
1174
1236
  proposalLaunchers.register('onboard', new OnboardLauncher({
1175
1237
  ...onboardReads,
1176
1238
  sessions: () => adapter.sessions(),
1239
+ // crew#1694: the one project create, as `POST /projects` makes it (bus event, audit line, charter).
1240
+ createProject: async (name, actor) => createProjectRecorded(adapter, projects, audit, actor, { name }),
1177
1241
  register: (data, ctx) => registerAndOnboard(data, { actor: ctx.actor, runId: ctx.runId, gitProtocols: CHAT_GIT_PROTOCOLS, log: { warn: (o, m) => app.log.warn(o, m) } }),
1178
1242
  attach: async (projectId, repoId, actor) => {
1179
1243
  await attachRepoToProject(adapter, projects, { projectId, repoId, actor, attachedBy: 'studio' });
@@ -1239,6 +1303,7 @@ runtime = {}) {
1239
1303
  const deliveryCache = runtime.deliveryCache ??
1240
1304
  new DeliveryDerivationCache({
1241
1305
  listViews: () => adapter.sessionsDetail(),
1306
+ viewOf: (id) => adapter.runView(id),
1242
1307
  probes: vacuityProbes,
1243
1308
  isDelivered: (runId) => deliveryIndex.isDelivered(runId),
1244
1309
  canDeliver,
@@ -1320,7 +1385,7 @@ runtime = {}) {
1320
1385
  adapter,
1321
1386
  broadcast,
1322
1387
  packCheck: runtime.packCheck ?? gardenPackCheck(discoverLivePlugin()?.path ?? null),
1323
- conformance: runtime.editorConformance ?? gardenConformance(discoverLivePlugin()?.path ?? null, () => process.env['WICKED_CREW_URL'] ?? null, { provision: editorConformanceRuntime }),
1388
+ conformance: runtime.editorConformance ?? engineConformance({ provision: editorConformanceRuntime }),
1324
1389
  // F37: the grant write's §6.4 tripwire asks the engine whether a bearer is a governed unit's token.
1325
1390
  ...(() => {
1326
1391
  const probe = runtime.editorUnitTokenProbe !== undefined ? runtime.editorUnitTokenProbe : unitTokenProbe(CoreAdapter.estateScopeResolver());
@@ -1403,6 +1468,18 @@ runtime = {}) {
1403
1468
  : null;
1404
1469
  /** Repo root for a repo ref, from the registry — shared by the reprovision path below. */
1405
1470
  const repoRootOf = async (repoRef) => (await adapter.listRepos()).find((r) => r.id === repoRef)?.root_path;
1471
+ /** (crew#1792) The push identity a repository's PR reads run as: its pin or the setting, else `GH_ACCOUNT` (the
1472
+ * deliver-target route's own resolution). Settings that cannot be read leave it to `GH_ACCOUNT`. */
1473
+ const readIdentityOf = (repoRef) => async () => {
1474
+ let configured = '';
1475
+ try {
1476
+ configured = deliverIdentityFor(await adapter.getSettings(), repoRef).login;
1477
+ }
1478
+ catch {
1479
+ configured = '';
1480
+ }
1481
+ return pushIdentityOf(configured);
1482
+ };
1406
1483
  /** The lookups a review-change exclusion reads (the launch and the job proposal read the same ones, CJ13). */
1407
1484
  const reviewChangeDeps = (repoRef, repoRoot) => ({
1408
1485
  repoRef,
@@ -1412,20 +1489,24 @@ runtime = {}) {
1412
1489
  pushed: (id) => deliveryIndex.pushedFor(id),
1413
1490
  deliveredCommit: (id) => deliveryIndex.commitFor(id),
1414
1491
  revisesPr: (id) => retryIndex.revisesPrFor(id),
1415
- gh: runtime.reviewChange?.gh ?? defaultGhExec,
1416
- git: runtime.reviewChange?.git ?? (async (args, cwd) => {
1492
+ gh: pinnedGhExec(readIdentityOf(repoRef), runtime.reviewChange?.gh ?? defaultGhExec),
1493
+ // crew#1804: a branch or commit target's fetch runs as the deliver identity too, like the deliver script's `_gnet`.
1494
+ git: pinnedGitExec(readIdentityOf(repoRef), runtime.reviewChange?.git ?? (async (args, cwd, env) => {
1417
1495
  try {
1418
- return { ...(await execCapped('git', args, { cwd, timeout: 5_000 })), code: 0 };
1496
+ return { ...(await execCapped('git', args, { cwd, timeout: 5_000, ...(env !== undefined ? { env: { ...process.env, ...env } } : {}) })), code: 0 };
1419
1497
  }
1420
1498
  catch (err) {
1421
1499
  // Only exit 1 proves non-membership; preserve it separately from lookup failures.
1422
1500
  const code = err.code;
1423
1501
  return { code: typeof code === 'number' ? code : null, stdout: '', stderr: message(err) };
1424
1502
  }
1425
- }),
1503
+ }), runtime.reviewChange?.gh ?? defaultGhExec),
1426
1504
  });
1427
- /** DES-L9: PR number → head branch, through `gh pr view` unless the runtime injected an answerer. */
1428
- const resolvePullRequest = runtime.resolvePullRequest ?? resolvePullRequestViaGh;
1505
+ /** DES-L9: PR number → head branch, through `gh pr view` as the repository's push identity (crew#1792) unless the
1506
+ * runtime injected an answerer. */
1507
+ const resolvePullRequest = (repoRoot, number, repoRef) => runtime.resolvePullRequest !== undefined
1508
+ ? runtime.resolvePullRequest(repoRoot, number)
1509
+ : resolvePullRequestViaGh(repoRoot, number, pinnedGhExec(readIdentityOf(repoRef)));
1429
1510
  /** crew#627: the intent's linked issues, read under the daemon's identity at launch. */
1430
1511
  /** (DES-PM-001 §3.2) A project's live `crew.repo` members, for a tracker set. */
1431
1512
  const repoMembersOf = async (projectId) => (await adapter.projectMembers(projectId)).filter((m) => m.member_kind === 'crew.repo').map((m) => m.member_ref);
@@ -1761,23 +1842,39 @@ runtime = {}) {
1761
1842
  ...[adapter.vaultBin != null ? vaultBinWarning(adapter.vaultBin) : null].filter((w) => w !== null),
1762
1843
  ];
1763
1844
  // crew#1157: the engine's built-in presets are compiled in, so the chat workflows it carries are
1764
- // read once (on the first probe that can read them) and held until restart.
1845
+ // read once and held until restart. crew#1767: the read is an actor round trip, so it starts here,
1846
+ // at registration (the first probe usually finds it held), at most one is in flight, and `/health`
1847
+ // waits for it only inside the ping's own bound: a probe while the actor is busy answers `[]` (the
1848
+ // engine's answer is not known yet) and a later probe answers the held list. A failed read is
1849
+ // dropped, so the next probe reads again.
1765
1850
  let chatWorkflowsHeld = null;
1766
- const chatWorkflowsNow = async () => {
1851
+ let chatWorkflowsRead = null;
1852
+ const chatWorkflowsLoad = () => {
1767
1853
  if (chatWorkflowsHeld !== null)
1768
- return chatWorkflowsHeld;
1854
+ return Promise.resolve(chatWorkflowsHeld);
1769
1855
  if (typeof adapter.listPresets !== 'function')
1770
- return [];
1771
- try {
1772
- chatWorkflowsHeld = servedChatWorkflows(await adapter.listPresets());
1773
- return chatWorkflowsHeld;
1774
- }
1775
- catch {
1776
- return [];
1777
- }
1856
+ return Promise.resolve([]);
1857
+ chatWorkflowsRead ??= Promise.resolve()
1858
+ .then(() => adapter.listPresets())
1859
+ .then((presets) => (chatWorkflowsHeld = servedChatWorkflows(presets)))
1860
+ .catch(() => [])
1861
+ .finally(() => {
1862
+ chatWorkflowsRead = null;
1863
+ });
1864
+ return chatWorkflowsRead;
1778
1865
  };
1866
+ void chatWorkflowsLoad();
1779
1867
  app.get(`${V}/health`, { config: { manifest: { statusCodes: [200] } } }, async () => {
1868
+ const deadline = performance.now() + HEALTH_PING_WAIT_MS;
1869
+ const workflowsRead = chatWorkflowsLoad();
1780
1870
  const ping = await enginePing();
1871
+ let chatWorkflowsTimer;
1872
+ const chatWorkflows = await Promise.race([
1873
+ workflowsRead,
1874
+ new Promise((resolve) => {
1875
+ chatWorkflowsTimer = setTimeout(() => resolve([]), Math.max(0, deadline - performance.now()));
1876
+ }),
1877
+ ]).finally(() => clearTimeout(chatWorkflowsTimer));
1781
1878
  // F-E2E-030: what this deployment can keep. A composer reads `capabilities.deliverGate`
1782
1879
  // before it promises "pauses at the deliver gate"; a stub-driven route set without the
1783
1880
  // probe honestly reports no gate.
@@ -1818,7 +1915,7 @@ runtime = {}) {
1818
1915
  chatAttachments: true,
1819
1916
  // api-types 0.141.0 (crew#1157): the read-only workflows `POST /chats {workflow}` runs on THIS
1820
1917
  // engine (`analyze` on a core-ts that carries it); `[]` = plain chats only.
1821
- chatWorkflows: await chatWorkflowsNow(),
1918
+ chatWorkflows,
1822
1919
  // api-types 0.145.0: the evals, insights and schedules surfaces, read off the route table this
1823
1920
  // daemon serves, so a route set booted without one says false rather than an invented true.
1824
1921
  defaultEvals: app.hasRoute({ method: 'GET', url: `${V}/testing/default-evals/suites` }),
@@ -1847,6 +1944,9 @@ runtime = {}) {
1847
1944
  chatJobProposals: chatJobProposalsOn,
1848
1945
  chatJobPower: chatJobProposalsOn,
1849
1946
  reshapeRun: chatJobProposalsOn,
1947
+ // crew#1697: soft retire + restore on the Memory page, forget on the Knowledge page.
1948
+ memoryRestore: app.hasRoute({ method: 'POST', url: `${V}/memory/unretire` }),
1949
+ knowledgeForget: app.hasRoute({ method: 'POST', url: `${V}/knowledge/forget` }),
1850
1950
  // (api-types 0.169.0, DES-CHAT-ARTIFACTS-001 §14) Per operation: A1 serves `context` (the chat sees the open
1851
1951
  // artifact and the runs the person names; `seedFromArtifact`); A2 (0.170.0) `proposals`. The operations are later
1852
1952
  // slices (all on, with `stub`, in the test configuration).
@@ -2494,54 +2594,9 @@ runtime = {}) {
2494
2594
  return adapter.maintenanceState();
2495
2595
  });
2496
2596
  // Registered repos → target-repo picker. Each carries `git_url` (studio#1012: the repo page's "This repository"
2497
- // tracker row reads it): the address the engine recorded, else — it records none for its own clones — the checkout's
2498
- // `origin` through `originOf` (the onboard card's own read), held a minute per checkout and read at most eight at a
2499
- // time across every list, so a list never runs a `git` per repository per request. Shown through `shownGitUrl`
2500
- // (credentials and query removed, an address it can't vouch for dropped); none = no field.
2501
- const originCache = new Map();
2502
- let originReads = 0;
2503
- const originQueue = [];
2504
- const limitedOrigin = async (rootPath) => {
2505
- if (originReads < 8)
2506
- originReads += 1;
2507
- else
2508
- await new Promise((go) => originQueue.push(go));
2509
- try {
2510
- return await originOf(rootPath);
2511
- }
2512
- finally {
2513
- // The slot passes straight to the next waiter, so no new read can take it in between.
2514
- const next = originQueue.shift();
2515
- if (next !== undefined)
2516
- next();
2517
- else
2518
- originReads -= 1;
2519
- }
2520
- };
2521
- const listedOrigin = (rootPath) => {
2522
- const now = Date.now();
2523
- const hit = originCache.get(rootPath);
2524
- if (hit !== undefined && now - hit.at < 60_000)
2525
- return hit.url;
2526
- const url = limitedOrigin(rootPath);
2527
- originCache.set(rootPath, { at: now, url });
2528
- return url;
2529
- };
2530
- const withGitUrl = async (r) => {
2531
- const { git_url: recorded, ...rest } = r;
2532
- const raw = typeof recorded === 'string' && recorded.trim() !== '' ? recorded : await listedOrigin(r.root_path);
2533
- const shown = raw === null ? null : shownGitUrl(raw);
2534
- return shown === null ? rest : { ...rest, git_url: shown };
2535
- };
2536
- app.get(`${V}/repos`, async () => {
2537
- const listed = await adapter.listRepos();
2538
- // A checkout no longer registered leaves the cache.
2539
- const roots = new Set(listed.map((r) => r.root_path));
2540
- for (const root of originCache.keys())
2541
- if (!roots.has(root))
2542
- originCache.delete(root);
2543
- return { repos: await Promise.all(listed.map(withGitUrl)) };
2544
- });
2597
+ // tracker row reads it), through the daemon's one origin reader (repo-origins.ts, crew#1744): the review's issue
2598
+ // link and the repo search read the same.
2599
+ app.get(`${V}/repos`, async () => ({ repos: await repoOrigins.list(() => adapter.listRepos()) }));
2545
2600
  app.delete(`${V}/repos/:id`, { config: { manifest: { responseType: 'UnregisterRepoResponse', statusCodes: [200, 404, 409, 501] } } }, async (req, reply) => {
2546
2601
  const { id } = req.params;
2547
2602
  const runIds = (await adapter.sessionsDetail())
@@ -3121,7 +3176,7 @@ runtime = {}) {
3121
3176
  if (root === undefined) {
3122
3177
  return reply.code(404).send({ error: `repoRef names an unknown repo: ${revisedRepo}` });
3123
3178
  }
3124
- const resolved = await resolvePullRequest(root, b.revisesPr);
3179
+ const resolved = await resolvePullRequest(root, b.revisesPr, revisedRepo);
3125
3180
  if (!resolved.ok)
3126
3181
  return reply.code(409).send({ error: resolved.error });
3127
3182
  revisesPr = { number: b.revisesPr, headRef: resolved.pr.headRef, url: resolved.pr.url };
@@ -3144,7 +3199,15 @@ runtime = {}) {
3144
3199
  // retry or reshape that sends none keeps the earlier run's pick; a run without a pick reads what the switches allow.
3145
3200
  let sourcePick = null;
3146
3201
  // An inherited pick is checked like a sent one (the switches may have changed since the earlier run).
3147
- const wantedPick = b.sources ?? (b.retryOf !== undefined ? (runtime.runSourcePicks?.get(b.retryOf) ?? undefined) : undefined);
3202
+ let wantedPick;
3203
+ try {
3204
+ wantedPick = b.sources ?? (b.retryOf !== undefined ? (runtime.runSourcePicks?.get(b.retryOf) ?? undefined) : undefined);
3205
+ }
3206
+ catch (err) {
3207
+ // (crew#1442, coord on #1734) The earlier run's pick can't be read (its store entry is gone and the launch trail
3208
+ // was not read at boot): refused, never launched as if it had no pick.
3209
+ return reply.code(409).send({ code: 'sources_unavailable', error: `the earlier run's source pick could not be read: ${message(err)}` });
3210
+ }
3148
3211
  if (wantedPick !== undefined) {
3149
3212
  if (runtime.runSourcePicks === undefined || runtime.dataGate === undefined) {
3150
3213
  return reply.code(400).send({ code: 'sources_refused', error: 'this daemon cannot limit a run to picked sources' });
@@ -3238,8 +3301,11 @@ runtime = {}) {
3238
3301
  // crew#825: an all-excluded intent appends nothing but still answers what it left out.
3239
3302
  if (linked.issues.length > 0)
3240
3303
  linkedIssues = linked.issues;
3241
- if (linked.addresses !== undefined && linked.addresses.length > 0)
3304
+ if (linked.addresses !== undefined && linked.addresses.length > 0) {
3242
3305
  linkedAddresses = linked.addresses;
3306
+ // crew#1352: known before the engine is called, so the deliver script's embedded fallback links them back.
3307
+ input.trackerRefs = linked.addresses.map((a) => ({ system: a.system, ref: a.ref, ...(a.asked !== undefined ? { asked: a.asked } : {}) }));
3308
+ }
3243
3309
  }
3244
3310
  catch (err) {
3245
3311
  req.log.warn(`linked-issue resolution failed; launching on the intent alone: ${message(err)}`);
@@ -3272,7 +3338,10 @@ runtime = {}) {
3272
3338
  // the evals in-process and writes the report copy its Tool step reads; it delivers nothing.
3273
3339
  if (b.workflow === RUN_EVALS_WORKFLOW) {
3274
3340
  try {
3275
- await runEvalsPrepare(input);
3341
+ // (crew#1375) A card launch scores what its card asks for: Evaluate rules the steering suite, and a card that takes
3342
+ // a project input (Evaluate rules, Analyze runs) the project the launch is filed in. A launch with no shape (a
3343
+ // schedule, `/workflow-run-evals`) scores every suite and project.
3344
+ await runEvalsPrepare(input, runEvalsScopeOf(shapeChecked?.shape.card ?? null, b.projectId ?? null));
3276
3345
  }
3277
3346
  catch (err) {
3278
3347
  return reply.code(409).send({ error: `the default evals could not be prepared: ${message(err)}` });
@@ -3284,9 +3353,21 @@ runtime = {}) {
3284
3353
  await runtime.reviewLaunch(input);
3285
3354
  }
3286
3355
  catch (err) {
3356
+ // (crew#1375) No seat that ran none of the reviewed work: the review-change refusal's shape, so a chat job's Start
3357
+ // offers reduced assurance.
3358
+ if (err instanceof NoIndependentReviewer) {
3359
+ return reply.code(409).send({ code: err.code, error: `the review could not be prepared: ${err.message}`, excluded: err.excluded, retryWith: { reducedAssurance: true } });
3360
+ }
3287
3361
  return reply.code(409).send({ error: `the review could not be prepared: ${message(err)}` });
3288
3362
  }
3289
3363
  }
3364
+ // (crew#1375) Every refusal from here to the engine call leaves a prepared review that never ran: it is recorded as
3365
+ // refused, so a retry under the same run id (a chat job's Go) prepares it again instead of being refused.
3366
+ const refuse = (code, body) => {
3367
+ if (isReview)
3368
+ runtime.reviewLaunchRefused?.(input.sessionId, body.error);
3369
+ return reply.code(code).send(body);
3370
+ };
3290
3371
  if (b.workflow !== undefined && postureFacts.preparationDropsDelivery(b.workflow)) {
3291
3372
  deliver = 'none';
3292
3373
  delete input.deliver;
@@ -3296,7 +3377,7 @@ runtime = {}) {
3296
3377
  if (b.chatId !== undefined && chatArtifactFlags.proposals) {
3297
3378
  const live = await chatProposals.liveJobOf(b.chatId).catch(() => null);
3298
3379
  if (live !== null)
3299
- return reply.code(409).send({ code: 'chat_busy', error: `This chat already has a job running (${live}). Wait, or stop that run.` });
3380
+ return refuse(409, { code: 'chat_busy', error: `This chat already has a job running (${live}). Wait, or stop that run.` });
3300
3381
  }
3301
3382
  // DES-CATALOG-002 §4.4 (codex r1): the effective resolution a shape was judged by is read again right before the
3302
3383
  // engine resolves the preset, so a preset saved during this launch's awaits refuses it rather than running a shape
@@ -3305,11 +3386,11 @@ runtime = {}) {
3305
3386
  try {
3306
3387
  const again = checkLaunchShape(shapeChecked.shape, shapeChecked.target, await servedFor(shapeReads, b.projectId));
3307
3388
  if (!again.ok || again.resolved.resolved.resolution !== shapeChecked.resolution) {
3308
- return reply.code(409).send({ code: 'catalog_changed', error: 'the catalog changed while this was starting; check the job again' });
3389
+ return refuse(409, { code: 'catalog_changed', error: 'the catalog changed while this was starting; check the job again' });
3309
3390
  }
3310
3391
  }
3311
3392
  catch (err) {
3312
- return reply.code(409).send({ code: 'catalog_unavailable', error: message(err) });
3393
+ return refuse(409, { code: 'catalog_unavailable', error: message(err) });
3313
3394
  }
3314
3395
  }
3315
3396
  // (CS4) The pick is recorded before anything is staged and before the engine is called, so no unit of the run ever
@@ -3319,7 +3400,7 @@ runtime = {}) {
3319
3400
  runtime.runSourcePicks.set(input.sessionId, sourcePick);
3320
3401
  }
3321
3402
  catch (err) {
3322
- return reply.code(409).send({ code: 'sources_unavailable', error: `the source pick could not be recorded: ${message(err)}` });
3403
+ return refuse(409, { code: 'sources_unavailable', error: `the source pick could not be recorded: ${message(err)}` });
3323
3404
  }
3324
3405
  }
3325
3406
  // (DES-CATALOG-002 §2.d piece 2, CS4) The documents: every token authorised again with the chat's own rules (this
@@ -3337,10 +3418,10 @@ runtime = {}) {
3337
3418
  else if (b.retryOf !== undefined && runtime.runDocumentsRoot !== undefined) {
3338
3419
  const earlier = stagedTokensOf(b.retryOf, runtime.runDocumentsRoot);
3339
3420
  if (earlier === 'removed') {
3340
- return reply.code(409).send({ code: 'documents_unavailable', error: `the documents of run ${b.retryOf} were removed when it was archived; start the job again from its chat` });
3421
+ return refuse(409, { code: 'documents_unavailable', error: `the documents of run ${b.retryOf} were removed when it was archived; start the job again from its chat` });
3341
3422
  }
3342
3423
  if (earlier === 'unreadable') {
3343
- return reply.code(409).send({ code: 'documents_unavailable', error: `the documents of run ${b.retryOf} can't be read again; start the job again from its chat` });
3424
+ return refuse(409, { code: 'documents_unavailable', error: `the documents of run ${b.retryOf} can't be read again; start the job again from its chat` });
3344
3425
  }
3345
3426
  if (earlier !== null)
3346
3427
  docTokens = earlier;
@@ -3351,7 +3432,7 @@ runtime = {}) {
3351
3432
  const runProject = b.projectId !== undefined && b.projectId !== DEFAULT_PROJECT_ID ? b.projectId : null;
3352
3433
  if ((chatProject ?? null) !== runProject) {
3353
3434
  // A bare retry sends no projectId: it is filed Unfiled, so it is told where its documents belong (fail closed).
3354
- return reply.code(400).send({
3435
+ return refuse(400, {
3355
3436
  code: 'documents_refused',
3356
3437
  error: chatProject !== null && runProject === null
3357
3438
  ? `the documents belong to project ${chatProject}: file this run there (send projectId)`
@@ -3377,13 +3458,13 @@ runtime = {}) {
3377
3458
  }
3378
3459
  catch (err) {
3379
3460
  if (err instanceof DocumentsRefused) {
3380
- return reply.code(400).send({
3461
+ return refuse(400, {
3381
3462
  code: 'documents_refused',
3382
3463
  error: `can't read ${err.refused.map((r) => `${r.token} (${r.reason})`).join(', ')}`,
3383
3464
  refused: err.refused,
3384
3465
  });
3385
3466
  }
3386
- return reply.code(409).send({ code: 'documents_unavailable', error: `the documents could not be staged: ${message(err)}` });
3467
+ return refuse(409, { code: 'documents_unavailable', error: `the documents could not be staged: ${message(err)}` });
3387
3468
  }
3388
3469
  }
3389
3470
  if (staged !== null) {
@@ -3461,6 +3542,12 @@ runtime = {}) {
3461
3542
  ...(b.actor !== undefined ? { actor: b.actor } : {}),
3462
3543
  // crew#627: which linked issues the daemon read into the problem, and which it could not.
3463
3544
  ...(linkedIssues !== undefined ? { linkedIssues } : {}),
3545
+ // crew#1352: the issues the run addresses, as its tracker set resolved them. The trail is the durable record for
3546
+ // the run's lifetime (the tracker-addresses store is a bounded cache, and its write may fail); the run-timing
3547
+ // index reads them back, live and after a restart.
3548
+ ...(linkedAddresses !== undefined ? { trackerAddresses: linkedAddresses } : {}),
3549
+ // crew#1442: the run's source pick, so a pick store that loses the run still narrows it (fail closed).
3550
+ ...(sourcePick !== null ? { sourcePick } : {}),
3464
3551
  // DES-CATALOG-002 §4.4: the shape it was launched as, what it was launched with, and the proposal behind it.
3465
3552
  ...(b.shape !== undefined ? { shape: launchShapeOf(b.shape) } : {}),
3466
3553
  ...(ctx.fromProposal !== undefined ? { fromProposal: ctx.fromProposal } : {}),
@@ -3548,7 +3635,9 @@ runtime = {}) {
3548
3635
  if (!launched && staged?.published === true)
3549
3636
  freeStagedDocuments(input.sessionId, false);
3550
3637
  const msg = message(err);
3551
- if (isReview)
3638
+ // (crew#1375, xreview r1) Only a launch the engine never took is a refused review: a failure after launchRun
3639
+ // resolved leaves the review running, so a retry under its run id can never clear a real review.
3640
+ if (isReview && !launched)
3552
3641
  runtime.reviewLaunchRefused?.(input.sessionId, msg);
3553
3642
  if (err instanceof MaintenanceDrainError)
3554
3643
  return reply.code(503).send(maintenanceDrainBody(err));
@@ -3713,10 +3802,8 @@ runtime = {}) {
3713
3802
  */
3714
3803
  proposalLaunchers.register('job', {
3715
3804
  find: async (identity) => (await adapter.sessions()).includes(identity.runId),
3716
- live: async (runId) => {
3717
- const v = await adapter.runView(runId);
3718
- return v !== undefined && !['completed', 'cancelled', 'failed'].includes(String(v.session.status));
3719
- },
3805
+ // crew#1779: read off the check's one run list, never one engine read per job.
3806
+ live: liveInRuns,
3720
3807
  launch: async (d) => {
3721
3808
  const p = d.resolution;
3722
3809
  if (p.shape === undefined || p.catalogRev === undefined)
@@ -3758,7 +3845,7 @@ runtime = {}) {
3758
3845
  ...(projectId !== null && projectId !== DEFAULT_PROJECT_ID ? { projectId } : {}),
3759
3846
  ...common,
3760
3847
  // (CS4) The documents and the source pick, as tokens and names (never flattened into the brief's prose).
3761
- ...jobInputsOfProposal(p, runtime.runSourcePicks !== undefined ? (runId) => runtime.runSourcePicks.get(runId) : undefined),
3848
+ ...jobInputsOfProposal(p, runtime.runSourcePicks !== undefined ? (runId) => heldSourcePick(runtime.runSourcePicks, runId) : undefined),
3762
3849
  // A power run when the person's Start chose one (checked against this daemon just now); otherwise it
3763
3850
  // stops at its first plan, as every chat job did before (operator ruling 2026-11-06).
3764
3851
  // (A power launch overrides the plan hold; launchRun refuses rather than run it phased, `powerRequired`.)
@@ -3769,6 +3856,8 @@ runtime = {}) {
3769
3856
  ...(p.relaunch?.deliver !== undefined ? { deliver: p.relaunch.deliver } : {}),
3770
3857
  ...(p.relaunch?.deliverGate !== undefined && p.relaunch.deliver !== 'none' ? { deliverGate: p.relaunch.deliverGate } : {}),
3771
3858
  ...(p.relaunch?.revisesPr !== undefined && p.relaunch.deliver === 'pr' && p.repoRefs?.[0] !== undefined ? { revisesPr: p.relaunch.revisesPr } : {}),
3859
+ // (crew#1840) A job asked to change a pull request this chat delivered updates it: no second PR.
3860
+ ...jobRevisionLaunch(p),
3772
3861
  }, { ...ctx, fromProposal: d.pid, ...(d.power === true ? { powerRequired: true } : {}) });
3773
3862
  if (out.statusCode !== 201)
3774
3863
  throw jobRefusal(out.statusCode, out.payload);
@@ -4285,7 +4374,7 @@ runtime = {}) {
4285
4374
  const revisedRoot = await repoRootOf(repoRef);
4286
4375
  const again = revisedRoot === undefined
4287
4376
  ? { ok: false, error: `repo ${repoRef} is no longer registered — cannot re-check pull request #${revising.number}` }
4288
- : await resolvePullRequest(revisedRoot, revising.number);
4377
+ : await resolvePullRequest(revisedRoot, revising.number, repoRef);
4289
4378
  if (!again.ok) {
4290
4379
  revisionRefused = again.error;
4291
4380
  return;
@@ -5106,7 +5195,7 @@ runtime = {}) {
5106
5195
  pickFirstRepo: async (chatId, repoRef, actor, pid) => {
5107
5196
  const previous = chatScopes.get(chatId);
5108
5197
  if (previous === undefined)
5109
- return { ok: false, status: 409, error: `chat ${chatId} has ended; start a new one` };
5198
+ return { ok: false, status: 409, error: CHAT_ENDED };
5110
5199
  if (previous.repos.length > 0)
5111
5200
  return { ok: false, status: 409, error: `chat ${chatId} already has a repository in scope` };
5112
5201
  if (previous.kind === 'everything')
@@ -5236,7 +5325,7 @@ runtime = {}) {
5236
5325
  if (root === undefined)
5237
5326
  return null;
5238
5327
  const ex = await reviewChangeExclusion(words, reviewChangeDeps(repoRef, root));
5239
- return ex.ok ? ex.excludeSeats : null;
5328
+ return ex.ok ? { seats: ex.excludeSeats, ...(ex.provenance === 'unknown' && ex.why !== undefined ? { unknown: ex.why } : {}) } : null;
5240
5329
  },
5241
5330
  powerPresets: async (projectId) => {
5242
5331
  if (!powerSupported() || ((await adapter.getSettings()).powerModeDefault ?? true) === false || typeof adapter.listPresets !== 'function')
@@ -5248,7 +5337,6 @@ runtime = {}) {
5248
5337
  acceptsOnboard: (chatId) => chatAcceptsOnboard.get(chatId) === true,
5249
5338
  onboard: {
5250
5339
  ...onboardReads,
5251
- projects: async () => (await adapter.projectList()).filter((p) => p.id !== DEFAULT_PROJECT_ID && p.status !== 'archived').map((p) => ({ id: p.id, name: p.name })),
5252
5340
  originOf,
5253
5341
  probe: (url) => probeGitUrl(url),
5254
5342
  // POST /repos's own intake refusal (no garden, an old one, the state home): the card says it before anyone presses.
@@ -7321,7 +7409,11 @@ runtime = {}) {
7321
7409
  }
7322
7410
  if (token !== null)
7323
7411
  voiceInputs.settle(id);
7324
- audit.record('run.injected', actorOf(req), { runId: id, detail: { target: parsed.data.target, ...(spoken ? { input: 'voice' } : {}) } });
7412
+ // (crew#1392) The words too, capped: the run's context document shows a person's steer under Decisions.
7413
+ audit.record('run.injected', actorOf(req), {
7414
+ runId: id,
7415
+ detail: { target: parsed.data.target, words: injectWords(parsed.data.message), ...(spoken ? { input: 'voice' } : {}) },
7416
+ });
7325
7417
  // DC-S4a host: the operator's mid-run steering text (review S9).
7326
7418
  if (decisions !== null) {
7327
7419
  decisions.track(ingestDecision(decisions, {
@@ -7403,7 +7495,28 @@ runtime = {}) {
7403
7495
  const textOrNull = (v) => (v === undefined || v === null || v.trim() === '' ? null : v.trim());
7404
7496
  const PowerToggleSchema = z.strictObject({ on: z.boolean(), reason: z.string().trim().max(2000).nullish() });
7405
7497
  const RigorRaiseSchema = z.strictObject({ atLeast: z.enum(RIGORS), reason: z.string().trim().min(1).max(2000) });
7406
- const PowerPauseSchema = z.strictObject({ decision: z.enum(['continue_high', 'continue', 'switch_phased', 'stop']), note: z.string().trim().max(8000).nullish() });
7498
+ const PowerPauseSchema = z.strictObject({
7499
+ decision: z.enum(['continue_high', 'continue', 'switch_phased', 'stop']),
7500
+ note: z.string().trim().max(8000).nullish(),
7501
+ // (crew#1739) The pause the person answered, as the card showed it (`PowerPause.checkpoint` / `.at`).
7502
+ checkpoint: z.number().int().positive().optional(),
7503
+ at: z.number().int().nonnegative().optional(),
7504
+ });
7505
+ /** (crew#1739) Each run's pause answers, one at a time (`onePauseAnswer`). */
7506
+ const pauseAnswers = new Map();
7507
+ const onePauseAnswer = (runId, op) => {
7508
+ const next = (pauseAnswers.get(runId) ?? Promise.resolve()).then(op, op);
7509
+ const settled = next.then(() => undefined, () => undefined);
7510
+ pauseAnswers.set(runId, settled);
7511
+ void settled.then(() => { if (pauseAnswers.get(runId) === settled)
7512
+ pauseAnswers.delete(runId); });
7513
+ return next;
7514
+ };
7515
+ /** A power pause's identity: its checkpoint and when it opened (`PowerPause`), or null when none is open. */
7516
+ const pauseIdentity = (view) => {
7517
+ const pause = view?.['pause'];
7518
+ return pause && typeof pause.checkpoint === 'number' && typeof pause.at === 'number' ? { checkpoint: pause.checkpoint, at: pause.at } : null;
7519
+ };
7407
7520
  /** An engine refusal as HTTP: `not_found:` 404, `conflict:` 409, `refused:` / `bad_request:` 409 / 400. */
7408
7521
  const powerError = (reply, err) => {
7409
7522
  const msg = message(err);
@@ -7484,22 +7597,42 @@ runtime = {}) {
7484
7597
  return reply.code(403).send({ error: 'Only a person can answer a power-mode pause' });
7485
7598
  if (!powerSupported())
7486
7599
  return reply.code(501).send({ error: 'This engine has no power mode' });
7487
- try {
7488
- const note = textOrNull(parsed.data.note);
7489
- const st = await adapter.answerPowerPause(id, parsed.data.decision, note, actor.id);
7490
- audit.record('run.power_mode.paused', actor, { runId: id, detail: { decision: parsed.data.decision } });
7491
- if (decisions !== null && note !== null) {
7492
- decisions.track(ingestDecision(decisions, {
7493
- host: 'inject', actor, words: note, projectId: projects.index.projectOf(id) ?? null, runId: id,
7494
- }));
7600
+ // (crew#1739) One answer per run at a time: the read of the open pause and the engine's answer are one step, so a
7601
+ // second answer reads what the first left (a newer pause, or none) and is refused if it named the old one. Every
7602
+ // pause answer goes through this route.
7603
+ return onePauseAnswer(id, async () => {
7604
+ try {
7605
+ // (crew#1739) Which pause this answer is for. One that names a pause no longer open is refused, so a queued
7606
+ // answer (studio's undo window) never lands on a newer pause the person never saw.
7607
+ const view = await powerView(id);
7608
+ const open = pauseIdentity(view);
7609
+ const { checkpoint, at } = parsed.data;
7610
+ if (view !== null && (checkpoint !== undefined || at !== undefined) &&
7611
+ (open === null || (checkpoint !== undefined && checkpoint !== open.checkpoint) || (at !== undefined && at !== open.at))) {
7612
+ return reply.code(409).send({
7613
+ error: 'Pause changed',
7614
+ reason: open === null
7615
+ ? 'This pause was already answered, and the run is not paused now. Nothing was changed.'
7616
+ : `This answer was for an earlier pause; the run is now paused at checkpoint ${open.checkpoint}. Read the pause again. Nothing was changed.`,
7617
+ open,
7618
+ });
7619
+ }
7620
+ const note = textOrNull(parsed.data.note);
7621
+ const st = await adapter.answerPowerPause(id, parsed.data.decision, note, actor.id);
7622
+ audit.record('run.power_mode.paused', actor, { runId: id, detail: { decision: parsed.data.decision } });
7623
+ if (decisions !== null && note !== null) {
7624
+ decisions.track(ingestDecision(decisions, {
7625
+ host: 'inject', actor, words: note, projectId: projects.index.projectOf(id) ?? null, runId: id,
7626
+ }));
7627
+ }
7628
+ return reply.send({ runId: id, ...st, answered: open });
7495
7629
  }
7496
- return reply.send({ runId: id, ...st });
7497
- }
7498
- catch (err) {
7499
- if (err instanceof MaintenanceDrainError)
7500
- return reply.code(503).send(maintenanceDrainBody(err));
7501
- return powerError(reply, err);
7502
- }
7630
+ catch (err) {
7631
+ if (err instanceof MaintenanceDrainError)
7632
+ return reply.code(503).send(maintenanceDrainBody(err));
7633
+ return powerError(reply, err);
7634
+ }
7635
+ });
7503
7636
  });
7504
7637
  /** The run's `wicked.run.*` bus mirror after a cursor (`RunBusPage`). Read through the engine's own bus
7505
7638
  * read and filtered to this run; a page scans at most 1000 bus rows past the cursor. */
@@ -7802,11 +7935,11 @@ runtime = {}) {
7802
7935
  // read it. A restart is routine: deploy, crash, laptop sleep.
7803
7936
  app.get(`${V}/runs/:id/gate`, async (req, reply) => {
7804
7937
  const { id } = req.params;
7805
- // F35: this run's view only, never every run's (studio polls this route for every parked run, from
7806
- // every open tab). Each read is a copy of one run from the shared snapshot, so a read after an
7807
- // await sees a change the adapter learned of during it (a frame, or a write it made); any other
7808
- // change is at most the snapshot's age bound old.
7809
- const runOf = () => adapter.runView(id);
7938
+ // F35, crew#1775: this run's view only, never every run's (studio reads this route for parked runs,
7939
+ // from every open tab): one engine read of this run, off the actor, as the store is when it starts.
7940
+ // Read once per request: the cached-but-not-servable path and the miss path share it (coord review C6).
7941
+ let viewRead;
7942
+ const runOf = () => (viewRead ??= adapter.runView(id));
7810
7943
  // (rejudge, api-types 0.134.0) A gate whose unit no judge could rule on says whether its judge
7811
7944
  // can be re-run now, and from which seats — the engine's own selection, read each time (a seat
7812
7945
  // signed in since the pause counts). Absent on every other gate and on an addon without the read.
@@ -7924,11 +8057,12 @@ runtime = {}) {
7924
8057
  }
7925
8058
  const cached = gateCache.get(id);
7926
8059
  if (cached) {
8060
+ const run = await runOf();
7927
8061
  const servable = recorded === null
7928
8062
  || (recorded.state === 'open' && cached.ord === recorded.ord)
7929
- || (recorded.state === 'none' && (await runOf())?.session.status === 'awaiting_human');
8063
+ || (recorded.state === 'none' && run?.session.status === 'awaiting_human');
7930
8064
  if (servable) {
7931
- const offers = await offersAt(cached.ord, await runOf());
8065
+ const offers = await offersAt(cached.ord, run);
7932
8066
  if (offers === null)
7933
8067
  return unavailable503();
7934
8068
  return { runId: id, ...cached, ...offers };
@@ -7944,13 +8078,9 @@ runtime = {}) {
7944
8078
  // cut of this assumed: it trades one read of the run's view for replaying an entire event history,
7945
8079
  // and it was that skipped check which made a completed run answer 503 on any build without the
7946
8080
  // binding (CI caught it) — an error where the honest, knowable answer was "no gate".
7947
- let run = await runOf();
7948
- // F35: the engine's gate record was read before the view and outranks it. A record showing a gate
7949
- // open beside no view of the run, or a view of it still moving, means the shared snapshot predates
7950
- // the pause (its frame has not landed yet): read the run from a fold that starts now.
7951
- if (recorded?.state === 'open' && run?.session.status !== 'awaiting_human') {
7952
- run = await adapter.runView(id, { fresh: true });
7953
- }
8081
+ // The view is read after the record, from the store as it is now (crew#1775), so a gate row the
8082
+ // record shows open is never beside an older view of its run: the engine writes both in one commit.
8083
+ const run = await runOf();
7954
8084
  if (!run)
7955
8085
  return reply.code(404).send({ error: 'Run not found' });
7956
8086
  if (run.session.status !== 'awaiting_human') {
@@ -8014,7 +8144,10 @@ runtime = {}) {
8014
8144
  });
8015
8145
  // ── Elicitation (DES-002) ────────────────────────────────────────────────────
8016
8146
  //
8017
- // GET returns the current pending elicitation prompt for a run (display-store read).
8147
+ // GET returns the current pending elicitation prompt for a run (display-store read), or `null`
8148
+ // (a 200) when the run exists and has none open: "nothing open" is the normal answer for every
8149
+ // parked run a client polls, not an error (studio#984 logged one 404 per parked run per page load).
8150
+ // 404 stays for a run that does not exist. Every studio already reads "nothing open" as `null`.
8018
8151
  // POST resolves it: the body carries the elicitationId to guard against stale tabs,
8019
8152
  // the action (accept|decline|cancel), and — for accept — the operator's response.
8020
8153
  app.get(`${V}/runs/:id/elicitation`, async (req, reply) => {
@@ -8024,7 +8157,7 @@ runtime = {}) {
8024
8157
  // ("runId is specified more than once") from a redundant spread.
8025
8158
  if (entry)
8026
8159
  return entry;
8027
- // Cache miss: check existence before returning 404.
8160
+ // Cache miss: check existence first — an unknown run is the only 404.
8028
8161
  // Use sessions() (IDs only) — cheaper than sessionsDetail() on this read path.
8029
8162
  const ids = await adapter.sessions();
8030
8163
  if (!ids.includes(id))
@@ -8050,7 +8183,7 @@ runtime = {}) {
8050
8183
  receivedAt: new Date(pending.created_at).toISOString(),
8051
8184
  };
8052
8185
  }
8053
- return reply.code(404).send({ error: 'No pending elicitation for this run' });
8186
+ return reply.code(200).type('application/json').send('null');
8054
8187
  });
8055
8188
  const ElicitationRespondSchema = z.strictObject({
8056
8189
  /** Guards against stale-tab submissions: must match the current elicitation's id. */
@@ -9032,6 +9165,45 @@ runtime = {}) {
9032
9165
  return reply.code(404).send({ error: 'Requirement not found' });
9033
9166
  return { requirement: detail };
9034
9167
  });
9168
+ // wicked-core#1698: retire a requirement whose code was deleted (the engine flags it `unindexed`), so a re-map
9169
+ // stops listing it. The engine's own command does the write; the id is never reused.
9170
+ app.post(`${V}/repos/:id/requirements/:key/retire`, async (req, reply) => {
9171
+ const { id, key } = req.params;
9172
+ const repos = await adapter.listRepos();
9173
+ const repo = repos.find((r) => r.id === id);
9174
+ if (!repo)
9175
+ return reply.code(404).send({ error: `Repo ${id} not found` });
9176
+ let decodedKey;
9177
+ try {
9178
+ decodedKey = decodeURIComponent(key);
9179
+ }
9180
+ catch {
9181
+ return reply.code(400).send({ error: 'Malformed requirement key encoding' });
9182
+ }
9183
+ let outcome;
9184
+ try {
9185
+ outcome = await retireRequirement(repo, decodedKey, adapter);
9186
+ }
9187
+ catch (err) {
9188
+ const status = codeGraphErrorStatus(err);
9189
+ if (status !== null)
9190
+ return reply.code(status).send({ error: message(err) });
9191
+ return reply.code(500).send({ error: `${decodedKey} could not be retired: ${message(err)}` });
9192
+ }
9193
+ if (outcome === 'not_found')
9194
+ return reply.code(404).send({ error: 'Requirement not found' });
9195
+ if (outcome === 'not_unindexed') {
9196
+ return reply.code(409).send({
9197
+ error: `${decodedKey} is not listed as no longer in the code, so it cannot be retired. Only a requirement whose code was deleted can be. If its code was deleted, map ${repo.name} again, then retire it.`,
9198
+ });
9199
+ }
9200
+ if (outcome === 'engine_too_old') {
9201
+ return reply.code(409).send({
9202
+ error: 'The installed wicked-core cannot retire requirements yet. Update wicked-core, then try again.',
9203
+ });
9204
+ }
9205
+ return { retired: decodedKey };
9206
+ });
9035
9207
  app.get(`${V}/repos/:id/graph`, { config: { manifest: { responseType: 'RepoGraphResponse', statusCodes: [200, 404, 409, 500, 503] } } }, async (req, reply) => {
9036
9208
  const { id } = req.params;
9037
9209
  const repos = await adapter.listRepos();
@@ -9345,6 +9517,12 @@ runtime = {}) {
9345
9517
  // additive `path` (api-types 0.38.0 `SettingsResponse.path?`; adjudicated §4.6 — `path`, not
9346
9518
  // `settings_path`).
9347
9519
  app.get(`${V}/settings`, async () => ({ settings: await adapter.getSettings(), path: settingsFilePath() }));
9520
+ // studio#1324: whether this daemon's port starts at login (`serve --install-service`), for Settings' status row. The
9521
+ // port is the one this daemon listens on (the default when it is not listening, as under inject).
9522
+ app.get(`${V}/settings/start-on-login`, { config: { manifest: { responseType: 'StartOnLoginStatus', statusCodes: [200] } } }, async () => {
9523
+ const bound = app.server.address();
9524
+ return startOnLoginStatus(bound !== null && typeof bound === 'object' ? bound.port : DEFAULT_DAEMON_PORT, runtime.startOnLogin?.platform, runtime.startOnLogin?.home);
9525
+ });
9348
9526
  // The demo video's palette from the studio skin (operator 2026-10-14): read-only, derived from `studio.appearance`;
9349
9527
  // garden's demo stage and interactive's re-cuts read it as their default colours.
9350
9528
  app.get(`${V}/appearance/video-palette`, { config: { manifest: { responseType: 'VideoPaletteResponse', statusCodes: [200] } } }, async () => videoPalette((await adapter.getSettings())['studio.appearance']));
@@ -9711,12 +9889,24 @@ runtime = {}) {
9711
9889
  args.kind_type = kindType;
9712
9890
  if (state !== undefined)
9713
9891
  args.state = state;
9892
+ let listed;
9714
9893
  try {
9715
- return (await estateTool('proposal.list', args));
9894
+ listed = (await estateTool('proposal.list', args));
9716
9895
  }
9717
9896
  catch (err) {
9718
9897
  return estateUpstreamError(reply, err);
9719
9898
  }
9899
+ // crew#1261: a rejected row says who rejected it and why, when crew made that decision.
9900
+ const decided = await proposalDecisions.decisions();
9901
+ if (decided.size === 0 || !Array.isArray(listed?.proposals))
9902
+ return listed;
9903
+ return {
9904
+ ...listed,
9905
+ proposals: listed.proposals.map((p) => {
9906
+ const decision = p.state === 'rejected' ? decided.get(p.id) : undefined;
9907
+ return decision !== undefined ? { ...p, decision } : p;
9908
+ }),
9909
+ };
9720
9910
  });
9721
9911
  // POST /proposals {content, project?, source?} → proposal.submit → 201 { id } (api-types 0.54.0).
9722
9912
  // A skin files ONE preference into the same review queue — studio's "takes": the person picks one
@@ -9839,7 +10029,9 @@ runtime = {}) {
9839
10029
  }
9840
10030
  if (policyReach === undefined && (edit.data.content !== undefined || edit.data.reach !== undefined)) {
9841
10031
  try {
9842
- const done = await approveEdited(editTool, id, edit.data, (runId) => projects.index.projectOf(runId));
10032
+ const done = await approveEdited(editTool, id, edit.data, (runId) => projects.index.projectOf(runId),
10033
+ // crew#1261: the original replaced by the copy, or a copy withdrawn, is crew's decision on the person's behalf.
10034
+ (pid, reason, copy) => recordProposalDecision(audit, actorOf(req), pid, reason, copy));
9843
10035
  return reply.code(done.status).send(done.body);
9844
10036
  }
9845
10037
  catch (err) {
@@ -9864,7 +10056,9 @@ runtime = {}) {
9864
10056
  // crew#1546: an edited learning's replacement whose learning is gone is stale: refused and rejected, never approved,
9865
10057
  // so no crash window can bring retired words back (accept-with-edit checks the same in `approveEdited`).
9866
10058
  try {
9867
- const stale = row?.kind_type === 'memory' ? await refuseStaleReplacement(estateTool, id, row.payload) : null;
10059
+ const stale = row?.kind_type === 'memory'
10060
+ ? await refuseStaleReplacement(estateTool, id, row.payload, (pid) => recordProposalDecision(audit, actorOf(req), pid, 'stale'))
10061
+ : null;
9868
10062
  if (stale !== null)
9869
10063
  return reply.code(409).send({ error: stale, code: 'stale_replacement' });
9870
10064
  }
@@ -9949,10 +10143,18 @@ runtime = {}) {
9949
10143
  return landFailed(`${new SteeringUnsupportedError('Landing an approved policy proposal').message} — the ` +
9950
10144
  `installed engine would silently drop the rule's steering fields; upgrade wicked-core-ts (>= 0.7.5)`);
9951
10145
  }
9952
- // A proposal with no `project` facet keeps the project of the run that filed it.
10146
+ // A proposal's `project` facet resolves to a known project (crew#1774); one that names none keeps the project of
10147
+ // the run that filed it.
9953
10148
  const runId = policyRow.provenance?.['run_id'];
9954
10149
  const runProject = typeof runId === 'string' && runId !== '' ? projects.index.projectOf(runId) : undefined;
9955
- const built = policyProposalToRule(id, policyRow.kind_type, policyRow.payload, isStringRecord(policyRow.facets) ? policyRow.facets : undefined, { ...(runProject !== undefined ? { runProject } : {}), ...(policyReach !== undefined ? { reach: policyReach } : {}) });
10150
+ let knownProjects;
10151
+ try {
10152
+ knownProjects = await adapter.projectList();
10153
+ }
10154
+ catch (err) {
10155
+ return landFailed(`the projects could not be read to resolve the rule's project (${message(err)})`);
10156
+ }
10157
+ const built = policyProposalToRule(id, policyRow.kind_type, policyRow.payload, isStringRecord(policyRow.facets) ? policyRow.facets : undefined, { ...(runProject !== undefined ? { runProject } : {}), ...(policyReach !== undefined ? { reach: policyReach } : {}), projects: knownProjects });
9956
10158
  if ('error' in built) {
9957
10159
  return landFailed(built.error);
9958
10160
  }
@@ -10019,6 +10221,8 @@ runtime = {}) {
10019
10221
  catch (err) {
10020
10222
  return estateUpstreamError(reply, err);
10021
10223
  }
10224
+ // crew#1261: turned down by this caller (a person's rejection when it is a person).
10225
+ recordProposalDecision(audit, actorOf(req), id.trim(), 'rejected');
10022
10226
  // A policy proposal's rule lands before its approval, so a still-pending proposal may already
10023
10227
  // have a live rule (a crash or an unconfirmed approve in between): rejecting it withdraws it.
10024
10228
  const withdrawn = await withdrawLandedRule(adapter, id.trim());
@@ -10047,11 +10251,14 @@ runtime = {}) {
10047
10251
  // • RETIRE comes in two widths. `POST /memory/retire { scope_prefix }` is SUBTREE-scoped:
10048
10252
  // `memory.erase {scope_prefix}` hard-deletes EVERY memory whose scope equals or descends from
10049
10253
  // the prefix, and refuses an empty prefix (a total-wipe guard) — the UI must show the operator
10050
- // the subtree. `POST /memory/retire-item { memory_id }` (studio#206) removes exactly ONE memory
10051
- // through `memory.erase {id}` (wicked-estate#188); an older estate refuses that call without
10052
- // deleting anything, and the route answers 501 naming the upgrade — never a subtree fallback.
10254
+ // the subtree. `POST /memory/retire-item { memory_id }` (studio#206) SOFT-retires exactly ONE
10255
+ // memory through `memory.retire {id}` (crew#1697, wicked-estate#552): hidden from recall and the
10256
+ // browse, kept with its id, listed by `GET /memory?retired=1`, restored by `POST /memory/unretire`.
10257
+ // `POST /memory/erase-item { memory_id }` deletes one for good (`memory.erase {id}`,
10258
+ // wicked-estate#188), the right-to-erasure path. An estate without the tool refuses the call
10259
+ // without changing anything, and the route answers 501 naming the upgrade — never a fallback.
10053
10260
  // GET /memory?query=&scope_prefix=&facets=<json>&limit= → memory.list + post-filter → { memories }.
10054
- app.get(`${V}/memory`, { config: { manifest: { responseType: 'ListMemoriesResponse', statusCodes: [200, 400, 502] } } }, async (req, reply) => {
10261
+ app.get(`${V}/memory`, { config: { manifest: { responseType: 'ListMemoriesResponse', statusCodes: [200, 400, 501, 502] } } }, async (req, reply) => {
10055
10262
  const q = req.query;
10056
10263
  // `scope_prefix` is the ONLY estate-side argument to memory.list (a subtree filter; blank /
10057
10264
  // omitted = every memory). Forward verbatim WHEN PRESENT — a blank value is meaningful
@@ -10060,6 +10267,14 @@ runtime = {}) {
10060
10267
  const scopePrefix = firstQueryValue(q.scope_prefix);
10061
10268
  if (scopePrefix !== undefined)
10062
10269
  args.scope_prefix = scopePrefix;
10270
+ // crew#1697: `retired=1` lists the soft-retired memories (`memory.list {retired: true}`) instead.
10271
+ const rawRetired = firstQueryValue(q.retired)?.trim().toLowerCase();
10272
+ if (rawRetired !== undefined && !['1', 'true', '0', 'false'].includes(rawRetired)) {
10273
+ return reply.code(400).send({ error: '`retired` must be 1, true, 0 or false' });
10274
+ }
10275
+ const retired = rawRetired === '1' || rawRetired === 'true';
10276
+ if (retired)
10277
+ args.retired = true;
10063
10278
  // `facets` narrows the COMPLETE list crew-side (after the estate fetch) to memories carrying
10064
10279
  // every given axis:value (a management filter, NOT a recall intent). Present-but-blank is a
10065
10280
  // client error
@@ -10120,6 +10335,14 @@ runtime = {}) {
10120
10335
  throw new EstateMcpError('memory.list returned an unexpected shape');
10121
10336
  }
10122
10337
  let memories = items.map(shapeMemoryItem);
10338
+ // An estate before wicked-estate#552 ignores `retired` and lists the LIVE memories: a row without
10339
+ // `retired_at` in a retired list is that, never shown as retired.
10340
+ if (retired && memories.some((m) => m.retired_at === undefined)) {
10341
+ return reply.code(501).send({
10342
+ error: 'this wicked-estate cannot list retired memories (it needs wicked-estate#552); upgrade wicked-estate-mcp',
10343
+ code: 'estate_upgrade_required',
10344
+ });
10345
+ }
10123
10346
  if (query !== '')
10124
10347
  memories = memories.filter((m) => m.content.toLowerCase().includes(query));
10125
10348
  if (facetFilter !== undefined) {
@@ -10136,6 +10359,9 @@ runtime = {}) {
10136
10359
  return body;
10137
10360
  }
10138
10361
  catch (err) {
10362
+ if (retired && estateLacksTool(err)) {
10363
+ return reply.code(501).send(estateUpgrade('cannot list retired memories', '#552', 'nothing was changed'));
10364
+ }
10139
10365
  return estateUpstreamError(reply, err);
10140
10366
  }
10141
10367
  });
@@ -10188,15 +10414,15 @@ runtime = {}) {
10188
10414
  return estateUpstreamError(reply, err);
10189
10415
  }
10190
10416
  });
10191
- // POST /memory/retire-item { memory_id } → memory.erase { id } → { erased: 1 } (studio#206). Removes
10192
- // exactly ONE memory: the id is the only target sent, so no reading of it can widen to a subtree.
10193
- // 404 when estate holds no memory with that id (it erased 0). 501 when the estate predates
10194
- // wicked-estate#188: it refuses an id-only erase for want of `scope_prefix`, deleting nothing.
10417
+ // POST /memory/retire-item { memory_id } → memory.retire { id } → { retired: 1 } (studio#206; soft since
10418
+ // crew#1697). Hides exactly ONE memory, kept with its id: the id is the only target sent, so no reading of it can
10419
+ // widen to a subtree. 404 when estate holds no live memory with that id (it retired 0). 501 when the estate
10420
+ // predates soft retire (wicked-estate#552): it refuses the unknown tool, changing nothing — never an erase instead.
10195
10421
  app.post(`${V}/memory/retire-item`, {
10196
10422
  config: {
10197
10423
  manifest: {
10198
10424
  requestType: 'RetireMemoryItemBody',
10199
- responseType: 'RetireMemoryResponse',
10425
+ responseType: 'RetireMemoryItemResponse',
10200
10426
  statusCodes: [200, 400, 404, 501, 502],
10201
10427
  },
10202
10428
  },
@@ -10208,27 +10434,132 @@ runtime = {}) {
10208
10434
  const memoryId = parsed.data.memory_id.trim();
10209
10435
  if (memoryId === '')
10210
10436
  return reply.code(400).send({ error: '`memory_id` must not be empty' });
10437
+ // An edit in flight ends by erasing the memory it replaces (retired or not), so a retire that slipped in
10438
+ // between would be erased for good: the two take turns on one memory (codex review).
10439
+ if (memoryEditsInFlight.has(memoryId)) {
10440
+ return reply.code(409).send({ error: `memory ${memoryId} is being edited; retire it once the edit is done` });
10441
+ }
10442
+ memoryEditsInFlight.add(memoryId);
10211
10443
  try {
10212
- const raw = await estateTool('memory.erase', { id: memoryId });
10213
- const deleted = typeof raw === 'object' && raw !== null ? raw['deleted_count'] : undefined;
10214
- if (typeof deleted !== 'number') {
10215
- throw new EstateMcpError('memory.erase returned an unexpected shape');
10216
- }
10217
- if (deleted === 0)
10444
+ const count = oneMemoryCount(await estateTool('memory.retire', { id: memoryId }), 'memory.retire', 'retired_count');
10445
+ if (count === 0)
10446
+ return reply.code(404).send({ error: `no live memory ${memoryId}` });
10447
+ const body = { retired: 1 };
10448
+ return body;
10449
+ }
10450
+ catch (err) {
10451
+ if (estateLacksTool(err))
10452
+ return reply.code(501).send(estateUpgrade('cannot retire a memory and restore it later', '#552', 'nothing was changed'));
10453
+ return estateUpstreamError(reply, err);
10454
+ }
10455
+ finally {
10456
+ memoryEditsInFlight.delete(memoryId);
10457
+ }
10458
+ });
10459
+ // POST /memory/unretire { memory_id } → memory.unretire { id } → { restored: 1 } (crew#1697). Restores ONE
10460
+ // retired memory with the same id. 404 when no retired memory has that id; 501 on an estate before #552.
10461
+ app.post(`${V}/memory/unretire`, {
10462
+ config: {
10463
+ manifest: {
10464
+ requestType: 'UnretireMemoryBody',
10465
+ responseType: 'UnretireMemoryResponse',
10466
+ statusCodes: [200, 400, 404, 501, 502],
10467
+ },
10468
+ },
10469
+ }, async (req, reply) => {
10470
+ const parsed = RetireMemoryItemSchema.safeParse(req.body);
10471
+ if (!parsed.success) {
10472
+ return reply.code(400).send(invalidBody(parsed.error, 'Invalid restore request'));
10473
+ }
10474
+ const memoryId = parsed.data.memory_id.trim();
10475
+ if (memoryId === '')
10476
+ return reply.code(400).send({ error: '`memory_id` must not be empty' });
10477
+ try {
10478
+ const count = oneMemoryCount(await estateTool('memory.unretire', { id: memoryId }), 'memory.unretire', 'restored_count');
10479
+ if (count === 0)
10480
+ return reply.code(404).send({ error: `no retired memory ${memoryId}` });
10481
+ const body = { restored: 1 };
10482
+ return body;
10483
+ }
10484
+ catch (err) {
10485
+ if (estateLacksTool(err))
10486
+ return reply.code(501).send(estateUpgrade('cannot restore a retired memory', '#552', 'nothing was changed'));
10487
+ return estateUpstreamError(reply, err);
10488
+ }
10489
+ });
10490
+ // POST /memory/erase-item { memory_id } → memory.erase { id } → { erased: 1 } (crew#1697; the hard delete
10491
+ // `retire-item` was before it went soft). Deletes ONE memory for good, live or retired. 404 when estate holds no
10492
+ // memory with that id; 501 when the estate predates wicked-estate#188 (it refuses an id-only erase, deleting nothing).
10493
+ app.post(`${V}/memory/erase-item`, {
10494
+ config: {
10495
+ manifest: {
10496
+ requestType: 'EraseMemoryItemBody',
10497
+ responseType: 'RetireMemoryResponse',
10498
+ statusCodes: [200, 400, 404, 501, 502],
10499
+ },
10500
+ },
10501
+ }, async (req, reply) => {
10502
+ const parsed = RetireMemoryItemSchema.safeParse(req.body);
10503
+ if (!parsed.success) {
10504
+ return reply.code(400).send(invalidBody(parsed.error, 'Invalid erase request'));
10505
+ }
10506
+ const memoryId = parsed.data.memory_id.trim();
10507
+ if (memoryId === '')
10508
+ return reply.code(400).send({ error: '`memory_id` must not be empty' });
10509
+ try {
10510
+ const count = oneMemoryCount(await estateTool('memory.erase', { id: memoryId }), 'memory.erase', 'deleted_count');
10511
+ if (count === 0)
10218
10512
  return reply.code(404).send({ error: `no memory ${memoryId}` });
10219
- if (deleted !== 1) {
10220
- // An id names one memory; any other count is estate misbehaving, and it is reported as such.
10221
- return reply.code(502).send({ error: `memory.erase {id} removed ${deleted} memories, expected 1` });
10222
- }
10223
10513
  const body = { erased: 1 };
10224
10514
  return body;
10225
10515
  }
10226
10516
  catch (err) {
10227
10517
  if (err instanceof EstateMcpError && err.code === -32602 && ESTATE_NO_ERASE_BY_ID.test(err.message)) {
10228
- return reply.code(501).send({
10229
- error: 'this wicked-estate cannot erase one memory by id (it needs wicked-estate#188); upgrade wicked-estate-mcp — nothing was deleted',
10230
- code: 'estate_upgrade_required',
10231
- });
10518
+ return reply.code(501).send(estateUpgrade('cannot erase one memory by id', '#188', 'nothing was deleted'));
10519
+ }
10520
+ return estateUpstreamError(reply, err);
10521
+ }
10522
+ });
10523
+ // POST /knowledge/forget { id | source | scope_prefix, confirm_erase_all? } → knowledge.forget →
10524
+ // { forgotten, skipped_live_source } (crew#1697, wicked-estate#553). Hard-deletes document knowledge only. Exactly
10525
+ // one target, checked here (400 before any spawn); estate's own -32602 is a 400 too. A live source's structure
10526
+ // named by id is refused by estate (409: it is refreshed through its source); an estate before #553 is a 501.
10527
+ app.post(`${V}/knowledge/forget`, {
10528
+ config: {
10529
+ manifest: {
10530
+ requestType: 'ForgetKnowledgeBody',
10531
+ responseType: 'ForgetKnowledgeResponse',
10532
+ statusCodes: [200, 400, 409, 501, 502],
10533
+ },
10534
+ },
10535
+ }, async (req, reply) => {
10536
+ const parsed = ForgetKnowledgeSchema.safeParse(req.body);
10537
+ if (!parsed.success) {
10538
+ return reply.code(400).send(invalidBody(parsed.error, 'Invalid forget request'));
10539
+ }
10540
+ const { confirm_erase_all: confirm, ...targets } = parsed.data;
10541
+ const named = Object.entries(targets).filter(([, v]) => v !== undefined);
10542
+ if (named.length !== 1) {
10543
+ return reply.code(400).send({ error: 'give exactly one of `id`, `source` or `scope_prefix`' });
10544
+ }
10545
+ const [field, value] = named[0];
10546
+ if (value.trim() === '' && !(field === 'scope_prefix' && value === '' && confirm === true)) {
10547
+ return reply.code(400).send({ error: `\`${field}\` must not be empty (forgetting everything is \`scope_prefix: ""\` with \`confirm_erase_all: true\`)` });
10548
+ }
10549
+ try {
10550
+ const raw = await estateTool('knowledge.forget', { [field]: value, ...(confirm !== undefined ? { confirm_erase_all: confirm } : {}) });
10551
+ const r = typeof raw === 'object' && raw !== null ? raw : {};
10552
+ if (typeof r['forgotten'] !== 'number' || typeof r['skipped_live_source'] !== 'number') {
10553
+ throw new EstateMcpError('knowledge.forget returned an unexpected shape');
10554
+ }
10555
+ const body = { forgotten: r['forgotten'], skipped_live_source: r['skipped_live_source'] };
10556
+ return body;
10557
+ }
10558
+ catch (err) {
10559
+ if (estateLacksTool(err))
10560
+ return reply.code(501).send(estateUpgrade('cannot forget knowledge', '#553', 'nothing was deleted'));
10561
+ if (err instanceof EstateMcpError && ESTATE_FORGET_REFUSED.test(err.message)) {
10562
+ return reply.code(409).send({ error: err.message });
10232
10563
  }
10233
10564
  return estateUpstreamError(reply, err);
10234
10565
  }
@@ -10261,7 +10592,7 @@ runtime = {}) {
10261
10592
  if (content === '')
10262
10593
  return reply.code(400).send({ error: '`content` must not be empty' });
10263
10594
  if (memoryEditsInFlight.has(memoryId)) {
10264
- return reply.code(409).send({ error: `memory ${memoryId} is already being edited` });
10595
+ return reply.code(409).send({ error: `memory ${memoryId} is already being edited or retired` });
10265
10596
  }
10266
10597
  memoryEditsInFlight.add(memoryId);
10267
10598
  // Every estate call here is crew's own (no client argument reaches estate unchecked), so an
@@ -10289,10 +10620,14 @@ runtime = {}) {
10289
10620
  : [];
10290
10621
  });
10291
10622
  };
10292
- /** Reject these proposals; true only when the queue is read back with none of them pending. */
10293
- const withdraw = async (ids) => {
10294
- for (const id of ids)
10295
- await estateTool('proposal.reject', { id }).catch(() => undefined);
10623
+ /** Reject these proposals; true only when the queue is read back with none of them pending. Each rejection
10624
+ * that happened is recorded as crew's (crew#1261): `stale` for a superseded replacement, `withdrawn` for one
10625
+ * this edit filed itself and is taking back. */
10626
+ const withdraw = async (ids, reason = 'withdrawn') => {
10627
+ for (const id of ids) {
10628
+ if (await estateTool('proposal.reject', { id }).then(() => true, () => false))
10629
+ recordProposalDecision(audit, actorOf(req), id, reason);
10630
+ }
10296
10631
  try {
10297
10632
  const still = new Set((await pendingMemoryProposals()).map((q) => q.id));
10298
10633
  return ids.every((id) => !still.has(id));
@@ -10344,7 +10679,7 @@ runtime = {}) {
10344
10679
  catch (err) {
10345
10680
  return { status: 502, error: `reading the approve queue failed (${message(err)}); nothing changed` };
10346
10681
  }
10347
- if (superseded.length > 0 && !(await withdraw(superseded))) {
10682
+ if (superseded.length > 0 && !(await withdraw(superseded, 'stale'))) {
10348
10683
  return { status: 502, error: `an earlier replacement of ${old.id} (${superseded.join(', ')}) is still pending and could not be rejected; reject it on the approve page first. Nothing changed` };
10349
10684
  }
10350
10685
  let pid = null;
@@ -10954,7 +11289,7 @@ runtime = {}) {
10954
11289
  // Bounded by what is left of the snapshot's budget too (a slow start must not push it past 8 s):
10955
11290
  // the assembly after the infra probes keeps about 1.5 s.
10956
11291
  const clusterP = (containerFloor ? clusterReader.read(Math.min(CLUSTER_TIMEOUT_MS, left() - 1_500)) : Promise.resolve(null))
10957
- .then((read) => clusterRows(read, containerFloor, clusterStarted));
11292
+ .then((read) => clusterRows(read, containerFloor, clusterStarted, clusterReader.engine()));
10958
11293
  const infraP = Promise.all([
10959
11294
  clusterP.then((rows) => rows.gateway),
10960
11295
  brokerP,
@@ -11365,7 +11700,8 @@ runtime = {}) {
11365
11700
  sessionsDetail: () => adapter.sessionsDetail(),
11366
11701
  workOutput: (unitId) => adapter.workOutput(unitId),
11367
11702
  projectList: () => adapter.projectList(),
11368
- listRepos: () => adapter.listRepos(),
11703
+ // crew#1744: the repo search indexes each repo's remote, so it reads the same `git_url` GET /repos shows.
11704
+ listRepos: () => repoOrigins.list(() => adapter.listRepos()),
11369
11705
  listRules: () => adapter.listConformanceRules(),
11370
11706
  projectOf: (id) => projects.index.projectOf(id),
11371
11707
  runFacts: runTimingIndex,
@@ -11386,8 +11722,8 @@ runtime = {}) {
11386
11722
  log: (m) => app.log.warn(m),
11387
11723
  });
11388
11724
  registerSearchRoutes(app, search);
11389
- const runEvalsPrepare = async (input) => {
11390
- await prepareRunEvalsLaunch(input, () => runAndRecord(defaultEvalDeps, { project: null, baseline: false, id: randomUUID(), now: new Date() }), runtime.evalRunsDir);
11725
+ const runEvalsPrepare = async (input, scope = { project: null }) => {
11726
+ await prepareRunEvalsLaunch(input, () => runAndRecord(defaultEvalDeps, { project: scope.project, baseline: false, ...(scope.suites !== undefined ? { suites: scope.suites } : {}), id: randomUUID(), now: new Date() }), runtime.evalRunsDir, scope);
11391
11727
  };
11392
11728
  return { exclusive: decideExclusively, decideGate, decisions, chatRecorder, considerations, search, decorateRun, runEvalsPrepare, chatProposals, proposalLaunchers };
11393
11729
  }