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
@@ -40,9 +40,9 @@ import { NEW_WORK_SEATS_FIX, NewWorkSeatsRefusal, jobSeatPool } from '../core/jo
40
40
  import { z } from '../zod.js';
41
41
  import { parseCommand, resolveOption } from '../workflow-catalog/build-v2.js';
42
42
  import { CATALOG_V2_CARDS } from '../workflow-catalog/catalog-data-v2.js';
43
- import { REVIEW_CHANGE_WORKFLOW } from './review-change.js';
44
- import { checksLabel, ownWords, factsOf, JobRefusal, mergeRevision, nounOf, optionFor, personAskedSkip, personPid, proposalKindOf, qeSkipBound, requestDigest, repoOf, resolveJob, SEAT_WORDS, seatProtections, seatRemovalNote, briefOf, inputLines, SELF_SEATED, } from './chat-jobs.js';
45
- import { artifactExists, artifactHead, chatMount, parseArtifactRef, UNFILED_MOUNT } from './chat-context.js';
43
+ import { REVIEW_CHANGE_WORKFLOW, REVIEW_PROVENANCE_WINDOW_DAYS } from './review-change.js';
44
+ import { checksLabel, ownWords, factsOf, JobRefusal, mergeRevision, nounOf, optionFor, personAskedSkip, personPid, proposalKindOf, qeSkipBound, requestDigest, repoOf, resolveJob, SEAT_WORDS, seatProtections, seatRemovalNote, seatsNeeded, seatsShortLine, briefOf, inputLines, repoNamedIn, SELF_SEATED, mentionsPullRequest, prNumberOfUrl, } from './chat-jobs.js';
45
+ import { artifactExists, artifactHead, artifactIsCut, chatMount, parseArtifactRef, UNFILED_MOUNT } from './chat-context.js';
46
46
  import { ATTACHMENT_MAX_FILE_BYTES } from './chat-attachments.js';
47
47
  import { documentPathPlan } from '../interactive/source-packet.js';
48
48
  import { tornTailPrefix } from './chat-transcripts.js';
@@ -73,6 +73,10 @@ const EntryBlock = z.object({
73
73
  depth: z.enum(['quick', 'standard', 'deep']).nullable().optional(),
74
74
  confidence: z.number().optional(),
75
75
  title: z.string().trim().max(200).optional(),
76
+ // crew#1737: who the person named in this message to do the job (`lead` builds or writes, `seats` the others, in
77
+ // their order). crew keeps only the ones the person's own turn names (`seatNamedIn`).
78
+ lead: z.string().trim().min(1).max(64).optional(),
79
+ seats: z.array(z.string().trim().min(1).max(64)).max(8).optional(),
76
80
  brief: z.string().max(8000).optional(),
77
81
  url: z.string().trim().max(2048).optional(),
78
82
  audience: z.string().max(400).optional(),
@@ -299,6 +303,11 @@ export function viewOf(f) {
299
303
  ...(f.decidedAt !== undefined ? { decidedAt: f.decidedAt } : {}),
300
304
  };
301
305
  }
306
+ /** A job's run is live while the check's run list has it and it has not ended (crew#1779: no engine read per job). */
307
+ export async function liveInRuns(runId, runs) {
308
+ const v = (await runs()).find((r) => r.session.id === runId);
309
+ return v !== undefined && !['completed', 'cancelled', 'failed'].includes(String(v.session.status));
310
+ }
302
311
  /** Serialize work per key: a second caller waits for the first, then runs. */
303
312
  class KeyedLock {
304
313
  tails = new Map();
@@ -314,6 +323,16 @@ class KeyedLock {
314
323
  return next;
315
324
  }
316
325
  }
326
+ /** A launch refused before starting anything; the caller can correct the open card and try again. */
327
+ export class LaunchRefusal extends Error {
328
+ status;
329
+ body;
330
+ constructor(status, body) {
331
+ super(typeof body['error'] === 'string' ? body['error'] : 'The launch was refused.');
332
+ this.status = status;
333
+ this.body = body;
334
+ }
335
+ }
317
336
  /**
318
337
  * DES §4.3 step 3: ONE launcher per run id. `launchOnce` takes the run id's lock, asks the operation's launcher whether
319
338
  * that run exists (adopt), and starts it only if not — so a retry, a second tab and a late bus trigger (A3 calls this
@@ -342,15 +361,15 @@ export class LaunchOnceRegistry {
342
361
  return null;
343
362
  return { stub: d.stub === true };
344
363
  }
345
- async live(kind, runId) {
364
+ async live(kind, runId, runs) {
346
365
  const d = this.dispatchers.get(kind);
347
- return d?.live === undefined ? false : d.live(runId);
366
+ return d?.live === undefined ? false : d.live(runId, runs);
348
367
  }
349
368
  /** Whether a run this daemon started for the artifact is still live, or a launcher's durable record says an attempt at
350
369
  * it has no outcome yet (A3: across a restart too). */
351
- async liveForArtifact(artifactRef) {
370
+ async liveForArtifact(artifactRef, runs) {
352
371
  for (const r of this.byArtifact.get(artifactRef) ?? [])
353
- if (await this.live(r.kind, r.runId))
372
+ if (await this.live(r.kind, r.runId, runs))
354
373
  return true;
355
374
  for (const d of new Set(this.dispatchers.values()))
356
375
  if (d.docBusy !== undefined && (await d.docBusy(artifactRef)))
@@ -470,6 +489,8 @@ export const PROPOSAL_WORKFLOWS = {
470
489
  refine: 'interactive-chat',
471
490
  demo: 'demo',
472
491
  };
492
+ /** studio#1140: why a refine of a demo cut is blocked (the card says it after the document's title). */
493
+ export const CUT_BLOCKED = "a demo video: this chat can't change it. Change it by hand in the video editor (chapters, trims, captions, theme)";
473
494
  const STOPS = {
474
495
  create: 'Stops for you if the check fails. The plan or an escalation may also ask.',
475
496
  refine: 'Stops for you if the check fails. The plan or an escalation may also ask.',
@@ -605,6 +626,66 @@ export function isJobCardEntry(block) {
605
626
  const card = CATALOG_V2_CARDS.find((c) => c.id === block.entry);
606
627
  return (card !== undefined && detectable(card)) || block.option !== undefined || block.confidence !== undefined;
607
628
  }
629
+ /** A document title must occur in the person's own turn. */
630
+ function ownTitle(title, words) {
631
+ const plain = (s) => s.replace(/['"‘’“”]/gu, '').replace(/\s+/gu, ' ').trim().toLowerCase();
632
+ const named = plain(title);
633
+ return named !== '' && plain(words).includes(named);
634
+ }
635
+ /**
636
+ * (crew#1728) A seat's entry block keeps its `title` only when the person named it in their own words, as a job card's
637
+ * does (`ownTitle`); else the title is dropped and the catalog's title is used.
638
+ */
639
+ function ownWordsTitle(block, records, turnId) {
640
+ if (block.op !== 'entry' || block.title === undefined || ownTitle(block.title, personWords(records, turnId)))
641
+ return block;
642
+ const rest = { ...block };
643
+ delete rest.title;
644
+ return rest;
645
+ }
646
+ /**
647
+ * (crew#1737) The person's own request with what they only quoted taken out: fenced and inline code, `>` quote lines
648
+ * and text in quotation marks. A seat named only there was pasted or reported, not chosen.
649
+ */
650
+ export function ownRequestWords(words) {
651
+ return words
652
+ .replace(/(`{3,}|~{3,})[\s\S]*?(?:\1|$)/gu, ' ')
653
+ .replace(/(`+)[\s\S]*?\1/gu, ' ')
654
+ .split(/\r?\n/u)
655
+ .filter((line) => !/^\s*>/u.test(line))
656
+ .join('\n')
657
+ .replace(/"[^"]*"|“[^”]*”|‘[^’]*’/gu, ' ');
658
+ }
659
+ /** (crew#1737) Whether the person's words name a seat, by its key or its roster name, as a whole word, outside what
660
+ * they quoted ({@link ownRequestWords}). */
661
+ export function seatNamedIn(key, name, words) {
662
+ const plain = ownRequestWords(words).toLowerCase();
663
+ return [key, name].some((n) => {
664
+ const w = (n ?? '').trim().toLowerCase();
665
+ if (w === '')
666
+ return false;
667
+ const esc = w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
668
+ return new RegExp(`(^|[^\\p{L}\\p{N}])${esc}(?![\\p{L}\\p{N}])`, 'u').test(plain);
669
+ });
670
+ }
671
+ /**
672
+ * (crew#1737) The seats a routing block names that the person's own turn names too and that can work now: the lead
673
+ * first, then the others in the person's order. Nothing named (or nothing that passes) leaves both `null`, so the card
674
+ * draws its own seats.
675
+ */
676
+ function namedSeats(block, words, roster) {
677
+ const ok = (k) => roster.some((s) => s.key === k) && seatNamedIn(k, roster.find((s) => s.key === k)?.name, words);
678
+ const lead = block.lead !== undefined && ok(block.lead) ? block.lead : null;
679
+ const others = [...new Set(block.seats ?? [])].filter((k) => k !== lead && ok(k));
680
+ // Seats ride only beside a named lead: a list without one would read as the whole roster (its first seat building),
681
+ // so a seat named only to check is left to the card's own draw, which the person can swap (xreview r2).
682
+ return { lead, seats: lead !== null && others.length > 0 ? [lead, ...others] : null };
683
+ }
684
+ /**
685
+ * (crew#1745) A chat that ended (closed, its id reused, or the daemon restarted) can't take a proposal any more. Said
686
+ * without its id: the person reads this under the card, and the way forward is a new chat.
687
+ */
688
+ export const CHAT_ENDED = 'this chat has ended (it was closed, or the daemon restarted), so it can’t start this again. Start it again in a new chat.';
608
689
  /** The person's own words of ONE turn (the message the seat's block answers). */
609
690
  function turnWords(records, turnId) {
610
691
  const r = records.find((x) => x.kind === 'user' && x.turnId === turnId && x.owner === true);
@@ -771,7 +852,7 @@ export class ChatProposals {
771
852
  const jobBlock = jobs && block.op === 'entry' && isJobCardEntry(block);
772
853
  const proposal = jobBlock
773
854
  ? await this.resolveDetected({ chatId: frame.chat, turnId, seat: frame.cliKey, block: block, records: this.deps.records(frame.chat) })
774
- : await this.resolve({ chatId: frame.chat, turnId, seat: frame.cliKey, block, records: this.deps.records(frame.chat) });
855
+ : await this.resolve({ chatId: frame.chat, turnId, seat: frame.cliKey, block: ownWordsTitle(block, this.deps.records(frame.chat), turnId), records: this.deps.records(frame.chat) });
775
856
  if (proposal === null)
776
857
  return;
777
858
  // A job card never appears after the person has written again (codex r4): a newer message ("never mind") supersedes a
@@ -848,7 +929,7 @@ export class ChatProposals {
848
929
  // Only for a client that draws the card (its seat was told the block exists only then).
849
930
  if (flags.onboard !== true || this.deps.onboard === undefined || this.deps.acceptsOnboard?.(chatId) !== true)
850
931
  return this.refused(chatId, 'onboard');
851
- return resolveOnboard(block, { pid, chatId, turnId, seat, chatProjectId: chat.projectId === null || chat.projectId === 'default' ? null : chat.projectId }, this.deps.onboard);
932
+ return resolveOnboard(block, { pid, chatId, turnId, seat, chatProjectId: chat.projectId === null || chat.projectId === 'default' ? null : chat.projectId, words }, this.deps.onboard);
852
933
  }
853
934
  if (block.op === 'theme') {
854
935
  if (!flags.theme)
@@ -894,6 +975,9 @@ export class ChatProposals {
894
975
  const head = root === null ? null : artifactHead(root, ref.doc);
895
976
  if (head === null)
896
977
  blocked.push(`${title} · no such document`);
978
+ // studio#1140: a demo video changes in its editor; a page refine would write a page version over a cut.
979
+ else if (artifactIsCut(root, ref.doc))
980
+ blocked.push(`${title} · ${CUT_BLOCKED}`);
897
981
  else {
898
982
  target = { ref: ref.ref, title, base: head };
899
983
  projectId = projectOfMount(ref.mount);
@@ -907,9 +991,7 @@ export class ChatProposals {
907
991
  }
908
992
  }
909
993
  }
910
- // A5: a change works from the document and the person's words; extra sources do not reach its run yet, so the
911
- // card says so instead of showing them as used (codex A5 r1).
912
- const sources = (await this.resolveSources(block.sources, { chatId, turnId, records, binding, turnHas, chat, words, personNamed: false })).map((src) => src.status === 'ok' ? { ...src, status: 'struck', reason: 'a change works from the document and your words; make a new document to use this source' } : src);
994
+ const sources = await this.resolveSources(block.sources, { chatId, turnId, records, binding, turnHas, chat, words, personNamed: false });
913
995
  const { helpers, block: helperBlock, seatsUnread } = await this.docHelpers(chat);
914
996
  if (helperBlock !== null)
915
997
  blocked.push(helperBlock);
@@ -928,6 +1010,7 @@ export class ChatProposals {
928
1010
  filedIn: await filedIn(projectId),
929
1011
  ...(target !== undefined ? { target } : {}),
930
1012
  ...(block.touches.length > 0 ? { touches: block.touches } : {}),
1013
+ ...(binding?.artifact !== undefined && binding.artifact.ref === ref?.ref ? { anchors: [...binding.artifact.anchors] } : {}),
931
1014
  ...(protectedList !== undefined ? { protected: protectedList } : {}),
932
1015
  blocked: blocked[0] ?? null,
933
1016
  };
@@ -983,7 +1066,7 @@ export class ChatProposals {
983
1066
  demo = { url, audience: block.audience ?? null, show: block.show ?? null };
984
1067
  }
985
1068
  const sources = kind === 'create' ? await this.resolveSources(block.sources, { chatId, turnId, records, binding, turnHas, chat, words, personNamed: false }) : [];
986
- const { helpers, block: helperBlock, seatsUnread } = await this.docHelpers(chat);
1069
+ const { helpers, block: helperBlock, seatsUnread } = await this.docHelpers(chat, input.helperSeats, input.helperWriterNamed ?? true);
987
1070
  if (helperBlock !== null)
988
1071
  blocked.push(helperBlock);
989
1072
  return {
@@ -1274,8 +1357,8 @@ export class ChatProposals {
1274
1357
  // archived alias still waits for an in-flight answer through its first name.
1275
1358
  return this.lock.run(`pid\u0000${pid}`, () => this.decideLocked(chatId, pid, body, actor, instance)).then((r) => this.served(r));
1276
1359
  }
1277
- gone(chatId) {
1278
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} ended and its id was reused; this proposal can no longer be answered here` } };
1360
+ gone(chatId, acceptingAt) {
1361
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED, ...(acceptingAt !== undefined ? { acceptingAt } : {}) } };
1279
1362
  }
1280
1363
  async decideLocked(chatId, pid, body, actor, instance) {
1281
1364
  if (this.deps.instanceOf(chatId) !== instance)
@@ -1289,6 +1372,9 @@ export class ChatProposals {
1289
1372
  if (body.power !== undefined && (kind !== 'job' || body.decision !== 'go')) {
1290
1373
  return { code: 400, body: { code: 'power_not_applicable', error: kind !== 'job' ? 'only a job runs as a power run' : 'how a job runs is chosen with Start, not Not now' } };
1291
1374
  }
1375
+ if (body.reducedAssurance !== undefined && (kind !== 'job' || body.decision !== 'go')) {
1376
+ return { code: 400, body: { code: 'reduced_assurance_not_applicable', error: kind !== 'job' ? 'only a job can start with fewer checks' : 'choose fewer checks with Start' } };
1377
+ }
1292
1378
  const reread = () => foldProposals(this.deps.records(chatId)).get(pid) ?? folded;
1293
1379
  const ok = (f) => ({ code: 200, body: { view: viewOf(f) } });
1294
1380
  // 1. What already happened, before any state check.
@@ -1322,6 +1408,16 @@ export class ChatProposals {
1322
1408
  if (stale !== null)
1323
1409
  return stale;
1324
1410
  }
1411
+ if (kind === 'job') {
1412
+ const can = new Set(this.deps.rosterEligible().map((s) => s.key));
1413
+ const lost = (acc.resolution.seats?.keys ?? []).filter((k) => !can.has(k));
1414
+ if (lost.length > 0) {
1415
+ const reopened = this.reopenLaunch(chatId, folded, acc.resolution, instance);
1416
+ if (reopened === null)
1417
+ return this.gone(chatId);
1418
+ return { code: 409, body: { code: 'helper_unavailable', error: `${lost.join(' and ')} can't work now; change who works on it`, view: viewOf(reopened) } };
1419
+ }
1420
+ }
1325
1421
  // Go again: the frozen choices and identity, re-checked. Only the helpers may change (one may have signed out
1326
1422
  // since); everything else stays as accepted.
1327
1423
  let again = acc.resolution;
@@ -1338,6 +1434,8 @@ export class ChatProposals {
1338
1434
  throw err;
1339
1435
  }
1340
1436
  }
1437
+ if (body.reducedAssurance === true)
1438
+ again = { ...again, reducedAssurance: true };
1341
1439
  return this.go(chatId, folded, again, again === acc.resolution ? acc.edits : { ...(acc.edits ?? {}), ...body.edits }, acc.identity, actor, instance, body.power);
1342
1440
  }
1343
1441
  if (folded.state === 'superseded') {
@@ -1400,6 +1498,8 @@ export class ChatProposals {
1400
1498
  if (effective.blocked !== null) {
1401
1499
  return { code: 409, body: { code: 'proposal_blocked', error: effective.blocked, view: viewOf(folded) } };
1402
1500
  }
1501
+ if (body.reducedAssurance === true)
1502
+ effective = { ...effective, reducedAssurance: true };
1403
1503
  return this.go(chatId, folded, effective, body.edits ?? null, this.identityOf(effective), actor, instance, body.power);
1404
1504
  }
1405
1505
  /**
@@ -1407,11 +1507,19 @@ export class ChatProposals {
1407
1507
  * proposals of one chat (or two chats changing one document) can never both pass the busy check.
1408
1508
  */
1409
1509
  go(chatId, folded, resolution, edits, identity, actor, instance, power) {
1410
- const docKey = (resolution.kind === 'refine' || (resolution.kind === 'create' && resolution.artifactRef !== undefined)) && identity.artifactRef !== null ? identity.artifactRef : null;
1510
+ const docKey = identity.artifactRef;
1411
1511
  // Keyed by the chat's instance (shared by its original id and an ended chat's archived alias), else its id.
1412
1512
  return this.lock.run(`chat\u0000${instance ?? chatId}`, () => docKey === null
1413
1513
  ? this.goLocked(chatId, folded, resolution, edits, identity, actor, instance, power)
1414
- : this.lock.run(`doc\u0000${docKey}`, () => this.goLocked(chatId, folded, resolution, edits, identity, actor, instance, power)));
1514
+ : this.admitDocument(docKey, () => this.goLocked(chatId, folded, resolution, edits, identity, actor, instance, power)));
1515
+ }
1516
+ /** Share Go's admission with other actions on this chat instance. */
1517
+ admitChat(chatId, fn) {
1518
+ return this.lock.run(`chat\u0000${this.deps.instanceOf(chatId) ?? chatId}`, fn);
1519
+ }
1520
+ /** A create, refine or retirement of the same document waits for the previous admission. */
1521
+ admitDocument(ref, fn) {
1522
+ return this.lock.run(`doc\u0000${ref}`, fn);
1415
1523
  }
1416
1524
  async goLocked(chatId, folded, resolution, edits, identity, actor, instance, power) {
1417
1525
  const kind = resolution.kind;
@@ -1479,6 +1587,9 @@ export class ChatProposals {
1479
1587
  const head = root === null ? null : artifactHead(root, ref.doc);
1480
1588
  if (head === null)
1481
1589
  return { code: 409, body: { code: 'source_gone', error: `${resolution.target.title} is gone`, view: viewOf(folded) } };
1590
+ // studio#1140: a refine recorded before crew blocked cuts (or a document that became one) never launches on a cut.
1591
+ if (artifactIsCut(root, ref.doc))
1592
+ return { code: 409, body: { code: 'proposal_blocked', error: `${resolution.target.title} · ${CUT_BLOCKED}`, view: viewOf(folded) } };
1482
1593
  if (head !== resolution.target.base) {
1483
1594
  // A newer proposal exists: this one is not re-opened over it (the chat moved on). The re-resolution is still
1484
1595
  // recorded, so the fold settles it as superseded for every reader (and its frame says so).
@@ -1530,7 +1641,9 @@ export class ChatProposals {
1530
1641
  return this.gone(chatId);
1531
1642
  }
1532
1643
  // Recorded before anything starts.
1533
- const accepting = { at: this.now(), turnId: folded.turnId, kind: 'proposal_accepting', pid, actor: actor.id, edits, resolution, identity };
1644
+ // crew#1695: `at` names this Go (its refusals carry it), so it is never the same as an earlier accepting record's.
1645
+ const lastAt = Math.max(-1, ...this.deps.records(chatId).flatMap((r) => (r.kind === 'proposal_accepting' && r.pid === pid ? [r.at] : [])));
1646
+ const accepting = { at: Math.max(this.now(), lastAt + 1), turnId: folded.turnId, kind: 'proposal_accepting', pid, actor: actor.id, edits, resolution, identity };
1534
1647
  if (!this.write(chatId, accepting, instance))
1535
1648
  return this.gone(chatId);
1536
1649
  let result;
@@ -1538,17 +1651,42 @@ export class ChatProposals {
1538
1651
  result = await this.deps.registry.launchOnce({ kind, pid, chatId, actor, identity, resolution, ...(power !== undefined ? { power } : {}) });
1539
1652
  }
1540
1653
  catch (err) {
1654
+ // crew#1695: every refusal after this Go's accepting write names that record (`acceptingAt`), so a client marks
1655
+ // only it stopped, never another tab's newer Go.
1656
+ if (err instanceof LaunchRefusal) {
1657
+ const reopened = this.reopenLaunch(chatId, folded, resolution, instance);
1658
+ if (reopened === null)
1659
+ return this.gone(chatId, accepting.at);
1660
+ this.deps.audit('chat.proposal.launch_refused', actor, { chatId, pid, code: err.body['code'], error: err.message });
1661
+ return { code: err.status, body: {
1662
+ code: err.body['code'], error: err.message, acceptingAt: accepting.at,
1663
+ ...(err.body['excluded'] !== undefined ? { excluded: err.body['excluded'] } : {}),
1664
+ ...(err.body['retryWith'] !== undefined ? { retryWith: err.body['retryWith'] } : {}),
1665
+ view: viewOf(reopened),
1666
+ } };
1667
+ }
1541
1668
  // Accepting stays recorded: the card shows "Interrupted · Go again", which resumes the same identity.
1542
1669
  const msg = err instanceof Error ? err.message : String(err);
1543
1670
  this.deps.audit('chat.proposal.launch_failed', actor, { chatId, pid, error: msg, ...(power !== undefined ? { power } : {}) });
1544
1671
  const after = foldProposals(this.deps.records(chatId)).get(pid);
1545
- return { code: 502, body: { code: 'launch_failed', error: `could not start it: ${msg}. Go again resumes the same job.`, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1672
+ return { code: 502, body: { code: 'launch_failed', error: `could not start it: ${msg}. Go again resumes the same job.`, acceptingAt: accepting.at, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1546
1673
  }
1547
1674
  if (!this.decided(chatId, folded.turnId, pid, actor, 'go', result, resolution, edits, instance, power))
1548
- return this.gone(chatId);
1675
+ return this.gone(chatId, accepting.at);
1549
1676
  const after = foldProposals(this.deps.records(chatId)).get(pid) ?? folded;
1550
1677
  return { code: 200, body: { view: viewOf(after) } };
1551
1678
  }
1679
+ reopenLaunch(chatId, folded, resolution, instance) {
1680
+ const proposal = { ...resolution };
1681
+ // A Go-only opt-in belongs to that attempt; a reshape card keeps its own prior choice.
1682
+ if (folded.proposal.reducedAssurance === true)
1683
+ proposal.reducedAssurance = true;
1684
+ else
1685
+ delete proposal.reducedAssurance;
1686
+ if (!this.write(chatId, { at: this.now(), turnId: folded.turnId, kind: 'proposal', proposal }, instance))
1687
+ return null;
1688
+ return foldProposals(this.deps.records(chatId)).get(resolution.pid) ?? null;
1689
+ }
1552
1690
  /** Record the answer (and audit exactly what was answered); `false` when the chat is no longer this instance. */
1553
1691
  decided(chatId, turnId, pid, actor, decision, result, resolution, edits, instance, power) {
1554
1692
  if (!this.write(chatId, { at: this.now(), turnId, kind: 'proposal_decided', pid, actor: actor.id, decision, result }, instance))
@@ -1576,7 +1714,7 @@ export class ChatProposals {
1576
1714
  async onNewHead(p) {
1577
1715
  if (p.kind !== 'refine' || p.target === undefined)
1578
1716
  return p;
1579
- const kept = await this.protectedOf(p.target.ref, p.target.base, p.touches ?? []);
1717
+ const kept = await this.protectedOf(p.target.ref, p.target.base, [...(p.touches ?? []), ...(p.anchors ?? [])]);
1580
1718
  return 'error' in kept ? { ...p, protected: [], blocked: kept.error } : { ...p, protected: kept.entries, blocked: p.blocked };
1581
1719
  }
1582
1720
  /** The identity a Go is named by (DES §4.3 step 2). */
@@ -1642,6 +1780,7 @@ export class ChatProposals {
1642
1780
  */
1643
1781
  async busy(chatId, artifactRef, p) {
1644
1782
  const runs = await this.deps.runs();
1783
+ const runsOnce = async () => runs;
1645
1784
  // A reshape's held run is the one it replaces: answered Reject inside this Go, so it does not make the chat busy.
1646
1785
  const held = p.reshapes !== undefined && p.heldRejected !== true ? p.reshapes : null;
1647
1786
  for (const f of foldProposals(this.deps.records(chatId)).values()) {
@@ -1650,7 +1789,7 @@ export class ChatProposals {
1650
1789
  // Another proposal of this chat started a job (decided go, or accepting with its run launched) still live.
1651
1790
  const runId = f.state === 'decided' && f.decision === 'go' ? f.result?.runId ?? null
1652
1791
  : f.state === 'accepting' ? f.accepting?.identity.runId ?? null : null;
1653
- if (runId !== null && runId !== held && (await this.deps.registry.live(f.proposal.kind, runId))) {
1792
+ if (runId !== null && runId !== held && (await this.deps.registry.live(f.proposal.kind, runId, runsOnce))) {
1654
1793
  return { code: 'chat_busy', reason: `This chat already has a job running (${f.proposal.what.label}). Wait, or stop that run.` };
1655
1794
  }
1656
1795
  }
@@ -1660,7 +1799,7 @@ export class ChatProposals {
1660
1799
  return { code: 'chat_busy', reason: `This chat already has a job running (run ${v.session.id.slice(0, 8)}). Wait, or stop that run.` };
1661
1800
  }
1662
1801
  if (artifactRef !== null && (p.kind === 'refine' || (p.kind === 'create' && p.artifactRef !== undefined))) {
1663
- if (await this.deps.registry.liveForArtifact(artifactRef)) {
1802
+ if (await this.deps.registry.liveForArtifact(artifactRef, runsOnce)) {
1664
1803
  return { code: 'document_busy', reason: `“${p.target?.title ?? p.what.title}” is being ${p.kind === 'create' ? 'drafted' : 'revised'}. Wait, or stop that run.` };
1665
1804
  }
1666
1805
  const ref = parseArtifactRef(artifactRef);
@@ -1947,21 +2086,23 @@ export class ChatProposals {
1947
2086
  });
1948
2087
  const g = d.guess;
1949
2088
  // The repository the block names, when it is one of this chat's (else the chat's own rule picks it).
1950
- const named = block.repos.map((want) => jc.repos.filter((r) => r.name === want || r.id === want)).find((hits) => hits.length === 1)?.[0];
2089
+ // crew#1791: else the one the person's words clearly name ("In tiny-math-rd, fix …").
2090
+ const named = block.repos.map((want) => jc.repos.filter((r) => r.name === want || r.id === want)).find((hits) => hits.length === 1)?.[0]
2091
+ ?? repoNamedIn(words, jc.repos) ?? undefined;
1951
2092
  // A demo's address only from the person's own words (DES-CHAT-ARTIFACTS-001 §4.3), never the model's.
1952
2093
  const inputs = {};
1953
2094
  if (block.url !== undefined && block.url !== '' && personUrls(words).has(block.url))
1954
2095
  inputs['url'] = { kind: 'url', value: block.url };
1955
2096
  const facts = {
1956
2097
  card: g.card,
2098
+ title: block.title !== undefined && ownTitle(block.title, words) ? block.title : null,
1957
2099
  option: g.option,
1958
2100
  depth: g.depth,
1959
2101
  words,
1960
2102
  details: [],
1961
2103
  repoRef: named?.id ?? null,
1962
2104
  projectId: jc.projectId,
1963
- lead: null,
1964
- seats: null,
2105
+ ...namedSeats(block, words, ctx.roster),
1965
2106
  inputs,
1966
2107
  skipQe: null,
1967
2108
  by: 'detected',
@@ -2193,7 +2334,7 @@ export class ChatProposals {
2193
2334
  const open = [...foldProposals(this.deps.records(chatId)).values()].find((f) => (f.state === 'open' || f.state === 'revising') && f.proposal.shape !== undefined);
2194
2335
  if (open !== undefined) {
2195
2336
  const p = open.proposal;
2196
- context.open = { pid: p.pid, label: p.what.label, card: p.shape.card, option: p.shape.option, repo: p.repos[0] ?? null, seats: [...(p.seats?.keys ?? [])], checks: checksLabel(p.gate ?? []) };
2337
+ context.open = { pid: p.pid, label: p.what.label, card: p.shape.card, option: p.shape.option, repo: p.repos[0] ?? null, seats: [...(p.seats?.keys ?? p.helpers?.seats ?? [])], checks: checksLabel(p.gate ?? []) };
2197
2338
  }
2198
2339
  const job = this.launchedJob(chatId);
2199
2340
  if (job !== null && this.deps.heldPlan !== undefined) {
@@ -2310,9 +2451,19 @@ export class ChatProposals {
2310
2451
  return records.map((r) => this.seatsBlocked(r, refusal, open));
2311
2452
  }
2312
2453
  /** A document's two default helpers from the pool, and the line that blocks it when there are none. */
2313
- async docHelpers(chat) {
2454
+ async docHelpers(chat, chosen, writerNamed = true) {
2314
2455
  const { pool, refusal } = await this.seatPool();
2315
- const helpers = this.helpers(chat, undefined, pool);
2456
+ const eligible = new Set(this.deps.rosterEligible().map((s) => s.key));
2457
+ let seats = chosen === undefined ? undefined : [...new Set(chosen)].filter((k) => eligible.has(k)).slice(0, 2);
2458
+ // crew#1737: one helper named: the other is the one the card would draw, never the same seat again. A named writer
2459
+ // writes; a seat named only to check (no writer named, or the one named can't work now) checks.
2460
+ if (seats !== undefined && seats.length === 1) {
2461
+ const drawn = [...(this.helpers(chat, undefined, pool)?.seats ?? []), ...pool.map((s) => s.key)];
2462
+ const other = drawn.find((k) => k !== seats[0] && eligible.has(k));
2463
+ if (other !== undefined)
2464
+ seats = writerNamed && chosen?.[0] === seats[0] ? [seats[0], other] : [other, seats[0]];
2465
+ }
2466
+ const helpers = this.helpers(chat, seats, pool);
2316
2467
  return { helpers, block: helpers === null ? NEEDS_HELPER : null, ...(refusal !== undefined ? { seatsUnread: true } : {}) };
2317
2468
  }
2318
2469
  async jobContext(chatId, pid, turnId, seat, chat, extra) {
@@ -2329,7 +2480,29 @@ export class ChatProposals {
2329
2480
  const qeOff = (await this.deps.qeOff?.().catch(() => false)) === true;
2330
2481
  const powerPresets = (await this.deps.powerPresets?.(chat.projectId).catch(() => null)) ?? null;
2331
2482
  const { eligible: roster, pool, refusal } = await this.seatPool();
2332
- return { chatId, pid, turnId, seat, chat, served, roster, pool, projectLabel, qeOff, powerPresets, ...extra, ...(refusal !== undefined ? { seatsUnread: true } : {}) };
2483
+ return { chatId, pid, turnId, seat, chat, served, roster, pool, projectLabel, qeOff, powerPresets, ...(this.deps.coverage !== undefined ? { coverage: (keys, bound) => this.deps.coverage(keys, bound) } : {}), ...extra, ...(refusal !== undefined ? { seatsUnread: true } : {}) };
2484
+ }
2485
+ /** (crew#1840) The pull requests this chat's runs delivered (a run record's `deliverUrl`), newest run last. A failed
2486
+ * read is none: the job then opens its own pull request, and its card says so when the words asked otherwise. */
2487
+ async deliveredPrs(chatId) {
2488
+ try {
2489
+ const out = [];
2490
+ for (const v of await this.deps.runs()) {
2491
+ if (this.deps.chatOfRun(v.session.id) !== chatId)
2492
+ continue;
2493
+ const url = v.session.deliverUrl;
2494
+ const number = typeof url === 'string' ? prNumberOfUrl(url) : null;
2495
+ if (number === null)
2496
+ continue;
2497
+ const repo = v.session.repo_ref;
2498
+ out.push({ number, url: url, runId: v.session.id, repoRef: typeof repo === 'string' ? repo : null });
2499
+ }
2500
+ return out;
2501
+ }
2502
+ catch (err) {
2503
+ this.log(`[proposals] chat ${chatId}: its runs could not be read for a delivered pull request: ${err instanceof Error ? err.message : String(err)}`);
2504
+ return [];
2505
+ }
2333
2506
  }
2334
2507
  /** Source availability matters only to a card that shows this input. Keep a failed read a named refusal. */
2335
2508
  async loadJobSources(facts, ctx) {
@@ -2382,10 +2555,16 @@ export class ChatProposals {
2382
2555
  this.reviewAuthorsSeen.delete(k);
2383
2556
  this.reviewAuthorsSeen.set(key, authors);
2384
2557
  }
2385
- const roster = ctx.roster.filter((s) => !authors.authors.includes(s.key));
2558
+ const { seats, unknown } = authors.authors;
2559
+ const roster = ctx.roster.filter((s) => !seats.includes(s.key));
2386
2560
  if (roster.length === 0 || roster.length === ctx.roster.length)
2387
2561
  return ctx;
2388
- return { ...ctx, roster, ...(ctx.pool !== undefined ? { pool: ctx.pool.filter((s) => !authors.authors.includes(s.key)) } : {}) };
2562
+ // crew#1803: the card names the seats it left off and why, in a note of its own (`notes` refuses a seat edit).
2563
+ const off = ctx.roster.filter((s) => seats.includes(s.key)).map((s) => s.name).join(', ');
2564
+ const reviewNote = unknown === undefined
2565
+ ? `${off} left off: authors of this change don't review it`
2566
+ : `${off} left off: crew could not read who made this change (${unknown}), so seats that worked in this repository in the last ${REVIEW_PROVENANCE_WINDOW_DAYS} days don't review it`;
2567
+ return { ...ctx, roster, reviewNote, ...(ctx.pool !== undefined ? { pool: ctx.pool.filter((s) => !seats.includes(s.key)) } : {}) };
2389
2568
  }
2390
2569
  /** Resolve the revision's shape first, then load only the choices that its input checks need. */
2391
2570
  async mergeJobRevision(parent, edits, ctx) {
@@ -2431,10 +2610,21 @@ export class ChatProposals {
2431
2610
  const turnId = ctx.turnId ?? `person:${pid.slice(pid.lastIndexOf(':') + 1)}`;
2432
2611
  // Crew's kind line goes first, as `withBriefLines` puts it on a run: a long request is cut at its end, never the line.
2433
2612
  const words = [r.resolved.brief ?? '', briefOf(facts)].filter((x) => x !== '').join('\n\n');
2434
- const made = await this.resolve({ chatId, turnId, seat: ctx.seat, block: { op: 'entry', entry: seed.id, brief: words, sources: ['chat'], repos: facts.repoRef !== null ? [facts.repoRef] : [] }, records });
2613
+ const chosen = facts.lead === null && facts.seats === null ? undefined
2614
+ : [...new Set([facts.lead, ...(facts.seats ?? [])].filter((k) => k !== null))];
2615
+ const made = await this.resolve({ chatId, turnId, seat: ctx.seat, ...(chosen !== undefined ? { helperSeats: chosen, helperWriterNamed: facts.lead !== null } : {}), block: { op: 'entry', entry: seed.id, ...(facts.title !== null ? { title: facts.title } : {}), brief: words, sources: ['chat'], repos: facts.repoRef !== null ? [facts.repoRef] : [] }, records });
2435
2616
  if (made === null)
2436
2617
  throw new JobRefusal('operation_unavailable', 'studio cannot start a document from a chat on this daemon yet', 409);
2437
2618
  const shape = { card: card.id, option: r.option?.id ?? null, depth: null, by: facts.by, source: facts.source, ...(facts.guess !== undefined ? { guess: facts.guess } : {}) };
2619
+ const nameOf = (key) => ctx.roster.find((s) => s.key === key)?.name ?? key;
2620
+ const extra = (chosen ?? []).filter((k) => ctx.roster.some((s) => s.key === k)).slice(2);
2621
+ const helperNotes = extra.length > 0 ? [`${extra.map(nameOf).join(', ')} left out: a document uses two helpers`] : [];
2622
+ const choices = (ctx.pool ?? ctx.roster).filter((s) => s.key !== made.helpers?.seats[0]).slice(0, 4).map((s) => ({ label: `${s.name} writes`, edit: { lead: s.key } }));
2623
+ const seatsTok = {
2624
+ id: 'seats', kind: 'seats',
2625
+ label: made.helpers === null ? 'two helpers needed' : `${nameOf(made.helpers.seats[0])} writes, ${nameOf(made.helpers.seats[1])} checks`,
2626
+ swap: choices.length > 0 ? { choices } : null,
2627
+ };
2438
2628
  const kindTok = { id: 'kind', kind: (card.variant !== undefined ? 'option' : 'card'), label: nounOf(card, shape.option), swap: null };
2439
2629
  const checksTok = { id: 'checks', kind: 'checks', label: checksLabel(r.resolved.gate), swap: null };
2440
2630
  const documentsInput = r.resolved.inputs.find((i) => i.id === 'documents');
@@ -2466,8 +2656,9 @@ export class ChatProposals {
2466
2656
  command: r.option?.command ?? card.command,
2467
2657
  gate: [...r.resolved.gate],
2468
2658
  words: facts.words,
2659
+ ...(facts.title !== null ? { namedTitle: facts.title } : {}),
2469
2660
  details: [...facts.details],
2470
- sentence: { text: `I'll make {kind} from this conversation${documentsInput !== undefined ? ', reading {documents}' : ''}, filed in ${made.filedIn.label}, checked by {checks}.`, tokens: [kindTok, ...documentsTok, checksTok], notes: [...ctx.notes], ask: offline !== null ? null : question?.text ?? (made.blocked === null ? 'Start?' : null) },
2661
+ sentence: { text: `I'll make {kind} from this conversation${documentsInput !== undefined ? ', reading {documents}' : ''}, filed in ${made.filedIn.label}, written by {seats}, checked by {checks}.`, tokens: [kindTok, ...documentsTok, seatsTok, checksTok], notes: [...ctx.notes, ...helperNotes], ask: offline !== null ? null : question?.text ?? (made.blocked === null ? 'Start?' : null) },
2471
2662
  suggestions: [],
2472
2663
  question,
2473
2664
  revises: ctx.revises,
@@ -2477,11 +2668,18 @@ export class ChatProposals {
2477
2668
  };
2478
2669
  }
2479
2670
  /** Resolve facts to their proposal. `previous` marks a rebuild; null is a held job without a stored parent. */
2480
- async proposalOf(chatId, pid, facts, ctx, records, allowHidden = false, previous) {
2671
+ async proposalOf(chatId, pid, facts, ctx, records, allowHidden = false, previous, relaunch = previous?.relaunch) {
2481
2672
  const card = CATALOG_V2_CARDS.find((c) => c.id === facts.card);
2482
2673
  const r = card === undefined ? null : resolveOption(card.id, optionFor(card, facts.option), ctx.served);
2483
2674
  await this.loadJobSources(facts, ctx);
2675
+ if (relaunch !== undefined && this.deps.coverage !== undefined) {
2676
+ ctx = { ...ctx, coverage: (keys, bound) => this.deps.coverage(keys, bound, relaunch) };
2677
+ }
2484
2678
  ctx = await this.reviewRoster(facts, ctx);
2679
+ // (crew#1840) Words that name a pull request: the ones this chat's runs delivered, so a job asked to change one
2680
+ // updates it (the resolution decides; it is pure).
2681
+ if (ctx.deliveredPrs === undefined && mentionsPullRequest(facts.words))
2682
+ ctx = { ...ctx, deliveredPrs: await this.deliveredPrs(chatId) };
2485
2683
  if (r?.resolved.inputs.some((i) => i.id === 'documents')) {
2486
2684
  if (facts.inputs['documents'] === undefined) {
2487
2685
  const { binding } = bindingOf(records, ctx.turnId ?? '\u0000');
@@ -2553,7 +2751,7 @@ export class ChatProposals {
2553
2751
  }
2554
2752
  const chat = this.jobChat(chatId);
2555
2753
  if (chat === null)
2556
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
2754
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
2557
2755
  // A command names its card (and maybe its option); an alias is the only way to a hidden card.
2558
2756
  let card = body.card;
2559
2757
  let option = body.option;
@@ -2569,11 +2767,13 @@ export class ChatProposals {
2569
2767
  }
2570
2768
  const facts = {
2571
2769
  card,
2770
+ title: null,
2572
2771
  option,
2573
2772
  depth: body.depth ?? null,
2574
2773
  words: (body.words ?? '').slice(0, 8000),
2575
2774
  details: [],
2576
- repoRef: null,
2775
+ // crew#1791: the repository the person's words clearly name, else the question asks.
2776
+ repoRef: repoNamedIn(body.words ?? '', chat.repos)?.id ?? null,
2577
2777
  projectId: chat.projectId,
2578
2778
  lead: null,
2579
2779
  seats: null,
@@ -2623,7 +2823,7 @@ export class ChatProposals {
2623
2823
  return { code: 400, body: { code: 'edits_invalid', error: 'only a job proposal is revised this way' } };
2624
2824
  const chat = this.jobChat(chatId);
2625
2825
  if (chat === null)
2626
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
2826
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
2627
2827
  const fromPerson = src.person !== null;
2628
2828
  // Only the person's own press can give up a check.
2629
2829
  const edits = { ...rev.edits };
@@ -2638,7 +2838,7 @@ export class ChatProposals {
2638
2838
  : new Set();
2639
2839
  const confirmed = confirmIds !== null;
2640
2840
  delete edits.confirmLoss;
2641
- const ctx0 = await this.jobContext(chatId, src.pid, src.turnId, fromPerson ? 'person' : (parent.proposal.seat ?? 'seat'), chat, {
2841
+ let ctx0 = await this.jobContext(chatId, src.pid, src.turnId, fromPerson ? 'person' : (parent.proposal.seat ?? 'seat'), chat, {
2642
2842
  revises: parent.proposal.pid,
2643
2843
  lineage: parent.proposal.lineage ?? parent.proposal.pid,
2644
2844
  notes: [],
@@ -2650,6 +2850,17 @@ export class ChatProposals {
2650
2850
  // the person never asked for in their own words changes nothing. On the person's route, only the press applies it.
2651
2851
  let qe = null;
2652
2852
  const extraNotes = [];
2853
+ // studio#1094: only the person's repository answer can set the chat's first scope.
2854
+ if (src.person !== null && edits.repoRef !== undefined && parent.proposal.needs?.some((n) => n.id === 'repo') === true && chat.repos.length === 0 && this.deps.pickFirstRepo !== undefined) {
2855
+ const picked = await this.deps.pickFirstRepo(chatId, edits.repoRef, src.person, src.pid);
2856
+ if (!picked.ok)
2857
+ return { code: picked.status, body: { code: 'chat_scope_refused', error: picked.error } };
2858
+ const scoped = this.jobChat(chatId);
2859
+ if (scoped === null)
2860
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
2861
+ ctx0 = { ...ctx0, chat: scoped };
2862
+ extraNotes.push(`This chat now reads ${picked.name}: you picked it for this job.`);
2863
+ }
2653
2864
  if (edits.skipQe !== undefined && !confirmed) {
2654
2865
  const reason = edits.skipQe.reason;
2655
2866
  delete edits.skipQe;
@@ -2815,7 +3026,7 @@ export class ChatProposals {
2815
3026
  // (F1/F2) What a removal did, from the card as published (never from the merge, which a loss question can hold).
2816
3027
  // A document's workers are its helpers (a revision can make a job a document; codex r2).
2817
3028
  const workers = candidate.seats !== undefined ? candidate.seats.keys : (candidate.helpers?.seats ?? []);
2818
- const removal = seatRemovalNote(edits.removeSeats, parent.proposal.seats?.keys ?? [], workers, (k) => ctx.roster.find((s) => s.key === k)?.name ?? k, candidate.seats !== undefined);
3029
+ const removal = seatRemovalNote(edits.removeSeats, parent.proposal.seats?.keys ?? parent.proposal.helpers?.seats ?? [], workers, (k) => ctx.roster.find((s) => s.key === k)?.name ?? k);
2819
3030
  const proposal = removal.length === 0 || candidate.sentence === undefined ? candidate : { ...candidate, sentence: { ...candidate.sentence, notes: [...candidate.sentence.notes, ...removal] } };
2820
3031
  if (!this.write(chatId, { at: this.now(), turnId: src.turnId ?? `person:${src.pid.slice(src.pid.lastIndexOf(':') + 1)}`, kind: 'proposal', proposal }, instance))
2821
3032
  return this.gone(chatId);
@@ -2945,6 +3156,49 @@ export class ChatProposals {
2945
3156
  return released;
2946
3157
  });
2947
3158
  }
3159
+ /** A read redraws a seat-held job from the current pool, without an answer turn (crew#1484). */
3160
+ async recheckHeldSeats(chatId, instance = this.deps.instanceOf(chatId)) {
3161
+ const held = (f) => f.state === 'open' && f.proposal.kind === 'job'
3162
+ && f.proposal.shape !== undefined && !f.proposal.seatsUnread && f.proposal.blocked?.startsWith('Needs ') === true;
3163
+ if (![...foldProposals(this.deps.records(chatId)).values()].some(held))
3164
+ return false;
3165
+ return this.lock.run(`chat\u0000${instance ?? chatId}`, async () => {
3166
+ let changed = false;
3167
+ for (const f of foldProposals(this.deps.records(chatId)).values()) {
3168
+ if (!held(f))
3169
+ continue;
3170
+ const p = f.proposal;
3171
+ // An ended chat's open card is redrawn using its recorded scope and seat order.
3172
+ const chat = this.jobChat(chatId) ?? {
3173
+ projectId: p.filedIn.projectId,
3174
+ repos: (p.repoRefs ?? []).map((id, i) => ({ id, name: p.repos[i] ?? id })),
3175
+ lead: p.seats?.lead ?? null,
3176
+ seats: p.seats?.keys ?? [],
3177
+ };
3178
+ const ctx = await this.jobContext(chatId, p.pid, p.turnId, p.seat, chat, {
3179
+ revises: p.revises ?? null, lineage: p.lineage ?? p.pid, notes: [],
3180
+ ...(p.request !== undefined ? { request: p.request } : {}),
3181
+ ...(p.answers !== undefined ? { answers: p.answers } : {}),
3182
+ });
3183
+ if (ctx.seatsUnread)
3184
+ continue;
3185
+ const r = resolveOption(p.shape.card, p.shape.option, ctx.served);
3186
+ if (r === null || ctx.served.rev !== p.catalogRev || r.resolved.resolution !== p.resolution || p.blocked !== seatsShortLine(r, p.seats?.keys.length ?? 0))
3187
+ continue;
3188
+ if ((ctx.pool ?? ctx.roster).length < seatsNeeded(r))
3189
+ continue;
3190
+ const facts = { ...factsOf(p), lead: null, seats: null };
3191
+ const fresh = keepReshape(await this.proposalOf(chatId, p.pid, facts, ctx, this.deps.records(chatId), true, p), p);
3192
+ if (fresh.seats === undefined || fresh.seats.keys.length < seatsNeeded(r))
3193
+ continue;
3194
+ const current = foldProposals(this.deps.records(chatId)).get(p.pid);
3195
+ if (current === undefined || !held(current) || current.proposal.blocked !== p.blocked)
3196
+ continue;
3197
+ changed = this.write(chatId, { at: this.now(), turnId: current.turnId, kind: 'proposal', proposal: fresh }, instance) || changed;
3198
+ }
3199
+ return changed;
3200
+ });
3201
+ }
2948
3202
  /** A job's Go edits (option, depth, repository, seats, inputs) merged by the revision rules: one that loses a check
2949
3203
  * is refused (that is the person's press on the lost-check question, not an edit at Go). */
2950
3204
  async applyJobEdits(chatId, f, edits) {
@@ -2992,7 +3246,7 @@ export class ChatProposals {
2992
3246
  throw new EditRefusal(`that would drop ${checksLabel(dropped)}; check the job again`);
2993
3247
  if (out.seats !== undefined && out.shape !== undefined) {
2994
3248
  const r = resolveOption(out.shape.card, out.shape.option, ctx.served);
2995
- if (r !== null && !(r.workflow !== null && SELF_SEATED.has(r.workflow)) && out.seats.keys.length < 1 + (r.resolved.seats.distinctEvaluator ? 1 : 0) + (r.resolved.seats.distinctJudge ? 1 : 0)) {
3249
+ if (r !== null && !(r.workflow !== null && SELF_SEATED.has(r.workflow)) && out.seats.keys.length < seatsNeeded(r)) {
2996
3250
  throw new EditRefusal('this job needs another seat to check the one that builds');
2997
3251
  }
2998
3252
  }
@@ -3084,7 +3338,7 @@ export class ChatProposals {
3084
3338
  if (folded === undefined) {
3085
3339
  const chat = this.jobChat(chatId);
3086
3340
  if (chat === null)
3087
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
3341
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
3088
3342
  const parent = x.parentPid === null ? undefined : foldProposals(this.deps.records(chatId)).get(x.parentPid);
3089
3343
  let proposal;
3090
3344
  try {
@@ -3122,7 +3376,7 @@ export class ChatProposals {
3122
3376
  if (gone !== null)
3123
3377
  throw new JobRefusal('source_gone', gone, 409);
3124
3378
  }
3125
- proposal = await this.proposalOf(chatId, x.pid, facts, ctx, this.deps.records(chatId), false, heldP ?? null);
3379
+ proposal = await this.proposalOf(chatId, x.pid, facts, ctx, this.deps.records(chatId), false, heldP ?? null, x.relaunch);
3126
3380
  if (x.edits.inputs?.['documents'] !== undefined)
3127
3381
  this.refuseStruckDocuments(proposal);
3128
3382
  else if (heldP !== undefined)
@@ -3248,20 +3502,24 @@ export class ChatProposals {
3248
3502
  const pid = `${base.chatId}:retry:${runId}`;
3249
3503
  if (folded.has(pid))
3250
3504
  return pid;
3251
- // A5 (codex r1): a refine's retry is drawn on the document as it is now (a conflict moved its head), with the
3252
- // protected edits of that head, Keep preselected for every one.
3505
+ // A retry keeps the accepted choices only for edit ids still present on the new head.
3253
3506
  const fresh = base.kind === 'refine' && base.target !== undefined ? await this.refreshTarget(base) : base;
3507
+ // crew#1745: a chat that has ended (closed, or the daemon restarted under the attempt) can't take Try again: its
3508
+ // Go would only answer chat_gone. The card says so and where to go, with no Try again to press.
3509
+ const ended = this.deps.chat(chatId) === null;
3510
+ const again = ended ? '' : base.kind === 'refine' ? ' Try again revises the latest version, and keeps your edits.' : ' Try again fills the same document.';
3254
3511
  const retry = {
3255
3512
  ...fresh,
3513
+ ...(base.kind === 'refine' ? { allow: (failed.accepting?.edits?.allow ?? []).filter((id) => fresh.protected?.some((e) => e.id === id)) } : {}),
3256
3514
  pid,
3257
3515
  turnId: null,
3258
3516
  sourceRunId: runId,
3259
3517
  artifactRef,
3260
3518
  reason: base.kind === 'refine'
3261
- ? `The last change was not applied: ${reason}. Try again revises the latest version, and keeps your edits.`
3262
- : `The last attempt ended without a draft: ${reason}. Try again fills the same document.`,
3519
+ ? `The last change was not applied: ${reason}.${again}`
3520
+ : `The last attempt ended without a draft: ${reason}.${again}`,
3263
3521
  // A refine whose edits cannot be read on the new head stays blocked with why (codex A5 r2).
3264
- blocked: fresh !== base ? fresh.blocked : null,
3522
+ blocked: ended ? CHAT_ENDED : fresh !== base ? fresh.blocked : null,
3265
3523
  };
3266
3524
  return this.write(chatId, { at: this.now(), turnId: failed.turnId, kind: 'proposal', proposal: retry }, instance) ? pid : null;
3267
3525
  });
@@ -3272,9 +3530,12 @@ export class ChatProposals {
3272
3530
  * job per chat, work and artifact runs together (DES §4.3).
3273
3531
  */
3274
3532
  async liveJobOf(chatId) {
3533
+ // crew#1779: the run list is read once, and only when a job's check needs it.
3534
+ let read = null;
3535
+ const runsOnce = () => (read ??= this.deps.runs());
3275
3536
  for (const f of foldProposals(this.deps.records(chatId)).values()) {
3276
3537
  const runId = f.state === 'decided' && f.decision === 'go' ? f.result?.runId ?? null : f.state === 'accepting' ? f.accepting?.identity.runId ?? null : null;
3277
- if (runId !== null && (await this.deps.registry.live(f.proposal.kind, runId)))
3538
+ if (runId !== null && (await this.deps.registry.live(f.proposal.kind, runId, runsOnce)))
3278
3539
  return f.proposal.what.label;
3279
3540
  }
3280
3541
  return null;