wicked-crew 0.18.20 → 0.18.22

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 (640) hide show
  1. package/dist/api/audit.d.ts +28 -1
  2. package/dist/api/audit.d.ts.map +1 -1
  3. package/dist/api/audit.js +90 -9
  4. package/dist/api/audit.js.map +1 -1
  5. package/dist/api/auth.d.ts +7 -0
  6. package/dist/api/auth.d.ts.map +1 -1
  7. package/dist/api/auth.js +53 -10
  8. package/dist/api/auth.js.map +1 -1
  9. package/dist/api/capture.d.ts +16 -4
  10. package/dist/api/capture.d.ts.map +1 -1
  11. package/dist/api/capture.js +20 -12
  12. package/dist/api/capture.js.map +1 -1
  13. package/dist/api/chat-context.d.ts +17 -0
  14. package/dist/api/chat-context.d.ts.map +1 -1
  15. package/dist/api/chat-context.js +94 -5
  16. package/dist/api/chat-context.js.map +1 -1
  17. package/dist/api/chat-freshness.js +2 -2
  18. package/dist/api/chat-freshness.js.map +1 -1
  19. package/dist/api/chat-jobs.d.ts +54 -0
  20. package/dist/api/chat-jobs.d.ts.map +1 -1
  21. package/dist/api/chat-jobs.js +199 -7
  22. package/dist/api/chat-jobs.js.map +1 -1
  23. package/dist/api/chat-proposals.d.ts +62 -12
  24. package/dist/api/chat-proposals.d.ts.map +1 -1
  25. package/dist/api/chat-proposals.js +257 -52
  26. package/dist/api/chat-proposals.js.map +1 -1
  27. package/dist/api/chat-requirements.d.ts.map +1 -1
  28. package/dist/api/chat-requirements.js +4 -1
  29. package/dist/api/chat-requirements.js.map +1 -1
  30. package/dist/api/chat-scope.d.ts +12 -0
  31. package/dist/api/chat-scope.d.ts.map +1 -1
  32. package/dist/api/chat-scope.js +35 -5
  33. package/dist/api/chat-scope.js.map +1 -1
  34. package/dist/api/cluster-status.d.ts +41 -12
  35. package/dist/api/cluster-status.d.ts.map +1 -1
  36. package/dist/api/cluster-status.js +148 -3
  37. package/dist/api/cluster-status.js.map +1 -1
  38. package/dist/api/codebase-archive.js +2 -2
  39. package/dist/api/codebase-archive.js.map +1 -1
  40. package/dist/api/compose-facts.d.ts +35 -0
  41. package/dist/api/compose-facts.d.ts.map +1 -0
  42. package/dist/api/compose-facts.js +46 -0
  43. package/dist/api/compose-facts.js.map +1 -0
  44. package/dist/api/cut-read.d.ts +62 -0
  45. package/dist/api/cut-read.d.ts.map +1 -0
  46. package/dist/api/cut-read.js +101 -0
  47. package/dist/api/cut-read.js.map +1 -0
  48. package/dist/api/delivery-cache.d.ts +2 -0
  49. package/dist/api/delivery-cache.d.ts.map +1 -1
  50. package/dist/api/delivery-cache.js +1 -2
  51. package/dist/api/delivery-cache.js.map +1 -1
  52. package/dist/api/delivery-index.d.ts +2 -2
  53. package/dist/api/delivery-index.d.ts.map +1 -1
  54. package/dist/api/delivery-index.js +1 -2
  55. package/dist/api/delivery-index.js.map +1 -1
  56. package/dist/api/desk-snoozes.d.ts +54 -0
  57. package/dist/api/desk-snoozes.d.ts.map +1 -0
  58. package/dist/api/desk-snoozes.js +174 -0
  59. package/dist/api/desk-snoozes.js.map +1 -0
  60. package/dist/api/diagnostics.d.ts +4 -0
  61. package/dist/api/diagnostics.d.ts.map +1 -1
  62. package/dist/api/diagnostics.js +15 -7
  63. package/dist/api/diagnostics.js.map +1 -1
  64. package/dist/api/disk-stores.d.ts +66 -0
  65. package/dist/api/disk-stores.d.ts.map +1 -0
  66. package/dist/api/disk-stores.js +206 -0
  67. package/dist/api/disk-stores.js.map +1 -0
  68. package/dist/api/eval-compare.d.ts +1 -1
  69. package/dist/api/eval-compare.js +1 -1
  70. package/dist/api/eval-sample.d.ts +7 -0
  71. package/dist/api/eval-sample.d.ts.map +1 -1
  72. package/dist/api/eval-sample.js +20 -0
  73. package/dist/api/eval-sample.js.map +1 -1
  74. package/dist/api/gate-cache.d.ts +8 -0
  75. package/dist/api/gate-cache.d.ts.map +1 -1
  76. package/dist/api/gate-cache.js +8 -1
  77. package/dist/api/gate-cache.js.map +1 -1
  78. package/dist/api/governance-steering.d.ts +13 -0
  79. package/dist/api/governance-steering.d.ts.map +1 -1
  80. package/dist/api/governance-steering.js +56 -7
  81. package/dist/api/governance-steering.js.map +1 -1
  82. package/dist/api/mcp.d.ts +19 -1
  83. package/dist/api/mcp.d.ts.map +1 -1
  84. package/dist/api/mcp.js +123 -3
  85. package/dist/api/mcp.js.map +1 -1
  86. package/dist/api/needs.d.ts +23 -0
  87. package/dist/api/needs.d.ts.map +1 -1
  88. package/dist/api/needs.js +124 -19
  89. package/dist/api/needs.js.map +1 -1
  90. package/dist/api/onboarding-capture.d.ts +21 -1
  91. package/dist/api/onboarding-capture.d.ts.map +1 -1
  92. package/dist/api/onboarding-capture.js +112 -8
  93. package/dist/api/onboarding-capture.js.map +1 -1
  94. package/dist/api/policy-landing.d.ts +36 -0
  95. package/dist/api/policy-landing.d.ts.map +1 -1
  96. package/dist/api/policy-landing.js +123 -4
  97. package/dist/api/policy-landing.js.map +1 -1
  98. package/dist/api/post-hoc-deliver.d.ts +7 -0
  99. package/dist/api/post-hoc-deliver.d.ts.map +1 -1
  100. package/dist/api/post-hoc-deliver.js +17 -5
  101. package/dist/api/post-hoc-deliver.js.map +1 -1
  102. package/dist/api/product-publish.d.ts +242 -0
  103. package/dist/api/product-publish.d.ts.map +1 -0
  104. package/dist/api/product-publish.js +902 -0
  105. package/dist/api/product-publish.js.map +1 -0
  106. package/dist/api/product.d.ts +5 -6
  107. package/dist/api/product.d.ts.map +1 -1
  108. package/dist/api/product.js +4 -4
  109. package/dist/api/product.js.map +1 -1
  110. package/dist/api/proposal-cut.d.ts +95 -0
  111. package/dist/api/proposal-cut.d.ts.map +1 -0
  112. package/dist/api/proposal-cut.js +231 -0
  113. package/dist/api/proposal-cut.js.map +1 -0
  114. package/dist/api/proposal-decisions.d.ts +44 -0
  115. package/dist/api/proposal-decisions.d.ts.map +1 -0
  116. package/dist/api/proposal-decisions.js +85 -0
  117. package/dist/api/proposal-decisions.js.map +1 -0
  118. package/dist/api/proposal-onboard.d.ts +29 -0
  119. package/dist/api/proposal-onboard.d.ts.map +1 -1
  120. package/dist/api/proposal-onboard.js +162 -11
  121. package/dist/api/proposal-onboard.js.map +1 -1
  122. package/dist/api/recording.d.ts.map +1 -1
  123. package/dist/api/recording.js +4 -5
  124. package/dist/api/recording.js.map +1 -1
  125. package/dist/api/redeliver.d.ts.map +1 -1
  126. package/dist/api/redeliver.js +11 -7
  127. package/dist/api/redeliver.js.map +1 -1
  128. package/dist/api/repo-input.d.ts.map +1 -1
  129. package/dist/api/repo-input.js +5 -2
  130. package/dist/api/repo-input.js.map +1 -1
  131. package/dist/api/repo-origins.d.ts +24 -0
  132. package/dist/api/repo-origins.d.ts.map +1 -0
  133. package/dist/api/repo-origins.js +71 -0
  134. package/dist/api/repo-origins.js.map +1 -0
  135. package/dist/api/requirements.d.ts +39 -4
  136. package/dist/api/requirements.d.ts.map +1 -1
  137. package/dist/api/requirements.js +76 -5
  138. package/dist/api/requirements.js.map +1 -1
  139. package/dist/api/review-change.d.ts +5 -6
  140. package/dist/api/review-change.d.ts.map +1 -1
  141. package/dist/api/review-change.js +45 -8
  142. package/dist/api/review-change.js.map +1 -1
  143. package/dist/api/routes.d.ts +48 -4
  144. package/dist/api/routes.d.ts.map +1 -1
  145. package/dist/api/routes.js +926 -268
  146. package/dist/api/routes.js.map +1 -1
  147. package/dist/api/run-liveness.d.ts.map +1 -1
  148. package/dist/api/run-liveness.js +3 -1
  149. package/dist/api/run-liveness.js.map +1 -1
  150. package/dist/api/run-sources.d.ts +11 -1
  151. package/dist/api/run-sources.d.ts.map +1 -1
  152. package/dist/api/run-sources.js +26 -3
  153. package/dist/api/run-sources.js.map +1 -1
  154. package/dist/api/run-timing-index.d.ts +56 -1
  155. package/dist/api/run-timing-index.d.ts.map +1 -1
  156. package/dist/api/run-timing-index.js +164 -10
  157. package/dist/api/run-timing-index.js.map +1 -1
  158. package/dist/api/runtime-state.d.ts +6 -0
  159. package/dist/api/runtime-state.d.ts.map +1 -1
  160. package/dist/api/runtime-state.js +14 -3
  161. package/dist/api/runtime-state.js.map +1 -1
  162. package/dist/api/seat-agents.d.ts.map +1 -1
  163. package/dist/api/seat-agents.js +3 -3
  164. package/dist/api/seat-agents.js.map +1 -1
  165. package/dist/api/seat-container-login.d.ts +17 -19
  166. package/dist/api/seat-container-login.d.ts.map +1 -1
  167. package/dist/api/seat-container-login.js +51 -76
  168. package/dist/api/seat-container-login.js.map +1 -1
  169. package/dist/api/seat-governance.d.ts +3 -2
  170. package/dist/api/seat-governance.d.ts.map +1 -1
  171. package/dist/api/seat-governance.js +31 -9
  172. package/dist/api/seat-governance.js.map +1 -1
  173. package/dist/api/seat-standing.d.ts +8 -0
  174. package/dist/api/seat-standing.d.ts.map +1 -1
  175. package/dist/api/seat-standing.js +26 -1
  176. package/dist/api/seat-standing.js.map +1 -1
  177. package/dist/api/server.d.ts +7 -0
  178. package/dist/api/server.d.ts.map +1 -1
  179. package/dist/api/server.js +93 -39
  180. package/dist/api/server.js.map +1 -1
  181. package/dist/api/start-on-login.d.ts +4 -0
  182. package/dist/api/start-on-login.d.ts.map +1 -0
  183. package/dist/api/start-on-login.js +35 -0
  184. package/dist/api/start-on-login.js.map +1 -0
  185. package/dist/api/steering-landing.d.ts +33 -8
  186. package/dist/api/steering-landing.d.ts.map +1 -1
  187. package/dist/api/steering-landing.js +235 -51
  188. package/dist/api/steering-landing.js.map +1 -1
  189. package/dist/api/system-snapshot.d.ts +2 -1
  190. package/dist/api/system-snapshot.d.ts.map +1 -1
  191. package/dist/api/system-snapshot.js +22 -9
  192. package/dist/api/system-snapshot.js.map +1 -1
  193. package/dist/api/ui-text.d.ts.map +1 -1
  194. package/dist/api/ui-text.js +3 -1
  195. package/dist/api/ui-text.js.map +1 -1
  196. package/dist/api/worktree-sweep.d.ts +7 -3
  197. package/dist/api/worktree-sweep.d.ts.map +1 -1
  198. package/dist/api/worktree-sweep.js +10 -6
  199. package/dist/api/worktree-sweep.js.map +1 -1
  200. package/dist/apps/exec/recall.d.ts.map +1 -1
  201. package/dist/apps/exec/recall.js +4 -4
  202. package/dist/apps/exec/recall.js.map +1 -1
  203. package/dist/apps/git.js +2 -2
  204. package/dist/apps/git.js.map +1 -1
  205. package/dist/apps/publish/manifest.d.ts +2 -0
  206. package/dist/apps/publish/manifest.d.ts.map +1 -1
  207. package/dist/apps/publish/manifest.js +8 -3
  208. package/dist/apps/publish/manifest.js.map +1 -1
  209. package/dist/apps/publish/run.d.ts +11 -1
  210. package/dist/apps/publish/run.d.ts.map +1 -1
  211. package/dist/apps/publish/run.js +97 -17
  212. package/dist/apps/publish/run.js.map +1 -1
  213. package/dist/apps/routes.d.ts +2 -0
  214. package/dist/apps/routes.d.ts.map +1 -1
  215. package/dist/apps/routes.js +45 -2
  216. package/dist/apps/routes.js.map +1 -1
  217. package/dist/apps/store.d.ts +35 -3
  218. package/dist/apps/store.d.ts.map +1 -1
  219. package/dist/apps/store.js +73 -9
  220. package/dist/apps/store.js.map +1 -1
  221. package/dist/apps/turns.d.ts +25 -2
  222. package/dist/apps/turns.d.ts.map +1 -1
  223. package/dist/apps/turns.js +276 -11
  224. package/dist/apps/turns.js.map +1 -1
  225. package/dist/apps-server/runners/sqlite-runner.mjs +39 -1
  226. package/dist/apps-server/server/lib/bundle/server.mjs +124 -14
  227. package/dist/cli/index.d.ts.map +1 -1
  228. package/dist/cli/index.js +27 -52
  229. package/dist/cli/index.js.map +1 -1
  230. package/dist/cli/start-stand-ins.d.ts +13 -0
  231. package/dist/cli/start-stand-ins.d.ts.map +1 -0
  232. package/dist/cli/start-stand-ins.js +30 -0
  233. package/dist/cli/start-stand-ins.js.map +1 -0
  234. package/dist/core/adapter.d.ts +66 -14
  235. package/dist/core/adapter.d.ts.map +1 -1
  236. package/dist/core/adapter.js +228 -56
  237. package/dist/core/adapter.js.map +1 -1
  238. package/dist/core/ado-deliver-helper.d.ts +2 -1
  239. package/dist/core/ado-deliver-helper.d.ts.map +1 -1
  240. package/dist/core/ado-deliver-helper.js +26 -1
  241. package/dist/core/ado-deliver-helper.js.map +1 -1
  242. package/dist/core/ado-env.d.ts +17 -0
  243. package/dist/core/ado-env.d.ts.map +1 -0
  244. package/dist/core/ado-env.js +34 -0
  245. package/dist/core/ado-env.js.map +1 -0
  246. package/dist/core/assurance.d.ts +10 -0
  247. package/dist/core/assurance.d.ts.map +1 -1
  248. package/dist/core/assurance.js +23 -0
  249. package/dist/core/assurance.js.map +1 -1
  250. package/dist/core/deliver-text.d.ts +19 -0
  251. package/dist/core/deliver-text.d.ts.map +1 -1
  252. package/dist/core/deliver-text.js +77 -1
  253. package/dist/core/deliver-text.js.map +1 -1
  254. package/dist/core/deliver.d.ts +49 -1
  255. package/dist/core/deliver.d.ts.map +1 -1
  256. package/dist/core/deliver.js +142 -6
  257. package/dist/core/deliver.js.map +1 -1
  258. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  259. package/dist/core/estate-mcp-client.js +4 -8
  260. package/dist/core/estate-mcp-client.js.map +1 -1
  261. package/dist/core/exec.d.ts +16 -1
  262. package/dist/core/exec.d.ts.map +1 -1
  263. package/dist/core/exec.js +32 -2
  264. package/dist/core/exec.js.map +1 -1
  265. package/dist/core/governance-store.d.ts +3 -1
  266. package/dist/core/governance-store.d.ts.map +1 -1
  267. package/dist/core/governance-store.js +7 -2
  268. package/dist/core/governance-store.js.map +1 -1
  269. package/dist/core/linked-issues.d.ts +13 -2
  270. package/dist/core/linked-issues.d.ts.map +1 -1
  271. package/dist/core/linked-issues.js +135 -4
  272. package/dist/core/linked-issues.js.map +1 -1
  273. package/dist/core/redeliver.js +2 -2
  274. package/dist/core/redeliver.js.map +1 -1
  275. package/dist/core/repo-clone.d.ts +64 -0
  276. package/dist/core/repo-clone.d.ts.map +1 -0
  277. package/dist/core/repo-clone.js +307 -0
  278. package/dist/core/repo-clone.js.map +1 -0
  279. package/dist/core/run-identity.d.ts.map +1 -1
  280. package/dist/core/run-identity.js +3 -0
  281. package/dist/core/run-identity.js.map +1 -1
  282. package/dist/core/run-log-facts.d.ts +56 -0
  283. package/dist/core/run-log-facts.d.ts.map +1 -0
  284. package/dist/core/run-log-facts.js +230 -0
  285. package/dist/core/run-log-facts.js.map +1 -0
  286. package/dist/core/run-read-lane.d.ts +30 -0
  287. package/dist/core/run-read-lane.d.ts.map +1 -0
  288. package/dist/core/run-read-lane.js +103 -0
  289. package/dist/core/run-read-lane.js.map +1 -0
  290. package/dist/core/shutdown.d.ts +27 -0
  291. package/dist/core/shutdown.d.ts.map +1 -1
  292. package/dist/core/shutdown.js +72 -0
  293. package/dist/core/shutdown.js.map +1 -1
  294. package/dist/core/stand-in.d.ts +40 -0
  295. package/dist/core/stand-in.d.ts.map +1 -0
  296. package/dist/core/stand-in.js +118 -0
  297. package/dist/core/stand-in.js.map +1 -0
  298. package/dist/core/types.d.ts +27 -0
  299. package/dist/core/types.d.ts.map +1 -1
  300. package/dist/core/types.js.map +1 -1
  301. package/dist/core/walkthrough-root.d.ts.map +1 -1
  302. package/dist/core/walkthrough-root.js +3 -5
  303. package/dist/core/walkthrough-root.js.map +1 -1
  304. package/dist/core/wicked-home.d.ts +9 -0
  305. package/dist/core/wicked-home.d.ts.map +1 -0
  306. package/dist/core/wicked-home.js +25 -0
  307. package/dist/core/wicked-home.js.map +1 -0
  308. package/dist/decisions/consider.d.ts +2 -1
  309. package/dist/decisions/consider.d.ts.map +1 -1
  310. package/dist/decisions/consider.js +2 -2
  311. package/dist/decisions/consider.js.map +1 -1
  312. package/dist/decisions/land.d.ts +2 -0
  313. package/dist/decisions/land.d.ts.map +1 -1
  314. package/dist/decisions/land.js +16 -3
  315. package/dist/decisions/land.js.map +1 -1
  316. package/dist/decisions/rules-brief.d.ts +2 -1
  317. package/dist/decisions/rules-brief.d.ts.map +1 -1
  318. package/dist/decisions/rules-brief.js +3 -2
  319. package/dist/decisions/rules-brief.js.map +1 -1
  320. package/dist/editors/conformance-runtime.d.ts +0 -2
  321. package/dist/editors/conformance-runtime.d.ts.map +1 -1
  322. package/dist/editors/conformance-runtime.js +0 -4
  323. package/dist/editors/conformance-runtime.js.map +1 -1
  324. package/dist/editors/pack-extras.d.ts +162 -0
  325. package/dist/editors/pack-extras.d.ts.map +1 -0
  326. package/dist/editors/pack-extras.js +596 -0
  327. package/dist/editors/pack-extras.js.map +1 -0
  328. package/dist/editors/pack-install.d.ts +26 -22
  329. package/dist/editors/pack-install.d.ts.map +1 -1
  330. package/dist/editors/pack-install.js +187 -80
  331. package/dist/editors/pack-install.js.map +1 -1
  332. package/dist/editors/registry.d.ts +66 -13
  333. package/dist/editors/registry.d.ts.map +1 -1
  334. package/dist/editors/registry.js +147 -24
  335. package/dist/editors/registry.js.map +1 -1
  336. package/dist/editors/routes.d.ts +10 -5
  337. package/dist/editors/routes.d.ts.map +1 -1
  338. package/dist/editors/routes.js +45 -11
  339. package/dist/editors/routes.js.map +1 -1
  340. package/dist/editors/visuals.d.ts +4 -3
  341. package/dist/editors/visuals.d.ts.map +1 -1
  342. package/dist/editors/visuals.js +17 -7
  343. package/dist/editors/visuals.js.map +1 -1
  344. package/dist/evals/runner.js +1 -1
  345. package/dist/evals/runner.js.map +1 -1
  346. package/dist/evals/shape.d.ts +7 -1
  347. package/dist/evals/shape.d.ts.map +1 -1
  348. package/dist/evals/shape.js +26 -6
  349. package/dist/evals/shape.js.map +1 -1
  350. package/dist/evals/workflow.d.ts +16 -3
  351. package/dist/evals/workflow.d.ts.map +1 -1
  352. package/dist/evals/workflow.js +31 -6
  353. package/dist/evals/workflow.js.map +1 -1
  354. package/dist/insights/review-service.d.ts +24 -3
  355. package/dist/insights/review-service.d.ts.map +1 -1
  356. package/dist/insights/review-service.js +75 -12
  357. package/dist/insights/review-service.js.map +1 -1
  358. package/dist/insights/routes.d.ts +2 -1
  359. package/dist/insights/routes.d.ts.map +1 -1
  360. package/dist/insights/routes.js +19 -4
  361. package/dist/insights/routes.js.map +1 -1
  362. package/dist/insights/run-facts.d.ts +5 -0
  363. package/dist/insights/run-facts.d.ts.map +1 -1
  364. package/dist/insights/run-facts.js +15 -0
  365. package/dist/insights/run-facts.js.map +1 -1
  366. package/dist/insights/workflow.d.ts +2 -1
  367. package/dist/insights/workflow.d.ts.map +1 -1
  368. package/dist/insights/workflow.js +4 -4
  369. package/dist/insights/workflow.js.map +1 -1
  370. package/dist/inspect/service.d.ts +3 -2
  371. package/dist/inspect/service.d.ts.map +1 -1
  372. package/dist/inspect/service.js +4 -4
  373. package/dist/inspect/service.js.map +1 -1
  374. package/dist/interactive/bridge-pool.d.ts +5 -2
  375. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  376. package/dist/interactive/bridge-pool.js +10 -5
  377. package/dist/interactive/bridge-pool.js.map +1 -1
  378. package/dist/interactive/chat-events.d.ts.map +1 -1
  379. package/dist/interactive/chat-events.js +7 -1
  380. package/dist/interactive/chat-events.js.map +1 -1
  381. package/dist/interactive/draft-events.d.ts +3 -0
  382. package/dist/interactive/draft-events.d.ts.map +1 -1
  383. package/dist/interactive/draft-events.js +5 -8
  384. package/dist/interactive/draft-events.js.map +1 -1
  385. package/dist/interactive/draft-skill.d.ts +56 -3
  386. package/dist/interactive/draft-skill.d.ts.map +1 -1
  387. package/dist/interactive/draft-skill.js +129 -20
  388. package/dist/interactive/draft-skill.js.map +1 -1
  389. package/dist/interactive/landing-guard.d.ts +30 -5
  390. package/dist/interactive/landing-guard.d.ts.map +1 -1
  391. package/dist/interactive/landing-guard.js +196 -6
  392. package/dist/interactive/landing-guard.js.map +1 -1
  393. package/dist/interactive/proposal-create.d.ts.map +1 -1
  394. package/dist/interactive/proposal-create.js +1 -0
  395. package/dist/interactive/proposal-create.js.map +1 -1
  396. package/dist/interactive/proposal-refine.d.ts.map +1 -1
  397. package/dist/interactive/proposal-refine.js +16 -1
  398. package/dist/interactive/proposal-refine.js.map +1 -1
  399. package/dist/interactive/review-events.js +1 -1
  400. package/dist/interactive/review-events.js.map +1 -1
  401. package/dist/interactive/run-units.d.ts.map +1 -1
  402. package/dist/interactive/run-units.js +3 -2
  403. package/dist/interactive/run-units.js.map +1 -1
  404. package/dist/interactive/source-packet.d.ts +8 -0
  405. package/dist/interactive/source-packet.d.ts.map +1 -1
  406. package/dist/interactive/source-packet.js +47 -6
  407. package/dist/interactive/source-packet.js.map +1 -1
  408. package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -1
  409. package/dist/knowledge/adapters/toolbox/memory.js +3 -2
  410. package/dist/knowledge/adapters/toolbox/memory.js.map +1 -1
  411. package/dist/knowledge/adapters/toolbox/supervisor.d.ts +21 -1
  412. package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
  413. package/dist/knowledge/adapters/toolbox/supervisor.js +76 -26
  414. package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
  415. package/dist/knowledge/estate-write.d.ts +5 -0
  416. package/dist/knowledge/estate-write.d.ts.map +1 -1
  417. package/dist/knowledge/estate-write.js +7 -0
  418. package/dist/knowledge/estate-write.js.map +1 -1
  419. package/dist/knowledge/projector.d.ts +60 -5
  420. package/dist/knowledge/projector.d.ts.map +1 -1
  421. package/dist/knowledge/projector.js +264 -21
  422. package/dist/knowledge/projector.js.map +1 -1
  423. package/dist/knowledge/shapes/map.d.ts.map +1 -1
  424. package/dist/knowledge/shapes/map.js +12 -2
  425. package/dist/knowledge/shapes/map.js.map +1 -1
  426. package/dist/knowledge/shapes/routes.d.ts +1 -1
  427. package/dist/knowledge/shapes/routes.d.ts.map +1 -1
  428. package/dist/knowledge/shapes/routes.js +42 -16
  429. package/dist/knowledge/shapes/routes.js.map +1 -1
  430. package/dist/knowledge/shapes/shapes.d.ts +60 -13
  431. package/dist/knowledge/shapes/shapes.d.ts.map +1 -1
  432. package/dist/knowledge/shapes/shapes.js +199 -31
  433. package/dist/knowledge/shapes/shapes.js.map +1 -1
  434. package/dist/knowledge/shapes/verified.d.ts.map +1 -1
  435. package/dist/knowledge/shapes/verified.js +3 -2
  436. package/dist/knowledge/shapes/verified.js.map +1 -1
  437. package/dist/knowledge/trackers/addresses.d.ts +27 -3
  438. package/dist/knowledge/trackers/addresses.d.ts.map +1 -1
  439. package/dist/knowledge/trackers/addresses.js +33 -5
  440. package/dist/knowledge/trackers/addresses.js.map +1 -1
  441. package/dist/knowledge/trackers/gate-pm.d.ts.map +1 -1
  442. package/dist/knowledge/trackers/gate-pm.js +4 -2
  443. package/dist/knowledge/trackers/gate-pm.js.map +1 -1
  444. package/dist/knowledge/trackers/projector.d.ts +3 -1
  445. package/dist/knowledge/trackers/projector.d.ts.map +1 -1
  446. package/dist/knowledge/trackers/projector.js +59 -8
  447. package/dist/knowledge/trackers/projector.js.map +1 -1
  448. package/dist/knowledge/trackers/set.d.ts +28 -0
  449. package/dist/knowledge/trackers/set.d.ts.map +1 -1
  450. package/dist/knowledge/trackers/set.js +26 -0
  451. package/dist/knowledge/trackers/set.js.map +1 -1
  452. package/dist/learn/scheduler.d.ts.map +1 -1
  453. package/dist/learn/scheduler.js +11 -2
  454. package/dist/learn/scheduler.js.map +1 -1
  455. package/dist/learnings/extract.d.ts +9 -3
  456. package/dist/learnings/extract.d.ts.map +1 -1
  457. package/dist/learnings/extract.js +62 -4
  458. package/dist/learnings/extract.js.map +1 -1
  459. package/dist/learnings/replacement-lineage.d.ts +3 -2
  460. package/dist/learnings/replacement-lineage.d.ts.map +1 -1
  461. package/dist/learnings/replacement-lineage.js +7 -6
  462. package/dist/learnings/replacement-lineage.js.map +1 -1
  463. package/dist/learnings/service.d.ts +12 -2
  464. package/dist/learnings/service.d.ts.map +1 -1
  465. package/dist/learnings/service.js +30 -5
  466. package/dist/learnings/service.js.map +1 -1
  467. package/dist/mcp/broker.d.ts.map +1 -1
  468. package/dist/mcp/broker.js +18 -4
  469. package/dist/mcp/broker.js.map +1 -1
  470. package/dist/mcp/estate-relay.d.ts +3 -0
  471. package/dist/mcp/estate-relay.d.ts.map +1 -1
  472. package/dist/mcp/estate-relay.js +5 -2
  473. package/dist/mcp/estate-relay.js.map +1 -1
  474. package/dist/mcp/invoke.js +2 -2
  475. package/dist/mcp/invoke.js.map +1 -1
  476. package/dist/mcp/policies.d.ts +35 -0
  477. package/dist/mcp/policies.d.ts.map +1 -1
  478. package/dist/mcp/policies.js +138 -1
  479. package/dist/mcp/policies.js.map +1 -1
  480. package/dist/mcp/redact.d.ts +1 -1
  481. package/dist/mcp/redact.d.ts.map +1 -1
  482. package/dist/mcp/redact.js +61 -4
  483. package/dist/mcp/redact.js.map +1 -1
  484. package/dist/mcp/registry-store.d.ts +35 -0
  485. package/dist/mcp/registry-store.d.ts.map +1 -1
  486. package/dist/mcp/registry-store.js +33 -0
  487. package/dist/mcp/registry-store.js.map +1 -1
  488. package/dist/mcp/registry.d.ts +65 -4
  489. package/dist/mcp/registry.d.ts.map +1 -1
  490. package/dist/mcp/registry.js +295 -21
  491. package/dist/mcp/registry.js.map +1 -1
  492. package/dist/mcp/rest.js +3 -3
  493. package/dist/mcp/rest.js.map +1 -1
  494. package/dist/mcp/run-fence.d.ts +2 -0
  495. package/dist/mcp/run-fence.d.ts.map +1 -1
  496. package/dist/mcp/run-fence.js +9 -0
  497. package/dist/mcp/run-fence.js.map +1 -1
  498. package/dist/mcp/trigger-names.d.ts +32 -0
  499. package/dist/mcp/trigger-names.d.ts.map +1 -0
  500. package/dist/mcp/trigger-names.js +529 -0
  501. package/dist/mcp/trigger-names.js.map +1 -0
  502. package/dist/mcp/upstream-error.d.ts +5 -1
  503. package/dist/mcp/upstream-error.d.ts.map +1 -1
  504. package/dist/mcp/upstream-error.js +5 -1
  505. package/dist/mcp/upstream-error.js.map +1 -1
  506. package/dist/projects/graph.d.ts +6 -4
  507. package/dist/projects/graph.d.ts.map +1 -1
  508. package/dist/projects/graph.js +173 -25
  509. package/dist/projects/graph.js.map +1 -1
  510. package/dist/projects/routes.d.ts +7 -1
  511. package/dist/projects/routes.d.ts.map +1 -1
  512. package/dist/projects/routes.js +13 -5
  513. package/dist/projects/routes.js.map +1 -1
  514. package/dist/projects/state-home-preflight.d.ts +5 -0
  515. package/dist/projects/state-home-preflight.d.ts.map +1 -1
  516. package/dist/projects/state-home-preflight.js +48 -8
  517. package/dist/projects/state-home-preflight.js.map +1 -1
  518. package/dist/projects/state-home-registry.d.ts.map +1 -1
  519. package/dist/projects/state-home-registry.js +6 -0
  520. package/dist/projects/state-home-registry.js.map +1 -1
  521. package/dist/projects/state-home.d.ts +6 -2
  522. package/dist/projects/state-home.d.ts.map +1 -1
  523. package/dist/projects/state-home.js +8 -5
  524. package/dist/projects/state-home.js.map +1 -1
  525. package/dist/qe/test-sets.d.ts +1 -1
  526. package/dist/qe/test-sets.d.ts.map +1 -1
  527. package/dist/qe/test-sets.js +2 -2
  528. package/dist/qe/test-sets.js.map +1 -1
  529. package/dist/schedules/routes.d.ts +5 -0
  530. package/dist/schedules/routes.d.ts.map +1 -1
  531. package/dist/schedules/routes.js +32 -5
  532. package/dist/schedules/routes.js.map +1 -1
  533. package/dist/schedules/scheduler.d.ts +8 -1
  534. package/dist/schedules/scheduler.d.ts.map +1 -1
  535. package/dist/schedules/scheduler.js +10 -1
  536. package/dist/schedules/scheduler.js.map +1 -1
  537. package/dist/schedules/store.d.ts +7 -0
  538. package/dist/schedules/store.d.ts.map +1 -1
  539. package/dist/schedules/store.js +19 -4
  540. package/dist/schedules/store.js.map +1 -1
  541. package/dist/skills/plugin-source.js +4 -4
  542. package/dist/skills/plugin-source.js.map +1 -1
  543. package/dist/skills/store.d.ts +11 -1
  544. package/dist/skills/store.d.ts.map +1 -1
  545. package/dist/skills/store.js +37 -3
  546. package/dist/skills/store.js.map +1 -1
  547. package/dist/sources/drivers/sqlite.d.ts +13 -0
  548. package/dist/sources/drivers/sqlite.d.ts.map +1 -1
  549. package/dist/sources/drivers/sqlite.js +11 -0
  550. package/dist/sources/drivers/sqlite.js.map +1 -1
  551. package/dist/sources/routes.d.ts.map +1 -1
  552. package/dist/sources/routes.js +1 -0
  553. package/dist/sources/routes.js.map +1 -1
  554. package/dist/sources/uploads.d.ts +22 -2
  555. package/dist/sources/uploads.d.ts.map +1 -1
  556. package/dist/sources/uploads.js +108 -10
  557. package/dist/sources/uploads.js.map +1 -1
  558. package/dist/standing-orders/parse.d.ts +8 -0
  559. package/dist/standing-orders/parse.d.ts.map +1 -1
  560. package/dist/standing-orders/parse.js +52 -5
  561. package/dist/standing-orders/parse.js.map +1 -1
  562. package/dist/studio/apps-standalone/fixture.js +3 -3
  563. package/dist/studio/assets/{KnowledgeGraph-dfq7Flyj.js → KnowledgeGraph-D6RRLDnV.js} +1 -1
  564. package/dist/studio/assets/index-BLo9vFQI.js +1128 -0
  565. package/dist/studio/assets/index-xW21Gkam.css +32 -0
  566. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  567. package/dist/studio/editors/wicked-apps/index.html +1 -1
  568. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  569. package/dist/studio/editors/wicked-deck/index.html +1 -1
  570. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  571. package/dist/studio/editors/wicked-doc/index.html +1 -1
  572. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  573. package/dist/studio/editors/wicked-insights/index.html +1 -1
  574. package/dist/studio/editors/wicked-page/editor.json +1 -1
  575. package/dist/studio/editors/wicked-page/index.html +1 -1
  576. package/dist/studio/editors/wicked-video/editor.json +1 -1
  577. package/dist/studio/editors/wicked-video/index.html +1 -1
  578. package/dist/studio/index.html +2 -2
  579. package/dist/studio/testid-inventory.json +1687 -236
  580. package/dist/team/routes.d.ts +4 -1
  581. package/dist/team/routes.d.ts.map +1 -1
  582. package/dist/team/routes.js +3 -2
  583. package/dist/team/routes.js.map +1 -1
  584. package/dist/voice/tts.d.ts +18 -0
  585. package/dist/voice/tts.d.ts.map +1 -1
  586. package/dist/voice/tts.js +134 -29
  587. package/dist/voice/tts.js.map +1 -1
  588. package/dist/workflow-catalog/build-v2.d.ts +34 -0
  589. package/dist/workflow-catalog/build-v2.d.ts.map +1 -1
  590. package/dist/workflow-catalog/build-v2.js +131 -10
  591. package/dist/workflow-catalog/build-v2.js.map +1 -1
  592. package/dist/workflow-catalog/catalog-data.d.ts.map +1 -1
  593. package/dist/workflow-catalog/catalog-data.js +0 -2
  594. package/dist/workflow-catalog/catalog-data.js.map +1 -1
  595. package/dist/workflow-catalog/detect.d.ts +18 -3
  596. package/dist/workflow-catalog/detect.d.ts.map +1 -1
  597. package/dist/workflow-catalog/detect.js +43 -8
  598. package/dist/workflow-catalog/detect.js.map +1 -1
  599. package/dist/working-doc/event-lines.d.ts +5 -2
  600. package/dist/working-doc/event-lines.d.ts.map +1 -1
  601. package/dist/working-doc/event-lines.js +38 -7
  602. package/dist/working-doc/event-lines.js.map +1 -1
  603. package/dist/working-doc/sections.d.ts +3 -0
  604. package/dist/working-doc/sections.d.ts.map +1 -1
  605. package/dist/working-doc/sections.js +5 -0
  606. package/dist/working-doc/sections.js.map +1 -1
  607. package/dist/working-doc/service.d.ts +23 -3
  608. package/dist/working-doc/service.d.ts.map +1 -1
  609. package/dist/working-doc/service.js +93 -54
  610. package/dist/working-doc/service.js.map +1 -1
  611. package/endpoint-manifest.json +144 -8
  612. package/evals/corpora/shape-v1.json +25 -1
  613. package/evals/corpora/shape-v1.seat-fixture.json +25 -1
  614. package/package.json +4 -4
  615. package/runners/sqlite-runner.mjs +39 -1
  616. package/voice-locks/darwin-arm64-cp310.txt +12 -0
  617. package/voice-locks/darwin-arm64-cp311.txt +8 -0
  618. package/voice-locks/darwin-arm64-cp312.txt +8 -0
  619. package/voice-locks/darwin-arm64-cp313.txt +8 -0
  620. package/voice-locks/darwin-arm64-cp314.txt +8 -0
  621. package/voice-locks/darwin-arm64-cp39.txt +12 -0
  622. package/voice-locks/darwin-x64-cp310.txt +12 -0
  623. package/voice-locks/darwin-x64-cp311.txt +12 -0
  624. package/voice-locks/darwin-x64-cp312.txt +12 -0
  625. package/voice-locks/darwin-x64-cp313.txt +12 -0
  626. package/voice-locks/darwin-x64-cp39.txt +12 -0
  627. package/voice-locks/linux-arm64-cp310.txt +12 -0
  628. package/voice-locks/linux-arm64-cp311.txt +8 -0
  629. package/voice-locks/linux-arm64-cp312.txt +8 -0
  630. package/voice-locks/linux-arm64-cp313.txt +8 -0
  631. package/voice-locks/linux-arm64-cp314.txt +8 -0
  632. package/voice-locks/linux-arm64-cp39.txt +12 -0
  633. package/voice-locks/linux-x64-cp310.txt +12 -0
  634. package/voice-locks/linux-x64-cp311.txt +8 -0
  635. package/voice-locks/linux-x64-cp312.txt +8 -0
  636. package/voice-locks/linux-x64-cp313.txt +8 -0
  637. package/voice-locks/linux-x64-cp314.txt +8 -0
  638. package/voice-locks/linux-x64-cp39.txt +12 -0
  639. package/dist/studio/assets/index-Bame65hj.js +0 -1108
  640. package/dist/studio/assets/index-CtB1BJRI.css +0 -32
@@ -40,14 +40,15 @@ 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, seatsNeeded, seatsShortLine, 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';
49
49
  import { catalogDigest, detect, detectable } from '../workflow-catalog/detect.js';
50
50
  import { OnboardBlock, resolveOnboard } from './proposal-onboard.js';
51
+ import { CUT_BLOCKING, CutBlock, cutInterruptedWords, resolveCut } from './proposal-cut.js';
51
52
  // ── the block ──────────────────────────────────────────────────────────────────────────────────────────────────────
52
53
  /** Sources a block may name. */
53
54
  export const PROPOSAL_SOURCES_MAX = 12;
@@ -73,6 +74,10 @@ const EntryBlock = z.object({
73
74
  depth: z.enum(['quick', 'standard', 'deep']).nullable().optional(),
74
75
  confidence: z.number().optional(),
75
76
  title: z.string().trim().max(200).optional(),
77
+ // crew#1737: who the person named in this message to do the job (`lead` builds or writes, `seats` the others, in
78
+ // their order). crew keeps only the ones the person's own turn names (`seatNamedIn`).
79
+ lead: z.string().trim().min(1).max(64).optional(),
80
+ seats: z.array(z.string().trim().min(1).max(64)).max(8).optional(),
76
81
  brief: z.string().max(8000).optional(),
77
82
  url: z.string().trim().max(2048).optional(),
78
83
  audience: z.string().max(400).optional(),
@@ -104,7 +109,7 @@ export function parseMakeBlock(body) {
104
109
  if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
105
110
  return null;
106
111
  const o = raw;
107
- const ops = ['entry', 'refine', 'theme', 'onboard'].filter((k) => o[k] !== undefined && o[k] !== null);
112
+ const ops = ['entry', 'refine', 'theme', 'onboard', 'cut'].filter((k) => o[k] !== undefined && o[k] !== null);
108
113
  if (ops.length !== 1)
109
114
  return null;
110
115
  if (ops[0] === 'entry') {
@@ -120,6 +125,11 @@ export function parseMakeBlock(body) {
120
125
  const r = OnboardBlock.safeParse(o);
121
126
  return r.success ? { op: 'onboard', ...r.data } : null;
122
127
  }
128
+ if (ops[0] === 'cut') {
129
+ // studio#1140 (a): a change to the demo video open in the chat (resolved by `proposal-cut.ts`).
130
+ const r = CutBlock.safeParse(o);
131
+ return r.success ? { op: 'cut', ...r.data } : null;
132
+ }
123
133
  const r = ThemeBlock.safeParse(o);
124
134
  return r.success ? { op: 'theme', ...r.data } : null;
125
135
  }
@@ -299,6 +309,11 @@ export function viewOf(f) {
299
309
  ...(f.decidedAt !== undefined ? { decidedAt: f.decidedAt } : {}),
300
310
  };
301
311
  }
312
+ /** 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). */
313
+ export async function liveInRuns(runId, runs) {
314
+ const v = (await runs()).find((r) => r.session.id === runId);
315
+ return v !== undefined && !['completed', 'cancelled', 'failed'].includes(String(v.session.status));
316
+ }
302
317
  /** Serialize work per key: a second caller waits for the first, then runs. */
303
318
  class KeyedLock {
304
319
  tails = new Map();
@@ -348,19 +363,20 @@ export class LaunchOnceRegistry {
348
363
  /** The run this identity names, when it exists (adopted, never started again), with whether a stub took it. */
349
364
  async find(kind, identity) {
350
365
  const d = this.dispatchers.get(kind);
351
- if (d === undefined || !(await d.find(identity)))
366
+ const found = d === undefined ? false : await d.find(identity);
367
+ if (d === undefined || found === false)
352
368
  return null;
353
- return { stub: d.stub === true };
369
+ return { stub: d.stub === true, ...(typeof found === 'object' ? { version: found.version } : {}) };
354
370
  }
355
- async live(kind, runId) {
371
+ async live(kind, runId, runs) {
356
372
  const d = this.dispatchers.get(kind);
357
- return d?.live === undefined ? false : d.live(runId);
373
+ return d?.live === undefined ? false : d.live(runId, runs);
358
374
  }
359
375
  /** Whether a run this daemon started for the artifact is still live, or a launcher's durable record says an attempt at
360
376
  * it has no outcome yet (A3: across a restart too). */
361
- async liveForArtifact(artifactRef) {
377
+ async liveForArtifact(artifactRef, runs) {
362
378
  for (const r of this.byArtifact.get(artifactRef) ?? [])
363
- if (await this.live(r.kind, r.runId))
379
+ if (await this.live(r.kind, r.runId, runs))
364
380
  return true;
365
381
  for (const d of new Set(this.dispatchers.values()))
366
382
  if (d.docBusy !== undefined && (await d.docBusy(artifactRef)))
@@ -373,13 +389,15 @@ export class LaunchOnceRegistry {
373
389
  return Promise.reject(new Error(`nothing can start a ${dispatch.kind} on this daemon yet`));
374
390
  return this.lock.run(dispatch.identity.runId, async () => {
375
391
  const base = { runId: dispatch.identity.runId, artifactRef: dispatch.identity.artifactRef, stub: d.stub === true };
376
- if (await d.find(dispatch.identity))
377
- return { ...base, adopted: true };
378
- await d.launch(dispatch);
392
+ const found = await d.find(dispatch.identity);
393
+ if (found !== false)
394
+ return { ...base, adopted: true, ...(typeof found === 'object' ? { version: found.version } : {}) };
395
+ const made = await d.launch(dispatch);
379
396
  const ref = dispatch.identity.artifactRef;
380
- if (ref !== null)
397
+ // A cut starts no run: nothing of it is live after its launch (its version is its outcome).
398
+ if (ref !== null && dispatch.kind !== 'cut')
381
399
  this.byArtifact.set(ref, [...(this.byArtifact.get(ref) ?? []).slice(-15), { kind: dispatch.kind, runId: dispatch.identity.runId }]);
382
- return { ...base, adopted: false };
400
+ return { ...base, adopted: false, ...(made !== undefined && made !== null ? { version: made.version } : {}) };
383
401
  });
384
402
  }
385
403
  }
@@ -480,6 +498,8 @@ export const PROPOSAL_WORKFLOWS = {
480
498
  refine: 'interactive-chat',
481
499
  demo: 'demo',
482
500
  };
501
+ /** studio#1140: why a refine of a demo cut is blocked (the card says it after the document's title). */
502
+ export const CUT_BLOCKED = "a demo video: ask for its change in this chat as a video change, not a page change (or change it by hand in the video editor)";
483
503
  const STOPS = {
484
504
  create: 'Stops for you if the check fails. The plan or an escalation may also ask.',
485
505
  refine: 'Stops for you if the check fails. The plan or an escalation may also ask.',
@@ -621,6 +641,60 @@ function ownTitle(title, words) {
621
641
  const named = plain(title);
622
642
  return named !== '' && plain(words).includes(named);
623
643
  }
644
+ /**
645
+ * (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
646
+ * does (`ownTitle`); else the title is dropped and the catalog's title is used.
647
+ */
648
+ function ownWordsTitle(block, records, turnId) {
649
+ if (block.op !== 'entry' || block.title === undefined || ownTitle(block.title, personWords(records, turnId)))
650
+ return block;
651
+ const rest = { ...block };
652
+ delete rest.title;
653
+ return rest;
654
+ }
655
+ /**
656
+ * (crew#1737) The person's own request with what they only quoted taken out: fenced and inline code, `>` quote lines
657
+ * and text in quotation marks. A seat named only there was pasted or reported, not chosen.
658
+ */
659
+ export function ownRequestWords(words) {
660
+ return words
661
+ .replace(/(`{3,}|~{3,})[\s\S]*?(?:\1|$)/gu, ' ')
662
+ .replace(/(`+)[\s\S]*?\1/gu, ' ')
663
+ .split(/\r?\n/u)
664
+ .filter((line) => !/^\s*>/u.test(line))
665
+ .join('\n')
666
+ .replace(/"[^"]*"|“[^”]*”|‘[^’]*’/gu, ' ');
667
+ }
668
+ /** (crew#1737) Whether the person's words name a seat, by its key or its roster name, as a whole word, outside what
669
+ * they quoted ({@link ownRequestWords}). */
670
+ export function seatNamedIn(key, name, words) {
671
+ const plain = ownRequestWords(words).toLowerCase();
672
+ return [key, name].some((n) => {
673
+ const w = (n ?? '').trim().toLowerCase();
674
+ if (w === '')
675
+ return false;
676
+ const esc = w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
677
+ return new RegExp(`(^|[^\\p{L}\\p{N}])${esc}(?![\\p{L}\\p{N}])`, 'u').test(plain);
678
+ });
679
+ }
680
+ /**
681
+ * (crew#1737) The seats a routing block names that the person's own turn names too and that can work now: the lead
682
+ * first, then the others in the person's order. Nothing named (or nothing that passes) leaves both `null`, so the card
683
+ * draws its own seats.
684
+ */
685
+ function namedSeats(block, words, roster) {
686
+ const ok = (k) => roster.some((s) => s.key === k) && seatNamedIn(k, roster.find((s) => s.key === k)?.name, words);
687
+ const lead = block.lead !== undefined && ok(block.lead) ? block.lead : null;
688
+ const others = [...new Set(block.seats ?? [])].filter((k) => k !== lead && ok(k));
689
+ // Seats ride only beside a named lead: a list without one would read as the whole roster (its first seat building),
690
+ // so a seat named only to check is left to the card's own draw, which the person can swap (xreview r2).
691
+ return { lead, seats: lead !== null && others.length > 0 ? [lead, ...others] : null };
692
+ }
693
+ /**
694
+ * (crew#1745) A chat that ended (closed, its id reused, or the daemon restarted) can't take a proposal any more. Said
695
+ * without its id: the person reads this under the card, and the way forward is a new chat.
696
+ */
697
+ 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.';
624
698
  /** The person's own words of ONE turn (the message the seat's block answers). */
625
699
  function turnWords(records, turnId) {
626
700
  const r = records.find((x) => x.kind === 'user' && x.turnId === turnId && x.owner === true);
@@ -717,6 +791,8 @@ export class ChatProposals {
717
791
  // crew-0182: the onboard block, for a client that draws the card (its seat is told only then).
718
792
  // `o.onboard`: this message's own declaration (the chat's stored one changes only once the message is accepted).
719
793
  ...(on && f.onboard === true && chatId !== undefined && this.deps.onboard !== undefined && (o.onboard ?? this.deps.acceptsOnboard?.(chatId)) === true ? { onboard: true } : {}),
794
+ // crew#1814: the cut block, for a client that draws the card (crew's note on an open video says when it fits).
795
+ ...(on && f.cut === true && chatId !== undefined && this.deps.cut !== undefined && (o.cut ?? this.deps.acceptsCut?.(chatId)) === true ? { cut: true } : {}),
720
796
  entries,
721
797
  ...(jobs !== undefined ? { jobs } : {}),
722
798
  };
@@ -787,7 +863,7 @@ export class ChatProposals {
787
863
  const jobBlock = jobs && block.op === 'entry' && isJobCardEntry(block);
788
864
  const proposal = jobBlock
789
865
  ? await this.resolveDetected({ chatId: frame.chat, turnId, seat: frame.cliKey, block: block, records: this.deps.records(frame.chat) })
790
- : await this.resolve({ chatId: frame.chat, turnId, seat: frame.cliKey, block, records: this.deps.records(frame.chat) });
866
+ : 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) });
791
867
  if (proposal === null)
792
868
  return;
793
869
  // A job card never appears after the person has written again (codex r4): a newer message ("never mind") supersedes a
@@ -864,7 +940,16 @@ export class ChatProposals {
864
940
  // Only for a client that draws the card (its seat was told the block exists only then).
865
941
  if (flags.onboard !== true || this.deps.onboard === undefined || this.deps.acceptsOnboard?.(chatId) !== true)
866
942
  return this.refused(chatId, 'onboard');
867
- return resolveOnboard(block, { pid, chatId, turnId, seat, chatProjectId: chat.projectId === null || chat.projectId === 'default' ? null : chat.projectId }, this.deps.onboard);
943
+ return resolveOnboard(block, { pid, chatId, turnId, seat, chatProjectId: chat.projectId === null || chat.projectId === 'default' ? null : chat.projectId, words }, this.deps.onboard);
944
+ }
945
+ if (block.op === 'cut') {
946
+ // Only for a client that draws the card (its seat was told the block exists only then), and only for the video
947
+ // open in this very turn.
948
+ if (flags.cut !== true || this.deps.cut === undefined || this.deps.acceptsCut?.(chatId) !== true)
949
+ return this.refused(chatId, 'cut');
950
+ const projectId = chat.projectId === null || chat.projectId === 'default' ? null : chat.projectId;
951
+ const f = await filedIn(projectId);
952
+ return resolveCut(block, { pid, chatId, turnId, seat, binding: turnHas ? binding : null, projectId, filedInLabel: f.label }, this.deps.cut);
868
953
  }
869
954
  if (block.op === 'theme') {
870
955
  if (!flags.theme)
@@ -910,6 +995,9 @@ export class ChatProposals {
910
995
  const head = root === null ? null : artifactHead(root, ref.doc);
911
996
  if (head === null)
912
997
  blocked.push(`${title} · no such document`);
998
+ // studio#1140: a demo video changes in its editor; a page refine would write a page version over a cut.
999
+ else if (artifactIsCut(root, ref.doc))
1000
+ blocked.push(`${title} · ${CUT_BLOCKED}`);
913
1001
  else {
914
1002
  target = { ref: ref.ref, title, base: head };
915
1003
  projectId = projectOfMount(ref.mount);
@@ -998,7 +1086,7 @@ export class ChatProposals {
998
1086
  demo = { url, audience: block.audience ?? null, show: block.show ?? null };
999
1087
  }
1000
1088
  const sources = kind === 'create' ? await this.resolveSources(block.sources, { chatId, turnId, records, binding, turnHas, chat, words, personNamed: false }) : [];
1001
- const { helpers, block: helperBlock, seatsUnread } = await this.docHelpers(chat, input.helperSeats);
1089
+ const { helpers, block: helperBlock, seatsUnread } = await this.docHelpers(chat, input.helperSeats, input.helperWriterNamed ?? true);
1002
1090
  if (helperBlock !== null)
1003
1091
  blocked.push(helperBlock);
1004
1092
  return {
@@ -1289,8 +1377,8 @@ export class ChatProposals {
1289
1377
  // archived alias still waits for an in-flight answer through its first name.
1290
1378
  return this.lock.run(`pid\u0000${pid}`, () => this.decideLocked(chatId, pid, body, actor, instance)).then((r) => this.served(r));
1291
1379
  }
1292
- gone(chatId) {
1293
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} ended and its id was reused; this proposal can no longer be answered here` } };
1380
+ gone(chatId, acceptingAt) {
1381
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED, ...(acceptingAt !== undefined ? { acceptingAt } : {}) } };
1294
1382
  }
1295
1383
  async decideLocked(chatId, pid, body, actor, instance) {
1296
1384
  if (this.deps.instanceOf(chatId) !== instance)
@@ -1317,16 +1405,32 @@ export class ChatProposals {
1317
1405
  }
1318
1406
  if (folded.state === 'accepting' && folded.accepting !== undefined) {
1319
1407
  const acc = folded.accepting;
1320
- const found = await this.deps.registry.find(kind, acc.identity);
1408
+ let found;
1409
+ try {
1410
+ found = await this.deps.registry.find(kind, acc.identity);
1411
+ }
1412
+ catch (err) {
1413
+ // studio#1140 (a): a cut still rendering is neither decided nor declined; a deleted video blocks its card; a
1414
+ // video tool that can't answer leaves the Go interrupted (Go again asks again).
1415
+ if (err instanceof LaunchRefusal && kind === 'cut' && err.body['code'] === 'cut_pending') {
1416
+ return { code: 409, body: { code: 'cut_pending', error: err.message, view: viewOf(folded) } };
1417
+ }
1418
+ if (err instanceof LaunchRefusal && kind === 'cut' && CUT_BLOCKING.has(err.body['code'])) {
1419
+ return this.blockCut(chatId, folded, acc.resolution, instance, err.body['code'], err.message);
1420
+ }
1421
+ if (kind !== 'cut')
1422
+ throw err;
1423
+ return { code: 502, body: { code: 'launch_failed', error: cutInterruptedWords(err instanceof Error ? err.message : String(err)), view: viewOf(folded) } };
1424
+ }
1321
1425
  if (found !== null) {
1322
1426
  // Its run exists: adopt it and decide (a crash after the launch, or a lost response).
1323
- const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub };
1427
+ const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub, ...(found.version !== undefined ? { version: found.version } : {}) };
1324
1428
  if (!this.decided(chatId, folded.turnId, pid, actor, 'go', result, acc.resolution, acc.edits, instance))
1325
1429
  return this.gone(chatId);
1326
1430
  const after = reread();
1327
1431
  if (body.decision === 'go')
1328
1432
  return ok(after);
1329
- return { code: 409, body: { code: 'proposal_decided', error: 'this proposal had already started', view: viewOf(after) } };
1433
+ return { code: 409, body: { code: 'proposal_decided', error: kind === 'cut' ? `The new version was already made${found.version !== undefined ? ` (version ${found.version})` : ''}, so it stays. Undo in the video's editor brings back the one before.` : 'this proposal had already started', view: viewOf(after) } };
1330
1434
  }
1331
1435
  if (body.decision === 'not_now') {
1332
1436
  if (!this.decided(chatId, folded.turnId, pid, actor, 'not_now', null, acc.resolution, acc.edits, instance))
@@ -1508,17 +1612,33 @@ export class ChatProposals {
1508
1612
  return { code: 409, body: { code: 'source_gone', error: gone, view: viewOf(folded) } };
1509
1613
  // A theme is no job (§15.2): applying colours never waits for a run of this chat.
1510
1614
  // An onboard card starts no job of this chat either (crew-0182): it registers a repository.
1511
- const busy = kind === 'theme' || kind === 'onboard' ? null : await this.busy(chatId, identity.artifactRef, resolution);
1615
+ // A cut starts no run either (studio#1140): the video tool's queue serializes it with the person's hand edits.
1616
+ const busy = kind === 'theme' || kind === 'onboard' || kind === 'cut' ? null : await this.busy(chatId, identity.artifactRef, resolution);
1512
1617
  if (busy !== null)
1513
1618
  return { code: 409, body: { code: busy.code, error: busy.reason, view: viewOf(folded) } };
1514
1619
  // A refine is on the head it was proposed on; else the card re-resolves (same pid, the new base). Read last, right
1515
1620
  // before the record: the landing itself is checked against this base (`expect_head`, slices I1 and A5).
1516
- if (resolution.target !== undefined) {
1621
+ if (kind === 'cut' && resolution.target !== undefined) {
1622
+ // studio#1140 (a): a cut is never rebased. A fresh Go on a moved video blocks the card; Go again (an accepting
1623
+ // record) skips this check, because the video tool checks the Go's request id before its head (DES-B7 R3).
1624
+ const ref = parseArtifactRef(resolution.target.ref);
1625
+ const root = await this.deps.docsRoot(ref.projectId);
1626
+ const head = root === null ? null : artifactHead(root, ref.doc);
1627
+ if (head === null)
1628
+ return this.blockCut(chatId, folded, resolution, instance, 'cut_gone', `${resolution.target.title} is gone.`);
1629
+ if (folded.state !== 'accepting' && head !== resolution.target.base) {
1630
+ return this.blockCut(chatId, folded, resolution, instance, 'cut_moved', `The video changed since this was proposed (now version ${head}). Ask again to change the new version.`);
1631
+ }
1632
+ }
1633
+ else if (resolution.target !== undefined) {
1517
1634
  const ref = parseArtifactRef(resolution.target.ref);
1518
1635
  const root = await this.deps.docsRoot(ref.projectId);
1519
1636
  const head = root === null ? null : artifactHead(root, ref.doc);
1520
1637
  if (head === null)
1521
1638
  return { code: 409, body: { code: 'source_gone', error: `${resolution.target.title} is gone`, view: viewOf(folded) } };
1639
+ // studio#1140: a refine recorded before crew blocked cuts (or a document that became one) never launches on a cut.
1640
+ if (artifactIsCut(root, ref.doc))
1641
+ return { code: 409, body: { code: 'proposal_blocked', error: `${resolution.target.title} · ${CUT_BLOCKED}`, view: viewOf(folded) } };
1522
1642
  if (head !== resolution.target.base) {
1523
1643
  // A newer proposal exists: this one is not re-opened over it (the chat moved on). The re-resolution is still
1524
1644
  // recorded, so the fold settles it as superseded for every reader (and its frame says so).
@@ -1570,7 +1690,9 @@ export class ChatProposals {
1570
1690
  return this.gone(chatId);
1571
1691
  }
1572
1692
  // Recorded before anything starts.
1573
- const accepting = { at: this.now(), turnId: folded.turnId, kind: 'proposal_accepting', pid, actor: actor.id, edits, resolution, identity };
1693
+ // crew#1695: `at` names this Go (its refusals carry it), so it is never the same as an earlier accepting record's.
1694
+ const lastAt = Math.max(-1, ...this.deps.records(chatId).flatMap((r) => (r.kind === 'proposal_accepting' && r.pid === pid ? [r.at] : [])));
1695
+ const accepting = { at: Math.max(this.now(), lastAt + 1), turnId: folded.turnId, kind: 'proposal_accepting', pid, actor: actor.id, edits, resolution, identity };
1574
1696
  if (!this.write(chatId, accepting, instance))
1575
1697
  return this.gone(chatId);
1576
1698
  let result;
@@ -1578,13 +1700,25 @@ export class ChatProposals {
1578
1700
  result = await this.deps.registry.launchOnce({ kind, pid, chatId, actor, identity, resolution, ...(power !== undefined ? { power } : {}) });
1579
1701
  }
1580
1702
  catch (err) {
1703
+ // crew#1695: every refusal after this Go's accepting write names that record (`acceptingAt`), so a client marks
1704
+ // only it stopped, never another tab's newer Go.
1705
+ // studio#1140 (a): a cut the video tool refused is blocked with its words (asking again is the way on); one still
1706
+ // rendering keeps its accepting record.
1707
+ if (err instanceof LaunchRefusal && kind === 'cut' && err.body['code'] === 'cut_pending') {
1708
+ return { code: 409, body: { code: 'cut_pending', error: err.message, acceptingAt: accepting.at, view: viewOf(foldProposals(this.deps.records(chatId)).get(pid) ?? folded) } };
1709
+ }
1710
+ if (err instanceof LaunchRefusal && kind === 'cut' && CUT_BLOCKING.has(err.body['code'])) {
1711
+ this.deps.audit('chat.proposal.launch_refused', actor, { chatId, pid, code: err.body['code'], error: err.message });
1712
+ const r = this.blockCut(chatId, folded, resolution, instance, err.body['code'], err.message, err.status);
1713
+ return { code: r.code, body: { ...r.body, acceptingAt: accepting.at } };
1714
+ }
1581
1715
  if (err instanceof LaunchRefusal) {
1582
1716
  const reopened = this.reopenLaunch(chatId, folded, resolution, instance);
1583
1717
  if (reopened === null)
1584
- return this.gone(chatId);
1718
+ return this.gone(chatId, accepting.at);
1585
1719
  this.deps.audit('chat.proposal.launch_refused', actor, { chatId, pid, code: err.body['code'], error: err.message });
1586
1720
  return { code: err.status, body: {
1587
- code: err.body['code'], error: err.message,
1721
+ code: err.body['code'], error: err.message, acceptingAt: accepting.at,
1588
1722
  ...(err.body['excluded'] !== undefined ? { excluded: err.body['excluded'] } : {}),
1589
1723
  ...(err.body['retryWith'] !== undefined ? { retryWith: err.body['retryWith'] } : {}),
1590
1724
  view: viewOf(reopened),
@@ -1594,13 +1728,23 @@ export class ChatProposals {
1594
1728
  const msg = err instanceof Error ? err.message : String(err);
1595
1729
  this.deps.audit('chat.proposal.launch_failed', actor, { chatId, pid, error: msg, ...(power !== undefined ? { power } : {}) });
1596
1730
  const after = foldProposals(this.deps.records(chatId)).get(pid);
1597
- return { code: 502, body: { code: 'launch_failed', error: `could not start it: ${msg}. Go again resumes the same job.`, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1731
+ // A cut starts no run: its card says crew's own sentence and what Go again does (R2 C1).
1732
+ const said = resolution.kind === 'cut' ? cutInterruptedWords(msg) : `could not start it: ${msg}. Go again resumes the same job.`;
1733
+ return { code: 502, body: { code: 'launch_failed', error: said, acceptingAt: accepting.at, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1598
1734
  }
1599
1735
  if (!this.decided(chatId, folded.turnId, pid, actor, 'go', result, resolution, edits, instance, power))
1600
- return this.gone(chatId);
1736
+ return this.gone(chatId, accepting.at);
1601
1737
  const after = foldProposals(this.deps.records(chatId)).get(pid) ?? folded;
1602
1738
  return { code: 200, body: { view: viewOf(after) } };
1603
1739
  }
1740
+ /** studio#1140 (a): a cut card that can't make its change any more is re-written blocked with the words (no rebase,
1741
+ * no Go). The person asks again for a new card. */
1742
+ blockCut(chatId, folded, resolution, instance, code, words, status = 409) {
1743
+ if (!this.write(chatId, { at: this.now(), turnId: folded.turnId, kind: 'proposal', proposal: { ...resolution, blocked: words } }, instance))
1744
+ return this.gone(chatId);
1745
+ const after = foldProposals(this.deps.records(chatId)).get(resolution.pid);
1746
+ return { code: status, body: { code, error: words, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1747
+ }
1604
1748
  reopenLaunch(chatId, folded, resolution, instance) {
1605
1749
  const proposal = { ...resolution };
1606
1750
  // A Go-only opt-in belongs to that attempt; a reshape card keeps its own prior choice.
@@ -1645,7 +1789,7 @@ export class ChatProposals {
1645
1789
  /** The identity a Go is named by (DES §4.3 step 2). */
1646
1790
  identityOf(p) {
1647
1791
  const runId = proposalRunId(p.pid);
1648
- if (p.kind === 'refine')
1792
+ if (p.kind === 'refine' || p.kind === 'cut')
1649
1793
  return { artifactRef: p.target?.ref ?? null, runId };
1650
1794
  if (p.kind === 'create') {
1651
1795
  // A retry fills the same document again (§4.3: artifact identity and attempt identity are separate).
@@ -1705,6 +1849,7 @@ export class ChatProposals {
1705
1849
  */
1706
1850
  async busy(chatId, artifactRef, p) {
1707
1851
  const runs = await this.deps.runs();
1852
+ const runsOnce = async () => runs;
1708
1853
  // A reshape's held run is the one it replaces: answered Reject inside this Go, so it does not make the chat busy.
1709
1854
  const held = p.reshapes !== undefined && p.heldRejected !== true ? p.reshapes : null;
1710
1855
  for (const f of foldProposals(this.deps.records(chatId)).values()) {
@@ -1713,7 +1858,7 @@ export class ChatProposals {
1713
1858
  // Another proposal of this chat started a job (decided go, or accepting with its run launched) still live.
1714
1859
  const runId = f.state === 'decided' && f.decision === 'go' ? f.result?.runId ?? null
1715
1860
  : f.state === 'accepting' ? f.accepting?.identity.runId ?? null : null;
1716
- if (runId !== null && runId !== held && (await this.deps.registry.live(f.proposal.kind, runId))) {
1861
+ if (runId !== null && runId !== held && (await this.deps.registry.live(f.proposal.kind, runId, runsOnce))) {
1717
1862
  return { code: 'chat_busy', reason: `This chat already has a job running (${f.proposal.what.label}). Wait, or stop that run.` };
1718
1863
  }
1719
1864
  }
@@ -1723,7 +1868,7 @@ export class ChatProposals {
1723
1868
  return { code: 'chat_busy', reason: `This chat already has a job running (run ${v.session.id.slice(0, 8)}). Wait, or stop that run.` };
1724
1869
  }
1725
1870
  if (artifactRef !== null && (p.kind === 'refine' || (p.kind === 'create' && p.artifactRef !== undefined))) {
1726
- if (await this.deps.registry.liveForArtifact(artifactRef)) {
1871
+ if (await this.deps.registry.liveForArtifact(artifactRef, runsOnce)) {
1727
1872
  return { code: 'document_busy', reason: `“${p.target?.title ?? p.what.title}” is being ${p.kind === 'create' ? 'drafted' : 'revised'}. Wait, or stop that run.` };
1728
1873
  }
1729
1874
  const ref = parseArtifactRef(artifactRef);
@@ -1757,6 +1902,8 @@ export class ChatProposals {
1757
1902
  demo: ['audience', 'show', 'helpers'],
1758
1903
  // An onboard card is changed by saying so in the chat (a new proposal replaces it); Go takes no edits.
1759
1904
  onboard: [],
1905
+ // So is a cut card (studio#1140): its ops are frozen with the head they were proposed on.
1906
+ cut: [],
1760
1907
  };
1761
1908
  const kindAllowed = allowed[p.kind];
1762
1909
  for (const k of Object.keys(edits)) {
@@ -2010,7 +2157,9 @@ export class ChatProposals {
2010
2157
  });
2011
2158
  const g = d.guess;
2012
2159
  // The repository the block names, when it is one of this chat's (else the chat's own rule picks it).
2013
- const named = block.repos.map((want) => jc.repos.filter((r) => r.name === want || r.id === want)).find((hits) => hits.length === 1)?.[0];
2160
+ // crew#1791: else the one the person's words clearly name ("In tiny-math-rd, fix …").
2161
+ const named = block.repos.map((want) => jc.repos.filter((r) => r.name === want || r.id === want)).find((hits) => hits.length === 1)?.[0]
2162
+ ?? repoNamedIn(words, jc.repos) ?? undefined;
2014
2163
  // A demo's address only from the person's own words (DES-CHAT-ARTIFACTS-001 §4.3), never the model's.
2015
2164
  const inputs = {};
2016
2165
  if (block.url !== undefined && block.url !== '' && personUrls(words).has(block.url))
@@ -2024,8 +2173,7 @@ export class ChatProposals {
2024
2173
  details: [],
2025
2174
  repoRef: named?.id ?? null,
2026
2175
  projectId: jc.projectId,
2027
- lead: null,
2028
- seats: null,
2176
+ ...namedSeats(block, words, ctx.roster),
2029
2177
  inputs,
2030
2178
  skipQe: null,
2031
2179
  by: 'detected',
@@ -2374,10 +2522,18 @@ export class ChatProposals {
2374
2522
  return records.map((r) => this.seatsBlocked(r, refusal, open));
2375
2523
  }
2376
2524
  /** A document's two default helpers from the pool, and the line that blocks it when there are none. */
2377
- async docHelpers(chat, chosen) {
2525
+ async docHelpers(chat, chosen, writerNamed = true) {
2378
2526
  const { pool, refusal } = await this.seatPool();
2379
2527
  const eligible = new Set(this.deps.rosterEligible().map((s) => s.key));
2380
- const seats = chosen === undefined ? undefined : [...new Set(chosen)].filter((k) => eligible.has(k)).slice(0, 2);
2528
+ let seats = chosen === undefined ? undefined : [...new Set(chosen)].filter((k) => eligible.has(k)).slice(0, 2);
2529
+ // crew#1737: one helper named: the other is the one the card would draw, never the same seat again. A named writer
2530
+ // writes; a seat named only to check (no writer named, or the one named can't work now) checks.
2531
+ if (seats !== undefined && seats.length === 1) {
2532
+ const drawn = [...(this.helpers(chat, undefined, pool)?.seats ?? []), ...pool.map((s) => s.key)];
2533
+ const other = drawn.find((k) => k !== seats[0] && eligible.has(k));
2534
+ if (other !== undefined)
2535
+ seats = writerNamed && chosen?.[0] === seats[0] ? [seats[0], other] : [other, seats[0]];
2536
+ }
2381
2537
  const helpers = this.helpers(chat, seats, pool);
2382
2538
  return { helpers, block: helpers === null ? NEEDS_HELPER : null, ...(refusal !== undefined ? { seatsUnread: true } : {}) };
2383
2539
  }
@@ -2397,6 +2553,28 @@ export class ChatProposals {
2397
2553
  const { eligible: roster, pool, refusal } = await this.seatPool();
2398
2554
  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 } : {}) };
2399
2555
  }
2556
+ /** (crew#1840) The pull requests this chat's runs delivered (a run record's `deliverUrl`), newest run last. A failed
2557
+ * read is none: the job then opens its own pull request, and its card says so when the words asked otherwise. */
2558
+ async deliveredPrs(chatId) {
2559
+ try {
2560
+ const out = [];
2561
+ for (const v of await this.deps.runs()) {
2562
+ if (this.deps.chatOfRun(v.session.id) !== chatId)
2563
+ continue;
2564
+ const url = v.session.deliverUrl;
2565
+ const number = typeof url === 'string' ? prNumberOfUrl(url) : null;
2566
+ if (number === null)
2567
+ continue;
2568
+ const repo = v.session.repo_ref;
2569
+ out.push({ number, url: url, runId: v.session.id, repoRef: typeof repo === 'string' ? repo : null });
2570
+ }
2571
+ return out;
2572
+ }
2573
+ catch (err) {
2574
+ this.log(`[proposals] chat ${chatId}: its runs could not be read for a delivered pull request: ${err instanceof Error ? err.message : String(err)}`);
2575
+ return [];
2576
+ }
2577
+ }
2400
2578
  /** Source availability matters only to a card that shows this input. Keep a failed read a named refusal. */
2401
2579
  async loadJobSources(facts, ctx) {
2402
2580
  const card = CATALOG_V2_CARDS.find((c) => c.id === facts.card);
@@ -2448,10 +2626,16 @@ export class ChatProposals {
2448
2626
  this.reviewAuthorsSeen.delete(k);
2449
2627
  this.reviewAuthorsSeen.set(key, authors);
2450
2628
  }
2451
- const roster = ctx.roster.filter((s) => !authors.authors.includes(s.key));
2629
+ const { seats, unknown } = authors.authors;
2630
+ const roster = ctx.roster.filter((s) => !seats.includes(s.key));
2452
2631
  if (roster.length === 0 || roster.length === ctx.roster.length)
2453
2632
  return ctx;
2454
- return { ...ctx, roster, ...(ctx.pool !== undefined ? { pool: ctx.pool.filter((s) => !authors.authors.includes(s.key)) } : {}) };
2633
+ // crew#1803: the card names the seats it left off and why, in a note of its own (`notes` refuses a seat edit).
2634
+ const off = ctx.roster.filter((s) => seats.includes(s.key)).map((s) => s.name).join(', ');
2635
+ const reviewNote = unknown === undefined
2636
+ ? `${off} left off: authors of this change don't review it`
2637
+ : `${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`;
2638
+ return { ...ctx, roster, reviewNote, ...(ctx.pool !== undefined ? { pool: ctx.pool.filter((s) => !seats.includes(s.key)) } : {}) };
2455
2639
  }
2456
2640
  /** Resolve the revision's shape first, then load only the choices that its input checks need. */
2457
2641
  async mergeJobRevision(parent, edits, ctx) {
@@ -2499,7 +2683,7 @@ export class ChatProposals {
2499
2683
  const words = [r.resolved.brief ?? '', briefOf(facts)].filter((x) => x !== '').join('\n\n');
2500
2684
  const chosen = facts.lead === null && facts.seats === null ? undefined
2501
2685
  : [...new Set([facts.lead, ...(facts.seats ?? [])].filter((k) => k !== null))];
2502
- const made = await this.resolve({ chatId, turnId, seat: ctx.seat, ...(chosen !== undefined ? { helperSeats: chosen } : {}), block: { op: 'entry', entry: seed.id, ...(facts.title !== null ? { title: facts.title } : {}), brief: words, sources: ['chat'], repos: facts.repoRef !== null ? [facts.repoRef] : [] }, records });
2686
+ 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 });
2503
2687
  if (made === null)
2504
2688
  throw new JobRefusal('operation_unavailable', 'studio cannot start a document from a chat on this daemon yet', 409);
2505
2689
  const shape = { card: card.id, option: r.option?.id ?? null, depth: null, by: facts.by, source: facts.source, ...(facts.guess !== undefined ? { guess: facts.guess } : {}) };
@@ -2563,6 +2747,10 @@ export class ChatProposals {
2563
2747
  ctx = { ...ctx, coverage: (keys, bound) => this.deps.coverage(keys, bound, relaunch) };
2564
2748
  }
2565
2749
  ctx = await this.reviewRoster(facts, ctx);
2750
+ // (crew#1840) Words that name a pull request: the ones this chat's runs delivered, so a job asked to change one
2751
+ // updates it (the resolution decides; it is pure).
2752
+ if (ctx.deliveredPrs === undefined && mentionsPullRequest(facts.words))
2753
+ ctx = { ...ctx, deliveredPrs: await this.deliveredPrs(chatId) };
2566
2754
  if (r?.resolved.inputs.some((i) => i.id === 'documents')) {
2567
2755
  if (facts.inputs['documents'] === undefined) {
2568
2756
  const { binding } = bindingOf(records, ctx.turnId ?? '\u0000');
@@ -2634,7 +2822,7 @@ export class ChatProposals {
2634
2822
  }
2635
2823
  const chat = this.jobChat(chatId);
2636
2824
  if (chat === null)
2637
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
2825
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
2638
2826
  // A command names its card (and maybe its option); an alias is the only way to a hidden card.
2639
2827
  let card = body.card;
2640
2828
  let option = body.option;
@@ -2655,7 +2843,8 @@ export class ChatProposals {
2655
2843
  depth: body.depth ?? null,
2656
2844
  words: (body.words ?? '').slice(0, 8000),
2657
2845
  details: [],
2658
- repoRef: null,
2846
+ // crew#1791: the repository the person's words clearly name, else the question asks.
2847
+ repoRef: repoNamedIn(body.words ?? '', chat.repos)?.id ?? null,
2659
2848
  projectId: chat.projectId,
2660
2849
  lead: null,
2661
2850
  seats: null,
@@ -2705,7 +2894,7 @@ export class ChatProposals {
2705
2894
  return { code: 400, body: { code: 'edits_invalid', error: 'only a job proposal is revised this way' } };
2706
2895
  const chat = this.jobChat(chatId);
2707
2896
  if (chat === null)
2708
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
2897
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
2709
2898
  const fromPerson = src.person !== null;
2710
2899
  // Only the person's own press can give up a check.
2711
2900
  const edits = { ...rev.edits };
@@ -2739,7 +2928,7 @@ export class ChatProposals {
2739
2928
  return { code: picked.status, body: { code: 'chat_scope_refused', error: picked.error } };
2740
2929
  const scoped = this.jobChat(chatId);
2741
2930
  if (scoped === null)
2742
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
2931
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
2743
2932
  ctx0 = { ...ctx0, chat: scoped };
2744
2933
  extraNotes.push(`This chat now reads ${picked.name}: you picked it for this job.`);
2745
2934
  }
@@ -3220,7 +3409,7 @@ export class ChatProposals {
3220
3409
  if (folded === undefined) {
3221
3410
  const chat = this.jobChat(chatId);
3222
3411
  if (chat === null)
3223
- return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
3412
+ return { code: 409, body: { code: 'chat_gone', error: CHAT_ENDED } };
3224
3413
  const parent = x.parentPid === null ? undefined : foldProposals(this.deps.records(chatId)).get(x.parentPid);
3225
3414
  let proposal;
3226
3415
  try {
@@ -3386,6 +3575,10 @@ export class ChatProposals {
3386
3575
  return pid;
3387
3576
  // A retry keeps the accepted choices only for edit ids still present on the new head.
3388
3577
  const fresh = base.kind === 'refine' && base.target !== undefined ? await this.refreshTarget(base) : base;
3578
+ // crew#1745: a chat that has ended (closed, or the daemon restarted under the attempt) can't take Try again: its
3579
+ // Go would only answer chat_gone. The card says so and where to go, with no Try again to press.
3580
+ const ended = this.deps.chat(chatId) === null;
3581
+ const again = ended ? '' : base.kind === 'refine' ? ' Try again revises the latest version, and keeps your edits.' : ' Try again fills the same document.';
3389
3582
  const retry = {
3390
3583
  ...fresh,
3391
3584
  ...(base.kind === 'refine' ? { allow: (failed.accepting?.edits?.allow ?? []).filter((id) => fresh.protected?.some((e) => e.id === id)) } : {}),
@@ -3394,10 +3587,10 @@ export class ChatProposals {
3394
3587
  sourceRunId: runId,
3395
3588
  artifactRef,
3396
3589
  reason: base.kind === 'refine'
3397
- ? `The last change was not applied: ${reason}. Try again revises the latest version, and keeps your edits.`
3398
- : `The last attempt ended without a draft: ${reason}. Try again fills the same document.`,
3590
+ ? `The last change was not applied: ${reason}.${again}`
3591
+ : `The last attempt ended without a draft: ${reason}.${again}`,
3399
3592
  // A refine whose edits cannot be read on the new head stays blocked with why (codex A5 r2).
3400
- blocked: fresh !== base ? fresh.blocked : null,
3593
+ blocked: ended ? CHAT_ENDED : fresh !== base ? fresh.blocked : null,
3401
3594
  };
3402
3595
  return this.write(chatId, { at: this.now(), turnId: failed.turnId, kind: 'proposal', proposal: retry }, instance) ? pid : null;
3403
3596
  });
@@ -3408,9 +3601,12 @@ export class ChatProposals {
3408
3601
  * job per chat, work and artifact runs together (DES §4.3).
3409
3602
  */
3410
3603
  async liveJobOf(chatId) {
3604
+ // crew#1779: the run list is read once, and only when a job's check needs it.
3605
+ let read = null;
3606
+ const runsOnce = () => (read ??= this.deps.runs());
3411
3607
  for (const f of foldProposals(this.deps.records(chatId)).values()) {
3412
3608
  const runId = f.state === 'decided' && f.decision === 'go' ? f.result?.runId ?? null : f.state === 'accepting' ? f.accepting?.identity.runId ?? null : null;
3413
- if (runId !== null && (await this.deps.registry.live(f.proposal.kind, runId)))
3609
+ if (runId !== null && (await this.deps.registry.live(f.proposal.kind, runId, runsOnce)))
3414
3610
  return f.proposal.what.label;
3415
3611
  }
3416
3612
  return null;
@@ -3423,10 +3619,19 @@ export class ChatProposals {
3423
3619
  const acc = f?.accepting;
3424
3620
  if (f === undefined || acc === undefined || f.state !== 'accepting')
3425
3621
  return false;
3426
- const found = await this.deps.registry.find(f.proposal.kind, acc.identity);
3622
+ let found;
3623
+ try {
3624
+ found = await this.deps.registry.find(f.proposal.kind, acc.identity);
3625
+ }
3626
+ catch (err) {
3627
+ // A cut still rendering, or a video tool that can't answer, settles at the person's Go again.
3628
+ if (f.proposal.kind === 'cut')
3629
+ return false;
3630
+ throw err;
3631
+ }
3427
3632
  if (found === null)
3428
3633
  return false;
3429
- const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub };
3634
+ const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub, ...(found.version !== undefined ? { version: found.version } : {}) };
3430
3635
  const actor = { id: acc.actor, kind: 'human', trust: 'operator' };
3431
3636
  return this.decided(chatId, f.turnId, pid, actor, 'go', result, acc.resolution, acc.edits, instance);
3432
3637
  });