wicked-crew 0.18.19 → 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 (700) hide show
  1. package/README.md +9 -6
  2. package/dist/api/ask-paths.d.ts +2 -0
  3. package/dist/api/ask-paths.d.ts.map +1 -1
  4. package/dist/api/ask-paths.js +6 -0
  5. package/dist/api/ask-paths.js.map +1 -1
  6. package/dist/api/auth.d.ts +7 -5
  7. package/dist/api/auth.d.ts.map +1 -1
  8. package/dist/api/auth.js +23 -9
  9. package/dist/api/auth.js.map +1 -1
  10. package/dist/api/capture.d.ts +5 -2
  11. package/dist/api/capture.d.ts.map +1 -1
  12. package/dist/api/capture.js +13 -10
  13. package/dist/api/capture.js.map +1 -1
  14. package/dist/api/chat-attachments.d.ts.map +1 -1
  15. package/dist/api/chat-attachments.js +69 -19
  16. package/dist/api/chat-attachments.js.map +1 -1
  17. package/dist/api/chat-citations.d.ts.map +1 -1
  18. package/dist/api/chat-citations.js +22 -0
  19. package/dist/api/chat-citations.js.map +1 -1
  20. package/dist/api/chat-context.d.ts +16 -1
  21. package/dist/api/chat-context.d.ts.map +1 -1
  22. package/dist/api/chat-context.js +75 -14
  23. package/dist/api/chat-context.js.map +1 -1
  24. package/dist/api/chat-freshness.js +2 -2
  25. package/dist/api/chat-freshness.js.map +1 -1
  26. package/dist/api/chat-history.d.ts +13 -0
  27. package/dist/api/chat-history.d.ts.map +1 -1
  28. package/dist/api/chat-history.js +25 -0
  29. package/dist/api/chat-history.js.map +1 -1
  30. package/dist/api/chat-jobs.d.ts +67 -6
  31. package/dist/api/chat-jobs.d.ts.map +1 -1
  32. package/dist/api/chat-jobs.js +243 -22
  33. package/dist/api/chat-jobs.js.map +1 -1
  34. package/dist/api/chat-proposals.d.ts +69 -6
  35. package/dist/api/chat-proposals.d.ts.map +1 -1
  36. package/dist/api/chat-proposals.js +310 -49
  37. package/dist/api/chat-proposals.js.map +1 -1
  38. package/dist/api/chat-requirements.d.ts.map +1 -1
  39. package/dist/api/chat-requirements.js +4 -1
  40. package/dist/api/chat-requirements.js.map +1 -1
  41. package/dist/api/chat-scope.d.ts +17 -9
  42. package/dist/api/chat-scope.d.ts.map +1 -1
  43. package/dist/api/chat-scope.js +55 -21
  44. package/dist/api/chat-scope.js.map +1 -1
  45. package/dist/api/cluster-status.d.ts +24 -12
  46. package/dist/api/cluster-status.d.ts.map +1 -1
  47. package/dist/api/cluster-status.js +82 -4
  48. package/dist/api/cluster-status.js.map +1 -1
  49. package/dist/api/codebase-archive.d.ts +4 -3
  50. package/dist/api/codebase-archive.d.ts.map +1 -1
  51. package/dist/api/codebase-archive.js +6 -5
  52. package/dist/api/codebase-archive.js.map +1 -1
  53. package/dist/api/delivery-cache.d.ts +2 -0
  54. package/dist/api/delivery-cache.d.ts.map +1 -1
  55. package/dist/api/delivery-cache.js +1 -2
  56. package/dist/api/delivery-cache.js.map +1 -1
  57. package/dist/api/delivery-index.d.ts +2 -2
  58. package/dist/api/delivery-index.d.ts.map +1 -1
  59. package/dist/api/delivery-index.js +1 -2
  60. package/dist/api/delivery-index.js.map +1 -1
  61. package/dist/api/eval-compare.d.ts +1 -1
  62. package/dist/api/eval-compare.js +1 -1
  63. package/dist/api/eval-sample.d.ts +7 -0
  64. package/dist/api/eval-sample.d.ts.map +1 -1
  65. package/dist/api/eval-sample.js +20 -0
  66. package/dist/api/eval-sample.js.map +1 -1
  67. package/dist/api/gate-cache.d.ts +1 -0
  68. package/dist/api/gate-cache.d.ts.map +1 -1
  69. package/dist/api/gate-cache.js +19 -6
  70. package/dist/api/gate-cache.js.map +1 -1
  71. package/dist/api/governance-steering.d.ts +17 -4
  72. package/dist/api/governance-steering.d.ts.map +1 -1
  73. package/dist/api/governance-steering.js +56 -7
  74. package/dist/api/governance-steering.js.map +1 -1
  75. package/dist/api/mcp.d.ts +12 -2
  76. package/dist/api/mcp.d.ts.map +1 -1
  77. package/dist/api/mcp.js +56 -12
  78. package/dist/api/mcp.js.map +1 -1
  79. package/dist/api/needs.d.ts +20 -0
  80. package/dist/api/needs.d.ts.map +1 -1
  81. package/dist/api/needs.js +120 -19
  82. package/dist/api/needs.js.map +1 -1
  83. package/dist/api/onboarding-capture.d.ts +21 -1
  84. package/dist/api/onboarding-capture.d.ts.map +1 -1
  85. package/dist/api/onboarding-capture.js +112 -8
  86. package/dist/api/onboarding-capture.js.map +1 -1
  87. package/dist/api/policy-landing.d.ts +36 -0
  88. package/dist/api/policy-landing.d.ts.map +1 -1
  89. package/dist/api/policy-landing.js +123 -4
  90. package/dist/api/policy-landing.js.map +1 -1
  91. package/dist/api/post-hoc-deliver.d.ts.map +1 -1
  92. package/dist/api/post-hoc-deliver.js +2 -1
  93. package/dist/api/post-hoc-deliver.js.map +1 -1
  94. package/dist/api/product.d.ts +1 -1
  95. package/dist/api/proposal-decisions.d.ts +44 -0
  96. package/dist/api/proposal-decisions.d.ts.map +1 -0
  97. package/dist/api/proposal-decisions.js +85 -0
  98. package/dist/api/proposal-decisions.js.map +1 -0
  99. package/dist/api/proposal-onboard.d.ts +38 -1
  100. package/dist/api/proposal-onboard.d.ts.map +1 -1
  101. package/dist/api/proposal-onboard.js +203 -14
  102. package/dist/api/proposal-onboard.js.map +1 -1
  103. package/dist/api/recording.d.ts +1 -1
  104. package/dist/api/recording.d.ts.map +1 -1
  105. package/dist/api/recording.js +4 -5
  106. package/dist/api/recording.js.map +1 -1
  107. package/dist/api/redeliver.d.ts.map +1 -1
  108. package/dist/api/redeliver.js +11 -7
  109. package/dist/api/redeliver.js.map +1 -1
  110. package/dist/api/repo-input.d.ts.map +1 -1
  111. package/dist/api/repo-input.js +5 -2
  112. package/dist/api/repo-input.js.map +1 -1
  113. package/dist/api/repo-origins.d.ts +24 -0
  114. package/dist/api/repo-origins.d.ts.map +1 -0
  115. package/dist/api/repo-origins.js +71 -0
  116. package/dist/api/repo-origins.js.map +1 -0
  117. package/dist/api/requirements.d.ts +37 -16
  118. package/dist/api/requirements.d.ts.map +1 -1
  119. package/dist/api/requirements.js +73 -2
  120. package/dist/api/requirements.js.map +1 -1
  121. package/dist/api/retry-index.d.ts +2 -0
  122. package/dist/api/retry-index.d.ts.map +1 -1
  123. package/dist/api/retry-index.js +16 -8
  124. package/dist/api/retry-index.js.map +1 -1
  125. package/dist/api/review-change.d.ts +5 -6
  126. package/dist/api/review-change.d.ts.map +1 -1
  127. package/dist/api/review-change.js +45 -8
  128. package/dist/api/review-change.js.map +1 -1
  129. package/dist/api/roster-standing.d.ts +2 -0
  130. package/dist/api/roster-standing.d.ts.map +1 -1
  131. package/dist/api/roster-standing.js +8 -1
  132. package/dist/api/roster-standing.js.map +1 -1
  133. package/dist/api/routes.d.ts +55 -12
  134. package/dist/api/routes.d.ts.map +1 -1
  135. package/dist/api/routes.js +961 -277
  136. package/dist/api/routes.js.map +1 -1
  137. package/dist/api/run-documents.d.ts +9 -1
  138. package/dist/api/run-documents.d.ts.map +1 -1
  139. package/dist/api/run-documents.js +63 -5
  140. package/dist/api/run-documents.js.map +1 -1
  141. package/dist/api/run-sources.d.ts +11 -1
  142. package/dist/api/run-sources.d.ts.map +1 -1
  143. package/dist/api/run-sources.js +26 -3
  144. package/dist/api/run-sources.js.map +1 -1
  145. package/dist/api/run-timing-index.d.ts +47 -0
  146. package/dist/api/run-timing-index.d.ts.map +1 -1
  147. package/dist/api/run-timing-index.js +196 -86
  148. package/dist/api/run-timing-index.js.map +1 -1
  149. package/dist/api/runtime-state.d.ts +6 -0
  150. package/dist/api/runtime-state.d.ts.map +1 -1
  151. package/dist/api/runtime-state.js +14 -3
  152. package/dist/api/runtime-state.js.map +1 -1
  153. package/dist/api/seat-agents.d.ts.map +1 -1
  154. package/dist/api/seat-agents.js +3 -3
  155. package/dist/api/seat-agents.js.map +1 -1
  156. package/dist/api/seat-container-login.d.ts +6 -2
  157. package/dist/api/seat-container-login.d.ts.map +1 -1
  158. package/dist/api/seat-container-login.js +17 -9
  159. package/dist/api/seat-container-login.js.map +1 -1
  160. package/dist/api/seat-governance.d.ts +3 -2
  161. package/dist/api/seat-governance.d.ts.map +1 -1
  162. package/dist/api/seat-governance.js +31 -9
  163. package/dist/api/seat-governance.js.map +1 -1
  164. package/dist/api/seat-standing.d.ts +8 -0
  165. package/dist/api/seat-standing.d.ts.map +1 -1
  166. package/dist/api/seat-standing.js +26 -1
  167. package/dist/api/seat-standing.js.map +1 -1
  168. package/dist/api/server.d.ts +7 -0
  169. package/dist/api/server.d.ts.map +1 -1
  170. package/dist/api/server.js +172 -59
  171. package/dist/api/server.js.map +1 -1
  172. package/dist/api/stall-watchdog.d.ts +6 -0
  173. package/dist/api/stall-watchdog.d.ts.map +1 -1
  174. package/dist/api/stall-watchdog.js +28 -0
  175. package/dist/api/stall-watchdog.js.map +1 -1
  176. package/dist/api/start-on-login.d.ts +4 -0
  177. package/dist/api/start-on-login.d.ts.map +1 -0
  178. package/dist/api/start-on-login.js +35 -0
  179. package/dist/api/start-on-login.js.map +1 -0
  180. package/dist/api/steering-landing.d.ts +33 -8
  181. package/dist/api/steering-landing.d.ts.map +1 -1
  182. package/dist/api/steering-landing.js +235 -51
  183. package/dist/api/steering-landing.js.map +1 -1
  184. package/dist/api/system-snapshot.d.ts +5 -0
  185. package/dist/api/system-snapshot.d.ts.map +1 -1
  186. package/dist/api/system-snapshot.js +22 -10
  187. package/dist/api/system-snapshot.js.map +1 -1
  188. package/dist/api/testing.d.ts +2 -2
  189. package/dist/api/ui-text.js +2 -2
  190. package/dist/api/ui-text.js.map +1 -1
  191. package/dist/api/worktree-sweep.d.ts +7 -3
  192. package/dist/api/worktree-sweep.d.ts.map +1 -1
  193. package/dist/api/worktree-sweep.js +10 -6
  194. package/dist/api/worktree-sweep.js.map +1 -1
  195. package/dist/apps/actions/api-action.js +5 -2
  196. package/dist/apps/actions/api-action.js.map +1 -1
  197. package/dist/apps/actions/write-path.d.ts +9 -0
  198. package/dist/apps/actions/write-path.d.ts.map +1 -1
  199. package/dist/apps/actions/write-path.js +17 -9
  200. package/dist/apps/actions/write-path.js.map +1 -1
  201. package/dist/apps/exec/executor.d.ts +8 -15
  202. package/dist/apps/exec/executor.d.ts.map +1 -1
  203. package/dist/apps/exec/executor.js +10 -3
  204. package/dist/apps/exec/executor.js.map +1 -1
  205. package/dist/apps/exec/recall.d.ts.map +1 -1
  206. package/dist/apps/exec/recall.js +4 -4
  207. package/dist/apps/exec/recall.js.map +1 -1
  208. package/dist/apps/exec/redescribe.d.ts +37 -0
  209. package/dist/apps/exec/redescribe.d.ts.map +1 -0
  210. package/dist/apps/exec/redescribe.js +86 -0
  211. package/dist/apps/exec/redescribe.js.map +1 -0
  212. package/dist/apps/exec/source-stage.d.ts +3 -1
  213. package/dist/apps/exec/source-stage.d.ts.map +1 -1
  214. package/dist/apps/exec/source-stage.js +13 -3
  215. package/dist/apps/exec/source-stage.js.map +1 -1
  216. package/dist/apps/exec/sources.d.ts +6 -0
  217. package/dist/apps/exec/sources.d.ts.map +1 -1
  218. package/dist/apps/exec/sources.js +8 -0
  219. package/dist/apps/exec/sources.js.map +1 -1
  220. package/dist/apps/git.js +2 -2
  221. package/dist/apps/git.js.map +1 -1
  222. package/dist/apps/publish/manifest.d.ts +8 -1
  223. package/dist/apps/publish/manifest.d.ts.map +1 -1
  224. package/dist/apps/publish/manifest.js +14 -3
  225. package/dist/apps/publish/manifest.js.map +1 -1
  226. package/dist/apps/publish/run.d.ts +15 -2
  227. package/dist/apps/publish/run.d.ts.map +1 -1
  228. package/dist/apps/publish/run.js +100 -17
  229. package/dist/apps/publish/run.js.map +1 -1
  230. package/dist/apps/routes.d.ts +3 -0
  231. package/dist/apps/routes.d.ts.map +1 -1
  232. package/dist/apps/routes.js +58 -2
  233. package/dist/apps/routes.js.map +1 -1
  234. package/dist/apps/store.d.ts +24 -3
  235. package/dist/apps/store.d.ts.map +1 -1
  236. package/dist/apps/store.js +26 -9
  237. package/dist/apps/store.js.map +1 -1
  238. package/dist/apps/turns.d.ts +25 -2
  239. package/dist/apps/turns.d.ts.map +1 -1
  240. package/dist/apps/turns.js +276 -11
  241. package/dist/apps/turns.js.map +1 -1
  242. package/dist/apps-server/Dockerfile +2 -2
  243. package/dist/apps-server/runners/sqlite-runner.mjs +67 -12
  244. package/dist/apps-server/server/lib/bundle/server.mjs +353 -159
  245. package/dist/cli/governance.d.ts +5 -2
  246. package/dist/cli/governance.d.ts.map +1 -1
  247. package/dist/cli/governance.js +8 -5
  248. package/dist/cli/governance.js.map +1 -1
  249. package/dist/cli/index.d.ts.map +1 -1
  250. package/dist/cli/index.js +6 -5
  251. package/dist/cli/index.js.map +1 -1
  252. package/dist/cli/service.d.ts +10 -6
  253. package/dist/cli/service.d.ts.map +1 -1
  254. package/dist/cli/service.js +39 -23
  255. package/dist/cli/service.js.map +1 -1
  256. package/dist/core/adapter.d.ts +61 -29
  257. package/dist/core/adapter.d.ts.map +1 -1
  258. package/dist/core/adapter.js +214 -83
  259. package/dist/core/adapter.js.map +1 -1
  260. package/dist/core/ado-deliver-helper.d.ts +2 -1
  261. package/dist/core/ado-deliver-helper.d.ts.map +1 -1
  262. package/dist/core/ado-deliver-helper.js +26 -1
  263. package/dist/core/ado-deliver-helper.js.map +1 -1
  264. package/dist/core/assurance.d.ts +45 -42
  265. package/dist/core/assurance.d.ts.map +1 -1
  266. package/dist/core/assurance.js +74 -67
  267. package/dist/core/assurance.js.map +1 -1
  268. package/dist/core/deliver-text.d.ts +14 -0
  269. package/dist/core/deliver-text.d.ts.map +1 -1
  270. package/dist/core/deliver-text.js +41 -2
  271. package/dist/core/deliver-text.js.map +1 -1
  272. package/dist/core/deliver.d.ts +66 -1
  273. package/dist/core/deliver.d.ts.map +1 -1
  274. package/dist/core/deliver.js +183 -10
  275. package/dist/core/deliver.js.map +1 -1
  276. package/dist/core/engine-roster.d.ts +2 -0
  277. package/dist/core/engine-roster.d.ts.map +1 -1
  278. package/dist/core/engine-roster.js +13 -0
  279. package/dist/core/engine-roster.js.map +1 -1
  280. package/dist/core/estate-mcp-client.d.ts +13 -14
  281. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  282. package/dist/core/estate-mcp-client.js +49 -68
  283. package/dist/core/estate-mcp-client.js.map +1 -1
  284. package/dist/core/exec.d.ts +24 -0
  285. package/dist/core/exec.d.ts.map +1 -1
  286. package/dist/core/exec.js +45 -2
  287. package/dist/core/exec.js.map +1 -1
  288. package/dist/core/linked-issues.d.ts +13 -2
  289. package/dist/core/linked-issues.d.ts.map +1 -1
  290. package/dist/core/linked-issues.js +135 -4
  291. package/dist/core/linked-issues.js.map +1 -1
  292. package/dist/core/pr-checks-helper.d.ts +8 -4
  293. package/dist/core/pr-checks-helper.d.ts.map +1 -1
  294. package/dist/core/pr-checks-helper.js +39 -17
  295. package/dist/core/pr-checks-helper.js.map +1 -1
  296. package/dist/core/redeliver.js +2 -2
  297. package/dist/core/redeliver.js.map +1 -1
  298. package/dist/core/repo-clone.d.ts +64 -0
  299. package/dist/core/repo-clone.d.ts.map +1 -0
  300. package/dist/core/repo-clone.js +306 -0
  301. package/dist/core/repo-clone.js.map +1 -0
  302. package/dist/core/repoPaths.d.ts +2 -4
  303. package/dist/core/repoPaths.d.ts.map +1 -1
  304. package/dist/core/repoPaths.js +4 -6
  305. package/dist/core/repoPaths.js.map +1 -1
  306. package/dist/core/run-identity.d.ts.map +1 -1
  307. package/dist/core/run-identity.js +3 -0
  308. package/dist/core/run-identity.js.map +1 -1
  309. package/dist/core/run-read-lane.d.ts +30 -0
  310. package/dist/core/run-read-lane.d.ts.map +1 -0
  311. package/dist/core/run-read-lane.js +103 -0
  312. package/dist/core/run-read-lane.js.map +1 -0
  313. package/dist/core/types.d.ts +10 -0
  314. package/dist/core/types.d.ts.map +1 -1
  315. package/dist/core/types.js +2 -0
  316. package/dist/core/types.js.map +1 -1
  317. package/dist/core/walkthrough-root.d.ts.map +1 -1
  318. package/dist/core/walkthrough-root.js +3 -5
  319. package/dist/core/walkthrough-root.js.map +1 -1
  320. package/dist/core/wicked-home.d.ts +9 -0
  321. package/dist/core/wicked-home.d.ts.map +1 -0
  322. package/dist/core/wicked-home.js +25 -0
  323. package/dist/core/wicked-home.js.map +1 -0
  324. package/dist/decisions/consider.d.ts +2 -1
  325. package/dist/decisions/consider.d.ts.map +1 -1
  326. package/dist/decisions/consider.js +2 -2
  327. package/dist/decisions/consider.js.map +1 -1
  328. package/dist/decisions/land.d.ts +2 -0
  329. package/dist/decisions/land.d.ts.map +1 -1
  330. package/dist/decisions/land.js +16 -3
  331. package/dist/decisions/land.js.map +1 -1
  332. package/dist/decisions/rules-brief.d.ts +4 -1
  333. package/dist/decisions/rules-brief.d.ts.map +1 -1
  334. package/dist/decisions/rules-brief.js +3 -2
  335. package/dist/decisions/rules-brief.js.map +1 -1
  336. package/dist/editors/conformance-runtime.d.ts +0 -2
  337. package/dist/editors/conformance-runtime.d.ts.map +1 -1
  338. package/dist/editors/conformance-runtime.js +0 -4
  339. package/dist/editors/conformance-runtime.js.map +1 -1
  340. package/dist/editors/csp.d.ts +6 -0
  341. package/dist/editors/csp.d.ts.map +1 -1
  342. package/dist/editors/csp.js +10 -0
  343. package/dist/editors/csp.js.map +1 -1
  344. package/dist/editors/pack-install.d.ts +11 -15
  345. package/dist/editors/pack-install.d.ts.map +1 -1
  346. package/dist/editors/pack-install.js +52 -65
  347. package/dist/editors/pack-install.js.map +1 -1
  348. package/dist/editors/registry.d.ts +31 -13
  349. package/dist/editors/registry.d.ts.map +1 -1
  350. package/dist/editors/registry.js +51 -18
  351. package/dist/editors/registry.js.map +1 -1
  352. package/dist/editors/routes.d.ts +4 -2
  353. package/dist/editors/routes.d.ts.map +1 -1
  354. package/dist/editors/routes.js +23 -6
  355. package/dist/editors/routes.js.map +1 -1
  356. package/dist/editors/visuals.d.ts +4 -3
  357. package/dist/editors/visuals.d.ts.map +1 -1
  358. package/dist/editors/visuals.js +17 -7
  359. package/dist/editors/visuals.js.map +1 -1
  360. package/dist/evals/runner.js +1 -1
  361. package/dist/evals/runner.js.map +1 -1
  362. package/dist/evals/shape-corrections.js +1 -1
  363. package/dist/evals/shape-corrections.js.map +1 -1
  364. package/dist/evals/shape.d.ts +7 -1
  365. package/dist/evals/shape.d.ts.map +1 -1
  366. package/dist/evals/shape.js +26 -6
  367. package/dist/evals/shape.js.map +1 -1
  368. package/dist/evals/workflow.d.ts +16 -3
  369. package/dist/evals/workflow.d.ts.map +1 -1
  370. package/dist/evals/workflow.js +32 -6
  371. package/dist/evals/workflow.js.map +1 -1
  372. package/dist/governance/rule-revision.d.ts +7 -0
  373. package/dist/governance/rule-revision.d.ts.map +1 -0
  374. package/dist/governance/rule-revision.js +23 -0
  375. package/dist/governance/rule-revision.js.map +1 -0
  376. package/dist/insights/review-service.d.ts +26 -3
  377. package/dist/insights/review-service.d.ts.map +1 -1
  378. package/dist/insights/review-service.js +101 -11
  379. package/dist/insights/review-service.js.map +1 -1
  380. package/dist/insights/routes.d.ts +2 -1
  381. package/dist/insights/routes.d.ts.map +1 -1
  382. package/dist/insights/routes.js +19 -4
  383. package/dist/insights/routes.js.map +1 -1
  384. package/dist/insights/run-facts.d.ts +5 -0
  385. package/dist/insights/run-facts.d.ts.map +1 -1
  386. package/dist/insights/run-facts.js +15 -0
  387. package/dist/insights/run-facts.js.map +1 -1
  388. package/dist/insights/workflow.d.ts +2 -1
  389. package/dist/insights/workflow.d.ts.map +1 -1
  390. package/dist/insights/workflow.js +4 -4
  391. package/dist/insights/workflow.js.map +1 -1
  392. package/dist/inspect/service.d.ts +3 -2
  393. package/dist/inspect/service.d.ts.map +1 -1
  394. package/dist/inspect/service.js +4 -4
  395. package/dist/inspect/service.js.map +1 -1
  396. package/dist/interactive/bridge-pool.d.ts +2 -0
  397. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  398. package/dist/interactive/bridge-pool.js +18 -8
  399. package/dist/interactive/bridge-pool.js.map +1 -1
  400. package/dist/interactive/chat-events.d.ts +3 -0
  401. package/dist/interactive/chat-events.d.ts.map +1 -1
  402. package/dist/interactive/chat-events.js +20 -5
  403. package/dist/interactive/chat-events.js.map +1 -1
  404. package/dist/interactive/doc-delete-routes.d.ts +1 -0
  405. package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
  406. package/dist/interactive/doc-delete-routes.js +126 -123
  407. package/dist/interactive/doc-delete-routes.js.map +1 -1
  408. package/dist/interactive/draft-events.d.ts +11 -7
  409. package/dist/interactive/draft-events.d.ts.map +1 -1
  410. package/dist/interactive/draft-events.js +29 -22
  411. package/dist/interactive/draft-events.js.map +1 -1
  412. package/dist/interactive/draft-skill.d.ts +56 -3
  413. package/dist/interactive/draft-skill.d.ts.map +1 -1
  414. package/dist/interactive/draft-skill.js +129 -20
  415. package/dist/interactive/draft-skill.js.map +1 -1
  416. package/dist/interactive/landing-guard.d.ts +30 -5
  417. package/dist/interactive/landing-guard.d.ts.map +1 -1
  418. package/dist/interactive/landing-guard.js +121 -5
  419. package/dist/interactive/landing-guard.js.map +1 -1
  420. package/dist/interactive/proposal-create.d.ts +9 -11
  421. package/dist/interactive/proposal-create.d.ts.map +1 -1
  422. package/dist/interactive/proposal-create.js +28 -21
  423. package/dist/interactive/proposal-create.js.map +1 -1
  424. package/dist/interactive/proposal-refine.d.ts +4 -4
  425. package/dist/interactive/proposal-refine.d.ts.map +1 -1
  426. package/dist/interactive/proposal-refine.js +40 -7
  427. package/dist/interactive/proposal-refine.js.map +1 -1
  428. package/dist/interactive/proxy-routes.d.ts +10 -5
  429. package/dist/interactive/proxy-routes.d.ts.map +1 -1
  430. package/dist/interactive/proxy-routes.js +108 -11
  431. package/dist/interactive/proxy-routes.js.map +1 -1
  432. package/dist/interactive/review-events.js +1 -1
  433. package/dist/interactive/review-events.js.map +1 -1
  434. package/dist/interactive/run-units.d.ts.map +1 -1
  435. package/dist/interactive/run-units.js +3 -2
  436. package/dist/interactive/run-units.js.map +1 -1
  437. package/dist/interactive/source-packet.d.ts +13 -1
  438. package/dist/interactive/source-packet.d.ts.map +1 -1
  439. package/dist/interactive/source-packet.js +108 -34
  440. package/dist/interactive/source-packet.js.map +1 -1
  441. package/dist/knowledge/adapters/toolbox/memory.d.ts +2 -0
  442. package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -0
  443. package/dist/knowledge/adapters/toolbox/memory.js +43 -0
  444. package/dist/knowledge/adapters/toolbox/memory.js.map +1 -0
  445. package/dist/knowledge/adapters/toolbox/supervisor.d.ts +30 -4
  446. package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
  447. package/dist/knowledge/adapters/toolbox/supervisor.js +112 -28
  448. package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
  449. package/dist/knowledge/estate-write.d.ts +5 -0
  450. package/dist/knowledge/estate-write.d.ts.map +1 -1
  451. package/dist/knowledge/estate-write.js +7 -0
  452. package/dist/knowledge/estate-write.js.map +1 -1
  453. package/dist/knowledge/gate/gate.d.ts.map +1 -1
  454. package/dist/knowledge/gate/gate.js +4 -1
  455. package/dist/knowledge/gate/gate.js.map +1 -1
  456. package/dist/knowledge/gate/record.d.ts +15 -2
  457. package/dist/knowledge/gate/record.d.ts.map +1 -1
  458. package/dist/knowledge/gate/record.js +108 -29
  459. package/dist/knowledge/gate/record.js.map +1 -1
  460. package/dist/knowledge/projector.d.ts +60 -5
  461. package/dist/knowledge/projector.d.ts.map +1 -1
  462. package/dist/knowledge/projector.js +264 -21
  463. package/dist/knowledge/projector.js.map +1 -1
  464. package/dist/knowledge/registry/entry.d.ts +7 -0
  465. package/dist/knowledge/registry/entry.d.ts.map +1 -1
  466. package/dist/knowledge/registry/entry.js +4 -0
  467. package/dist/knowledge/registry/entry.js.map +1 -1
  468. package/dist/knowledge/shapes/map.d.ts.map +1 -1
  469. package/dist/knowledge/shapes/map.js +12 -2
  470. package/dist/knowledge/shapes/map.js.map +1 -1
  471. package/dist/knowledge/shapes/routes.d.ts +1 -1
  472. package/dist/knowledge/shapes/routes.d.ts.map +1 -1
  473. package/dist/knowledge/shapes/routes.js +42 -16
  474. package/dist/knowledge/shapes/routes.js.map +1 -1
  475. package/dist/knowledge/shapes/shapes.d.ts +60 -13
  476. package/dist/knowledge/shapes/shapes.d.ts.map +1 -1
  477. package/dist/knowledge/shapes/shapes.js +199 -31
  478. package/dist/knowledge/shapes/shapes.js.map +1 -1
  479. package/dist/knowledge/shapes/verified.d.ts.map +1 -1
  480. package/dist/knowledge/shapes/verified.js +3 -2
  481. package/dist/knowledge/shapes/verified.js.map +1 -1
  482. package/dist/knowledge/trackers/addresses.d.ts +27 -3
  483. package/dist/knowledge/trackers/addresses.d.ts.map +1 -1
  484. package/dist/knowledge/trackers/addresses.js +33 -5
  485. package/dist/knowledge/trackers/addresses.js.map +1 -1
  486. package/dist/knowledge/trackers/gate-pm.d.ts.map +1 -1
  487. package/dist/knowledge/trackers/gate-pm.js +4 -2
  488. package/dist/knowledge/trackers/gate-pm.js.map +1 -1
  489. package/dist/knowledge/trackers/projector.d.ts +3 -1
  490. package/dist/knowledge/trackers/projector.d.ts.map +1 -1
  491. package/dist/knowledge/trackers/projector.js +59 -8
  492. package/dist/knowledge/trackers/projector.js.map +1 -1
  493. package/dist/learn/scheduler.d.ts.map +1 -1
  494. package/dist/learn/scheduler.js +13 -3
  495. package/dist/learn/scheduler.js.map +1 -1
  496. package/dist/learnings/estate.d.ts.map +1 -1
  497. package/dist/learnings/estate.js +3 -14
  498. package/dist/learnings/estate.js.map +1 -1
  499. package/dist/learnings/extract.d.ts +9 -3
  500. package/dist/learnings/extract.d.ts.map +1 -1
  501. package/dist/learnings/extract.js +62 -4
  502. package/dist/learnings/extract.js.map +1 -1
  503. package/dist/learnings/replacement-lineage.d.ts +3 -2
  504. package/dist/learnings/replacement-lineage.d.ts.map +1 -1
  505. package/dist/learnings/replacement-lineage.js +7 -6
  506. package/dist/learnings/replacement-lineage.js.map +1 -1
  507. package/dist/learnings/service.d.ts +12 -2
  508. package/dist/learnings/service.d.ts.map +1 -1
  509. package/dist/learnings/service.js +30 -5
  510. package/dist/learnings/service.js.map +1 -1
  511. package/dist/mcp/broker.d.ts.map +1 -1
  512. package/dist/mcp/broker.js +19 -5
  513. package/dist/mcp/broker.js.map +1 -1
  514. package/dist/mcp/env.d.ts +12 -4
  515. package/dist/mcp/env.d.ts.map +1 -1
  516. package/dist/mcp/env.js +24 -4
  517. package/dist/mcp/env.js.map +1 -1
  518. package/dist/mcp/estate-relay.d.ts +3 -0
  519. package/dist/mcp/estate-relay.d.ts.map +1 -1
  520. package/dist/mcp/estate-relay.js +7 -6
  521. package/dist/mcp/estate-relay.js.map +1 -1
  522. package/dist/mcp/invoke.d.ts.map +1 -1
  523. package/dist/mcp/invoke.js +6 -5
  524. package/dist/mcp/invoke.js.map +1 -1
  525. package/dist/mcp/probe.d.ts +14 -1
  526. package/dist/mcp/probe.d.ts.map +1 -1
  527. package/dist/mcp/probe.js +55 -10
  528. package/dist/mcp/probe.js.map +1 -1
  529. package/dist/mcp/redact.d.ts +1 -1
  530. package/dist/mcp/redact.d.ts.map +1 -1
  531. package/dist/mcp/redact.js +61 -4
  532. package/dist/mcp/redact.js.map +1 -1
  533. package/dist/mcp/registry-store.d.ts +37 -0
  534. package/dist/mcp/registry-store.d.ts.map +1 -1
  535. package/dist/mcp/registry-store.js +43 -0
  536. package/dist/mcp/registry-store.js.map +1 -1
  537. package/dist/mcp/registry.d.ts +38 -6
  538. package/dist/mcp/registry.d.ts.map +1 -1
  539. package/dist/mcp/registry.js +145 -14
  540. package/dist/mcp/registry.js.map +1 -1
  541. package/dist/mcp/rest.js +4 -4
  542. package/dist/mcp/rest.js.map +1 -1
  543. package/dist/mcp/run-fence.d.ts +2 -0
  544. package/dist/mcp/run-fence.d.ts.map +1 -1
  545. package/dist/mcp/run-fence.js +9 -0
  546. package/dist/mcp/run-fence.js.map +1 -1
  547. package/dist/mcp/secrets.d.ts +1 -1
  548. package/dist/mcp/secrets.d.ts.map +1 -1
  549. package/dist/mcp/secrets.js +10 -11
  550. package/dist/mcp/secrets.js.map +1 -1
  551. package/dist/mcp/upstream-error.d.ts +6 -2
  552. package/dist/mcp/upstream-error.d.ts.map +1 -1
  553. package/dist/mcp/upstream-error.js +5 -1
  554. package/dist/mcp/upstream-error.js.map +1 -1
  555. package/dist/projects/graph.d.ts +15 -5
  556. package/dist/projects/graph.d.ts.map +1 -1
  557. package/dist/projects/graph.js +354 -26
  558. package/dist/projects/graph.js.map +1 -1
  559. package/dist/projects/repo-watch.d.ts +2 -2
  560. package/dist/projects/repo-watch.d.ts.map +1 -1
  561. package/dist/projects/repo-watch.js +26 -9
  562. package/dist/projects/repo-watch.js.map +1 -1
  563. package/dist/projects/routes.d.ts +9 -1
  564. package/dist/projects/routes.d.ts.map +1 -1
  565. package/dist/projects/routes.js +63 -6
  566. package/dist/projects/routes.js.map +1 -1
  567. package/dist/projects/state-home-preflight.d.ts +5 -0
  568. package/dist/projects/state-home-preflight.d.ts.map +1 -1
  569. package/dist/projects/state-home-preflight.js +48 -8
  570. package/dist/projects/state-home-preflight.js.map +1 -1
  571. package/dist/projects/state-home-registry.d.ts.map +1 -1
  572. package/dist/projects/state-home-registry.js +9 -0
  573. package/dist/projects/state-home-registry.js.map +1 -1
  574. package/dist/projects/state-home.d.ts +11 -0
  575. package/dist/projects/state-home.d.ts.map +1 -1
  576. package/dist/projects/state-home.js +14 -0
  577. package/dist/projects/state-home.js.map +1 -1
  578. package/dist/qe/author-workflow.d.ts +4 -0
  579. package/dist/qe/author-workflow.d.ts.map +1 -1
  580. package/dist/qe/author-workflow.js +4 -0
  581. package/dist/qe/author-workflow.js.map +1 -1
  582. package/dist/qe/test-sets.d.ts +5 -6
  583. package/dist/qe/test-sets.d.ts.map +1 -1
  584. package/dist/qe/test-sets.js +4 -3
  585. package/dist/qe/test-sets.js.map +1 -1
  586. package/dist/schedules/routes.d.ts +5 -0
  587. package/dist/schedules/routes.d.ts.map +1 -1
  588. package/dist/schedules/routes.js +32 -5
  589. package/dist/schedules/routes.js.map +1 -1
  590. package/dist/schedules/scheduler.d.ts +8 -1
  591. package/dist/schedules/scheduler.d.ts.map +1 -1
  592. package/dist/schedules/scheduler.js +10 -1
  593. package/dist/schedules/scheduler.js.map +1 -1
  594. package/dist/schedules/store.d.ts +7 -0
  595. package/dist/schedules/store.d.ts.map +1 -1
  596. package/dist/schedules/store.js +19 -4
  597. package/dist/schedules/store.js.map +1 -1
  598. package/dist/skills/plugin-source.js +4 -4
  599. package/dist/skills/plugin-source.js.map +1 -1
  600. package/dist/sources/ask.d.ts.map +1 -1
  601. package/dist/sources/ask.js +12 -12
  602. package/dist/sources/ask.js.map +1 -1
  603. package/dist/sources/dialer.d.ts +6 -1
  604. package/dist/sources/dialer.d.ts.map +1 -1
  605. package/dist/sources/dialer.js +53 -31
  606. package/dist/sources/dialer.js.map +1 -1
  607. package/dist/sources/drivers/mysql.d.ts +2 -0
  608. package/dist/sources/drivers/mysql.d.ts.map +1 -1
  609. package/dist/sources/drivers/mysql.js +18 -2
  610. package/dist/sources/drivers/mysql.js.map +1 -1
  611. package/dist/sources/drivers/postgres.d.ts +2 -0
  612. package/dist/sources/drivers/postgres.d.ts.map +1 -1
  613. package/dist/sources/drivers/postgres.js +10 -3
  614. package/dist/sources/drivers/postgres.js.map +1 -1
  615. package/dist/sources/drivers/sqlite.d.ts +33 -3
  616. package/dist/sources/drivers/sqlite.d.ts.map +1 -1
  617. package/dist/sources/drivers/sqlite.js +18 -6
  618. package/dist/sources/drivers/sqlite.js.map +1 -1
  619. package/dist/sources/drivers/types.d.ts +3 -1
  620. package/dist/sources/drivers/types.d.ts.map +1 -1
  621. package/dist/sources/drivers/types.js +3 -1
  622. package/dist/sources/drivers/types.js.map +1 -1
  623. package/dist/sources/routes.d.ts.map +1 -1
  624. package/dist/sources/routes.js +1 -0
  625. package/dist/sources/routes.js.map +1 -1
  626. package/dist/sources/uploads.d.ts +22 -15
  627. package/dist/sources/uploads.d.ts.map +1 -1
  628. package/dist/sources/uploads.js +124 -436
  629. package/dist/sources/uploads.js.map +1 -1
  630. package/dist/standing-orders/history.d.ts +5 -3
  631. package/dist/standing-orders/history.d.ts.map +1 -1
  632. package/dist/standing-orders/history.js +6 -2
  633. package/dist/standing-orders/history.js.map +1 -1
  634. package/dist/standing-orders/parse.d.ts +8 -0
  635. package/dist/standing-orders/parse.d.ts.map +1 -1
  636. package/dist/standing-orders/parse.js +52 -5
  637. package/dist/standing-orders/parse.js.map +1 -1
  638. package/dist/studio/apps-standalone/fixture.js +3 -3
  639. package/dist/studio/apps-standalone/runtime.js +1 -1
  640. package/dist/studio/assets/{KnowledgeGraph-DWw0I8RJ.js → KnowledgeGraph-yP4WsnST.js} +1 -1
  641. package/dist/studio/assets/index-DNaLjJ7M.css +32 -0
  642. package/dist/studio/assets/index-DW53FKuT.js +1114 -0
  643. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  644. package/dist/studio/editors/wicked-apps/index.html +2 -2
  645. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  646. package/dist/studio/editors/wicked-deck/index.html +2 -2
  647. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  648. package/dist/studio/editors/wicked-doc/index.html +1 -1
  649. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  650. package/dist/studio/editors/wicked-insights/index.html +1 -1
  651. package/dist/studio/editors/wicked-page/editor.json +1 -1
  652. package/dist/studio/editors/wicked-page/index.html +1 -1
  653. package/dist/studio/editors/wicked-video/editor.json +1 -1
  654. package/dist/studio/editors/wicked-video/index.html +1 -1
  655. package/dist/studio/index.html +2 -2
  656. package/dist/studio/testid-inventory.json +1589 -281
  657. package/dist/team/routes.d.ts +11 -1
  658. package/dist/team/routes.d.ts.map +1 -1
  659. package/dist/team/routes.js +8 -4
  660. package/dist/team/routes.js.map +1 -1
  661. package/dist/voice/tts.d.ts +12 -0
  662. package/dist/voice/tts.d.ts.map +1 -1
  663. package/dist/voice/tts.js +118 -28
  664. package/dist/voice/tts.js.map +1 -1
  665. package/dist/workflow-catalog/build-v2.d.ts +34 -0
  666. package/dist/workflow-catalog/build-v2.d.ts.map +1 -1
  667. package/dist/workflow-catalog/build-v2.js +131 -10
  668. package/dist/workflow-catalog/build-v2.js.map +1 -1
  669. package/dist/workflow-catalog/catalog-data-v2.d.ts +6 -2
  670. package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
  671. package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
  672. package/dist/workflow-catalog/catalog-data.d.ts.map +1 -1
  673. package/dist/workflow-catalog/catalog-data.js +0 -2
  674. package/dist/workflow-catalog/catalog-data.js.map +1 -1
  675. package/dist/workflow-catalog/detect.d.ts +18 -3
  676. package/dist/workflow-catalog/detect.d.ts.map +1 -1
  677. package/dist/workflow-catalog/detect.js +43 -8
  678. package/dist/workflow-catalog/detect.js.map +1 -1
  679. package/dist/workflow-catalog/shape.d.ts +1 -1
  680. package/dist/working-doc/event-lines.d.ts +12 -2
  681. package/dist/working-doc/event-lines.d.ts.map +1 -1
  682. package/dist/working-doc/event-lines.js +62 -10
  683. package/dist/working-doc/event-lines.js.map +1 -1
  684. package/dist/working-doc/sections.d.ts +3 -0
  685. package/dist/working-doc/sections.d.ts.map +1 -1
  686. package/dist/working-doc/sections.js +5 -0
  687. package/dist/working-doc/sections.js.map +1 -1
  688. package/dist/working-doc/service.d.ts +23 -3
  689. package/dist/working-doc/service.d.ts.map +1 -1
  690. package/dist/working-doc/service.js +93 -54
  691. package/dist/working-doc/service.js.map +1 -1
  692. package/endpoint-manifest.json +148 -8
  693. package/evals/corpora/shape-v1.json +25 -1
  694. package/evals/corpora/shape-v1.seat-fixture.json +25 -1
  695. package/package.json +4 -4
  696. package/runners/sqlite-runner.mjs +67 -12
  697. package/runners/upload-parse.d.mts +13 -0
  698. package/runners/upload-parse.mjs +364 -0
  699. package/dist/studio/assets/index-C4Xj-zxa.css +0 -32
  700. package/dist/studio/assets/index-CrNY3d06.js +0 -1109
@@ -9,7 +9,9 @@ import { DecisionLedger } from '../decisions/ledger.js';
9
9
  import { requestOrigin, shellCsp } from '../editors/csp.js';
10
10
  import { conformanceRuntimeRoot, exportEngineConformanceEnv, exportManagedChrome, managedChromium } from '../editors/conformance-runtime.js';
11
11
  import { launchRosterNaming, registerRoutes } from './routes.js';
12
+ import { sweepStagedDocuments } from './run-documents.js';
12
13
  import { APPS_ACTIONS_STATE_FILENAME, AppActionStore } from '../apps/actions/store.js';
14
+ import { AppsRedescriber } from '../apps/exec/redescribe.js';
13
15
  import { AppsSourceStage } from '../apps/exec/source-stage.js';
14
16
  import { APPS_STATE_FILENAME, AppStore, defaultAppsRoot } from '../apps/store.js';
15
17
  import { agentMay } from '../knowledge/gate/access.js';
@@ -47,6 +49,8 @@ import { registerSetupRoutes } from '../setup/routes.js';
47
49
  import { voiceBlock } from '../persona/voice.js';
48
50
  import { VoiceInjectInputs } from '../voice/inject-input.js';
49
51
  import { factsUnitResolver, registerInsightsRoutes } from '../insights/routes.js';
52
+ import { RepoOrigins } from './repo-origins.js';
53
+ import { migrateInertPolicyRules } from './policy-landing.js';
50
54
  import { ReviewService } from '../insights/review-service.js';
51
55
  import { InsightsStore } from '../insights/store.js';
52
56
  import { ANALYZE_CLI, REVIEW_WORKFLOW, defaultReviewsDir, loadReviewWorkflow } from '../insights/workflow.js';
@@ -270,8 +274,11 @@ export async function createServer(adapter, options) {
270
274
  // `runtime.rosterWithStanding`), the four interactive seams (`roster`), and the adapter's own
271
275
  // launches (`setRosterProvider` → `seatsForWorkflow` / `wicked-crew start`). Read at call time,
272
276
  // so a seat signed in from the Agents page is eligible on the very next launch.
277
+ // wicked-crew#1705: hold roster admissions from setup until the background ladder settles.
278
+ let skillsLanded = options?.skills?.disabled === true || options?.skills?.background !== true;
273
279
  const rosterWithStanding = rosterWithStandingFactory({
274
280
  seatHealth,
281
+ skillsLanded: () => skillsLanded,
275
282
  ...(options?.seats?.signedIn !== undefined ? { signedIn: options.seats.signedIn } : {}),
276
283
  // The broker status cache reads the gateway the ENGINE arms (beside this adapter's store),
277
284
  // the same dir the sign-in routes pass (agy crew-r1).
@@ -413,7 +420,7 @@ export async function createServer(adapter, options) {
413
420
  skillsBoot = skillsRuntime.startBoot((health, ms) => {
414
421
  const gen = health.current === null ? '' : ` (generation ${health.current.gen})`;
415
422
  app.log.info(`[skills] boot ladder landed in ${ms}ms: ${health.state}${gen} — launches held while it ran proceed now`);
416
- });
423
+ }).finally(() => { skillsLanded = true; });
417
424
  }
418
425
  else {
419
426
  await skillsRuntime.apply();
@@ -543,6 +550,9 @@ export async function createServer(adapter, options) {
543
550
  }
544
551
  }
545
552
  catch (err) {
553
+ // crew#1442: a run launched before this boot then has an unknown source pick; one whose store entry is gone is
554
+ // refused its source calls (fail closed) until a restart reads the trail.
555
+ runTimingIndex.markLaunchHistoryUnreadable();
546
556
  app.log.warn(`[runs] launch-index hydrate failed (prior runs read as not-a-retry / ungrouped / undated, without their chat_id link, until restart): ${err instanceof Error ? err.message : String(err)}`);
547
557
  }
548
558
  // wicked-studio#284: the watchdog's own frames, rebuilt from the trail this daemon (or a previous
@@ -624,6 +634,7 @@ export async function createServer(adapter, options) {
624
634
  const canDeliver = canDeliverResolver(() => adapter.listWorkflows(), (m) => app.log.warn(m));
625
635
  const deliveryCache = new DeliveryDerivationCache({
626
636
  listViews: () => adapter.sessionsDetail(),
637
+ viewOf: (id) => adapter.runView(id),
627
638
  probes: vacuityProbes,
628
639
  isDelivered: (runId) => deliveryIndex.isDelivered(runId),
629
640
  canDeliver,
@@ -653,7 +664,7 @@ export async function createServer(adapter, options) {
653
664
  // record — the routes await it for such a view, so the wire never serves `completed` +
654
665
  // `delivery: 'stranded'` for a run whose deliver unit already carries the PR URL.
655
666
  const deliveryResolver = new DeliveryResolver({
656
- listViews: () => adapter.sessionsDetail(),
667
+ viewOf: (id) => adapter.runView(id),
657
668
  workOutput: (unitId) => adapter.workOutput(unitId),
658
669
  isDelivered: (runId) => deliveryIndex.isDelivered(runId),
659
670
  // The durable record first, then the read-side index — the same write order as
@@ -674,21 +685,27 @@ export async function createServer(adapter, options) {
674
685
  // crew#720 (operator ruling 2026-10-10): every delivery leaves a zip of the run's final codebase,
675
686
  // whatever the outcome. Taken when the deliver unit's output lands (delivered, push refused,
676
687
  // credentials missing, wrong account) and again at the run's terminal frame (a lift conflict, a
677
- // run that failed after building, a cancel) — BEFORE the delivered-worktree sweep. An unchanged
678
- // tree rewrites nothing. Best-effort: never awaited by the frame, never a run failure.
688
+ // run that failed after building, a cancel) — BEFORE the delivered-worktree sweep. A cancelled
689
+ // run archives from the reap's outcome: the run branch until worktreeRetained names the kept tree.
690
+ // An unchanged tree rewrites nothing. Best-effort: never awaited by the frame, never a run failure.
679
691
  const codebaseArchives = new CodebaseArchiveStore(options?.codebaseArchiveRoot, (m) => app.log.info(m));
692
+ const retainedTrees = new Map();
693
+ const cancelledRuns = new Set();
680
694
  /** `<run>\0<ord>` of deliver-script units dispatched and not yet captured (crew#720). */
681
695
  const deliverDispatches = new Set();
682
696
  /** Runs this daemon has seen a dispatch frame for (crew#720; the boot-redrive fallback). */
683
697
  const observedRuns = new Set();
684
- const archiveRunCodebase = async (runId, trigger, view) => {
698
+ const archiveRunCodebase = async (runId, trigger, view, cancelled = false) => {
685
699
  try {
686
- const v = view ?? (await adapter.sessionsDetail()).find((x) => x.session.id === runId);
700
+ const v = view ?? (await adapter.runView(runId));
687
701
  if (v === undefined || v.session.repo_ref == null)
688
702
  return;
689
703
  const repoRoot = (await adapter.listRepos()).find((r) => r.id === v.session.repo_ref)?.root_path ?? null;
690
704
  const before = codebaseArchives.get(runId);
691
- const rec = await codebaseArchives.archive(runId, { workdir: v.session.workdir, repoRoot }, trigger);
705
+ // Read the retained mark in the same tick as enqueueing: a pending cancel chain must never
706
+ // enqueue a branch archive after the retained-worktree refresh (crew#1508).
707
+ const workdir = cancelled ? retainedTrees.get(runId) ?? null : v.session.workdir;
708
+ const rec = await codebaseArchives.archive(runId, { workdir, repoRoot }, trigger);
692
709
  if (rec !== null && rec !== before)
693
710
  audit.record('run.codebase_archived', DAEMON_ACTOR, { runId, detail: { ...rec } });
694
711
  }
@@ -753,7 +770,7 @@ export async function createServer(adapter, options) {
753
770
  const floorChrome = () => (process.env['WICKED_CHROME'] ?? '').trim() || managedChromium(conformanceRuntimeRoot());
754
771
  // G12: the run's own engine `draft_render` record (its latest unit of that step, read fresh: the floor runs as the run
755
772
  // ends), which the floor reuses when it measured these exact bytes with the floor's own print profile.
756
- const floorEngineRender = async (runId) => latestDraftRender((await adapter.runView(runId, { fresh: true }))?.units);
773
+ const floorEngineRender = async (runId) => latestDraftRender((await adapter.runView(runId))?.units);
757
774
  const draftFloorIo = { chrome: floorChrome, engineRender: floorEngineRender };
758
775
  /**
759
776
  * A3 (§6.2): a proposal-bound attempt's outcome was recorded. A failure is said on the run (`run.landing_failed`, the
@@ -982,7 +999,7 @@ export async function createServer(adapter, options) {
982
999
  audit,
983
1000
  // crew#828: the run's own status (and, once it has ended, its recorded event count).
984
1001
  runFacts: async (runId) => {
985
- const view = (await adapter.sessionsDetail()).find((v) => v.session.id === runId);
1002
+ const view = await adapter.runView(runId);
986
1003
  if (view === undefined)
987
1004
  return null;
988
1005
  const ended = ['completed', 'failed', 'cancelled'].includes(String(view.session.status));
@@ -1052,6 +1069,8 @@ export async function createServer(adapter, options) {
1052
1069
  // The run review folds runs as `GET /runs` serves them (launch time, delivery, project are the daemon's
1053
1070
  // joins, not the engine's record): bound once the routes are registered below.
1054
1071
  let decorateRun = null;
1072
+ // crew#1744: the daemon's one `git_url` reader (GET /repos, the repo search, the review's issue link).
1073
+ const repoOrigins = new RepoOrigins();
1055
1074
  const reviewService = new ReviewService({
1056
1075
  store: insightsStore,
1057
1076
  adapter: {
@@ -1061,7 +1080,8 @@ export async function createServer(adapter, options) {
1061
1080
  },
1062
1081
  runEvents: (id) => adapter.runEvents(id),
1063
1082
  seatsForWorkflow: (id) => adapter.seatsForWorkflow(id),
1064
- listRepos: () => adapter.listRepos(),
1083
+ // crew#1744: the "open an issue" link needs the repo's remote: the same reader GET /repos uses.
1084
+ listRepos: () => repoOrigins.list(() => adapter.listRepos()),
1065
1085
  },
1066
1086
  reviewsDir: defaultReviewsDir(),
1067
1087
  // crew#1592: the review's seat comes from the seats new work may use (the strict reader: a bad setting refuses).
@@ -1080,9 +1100,12 @@ export async function createServer(adapter, options) {
1080
1100
  // Run learnings (src/learnings): every run proposes what it learned to the approve queue — template
1081
1101
  // learnings at its checkpoints, the rest distilled at its end by one cheap seat that did not build it.
1082
1102
  const LEARNINGS_ACTOR = { id: 'run-learnings', kind: 'system', trust: 'operator' };
1103
+ let workingDocsReady = () => undefined;
1104
+ const workingDocsMade = new Promise((resolve) => { workingDocsReady = resolve; });
1083
1105
  const runLearnings = new RunLearningsService({
1084
1106
  adapter: {
1085
1107
  sessionsDetail: () => adapter.sessionsDetail(),
1108
+ runView: (id) => adapter.runView(id),
1086
1109
  runEvents: (id) => adapter.runEvents(id),
1087
1110
  seatsForWorkflow: (id) => adapter.seatsForWorkflow(id),
1088
1111
  launchRun: (input) => adapter.launchRun(input),
@@ -1094,6 +1117,9 @@ export async function createServer(adapter, options) {
1094
1117
  },
1095
1118
  },
1096
1119
  submit: submitLearning,
1120
+ // (crew#1408) The person's Goal, Approach and Constraints from the run's context document, once it is made (further
1121
+ // down: the start-up recovery may ask first, and waits).
1122
+ personContext: async (runId) => (await workingDocsMade).personContextOf(runId),
1097
1123
  listProposals: async () => proposalRows(await callEstateTool('proposal.list', {})),
1098
1124
  listMemoryContents: async () => memoryContents(await callEstateTool('memory.list', {})),
1099
1125
  launched: (distillRunId, sourceRunId, projectId) => {
@@ -1141,14 +1167,14 @@ export async function createServer(adapter, options) {
1141
1167
  const INSPECT_ACTOR = { id: 'unit-inspect', kind: 'system', trust: 'operator' };
1142
1168
  const unitInspect = new InspectService({
1143
1169
  adapter: {
1144
- sessionsDetail: () => adapter.sessionsDetail(),
1170
+ runView: (id) => adapter.runView(id),
1145
1171
  runEvents: (id) => adapter.runEvents(id),
1146
1172
  seatsForWorkflow: (id) => adapter.seatsForWorkflow(id),
1147
1173
  launchRun: (input) => adapter.launchRun(input),
1148
1174
  cancelRun: (id) => adapter.cancelRun(id),
1149
1175
  },
1150
1176
  replyOf: async (checkRunId) => {
1151
- const view = (await adapter.sessionsDetail()).find((v) => v.session.id === checkRunId);
1177
+ const view = await adapter.runView(checkRunId);
1152
1178
  const unit = view?.units.find((u) => u.ord === 1) ?? view?.units[0];
1153
1179
  return view !== undefined && unit !== undefined ? adapter.workOutput(coreUnitId(checkRunId, unit)) : null;
1154
1180
  },
@@ -1201,6 +1227,9 @@ export async function createServer(adapter, options) {
1201
1227
  clisJson: '[]',
1202
1228
  workflow: row.workflow,
1203
1229
  ...(projectId !== undefined ? { projectId } : {}),
1230
+ // crew#1837: the person accepted reduced assurance for this schedule (a one-seat daemon): its review may be read
1231
+ // by a seat that ran the work, said in the brief and on the run, instead of being refused every time.
1232
+ ...(row.reducedAssurance ? { reducedAssurance: true } : {}),
1204
1233
  };
1205
1234
  const review = row.workflow === REVIEW_WORKFLOW;
1206
1235
  if (row.workflow === RUN_EVALS_WORKFLOW) {
@@ -1209,7 +1238,15 @@ export async function createServer(adapter, options) {
1209
1238
  await runEvalsPrepare(input);
1210
1239
  }
1211
1240
  else if (review) {
1212
- await reviewService.prepareLaunch(input, { trigger, scheduleId: row.id, projectIds: row.projectIds });
1241
+ const opts = { trigger, scheduleId: row.id, projectIds: row.projectIds };
1242
+ try {
1243
+ await reviewService.prepareLaunch(input, opts);
1244
+ }
1245
+ catch (err) {
1246
+ // (crew#1608) The attempt leaves a review record; the schedule's own back-off is unchanged.
1247
+ reviewService.prepareRefused(runId, opts, err instanceof Error ? err.message : String(err));
1248
+ throw err;
1249
+ }
1213
1250
  }
1214
1251
  else {
1215
1252
  input.clisJson = JSON.stringify(await adapter.seatsForWorkflow(row.workflow));
@@ -1246,9 +1283,16 @@ export async function createServer(adapter, options) {
1246
1283
  sessionsDetail: () => adapter.sessionsDetail(),
1247
1284
  launch: launchScheduled,
1248
1285
  // crew#1578: a scheduled run that never got seats is its schedule's to end, on the run's own record.
1249
- runViewFresh: (runId) => adapter.runView(runId, { fresh: true }),
1286
+ runViewFresh: (runId) => adapter.runView(runId),
1250
1287
  cancel: cancelOnItsRecord((runId) => adapter.cancelRun(runId), (runId, detail) => audit.record('run.cancelled', SCHEDULE_ACTOR, { runId, detail })),
1251
1288
  onTick: [(status) => reviewService.reconcile(status)],
1289
+ // (crew#1656) An unattended refusal is told on the activity trail too, not only on its schedule row: one entry per
1290
+ // refused attempt, for every scheduled workflow (the review also keeps its failed review record, crew#1608).
1291
+ onScheduledRefusal: (row, reason) => {
1292
+ audit.record('schedule.launch_refused', SCHEDULE_ACTOR, {
1293
+ detail: { id: row.id, workflow: row.workflow, trigger: 'schedule', reason: reason.slice(0, 500) },
1294
+ });
1295
+ },
1252
1296
  log: (m) => app.log.info(m),
1253
1297
  });
1254
1298
  registerScheduleRoutes(app, {
@@ -1366,6 +1410,7 @@ export async function createServer(adapter, options) {
1366
1410
  groundingStore: docGrounding,
1367
1411
  // DES-CHAT-ARTIFACTS-001 §5.2 (A3): chat-made documents.
1368
1412
  bindings: docBindings,
1413
+ chatIdOf: (chatId, instance) => chatHistory.idOfInstance(chatId, instance),
1369
1414
  onBoundDocCreated: (ref) => onBoundDocCreated(ref),
1370
1415
  onBoundOutcome,
1371
1416
  landings: docLandings,
@@ -1605,7 +1650,14 @@ export async function createServer(adapter, options) {
1605
1650
  // when one is available, else the current seat recycled in place); null lets the engine
1606
1651
  // re-run the council.
1607
1652
  reassign: async (runId, ord, cli) => {
1608
- await adapter.reassignUnit(runId, ord, cli ?? null);
1653
+ await registered.exclusive(runId, async () => {
1654
+ const run = await adapter.runView(runId);
1655
+ const cursor = run === undefined ? undefined : resolveCursorUnit(run);
1656
+ if (run?.session.status !== 'executing' || cursor?.ord !== ord) {
1657
+ throw new Error(`Run ${runId} moved on (status ${run?.session.status ?? 'gone'}, cursor ord ${cursor?.ord ?? 'none'}); nothing was reassigned.`);
1658
+ }
1659
+ await adapter.reassignUnit(runId, ord, cli ?? null);
1660
+ });
1609
1661
  },
1610
1662
  // An automated actor touching a run is a privileged action exactly like an operator
1611
1663
  // doing it — one audit line per escalation, needs-you or not (task #88 posture).
@@ -1671,7 +1723,7 @@ export async function createServer(adapter, options) {
1671
1723
  turns: chatTurns,
1672
1724
  workOutput: (unitId) => adapter.workOutput(unitId),
1673
1725
  units: async (runId) => {
1674
- const view = (await adapter.sessionsDetail()).find((v) => v.session.id === runId);
1726
+ const view = await adapter.runView(runId);
1675
1727
  return (view?.units ?? []).map((u) => {
1676
1728
  const la = u.last_attempt;
1677
1729
  return {
@@ -1874,6 +1926,18 @@ export async function createServer(adapter, options) {
1874
1926
  void standingOrderEvaluator?.onEvent(event);
1875
1927
  // The watch registry (TR-W5a, G3): synchronous, O(1), never awaited, never throws.
1876
1928
  watchRegistry?.offer(event);
1929
+ // crew#1508: the reap may retain a dirty tree before or after runCancelled. The archive path
1930
+ // never deletes a mark (a pending chain must still read it); a re-dispatch clears the run's
1931
+ // marks below (a failed run resumed: its earlier terminal reap outcome is stale), and the
1932
+ // bounded history evicts the oldest. A cancelled run is never resumed (the resume route
1933
+ // refuses it; a campaign same-id relaunch waits for the reap, core#1433).
1934
+ if (event.type === 'worktreeRetained' && session !== undefined && typeof event.path === 'string') {
1935
+ retainedTrees.set(session, event.path);
1936
+ if (retainedTrees.size > 1000)
1937
+ retainedTrees.delete(retainedTrees.keys().next().value);
1938
+ if (cancelledRuns.has(session))
1939
+ void archiveRunCodebase(session, 'run_end', undefined, true);
1940
+ }
1877
1941
  // DC-S7: a unit attempt's output landed — what its rules were, and which it cited (one fact per
1878
1942
  // (run, ord, attempt); the read itself answers GET …/considered). Off the hot path.
1879
1943
  if (event.type === 'unitOutputCaptured' && session !== undefined) {
@@ -1891,9 +1955,8 @@ export async function createServer(adapter, options) {
1891
1955
  if (key !== undefined && (deliverDispatches.delete(key) || unseen)) {
1892
1956
  observedRuns.add(session);
1893
1957
  void adapter
1894
- .sessionsDetail()
1895
- .then((views) => {
1896
- const view = views.find((v) => v.session.id === session);
1958
+ .runView(session)
1959
+ .then((view) => {
1897
1960
  if (view === undefined)
1898
1961
  return undefined;
1899
1962
  if (unseen && deliverUnitOf(view)?.ord !== ord)
@@ -1904,6 +1967,8 @@ export async function createServer(adapter, options) {
1904
1967
  }
1905
1968
  }
1906
1969
  if ((event.type === 'unitDispatched' || event.type === 'toolExecutorDispatched') && session !== undefined) {
1970
+ retainedTrees.delete(session);
1971
+ cancelledRuns.delete(session);
1907
1972
  if (observedRuns.size > 5000)
1908
1973
  observedRuns.clear();
1909
1974
  observedRuns.add(session);
@@ -1923,6 +1988,12 @@ export async function createServer(adapter, options) {
1923
1988
  // healing the DTO's stranded/vacuous/none label in seconds instead of at the next sweep.
1924
1989
  if ((event.type === 'sessionCompleted' || event.type === 'sessionFailed' || event.type === 'runCancelled') &&
1925
1990
  session !== undefined) {
1991
+ const cancelled = event.type === 'runCancelled';
1992
+ if (cancelled) {
1993
+ cancelledRuns.add(session);
1994
+ if (cancelledRuns.size > 1000)
1995
+ cancelledRuns.delete(cancelledRuns.values().next().value);
1996
+ }
1926
1997
  // crew#619: when a run that was linked to a chat terminates, release the retention hold and
1927
1998
  // drop the transcript if the chat was already reclaimed (not in chatScopes).
1928
1999
  const linkedChat = runToChat.get(session);
@@ -1955,14 +2026,13 @@ export async function createServer(adapter, options) {
1955
2026
  }
1956
2027
  void resolveRunDelivery(session)
1957
2028
  // crew#720: the final-codebase zip, before the sweep below can remove the worktree.
1958
- .then(() => archiveRunCodebase(session, 'run_end'))
2029
+ .then(() => archiveRunCodebase(session, 'run_end', undefined, cancelled))
1959
2030
  // crew#620 Acceptance 3: sweep the delivered run's worktree once the PR is open.
1960
2031
  // Best-effort — a sweep error must never fail the terminal frame.
1961
2032
  .then(async () => {
1962
2033
  if (deliveryIndex.urlFor(session) !== undefined) {
1963
2034
  try {
1964
- const views = await adapter.sessionsDetail();
1965
- const repoRef = views.find((v) => v.session.id === session)?.session.repo_ref;
2035
+ const repoRef = (await adapter.runView(session))?.session.repo_ref;
1966
2036
  if (repoRef !== null && repoRef !== undefined) {
1967
2037
  const repos = await adapter.listRepos();
1968
2038
  const repoRoot = repos.find((r) => r.id === repoRef)?.root_path;
@@ -2010,7 +2080,7 @@ export async function createServer(adapter, options) {
2010
2080
  if (event.type === 'runBaseResolved' && session !== undefined) {
2011
2081
  // A lookup that fails or finds no view yet is tried again (codex r2: one miss lost the invalidation for good).
2012
2082
  const note = (tries) => {
2013
- void adapter.runView(session, { fresh: tries > 0 }).then((v) => {
2083
+ void adapter.runView(session).then((v) => {
2014
2084
  const repo = v?.session.repo_ref;
2015
2085
  if (typeof repo === 'string' && repo !== '') {
2016
2086
  void repoWatcher.noteLaunch(repo);
@@ -2041,8 +2111,7 @@ export async function createServer(adapter, options) {
2041
2111
  if (event.type === 'sessionCompleted' && session !== undefined && projectId !== undefined) {
2042
2112
  void (async () => {
2043
2113
  try {
2044
- const views = await adapter.sessionsDetail();
2045
- const view = views.find((v) => v.session.id === session);
2114
+ const view = await adapter.runView(session);
2046
2115
  const repoRef = view?.session.repo_ref ?? null;
2047
2116
  const repoRoot = repoRef !== null
2048
2117
  ? ((await adapter.listRepos()).find((r) => r.id === repoRef)?.root_path ?? null)
@@ -2098,22 +2167,12 @@ export async function createServer(adapter, options) {
2098
2167
  });
2099
2168
  // (The seat-health `--version` recovery probe that armed here is retired — perf recon
2100
2169
  // fix #3; see seat-health.ts. Recovery = the seat's next real `ok` output.)
2101
- // Arm the stall watchdog's sweep (crew#287). ON in the daemon, OFF under a test runner
2102
- // unless a test opts in — a suite building servers over stub adapters must not have a
2103
- // background interval calling `sessionsDetail()` on them.
2104
2170
  if (repoWatchEnvOn && (options?.repoWatch?.enabled ?? !(process.env['VITEST'] !== undefined || process.env['NODE_ENV'] === 'test'))) {
2105
2171
  repoWatcher.start();
2106
2172
  app.addHook('onClose', async () => {
2107
2173
  await repoWatcher.stop();
2108
2174
  });
2109
2175
  }
2110
- const stallCfg = options?.stallWatchdog;
2111
- if (stallWatchdogArmed) {
2112
- stallWatchdog.start(stallCfg?.sweepIntervalMs);
2113
- app.addHook('onClose', async () => {
2114
- stallWatchdog.stop();
2115
- });
2116
- }
2117
2176
  // Clickjacking guard (frame-guard.ts): who may frame the daemon's pages, on every response. FIRST
2118
2177
  // onRequest hook, so a preflight 204, a 403 or a 401 answered by a later hook carries it too.
2119
2178
  const frameDirective = registerFrameGuard(app, { allowedOrigins: auth.allowedOrigins });
@@ -2240,18 +2299,23 @@ export async function createServer(adapter, options) {
2240
2299
  });
2241
2300
  toolboxProber = dataGate;
2242
2301
  app.addHook('onClose', async () => {
2243
- toolboxSupervisor.stopAll();
2302
+ // crew#1752: resolves once every adapter has exited and its run directory is gone.
2303
+ await toolboxSupervisor.stopAll();
2244
2304
  });
2245
2305
  // DES-KNOWLEDGE-DATA-001 §4.1: every stored catalog's STRUCTURE (never a row) is projected into estate's knowledge
2246
2306
  // plane, keyed by the registry id; what was described before this release is projected once, off the boot path.
2247
- const sourceProjector = new SourceProjector({ store: mcpRegistryStore, catalogs: mcpRegistry.catalogs, log: (m) => app.log.warn(m) });
2307
+ // crew#1328: the acknowledgements are kept beside the registry with the generation estate took. After a restart one
2308
+ // is provisional (crew#1741): the boot backfill admits the source once estate is seen to still hold that generation
2309
+ // (one cheap read, before the source's projection), or once the projection lands.
2310
+ const sourceProjector = new SourceProjector({ store: mcpRegistryStore, catalogs: mcpRegistry.catalogs, log: (m) => app.log.warn(m), acksFile: join(mcpRegistryStore.directory, 'knowledge-acks.json') });
2248
2311
  mcpRegistry.catalogs.onWritten = (name) => sourceProjector.written(name);
2249
2312
  // crew#1328: a restored generation changes what estate must hold for a source with no catalog written.
2250
2313
  mcpRegistry.onSourceChanged = (name) => sourceProjector.written(name);
2251
2314
  void sourceProjector.backfill();
2252
2315
  // DES-PM-001 §3.4: every linked tracker (and every retired one) projected into estate, reconciled; a tracker's
2253
2316
  // link state shows on its TrackerLink. The boot backfill sends what estate may not hold yet.
2254
- const trackerAddresses = new TrackerAddresses();
2317
+ // crew#1352: the store is a bounded cache; each run's `run.launched` entry is the durable record of its addresses.
2318
+ const trackerAddresses = new TrackerAddresses(undefined, { launched: { of: (runId) => runTimingIndex.addressesOf(runId), all: () => runTimingIndex.allAddresses() } });
2255
2319
  const trackerProjector = new TrackerProjector({ store: mcpRegistryStore, addresses: () => trackerAddresses.all(), delivered: (runId) => deliveryIndex.urlFor(runId), log: (m) => app.log.warn(m) });
2256
2320
  // A delivered PR joins the trail (`closes`) at the next reconcile; this one runs every ten minutes as well.
2257
2321
  const trackerTimer = setInterval(() => trackerProjector.changed(), 10 * 60_000);
@@ -2259,6 +2323,14 @@ export async function createServer(adapter, options) {
2259
2323
  app.addHook('onClose', async () => clearInterval(trackerTimer));
2260
2324
  mcpRegistry.trackerProjection = trackerProjector.projection;
2261
2325
  mcpRegistry.onRestored = () => trackerProjector.changed();
2326
+ // crew#1328, crew#1354: a removed source's structure and a removed PM entry's trackers are erased from estate, each by
2327
+ // the one writer of its id (the registry keeps the tombstones, so a restart before estate takes them still erases
2328
+ // them: the source backfill and the tracker reconcile above read them at boot).
2329
+ mcpRegistry.onTombstoned = (targets) => {
2330
+ sourceProjector.erase(targets.filter((t) => t.kind === 'source').map((t) => t.id));
2331
+ if (targets.some((t) => t.kind === 'tracker'))
2332
+ trackerProjector.changed();
2333
+ };
2262
2334
  trackerProjector.changed();
2263
2335
  // §4.3: what a unit's knowledge reads may see — the sources its project may see (the gate's predicate) and its repos.
2264
2336
  const projectVisible = async (projectId, repoId = null) => {
@@ -2286,9 +2358,12 @@ export async function createServer(adapter, options) {
2286
2358
  const unitVisible = (scope) => projectVisible(scope.projectId, scope.repoId);
2287
2359
  // DES-KNOWLEDGE-DATA-001 §9.1: an app's knowledge query sees what a unit in the APP'S project sees (the same set).
2288
2360
  const appsKnowledgeVisible = (projectId) => projectVisible(projectId);
2361
+ // One project predicate for the builder, governed check, live reads and action steps.
2362
+ const appsVisibleSources = async (projectId) => new Set((await dataGate.sources()).filter((s) => agentMay(s.access, s, projectId, 'see')).map((s) => s.name));
2289
2363
  // (DES-CATALOG-002 CS4/CS10) Each run's source pick: recorded at launch (POST /runs), read by the broker, the unit's
2290
2364
  // tool list and the estate relay, so a unit never reaches a registered source its job did not pick.
2291
- const runSourcePicks = new RunSourcePicks(join(crewStateHome(), 'mcp', 'run-source-picks.json'));
2365
+ // crew#1442: a run the store no longer holds keeps the pick its launch recorded (fail closed, never widened).
2366
+ const runSourcePicks = new RunSourcePicks(join(crewStateHome(), 'mcp', 'run-source-picks.json'), (runId) => runTimingIndex.recordedPickOf(runId));
2292
2367
  /** Every registered source and PM tracker id with its owning source's name: how the relay maps `source:<id>` to a pick. */
2293
2368
  const sourceOwnerNames = async () => {
2294
2369
  const out = (await dataGate.sources()).map((s) => ({ id: s.id, name: s.name }));
@@ -2314,6 +2389,7 @@ export async function createServer(adapter, options) {
2314
2389
  // so a version holding queries or actions lands when they pass (DES §9.2 step 3).
2315
2390
  sourceStage: new AppsSourceStage({
2316
2391
  registry: mcpRegistry,
2392
+ visibleSources: appsVisibleSources,
2317
2393
  // (DES-KNOWLEDGE-DATA-001 §9.1) A `recall` query is checked against what its app's project may see.
2318
2394
  knowledge: { sources: () => dataGate.sources(), visible: appsKnowledgeVisible },
2319
2395
  projectOf: (slug) => appStore?.projectOf(slug) ?? null,
@@ -2358,6 +2434,10 @@ export async function createServer(adapter, options) {
2358
2434
  catch (err) {
2359
2435
  app.log.error(`[apps] the app store cannot be read, so Apps is off: ${err instanceof Error ? err.message : String(err)}`);
2360
2436
  }
2437
+ // Like the tracker timer, descriptions refresh off the request path and stop with this daemon.
2438
+ const appsRedescriber = new AppsRedescriber({ store: () => appStore, registry: mcpRegistry, log: (m) => app.log.warn(m) });
2439
+ appsRedescriber.start();
2440
+ app.addHook('onClose', async () => appsRedescriber.close());
2361
2441
  const appsVerifyUnitToken = appStore !== null && CoreAdapter.estateScopeResolver() !== null
2362
2442
  ? appsUnitResolver((req) => {
2363
2443
  const resolve = CoreAdapter.estateScopeResolver();
@@ -2368,7 +2448,7 @@ export async function createServer(adapter, options) {
2368
2448
  : undefined;
2369
2449
  const mcpBroker = new McpBroker({
2370
2450
  ...(appStore !== null && appsVerifyUnitToken !== undefined ? { apps: new AppsSelfCheck(appStore, appsVerifyUnitToken, {
2371
- visibleSources: async (projectId) => new Set((await dataGate.sources()).filter((s) => agentMay(s.access, s, projectId, 'see')).map((s) => s.name)),
2451
+ visibleSources: appsVisibleSources,
2372
2452
  }) } : {}),
2373
2453
  picks: runSourcePicks,
2374
2454
  registry: mcpRegistry,
@@ -2419,6 +2499,7 @@ export async function createServer(adapter, options) {
2419
2499
  }, { audit, authMode: auth.mode }, {
2420
2500
  seatHealth,
2421
2501
  deliveryFreeze,
2502
+ repoOrigins,
2422
2503
  // wicked-studio#284: the watchdog's remembered frames ride `GET /runs/:id/events`.
2423
2504
  stallFrames: (runId) => stallFrameIndex.framesFor(runId),
2424
2505
  voiceInputs,
@@ -2483,7 +2564,7 @@ export async function createServer(adapter, options) {
2483
2564
  // Route tests drive `registerMcpRoutes` over their own registry (tests/mcp-registry.test.ts).
2484
2565
  mcp: mcpRegistry,
2485
2566
  // DES-APPS-001 (K2a): the app store (`daemon-apps.json` in the state home; repos under the apps root).
2486
- ...(appStore !== null ? { apps: appStore } : {}),
2567
+ ...(appStore !== null ? { apps: appStore, appsVisibleSources } : {}),
2487
2568
  // (DES-APPS-001 K5) `POST /apps/check`: the engine resolves the unit's token; crew reads which step it is.
2488
2569
  ...(appsVerifyUnitToken !== undefined ? { appsVerifyUnitToken } : {}),
2489
2570
  ...(appStore !== null && appActions !== null ? { appsActions: appActions } : {}),
@@ -2558,6 +2639,14 @@ export async function createServer(adapter, options) {
2558
2639
  decisionLedger: new DecisionLedger(),
2559
2640
  decisionsEmit: projectBus !== null ? (type, payload, key) => projectBus.emit(type, payload, key) : null,
2560
2641
  });
2642
+ // Arm after registration: the websocket-plugin await above can yield to a sweep, whose reassign needs registered.
2643
+ // ON in the daemon, OFF under a test runner unless a test opts in (crew#287).
2644
+ if (stallWatchdogArmed) {
2645
+ stallWatchdog.start(options?.stallWatchdog?.sweepIntervalMs);
2646
+ app.addHook('onClose', async () => {
2647
+ stallWatchdog.stop();
2648
+ });
2649
+ }
2561
2650
  // DC-S4a §6: records whose landing a restart interrupted are re-driven, idempotently (the review
2562
2651
  // proposal is keyed by the decision id). Off the boot path; a failure is a logged outcome.
2563
2652
  chatDecisionRecorder = registered.chatRecorder;
@@ -2570,6 +2659,16 @@ export async function createServer(adapter, options) {
2570
2659
  const decisionsService = registered.decisions;
2571
2660
  decisionsService.track(decisionsService.redrive());
2572
2661
  }
2662
+ // crew#1774: policy rules landed with a project NAME (not an id) apply to no run; retarget or retire them once, off
2663
+ // the boot path (OFF under a test runner, like the other boot sweeps).
2664
+ if (!(process.env['VITEST'] !== undefined || process.env['NODE_ENV'] === 'test')) {
2665
+ void migrateInertPolicyRules({
2666
+ adapter,
2667
+ audit,
2668
+ estateTool: callEstateTool,
2669
+ log: (m) => app.log.warn(m),
2670
+ });
2671
+ }
2573
2672
  // Standing orders (Studio OS behaviour 10): the store, the evaluator over THE gate decision path
2574
2673
  // (`registered.decideGate`), and the routes. See src/standing-orders/.
2575
2674
  // The durable record is the audit trail (store.ts): fold it once, here.
@@ -2580,7 +2679,7 @@ export async function createServer(adapter, options) {
2580
2679
  decideGate: registered.decideGate,
2581
2680
  audit,
2582
2681
  runFacts: async (runId) => {
2583
- const v = (await adapter.sessionsDetail()).find((x) => x.session.id === runId);
2682
+ const v = await adapter.runView(runId);
2584
2683
  if (v === undefined)
2585
2684
  return undefined;
2586
2685
  return {
@@ -2624,8 +2723,8 @@ export async function createServer(adapter, options) {
2624
2723
  // `phase-report` — and the steering notes a person's edits of it become. Steering rides the engine's operator
2625
2724
  // inject only; nothing here answers a gate.
2626
2725
  const workingDocNotes = new PersonNotesIndex();
2627
- // The working documents read the run views (the engine's whole-store fold) at most once per 2 s between them: the
2628
- // catch-up and a burst of syncs share one read instead of one each (crew#944: run reads must stay fast).
2726
+ // The working documents' live-run enumeration reads the run views (the engine's whole-store fold) at most once per 2 s:
2727
+ // the catch-up shares one read instead of one each (crew#944: run reads must stay fast). One run is read alone (`run`).
2629
2728
  let workingDocViewsRead = null;
2630
2729
  const workingDocViews = () => {
2631
2730
  if (workingDocViewsRead === null || Date.now() - workingDocViewsRead.at > 2_000) {
@@ -2653,21 +2752,7 @@ export async function createServer(adapter, options) {
2653
2752
  // (context-doc-switch) The person's Goal, Approach and Constraints as the engine's context block.
2654
2753
  setRunContext: (runId, ctx) => adapter.setRunContext(runId, ctx),
2655
2754
  },
2656
- run: async (runId) => {
2657
- const v = (await workingDocViews()).find((x) => x.session.id === runId);
2658
- if (v === undefined)
2659
- return null;
2660
- return {
2661
- title: workingDocTitle(v.session.problem),
2662
- problem: v.session.problem ?? '',
2663
- projectId: runProject(v, runId, (id) => membershipIndex.projectOf(id)) ?? WORKING_DOC_DEFAULT_PROJECT,
2664
- terminal: ['completed', 'cancelled', 'failed'].includes(v.session.status),
2665
- stepOf: (ord) => workingDocStep(v.units.find((x) => x.ord === ord)),
2666
- power: v.session.power != null,
2667
- // The run's current plan (the engine's unit list): what a phased run's Approach says once its plan settles.
2668
- steps: v.units.map((u) => ({ ord: u.ord, name: workingDocStep(u), seat: u.assigned_cli ?? null })),
2669
- };
2670
- },
2755
+ run: (runId) => workingDocRunFacts(adapter, (id) => membershipIndex.projectOf(id), runId),
2671
2756
  // A person's answers with their words (crew's own trail: the engine's log does not say who, or why), from memory,
2672
2757
  // once the start-up read of the trail is in (so a line never lands ahead of an older one).
2673
2758
  notes: async (runId) => { await workingDocNotesRead; return workingDocNotes.of(runId); },
@@ -2683,6 +2768,7 @@ export async function createServer(adapter, options) {
2683
2768
  log: (m) => app.log.warn(m),
2684
2769
  });
2685
2770
  workingDocTap = (e) => workingDocs.onEvent(e);
2771
+ workingDocsReady(workingDocs);
2686
2772
  // (context-doc-switch) The engine's context blocks are set at once (one cheap call per live document, serial), not
2687
2773
  // after the slower line catch-up below: a seat spawned meanwhile would miss a block the engine does not hold yet.
2688
2774
  void workingDocs.contextCatchUp();
@@ -2821,6 +2907,26 @@ export async function createServer(adapter, options) {
2821
2907
  return app;
2822
2908
  }
2823
2909
  /** The URL a worker on this host reaches the daemon at: a wildcard bind is reached on loopback. */
2910
+ /**
2911
+ * What a run's working document needs to know about the run. crew#1775: one run as the engine holds it now, never a
2912
+ * search of a shared list of every run, which a run launched after the list was read is missing from (its document
2913
+ * would then never be made) and which costs a fold of the whole store.
2914
+ */
2915
+ export async function workingDocRunFacts(adapter, projectOf, runId) {
2916
+ const v = await adapter.runView(runId);
2917
+ if (v === undefined)
2918
+ return null;
2919
+ return {
2920
+ title: workingDocTitle(v.session.problem),
2921
+ problem: v.session.problem ?? '',
2922
+ projectId: runProject(v, runId, projectOf) ?? WORKING_DOC_DEFAULT_PROJECT,
2923
+ terminal: ['completed', 'cancelled', 'failed'].includes(v.session.status),
2924
+ stepOf: (ord) => workingDocStep(v.units.find((x) => x.ord === ord)),
2925
+ power: v.session.power != null,
2926
+ // The run's current plan (the engine's unit list): what a phased run's Approach says once its plan settles.
2927
+ steps: v.units.map((u) => ({ ord: u.ord, name: workingDocStep(u), seat: u.assigned_cli ?? null })),
2928
+ };
2929
+ }
2824
2930
  export function brokerUrlFor(host, port) {
2825
2931
  const h = host === '0.0.0.0' || host === '' ? '127.0.0.1' : host === '::' ? '::1' : host;
2826
2932
  return `http://${h.includes(':') ? `[${h}]` : h}:${port}`;
@@ -2840,6 +2946,13 @@ export async function registerRunEvals(adapter, warn, runsDir = defaultEvalRunsD
2840
2946
  }
2841
2947
  export async function startServer(adapter, port = 7701, host = '127.0.0.1', options) {
2842
2948
  const app = await createServer(adapter, options);
2949
+ // crew#1429: staged document folders whose run the engine never took (a launch that died after staging).
2950
+ try {
2951
+ sweepStagedDocuments(runDocumentsRootDir(), new Set(await adapter.sessions()));
2952
+ }
2953
+ catch (err) {
2954
+ app.log.warn(`[runs] staged documents sweep skipped: ${err instanceof Error ? err.message : String(err)}`);
2955
+ }
2843
2956
  await app.listen({ port, host });
2844
2957
  const clock = app.bootStages ?? new BootStageClock();
2845
2958
  clock.lap('listen');