wicked-crew 0.18.18 → 0.18.20

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 (461) 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/chat-attachments.d.ts.map +1 -1
  11. package/dist/api/chat-attachments.js +69 -19
  12. package/dist/api/chat-attachments.js.map +1 -1
  13. package/dist/api/chat-citations.d.ts.map +1 -1
  14. package/dist/api/chat-citations.js +22 -0
  15. package/dist/api/chat-citations.js.map +1 -1
  16. package/dist/api/chat-context.d.ts +4 -1
  17. package/dist/api/chat-context.d.ts.map +1 -1
  18. package/dist/api/chat-context.js +15 -9
  19. package/dist/api/chat-context.js.map +1 -1
  20. package/dist/api/chat-history.d.ts +13 -0
  21. package/dist/api/chat-history.d.ts.map +1 -1
  22. package/dist/api/chat-history.js +25 -0
  23. package/dist/api/chat-history.js.map +1 -1
  24. package/dist/api/chat-jobs.d.ts +15 -6
  25. package/dist/api/chat-jobs.d.ts.map +1 -1
  26. package/dist/api/chat-jobs.js +48 -19
  27. package/dist/api/chat-jobs.js.map +1 -1
  28. package/dist/api/chat-proposals.d.ts +36 -7
  29. package/dist/api/chat-proposals.d.ts.map +1 -1
  30. package/dist/api/chat-proposals.js +224 -52
  31. package/dist/api/chat-proposals.js.map +1 -1
  32. package/dist/api/chat-scope.d.ts +18 -9
  33. package/dist/api/chat-scope.d.ts.map +1 -1
  34. package/dist/api/chat-scope.js +62 -23
  35. package/dist/api/chat-scope.js.map +1 -1
  36. package/dist/api/cluster-status.js +1 -1
  37. package/dist/api/cluster-status.js.map +1 -1
  38. package/dist/api/codebase-archive.d.ts +4 -3
  39. package/dist/api/codebase-archive.d.ts.map +1 -1
  40. package/dist/api/codebase-archive.js +4 -3
  41. package/dist/api/codebase-archive.js.map +1 -1
  42. package/dist/api/delivery-index.d.ts.map +1 -1
  43. package/dist/api/delivery-index.js +13 -0
  44. package/dist/api/delivery-index.js.map +1 -1
  45. package/dist/api/gate-cache.d.ts +1 -0
  46. package/dist/api/gate-cache.d.ts.map +1 -1
  47. package/dist/api/gate-cache.js +19 -6
  48. package/dist/api/gate-cache.js.map +1 -1
  49. package/dist/api/governance-steering.d.ts +4 -4
  50. package/dist/api/mcp.d.ts +10 -2
  51. package/dist/api/mcp.d.ts.map +1 -1
  52. package/dist/api/mcp.js +54 -13
  53. package/dist/api/mcp.js.map +1 -1
  54. package/dist/api/needs.js +1 -1
  55. package/dist/api/needs.js.map +1 -1
  56. package/dist/api/product.d.ts +1 -1
  57. package/dist/api/proposal-onboard.d.ts +9 -1
  58. package/dist/api/proposal-onboard.d.ts.map +1 -1
  59. package/dist/api/proposal-onboard.js +41 -3
  60. package/dist/api/proposal-onboard.js.map +1 -1
  61. package/dist/api/recording.d.ts +1 -1
  62. package/dist/api/redeliver.d.ts +48 -0
  63. package/dist/api/redeliver.d.ts.map +1 -0
  64. package/dist/api/redeliver.js +178 -0
  65. package/dist/api/redeliver.js.map +1 -0
  66. package/dist/api/requirements.d.ts +2 -16
  67. package/dist/api/requirements.d.ts.map +1 -1
  68. package/dist/api/requirements.js.map +1 -1
  69. package/dist/api/retry-index.d.ts +2 -0
  70. package/dist/api/retry-index.d.ts.map +1 -1
  71. package/dist/api/retry-index.js +16 -8
  72. package/dist/api/retry-index.js.map +1 -1
  73. package/dist/api/roster-standing.d.ts +5 -1
  74. package/dist/api/roster-standing.d.ts.map +1 -1
  75. package/dist/api/roster-standing.js +10 -3
  76. package/dist/api/roster-standing.js.map +1 -1
  77. package/dist/api/routes.d.ts +31 -9
  78. package/dist/api/routes.d.ts.map +1 -1
  79. package/dist/api/routes.js +572 -181
  80. package/dist/api/routes.js.map +1 -1
  81. package/dist/api/run-base-notice.d.ts +5 -0
  82. package/dist/api/run-base-notice.d.ts.map +1 -0
  83. package/dist/api/run-base-notice.js +15 -0
  84. package/dist/api/run-base-notice.js.map +1 -0
  85. package/dist/api/run-documents.d.ts +9 -1
  86. package/dist/api/run-documents.d.ts.map +1 -1
  87. package/dist/api/run-documents.js +63 -5
  88. package/dist/api/run-documents.js.map +1 -1
  89. package/dist/api/run-timing-index.d.ts +2 -0
  90. package/dist/api/run-timing-index.d.ts.map +1 -1
  91. package/dist/api/run-timing-index.js +62 -86
  92. package/dist/api/run-timing-index.js.map +1 -1
  93. package/dist/api/seat-container-login.js +2 -2
  94. package/dist/api/seat-container-login.js.map +1 -1
  95. package/dist/api/seat-probe.d.ts +6 -5
  96. package/dist/api/seat-probe.d.ts.map +1 -1
  97. package/dist/api/seat-probe.js +11 -7
  98. package/dist/api/seat-probe.js.map +1 -1
  99. package/dist/api/seat-standing.js +4 -4
  100. package/dist/api/seat-standing.js.map +1 -1
  101. package/dist/api/server.d.ts.map +1 -1
  102. package/dist/api/server.js +92 -25
  103. package/dist/api/server.js.map +1 -1
  104. package/dist/api/stall-watchdog.d.ts +6 -0
  105. package/dist/api/stall-watchdog.d.ts.map +1 -1
  106. package/dist/api/stall-watchdog.js +28 -0
  107. package/dist/api/stall-watchdog.js.map +1 -1
  108. package/dist/api/system-snapshot.d.ts +5 -0
  109. package/dist/api/system-snapshot.d.ts.map +1 -1
  110. package/dist/api/system-snapshot.js +20 -9
  111. package/dist/api/system-snapshot.js.map +1 -1
  112. package/dist/api/testing.d.ts +2 -2
  113. package/dist/api/ui-text.js +2 -2
  114. package/dist/api/ui-text.js.map +1 -1
  115. package/dist/apps/actions/api-action.js +5 -2
  116. package/dist/apps/actions/api-action.js.map +1 -1
  117. package/dist/apps/actions/write-path.d.ts +9 -0
  118. package/dist/apps/actions/write-path.d.ts.map +1 -1
  119. package/dist/apps/actions/write-path.js +17 -9
  120. package/dist/apps/actions/write-path.js.map +1 -1
  121. package/dist/apps/exec/executor.d.ts +8 -15
  122. package/dist/apps/exec/executor.d.ts.map +1 -1
  123. package/dist/apps/exec/executor.js +10 -3
  124. package/dist/apps/exec/executor.js.map +1 -1
  125. package/dist/apps/exec/redescribe.d.ts +37 -0
  126. package/dist/apps/exec/redescribe.d.ts.map +1 -0
  127. package/dist/apps/exec/redescribe.js +86 -0
  128. package/dist/apps/exec/redescribe.js.map +1 -0
  129. package/dist/apps/exec/source-stage.d.ts +3 -1
  130. package/dist/apps/exec/source-stage.d.ts.map +1 -1
  131. package/dist/apps/exec/source-stage.js +13 -3
  132. package/dist/apps/exec/source-stage.js.map +1 -1
  133. package/dist/apps/exec/sources.d.ts +6 -0
  134. package/dist/apps/exec/sources.d.ts.map +1 -1
  135. package/dist/apps/exec/sources.js +8 -0
  136. package/dist/apps/exec/sources.js.map +1 -1
  137. package/dist/apps/publish/manifest.d.ts +6 -1
  138. package/dist/apps/publish/manifest.d.ts.map +1 -1
  139. package/dist/apps/publish/manifest.js +6 -0
  140. package/dist/apps/publish/manifest.js.map +1 -1
  141. package/dist/apps/publish/run.d.ts +4 -1
  142. package/dist/apps/publish/run.d.ts.map +1 -1
  143. package/dist/apps/publish/run.js +4 -1
  144. package/dist/apps/publish/run.js.map +1 -1
  145. package/dist/apps/routes.d.ts +1 -0
  146. package/dist/apps/routes.d.ts.map +1 -1
  147. package/dist/apps/routes.js +13 -0
  148. package/dist/apps/routes.js.map +1 -1
  149. package/dist/apps-server/Dockerfile +2 -2
  150. package/dist/apps-server/runners/sqlite-runner.mjs +28 -11
  151. package/dist/apps-server/server/lib/bundle/server.mjs +348 -150
  152. package/dist/cli/governance.d.ts +5 -2
  153. package/dist/cli/governance.d.ts.map +1 -1
  154. package/dist/cli/governance.js +8 -5
  155. package/dist/cli/governance.js.map +1 -1
  156. package/dist/cli/index.d.ts +1 -0
  157. package/dist/cli/index.d.ts.map +1 -1
  158. package/dist/cli/index.js +8 -5
  159. package/dist/cli/index.js.map +1 -1
  160. package/dist/cli/service.d.ts +12 -6
  161. package/dist/cli/service.d.ts.map +1 -1
  162. package/dist/cli/service.js +53 -23
  163. package/dist/cli/service.js.map +1 -1
  164. package/dist/core/adapter.d.ts +44 -23
  165. package/dist/core/adapter.d.ts.map +1 -1
  166. package/dist/core/adapter.js +158 -60
  167. package/dist/core/adapter.js.map +1 -1
  168. package/dist/core/assurance.d.ts +37 -44
  169. package/dist/core/assurance.d.ts.map +1 -1
  170. package/dist/core/assurance.js +53 -69
  171. package/dist/core/assurance.js.map +1 -1
  172. package/dist/core/bridge-reaper.d.ts +4 -3
  173. package/dist/core/bridge-reaper.d.ts.map +1 -1
  174. package/dist/core/bridge-reaper.js +24 -8
  175. package/dist/core/bridge-reaper.js.map +1 -1
  176. package/dist/core/deliver-exclusions.d.ts +5 -2
  177. package/dist/core/deliver-exclusions.d.ts.map +1 -1
  178. package/dist/core/deliver-exclusions.js +5 -2
  179. package/dist/core/deliver-exclusions.js.map +1 -1
  180. package/dist/core/deliver-text.d.ts +12 -0
  181. package/dist/core/deliver-text.d.ts.map +1 -1
  182. package/dist/core/deliver-text.js +40 -2
  183. package/dist/core/deliver-text.js.map +1 -1
  184. package/dist/core/deliver.d.ts +27 -0
  185. package/dist/core/deliver.d.ts.map +1 -1
  186. package/dist/core/deliver.js +162 -39
  187. package/dist/core/deliver.js.map +1 -1
  188. package/dist/core/engine-roster.d.ts +2 -0
  189. package/dist/core/engine-roster.d.ts.map +1 -1
  190. package/dist/core/engine-roster.js +13 -0
  191. package/dist/core/engine-roster.js.map +1 -1
  192. package/dist/core/estate-mcp-client.d.ts +13 -14
  193. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  194. package/dist/core/estate-mcp-client.js +47 -62
  195. package/dist/core/estate-mcp-client.js.map +1 -1
  196. package/dist/core/pr-checks-helper.d.ts +8 -4
  197. package/dist/core/pr-checks-helper.d.ts.map +1 -1
  198. package/dist/core/pr-checks-helper.js +39 -17
  199. package/dist/core/pr-checks-helper.js.map +1 -1
  200. package/dist/core/redeliver.d.ts +16 -0
  201. package/dist/core/redeliver.d.ts.map +1 -0
  202. package/dist/core/redeliver.js +64 -0
  203. package/dist/core/redeliver.js.map +1 -0
  204. package/dist/core/repoPaths.d.ts +2 -4
  205. package/dist/core/repoPaths.d.ts.map +1 -1
  206. package/dist/core/repoPaths.js +4 -6
  207. package/dist/core/repoPaths.js.map +1 -1
  208. package/dist/core/threadpool.d.ts +3 -0
  209. package/dist/core/threadpool.d.ts.map +1 -0
  210. package/dist/core/threadpool.js +14 -0
  211. package/dist/core/threadpool.js.map +1 -0
  212. package/dist/core/types.d.ts.map +1 -1
  213. package/dist/core/types.js +2 -0
  214. package/dist/core/types.js.map +1 -1
  215. package/dist/decisions/rules-brief.d.ts +2 -0
  216. package/dist/decisions/rules-brief.d.ts.map +1 -1
  217. package/dist/decisions/rules-brief.js.map +1 -1
  218. package/dist/editors/csp.d.ts +6 -0
  219. package/dist/editors/csp.d.ts.map +1 -1
  220. package/dist/editors/csp.js +10 -0
  221. package/dist/editors/csp.js.map +1 -1
  222. package/dist/editors/pack-install.d.ts.map +1 -1
  223. package/dist/editors/pack-install.js +1 -0
  224. package/dist/editors/pack-install.js.map +1 -1
  225. package/dist/editors/registry.d.ts +5 -1
  226. package/dist/editors/registry.d.ts.map +1 -1
  227. package/dist/editors/registry.js +16 -3
  228. package/dist/editors/registry.js.map +1 -1
  229. package/dist/editors/routes.d.ts +4 -2
  230. package/dist/editors/routes.d.ts.map +1 -1
  231. package/dist/editors/routes.js +23 -6
  232. package/dist/editors/routes.js.map +1 -1
  233. package/dist/evals/shape-corrections.js +1 -1
  234. package/dist/evals/shape-corrections.js.map +1 -1
  235. package/dist/evals/workflow.d.ts.map +1 -1
  236. package/dist/evals/workflow.js +1 -0
  237. package/dist/evals/workflow.js.map +1 -1
  238. package/dist/governance/rule-revision.d.ts +7 -0
  239. package/dist/governance/rule-revision.d.ts.map +1 -0
  240. package/dist/governance/rule-revision.js +23 -0
  241. package/dist/governance/rule-revision.js.map +1 -0
  242. package/dist/insights/review-service.d.ts +2 -0
  243. package/dist/insights/review-service.d.ts.map +1 -1
  244. package/dist/insights/review-service.js +27 -0
  245. package/dist/insights/review-service.js.map +1 -1
  246. package/dist/interactive/bridge-pool.d.ts +2 -0
  247. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  248. package/dist/interactive/bridge-pool.js +12 -4
  249. package/dist/interactive/bridge-pool.js.map +1 -1
  250. package/dist/interactive/chat-events.d.ts +3 -0
  251. package/dist/interactive/chat-events.d.ts.map +1 -1
  252. package/dist/interactive/chat-events.js +13 -4
  253. package/dist/interactive/chat-events.js.map +1 -1
  254. package/dist/interactive/council-outcome.js +1 -1
  255. package/dist/interactive/council-outcome.js.map +1 -1
  256. package/dist/interactive/doc-delete-routes.d.ts +1 -0
  257. package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
  258. package/dist/interactive/doc-delete-routes.js +126 -123
  259. package/dist/interactive/doc-delete-routes.js.map +1 -1
  260. package/dist/interactive/draft-events.d.ts +8 -7
  261. package/dist/interactive/draft-events.d.ts.map +1 -1
  262. package/dist/interactive/draft-events.js +24 -14
  263. package/dist/interactive/draft-events.js.map +1 -1
  264. package/dist/interactive/proposal-create.d.ts +9 -11
  265. package/dist/interactive/proposal-create.d.ts.map +1 -1
  266. package/dist/interactive/proposal-create.js +27 -21
  267. package/dist/interactive/proposal-create.js.map +1 -1
  268. package/dist/interactive/proposal-refine.d.ts +4 -4
  269. package/dist/interactive/proposal-refine.d.ts.map +1 -1
  270. package/dist/interactive/proposal-refine.js +25 -7
  271. package/dist/interactive/proposal-refine.js.map +1 -1
  272. package/dist/interactive/proxy-routes.d.ts +10 -5
  273. package/dist/interactive/proxy-routes.d.ts.map +1 -1
  274. package/dist/interactive/proxy-routes.js +108 -11
  275. package/dist/interactive/proxy-routes.js.map +1 -1
  276. package/dist/interactive/source-packet.d.ts +5 -1
  277. package/dist/interactive/source-packet.d.ts.map +1 -1
  278. package/dist/interactive/source-packet.js +62 -29
  279. package/dist/interactive/source-packet.js.map +1 -1
  280. package/dist/knowledge/adapters/toolbox/memory.d.ts +2 -0
  281. package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -0
  282. package/dist/knowledge/adapters/toolbox/memory.js +43 -0
  283. package/dist/knowledge/adapters/toolbox/memory.js.map +1 -0
  284. package/dist/knowledge/adapters/toolbox/supervisor.d.ts +9 -3
  285. package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
  286. package/dist/knowledge/adapters/toolbox/supervisor.js +40 -6
  287. package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
  288. package/dist/knowledge/gate/gate.d.ts.map +1 -1
  289. package/dist/knowledge/gate/gate.js +4 -1
  290. package/dist/knowledge/gate/gate.js.map +1 -1
  291. package/dist/knowledge/gate/record.d.ts +15 -2
  292. package/dist/knowledge/gate/record.d.ts.map +1 -1
  293. package/dist/knowledge/gate/record.js +108 -29
  294. package/dist/knowledge/gate/record.js.map +1 -1
  295. package/dist/knowledge/registry/entry.d.ts +7 -0
  296. package/dist/knowledge/registry/entry.d.ts.map +1 -1
  297. package/dist/knowledge/registry/entry.js +4 -0
  298. package/dist/knowledge/registry/entry.js.map +1 -1
  299. package/dist/learn/scheduler.d.ts.map +1 -1
  300. package/dist/learn/scheduler.js +2 -1
  301. package/dist/learn/scheduler.js.map +1 -1
  302. package/dist/learnings/estate.d.ts.map +1 -1
  303. package/dist/learnings/estate.js +3 -14
  304. package/dist/learnings/estate.js.map +1 -1
  305. package/dist/learnings/extract.d.ts +7 -12
  306. package/dist/learnings/extract.d.ts.map +1 -1
  307. package/dist/learnings/extract.js +9 -40
  308. package/dist/learnings/extract.js.map +1 -1
  309. package/dist/learnings/service.d.ts +12 -15
  310. package/dist/learnings/service.d.ts.map +1 -1
  311. package/dist/learnings/service.js +23 -43
  312. package/dist/learnings/service.js.map +1 -1
  313. package/dist/mcp/broker.js +1 -1
  314. package/dist/mcp/broker.js.map +1 -1
  315. package/dist/mcp/env.d.ts +12 -4
  316. package/dist/mcp/env.d.ts.map +1 -1
  317. package/dist/mcp/env.js +27 -7
  318. package/dist/mcp/env.js.map +1 -1
  319. package/dist/mcp/estate-relay.d.ts.map +1 -1
  320. package/dist/mcp/estate-relay.js +2 -4
  321. package/dist/mcp/estate-relay.js.map +1 -1
  322. package/dist/mcp/invoke.d.ts.map +1 -1
  323. package/dist/mcp/invoke.js +4 -3
  324. package/dist/mcp/invoke.js.map +1 -1
  325. package/dist/mcp/probe.d.ts +14 -1
  326. package/dist/mcp/probe.d.ts.map +1 -1
  327. package/dist/mcp/probe.js +55 -10
  328. package/dist/mcp/probe.js.map +1 -1
  329. package/dist/mcp/registry-store.d.ts +12 -0
  330. package/dist/mcp/registry-store.d.ts.map +1 -1
  331. package/dist/mcp/registry-store.js +10 -0
  332. package/dist/mcp/registry-store.js.map +1 -1
  333. package/dist/mcp/registry.d.ts +13 -5
  334. package/dist/mcp/registry.d.ts.map +1 -1
  335. package/dist/mcp/registry.js +64 -12
  336. package/dist/mcp/registry.js.map +1 -1
  337. package/dist/mcp/rest.js +1 -1
  338. package/dist/mcp/rest.js.map +1 -1
  339. package/dist/mcp/secrets.d.ts +1 -1
  340. package/dist/mcp/secrets.d.ts.map +1 -1
  341. package/dist/mcp/secrets.js +10 -11
  342. package/dist/mcp/secrets.js.map +1 -1
  343. package/dist/mcp/upstream-error.d.ts +1 -1
  344. package/dist/mcp/upstream-error.d.ts.map +1 -1
  345. package/dist/projects/auto-refresh.d.ts +21 -0
  346. package/dist/projects/auto-refresh.d.ts.map +1 -1
  347. package/dist/projects/auto-refresh.js +55 -1
  348. package/dist/projects/auto-refresh.js.map +1 -1
  349. package/dist/projects/graph.d.ts +49 -2
  350. package/dist/projects/graph.d.ts.map +1 -1
  351. package/dist/projects/graph.js +334 -23
  352. package/dist/projects/graph.js.map +1 -1
  353. package/dist/projects/repo-watch.d.ts +2 -2
  354. package/dist/projects/repo-watch.d.ts.map +1 -1
  355. package/dist/projects/repo-watch.js +26 -9
  356. package/dist/projects/repo-watch.js.map +1 -1
  357. package/dist/projects/routes.d.ts +2 -0
  358. package/dist/projects/routes.d.ts.map +1 -1
  359. package/dist/projects/routes.js +50 -1
  360. package/dist/projects/routes.js.map +1 -1
  361. package/dist/projects/state-home-registry.d.ts.map +1 -1
  362. package/dist/projects/state-home-registry.js +3 -0
  363. package/dist/projects/state-home-registry.js.map +1 -1
  364. package/dist/projects/state-home.d.ts +7 -0
  365. package/dist/projects/state-home.d.ts.map +1 -1
  366. package/dist/projects/state-home.js +11 -0
  367. package/dist/projects/state-home.js.map +1 -1
  368. package/dist/qe/author-workflow.d.ts +4 -0
  369. package/dist/qe/author-workflow.d.ts.map +1 -1
  370. package/dist/qe/author-workflow.js +4 -0
  371. package/dist/qe/author-workflow.js.map +1 -1
  372. package/dist/qe/test-sets.d.ts +4 -5
  373. package/dist/qe/test-sets.d.ts.map +1 -1
  374. package/dist/qe/test-sets.js +2 -1
  375. package/dist/qe/test-sets.js.map +1 -1
  376. package/dist/schedules/scheduler.d.ts +40 -1
  377. package/dist/schedules/scheduler.d.ts.map +1 -1
  378. package/dist/schedules/scheduler.js +175 -13
  379. package/dist/schedules/scheduler.js.map +1 -1
  380. package/dist/schedules/store.d.ts +20 -0
  381. package/dist/schedules/store.d.ts.map +1 -1
  382. package/dist/schedules/store.js +17 -0
  383. package/dist/schedules/store.js.map +1 -1
  384. package/dist/sources/ask.d.ts.map +1 -1
  385. package/dist/sources/ask.js +12 -12
  386. package/dist/sources/ask.js.map +1 -1
  387. package/dist/sources/dialer.d.ts +6 -1
  388. package/dist/sources/dialer.d.ts.map +1 -1
  389. package/dist/sources/dialer.js +53 -31
  390. package/dist/sources/dialer.js.map +1 -1
  391. package/dist/sources/drivers/mysql.d.ts +2 -0
  392. package/dist/sources/drivers/mysql.d.ts.map +1 -1
  393. package/dist/sources/drivers/mysql.js +18 -2
  394. package/dist/sources/drivers/mysql.js.map +1 -1
  395. package/dist/sources/drivers/postgres.d.ts +2 -0
  396. package/dist/sources/drivers/postgres.d.ts.map +1 -1
  397. package/dist/sources/drivers/postgres.js +10 -3
  398. package/dist/sources/drivers/postgres.js.map +1 -1
  399. package/dist/sources/drivers/sqlite.d.ts +22 -5
  400. package/dist/sources/drivers/sqlite.d.ts.map +1 -1
  401. package/dist/sources/drivers/sqlite.js +10 -9
  402. package/dist/sources/drivers/sqlite.js.map +1 -1
  403. package/dist/sources/drivers/types.d.ts +3 -1
  404. package/dist/sources/drivers/types.d.ts.map +1 -1
  405. package/dist/sources/drivers/types.js +3 -1
  406. package/dist/sources/drivers/types.js.map +1 -1
  407. package/dist/sources/routes.js +1 -1
  408. package/dist/sources/routes.js.map +1 -1
  409. package/dist/sources/uploads.d.ts +2 -15
  410. package/dist/sources/uploads.d.ts.map +1 -1
  411. package/dist/sources/uploads.js +30 -440
  412. package/dist/sources/uploads.js.map +1 -1
  413. package/dist/standing-orders/history.d.ts +5 -3
  414. package/dist/standing-orders/history.d.ts.map +1 -1
  415. package/dist/standing-orders/history.js +6 -2
  416. package/dist/standing-orders/history.js.map +1 -1
  417. package/dist/standing-orders/parse.js +1 -1
  418. package/dist/standing-orders/parse.js.map +1 -1
  419. package/dist/studio/apps-standalone/fixture.js +3 -3
  420. package/dist/studio/apps-standalone/runtime.js +1 -1
  421. package/dist/studio/assets/{KnowledgeGraph-JfsMExo3.js → KnowledgeGraph-dfq7Flyj.js} +1 -1
  422. package/dist/studio/assets/index-Bame65hj.js +1108 -0
  423. package/dist/studio/assets/index-CtB1BJRI.css +32 -0
  424. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  425. package/dist/studio/editors/wicked-apps/index.html +2 -2
  426. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  427. package/dist/studio/editors/wicked-deck/index.html +14 -14
  428. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  429. package/dist/studio/editors/wicked-doc/index.html +12 -12
  430. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  431. package/dist/studio/editors/wicked-insights/index.html +2 -2
  432. package/dist/studio/editors/wicked-page/editor.json +1 -1
  433. package/dist/studio/editors/wicked-page/index.html +12 -12
  434. package/dist/studio/editors/wicked-video/editor.json +1 -1
  435. package/dist/studio/editors/wicked-video/index.html +10 -10
  436. package/dist/studio/index.html +2 -2
  437. package/dist/studio/testid-inventory.json +432 -11
  438. package/dist/team/routes.d.ts +11 -1
  439. package/dist/team/routes.d.ts.map +1 -1
  440. package/dist/team/routes.js +6 -3
  441. package/dist/team/routes.js.map +1 -1
  442. package/dist/workflow-catalog/catalog-data-v2.d.ts +6 -2
  443. package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
  444. package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
  445. package/dist/workflow-catalog/shape.d.ts +1 -1
  446. package/dist/working-doc/event-lines.d.ts +11 -0
  447. package/dist/working-doc/event-lines.d.ts.map +1 -1
  448. package/dist/working-doc/event-lines.js +32 -5
  449. package/dist/working-doc/event-lines.js.map +1 -1
  450. package/dist/working-doc/notes-index.d.ts.map +1 -1
  451. package/dist/working-doc/notes-index.js +2 -2
  452. package/dist/working-doc/notes-index.js.map +1 -1
  453. package/endpoint-manifest.json +114 -6
  454. package/evals/corpora/shape-v1.json +1 -1
  455. package/package.json +4 -4
  456. package/runners/sqlite-runner.mjs +28 -11
  457. package/runners/upload-parse.d.mts +13 -0
  458. package/runners/upload-parse.mjs +364 -0
  459. package/workflows/distill-learnings.json +2 -2
  460. package/dist/studio/assets/index-CkosDNYp.css +0 -32
  461. package/dist/studio/assets/index-pq0QeOmo.js +0 -1109
@@ -41,7 +41,7 @@ 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
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';
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
45
  import { artifactExists, artifactHead, 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';
@@ -314,6 +314,16 @@ class KeyedLock {
314
314
  return next;
315
315
  }
316
316
  }
317
+ /** A launch refused before starting anything; the caller can correct the open card and try again. */
318
+ export class LaunchRefusal extends Error {
319
+ status;
320
+ body;
321
+ constructor(status, body) {
322
+ super(typeof body['error'] === 'string' ? body['error'] : 'The launch was refused.');
323
+ this.status = status;
324
+ this.body = body;
325
+ }
326
+ }
317
327
  /**
318
328
  * DES §4.3 step 3: ONE launcher per run id. `launchOnce` takes the run id's lock, asks the operation's launcher whether
319
329
  * that run exists (adopt), and starts it only if not — so a retry, a second tab and a late bus trigger (A3 calls this
@@ -605,6 +615,12 @@ export function isJobCardEntry(block) {
605
615
  const card = CATALOG_V2_CARDS.find((c) => c.id === block.entry);
606
616
  return (card !== undefined && detectable(card)) || block.option !== undefined || block.confidence !== undefined;
607
617
  }
618
+ /** A document title must occur in the person's own turn. */
619
+ function ownTitle(title, words) {
620
+ const plain = (s) => s.replace(/['"‘’“”]/gu, '').replace(/\s+/gu, ' ').trim().toLowerCase();
621
+ const named = plain(title);
622
+ return named !== '' && plain(words).includes(named);
623
+ }
608
624
  /** The person's own words of ONE turn (the message the seat's block answers). */
609
625
  function turnWords(records, turnId) {
610
626
  const r = records.find((x) => x.kind === 'user' && x.turnId === turnId && x.owner === true);
@@ -656,8 +672,8 @@ function keepReshape(next, from) {
656
672
  export class ChatProposals {
657
673
  deps;
658
674
  lock = new KeyedLock();
659
- /** (F1/F2) The last `newWorkSeats` read's refusal (`null` = it read): what a proposal broadcast reads blocked by. */
660
- seatsRefusal = null;
675
+ /** Frames publish in append order after reading the live seat setting. */
676
+ publishing = Promise.resolve();
661
677
  /** Per chat: resolutions publish in the order their replies were folded (a slow one never lands after a newer one). */
662
678
  order = new KeyedLock();
663
679
  pending = new Set();
@@ -709,6 +725,7 @@ export class ChatProposals {
709
725
  async settled() {
710
726
  while (this.pending.size > 0)
711
727
  await Promise.all([...this.pending]);
728
+ await this.publishing;
712
729
  }
713
730
  /**
714
731
  * A seat's reply was folded with the `wicked-make` bodies cut from it. Resolution reads crew's records (it awaits),
@@ -811,11 +828,14 @@ export class ChatProposals {
811
828
  return false;
812
829
  }
813
830
  const projectId = this.deps.projectOf(chatId);
814
- // A new proposal record reads as served: blocked while `newWorkSeats` can't be honored (the last read, made while
815
- // drawing it). The transcript keeps the card as drawn.
816
- const served = record.kind === 'proposal' ? this.seatsBlocked(record, this.seatsRefusal, () => true) : record;
817
- const frame = { type: 'chatProposal', chat: chatId, turn_id: record.turnId, record: served, ...(projectId !== null ? { project_id: projectId } : {}) };
818
- this.deps.broadcast(frame);
831
+ this.publishing = this.publishing.then(async () => {
832
+ const { refusal } = await this.seatPool();
833
+ if (this.deps.instanceOf(chatId) !== instance)
834
+ return;
835
+ const served = this.seatsBlocked(record, refusal ?? null, () => true);
836
+ const frame = { type: 'chatProposal', chat: chatId, turn_id: record.turnId, record: served, ...(projectId !== null ? { project_id: projectId } : {}) };
837
+ this.deps.broadcast(frame);
838
+ }).catch((err) => this.log(`[proposals] chat ${chatId}: ${record.kind} broadcast failed: ${err instanceof Error ? err.message : String(err)}`));
819
839
  return true;
820
840
  }
821
841
  /**
@@ -903,10 +923,8 @@ export class ChatProposals {
903
923
  }
904
924
  }
905
925
  }
906
- // A5: a change works from the document and the person's words; extra sources do not reach its run yet, so the
907
- // card says so instead of showing them as used (codex A5 r1).
908
- 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);
909
- const { helpers, block: helperBlock } = await this.docHelpers(chat);
926
+ const sources = await this.resolveSources(block.sources, { chatId, turnId, records, binding, turnHas, chat, words, personNamed: false });
927
+ const { helpers, block: helperBlock, seatsUnread } = await this.docHelpers(chat);
910
928
  if (helperBlock !== null)
911
929
  blocked.push(helperBlock);
912
930
  const title = target?.title ?? (ref !== null ? humanDoc(ref.doc) : block.refine);
@@ -918,11 +936,13 @@ export class ChatProposals {
918
936
  sources,
919
937
  repos: [],
920
938
  helpers,
939
+ ...(seatsUnread ? { seatsUnread: true } : {}),
921
940
  time: await this.timeOf('refine', null, projectId),
922
941
  stops: STOPS.refine,
923
942
  filedIn: await filedIn(projectId),
924
943
  ...(target !== undefined ? { target } : {}),
925
944
  ...(block.touches.length > 0 ? { touches: block.touches } : {}),
945
+ ...(binding?.artifact !== undefined && binding.artifact.ref === ref?.ref ? { anchors: [...binding.artifact.anchors] } : {}),
926
946
  ...(protectedList !== undefined ? { protected: protectedList } : {}),
927
947
  blocked: blocked[0] ?? null,
928
948
  };
@@ -978,7 +998,7 @@ export class ChatProposals {
978
998
  demo = { url, audience: block.audience ?? null, show: block.show ?? null };
979
999
  }
980
1000
  const sources = kind === 'create' ? await this.resolveSources(block.sources, { chatId, turnId, records, binding, turnHas, chat, words, personNamed: false }) : [];
981
- const { helpers, block: helperBlock } = await this.docHelpers(chat);
1001
+ const { helpers, block: helperBlock, seatsUnread } = await this.docHelpers(chat, input.helperSeats);
982
1002
  if (helperBlock !== null)
983
1003
  blocked.push(helperBlock);
984
1004
  return {
@@ -995,6 +1015,7 @@ export class ChatProposals {
995
1015
  repos,
996
1016
  ...(repoRefs.length > 0 ? { repoRefs } : {}),
997
1017
  helpers,
1018
+ ...(seatsUnread ? { seatsUnread: true } : {}),
998
1019
  time: await this.timeOf(kind, seed ?? null, chat.projectId),
999
1020
  stops: STOPS[kind],
1000
1021
  filedIn: await filedIn(chat.projectId),
@@ -1283,6 +1304,9 @@ export class ChatProposals {
1283
1304
  if (body.power !== undefined && (kind !== 'job' || body.decision !== 'go')) {
1284
1305
  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' } };
1285
1306
  }
1307
+ if (body.reducedAssurance !== undefined && (kind !== 'job' || body.decision !== 'go')) {
1308
+ 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' } };
1309
+ }
1286
1310
  const reread = () => foldProposals(this.deps.records(chatId)).get(pid) ?? folded;
1287
1311
  const ok = (f) => ({ code: 200, body: { view: viewOf(f) } });
1288
1312
  // 1. What already happened, before any state check.
@@ -1316,6 +1340,16 @@ export class ChatProposals {
1316
1340
  if (stale !== null)
1317
1341
  return stale;
1318
1342
  }
1343
+ if (kind === 'job') {
1344
+ const can = new Set(this.deps.rosterEligible().map((s) => s.key));
1345
+ const lost = (acc.resolution.seats?.keys ?? []).filter((k) => !can.has(k));
1346
+ if (lost.length > 0) {
1347
+ const reopened = this.reopenLaunch(chatId, folded, acc.resolution, instance);
1348
+ if (reopened === null)
1349
+ return this.gone(chatId);
1350
+ return { code: 409, body: { code: 'helper_unavailable', error: `${lost.join(' and ')} can't work now; change who works on it`, view: viewOf(reopened) } };
1351
+ }
1352
+ }
1319
1353
  // Go again: the frozen choices and identity, re-checked. Only the helpers may change (one may have signed out
1320
1354
  // since); everything else stays as accepted.
1321
1355
  let again = acc.resolution;
@@ -1332,6 +1366,8 @@ export class ChatProposals {
1332
1366
  throw err;
1333
1367
  }
1334
1368
  }
1369
+ if (body.reducedAssurance === true)
1370
+ again = { ...again, reducedAssurance: true };
1335
1371
  return this.go(chatId, folded, again, again === acc.resolution ? acc.edits : { ...(acc.edits ?? {}), ...body.edits }, acc.identity, actor, instance, body.power);
1336
1372
  }
1337
1373
  if (folded.state === 'superseded') {
@@ -1368,6 +1404,10 @@ export class ChatProposals {
1368
1404
  if (stale !== null)
1369
1405
  return stale;
1370
1406
  }
1407
+ // Check the setting and redraw a card drawn during a refusal before edits or old-seat checks.
1408
+ const seatsRefused = await this.lock.run(`chat\u0000${instance ?? chatId}`, () => this.seatsSettingRefusal(chatId, folded.proposal, folded, instance));
1409
+ if (seatsRefused !== null)
1410
+ return seatsRefused;
1371
1411
  if (kind === 'job') {
1372
1412
  // A reshape starts only through its own transition (the held plan answered Reject first; codex r3).
1373
1413
  // The seats the proposal names can still work, before any edit re-resolves them (codex r3).
@@ -1387,14 +1427,11 @@ export class ChatProposals {
1387
1427
  return this.refusalOf(err);
1388
1428
  throw err;
1389
1429
  }
1390
- // (F1/F2) A job's seats and a document's helpers come from `newWorkSeats`: checked here before the card's own block (the
1391
- // setting is the cause to fix first), and again in `goLocked` for every launch path.
1392
- const seatsRefused = await this.seatsSettingRefusal(effective, folded);
1393
- if (seatsRefused !== null)
1394
- return seatsRefused;
1395
1430
  if (effective.blocked !== null) {
1396
1431
  return { code: 409, body: { code: 'proposal_blocked', error: effective.blocked, view: viewOf(folded) } };
1397
1432
  }
1433
+ if (body.reducedAssurance === true)
1434
+ effective = { ...effective, reducedAssurance: true };
1398
1435
  return this.go(chatId, folded, effective, body.edits ?? null, this.identityOf(effective), actor, instance, body.power);
1399
1436
  }
1400
1437
  /**
@@ -1402,11 +1439,19 @@ export class ChatProposals {
1402
1439
  * proposals of one chat (or two chats changing one document) can never both pass the busy check.
1403
1440
  */
1404
1441
  go(chatId, folded, resolution, edits, identity, actor, instance, power) {
1405
- const docKey = (resolution.kind === 'refine' || (resolution.kind === 'create' && resolution.artifactRef !== undefined)) && identity.artifactRef !== null ? identity.artifactRef : null;
1442
+ const docKey = identity.artifactRef;
1406
1443
  // Keyed by the chat's instance (shared by its original id and an ended chat's archived alias), else its id.
1407
1444
  return this.lock.run(`chat\u0000${instance ?? chatId}`, () => docKey === null
1408
1445
  ? this.goLocked(chatId, folded, resolution, edits, identity, actor, instance, power)
1409
- : this.lock.run(`doc\u0000${docKey}`, () => this.goLocked(chatId, folded, resolution, edits, identity, actor, instance, power)));
1446
+ : this.admitDocument(docKey, () => this.goLocked(chatId, folded, resolution, edits, identity, actor, instance, power)));
1447
+ }
1448
+ /** Share Go's admission with other actions on this chat instance. */
1449
+ admitChat(chatId, fn) {
1450
+ return this.lock.run(`chat\u0000${this.deps.instanceOf(chatId) ?? chatId}`, fn);
1451
+ }
1452
+ /** A create, refine or retirement of the same document waits for the previous admission. */
1453
+ admitDocument(ref, fn) {
1454
+ return this.lock.run(`doc\u0000${ref}`, fn);
1410
1455
  }
1411
1456
  async goLocked(chatId, folded, resolution, edits, identity, actor, instance, power) {
1412
1457
  const kind = resolution.kind;
@@ -1427,7 +1472,7 @@ export class ChatProposals {
1427
1472
  }
1428
1473
  // (F1/F2) Every launch path (a fresh Go, Go again, a reshape) re-reads `newWorkSeats` before anything is answered or
1429
1474
  // recorded: set but unreadable or invalid refuses with its code, never starting the seats drawn without the pick.
1430
- const seatsRefused = await this.seatsSettingRefusal(resolution, folded);
1475
+ const seatsRefused = await this.seatsSettingRefusal(chatId, resolution, folded, instance);
1431
1476
  if (seatsRefused !== null)
1432
1477
  return seatsRefused;
1433
1478
  // The helpers can still work (one may have signed out since the card was drawn).
@@ -1533,6 +1578,18 @@ export class ChatProposals {
1533
1578
  result = await this.deps.registry.launchOnce({ kind, pid, chatId, actor, identity, resolution, ...(power !== undefined ? { power } : {}) });
1534
1579
  }
1535
1580
  catch (err) {
1581
+ if (err instanceof LaunchRefusal) {
1582
+ const reopened = this.reopenLaunch(chatId, folded, resolution, instance);
1583
+ if (reopened === null)
1584
+ return this.gone(chatId);
1585
+ this.deps.audit('chat.proposal.launch_refused', actor, { chatId, pid, code: err.body['code'], error: err.message });
1586
+ return { code: err.status, body: {
1587
+ code: err.body['code'], error: err.message,
1588
+ ...(err.body['excluded'] !== undefined ? { excluded: err.body['excluded'] } : {}),
1589
+ ...(err.body['retryWith'] !== undefined ? { retryWith: err.body['retryWith'] } : {}),
1590
+ view: viewOf(reopened),
1591
+ } };
1592
+ }
1536
1593
  // Accepting stays recorded: the card shows "Interrupted · Go again", which resumes the same identity.
1537
1594
  const msg = err instanceof Error ? err.message : String(err);
1538
1595
  this.deps.audit('chat.proposal.launch_failed', actor, { chatId, pid, error: msg, ...(power !== undefined ? { power } : {}) });
@@ -1544,6 +1601,17 @@ export class ChatProposals {
1544
1601
  const after = foldProposals(this.deps.records(chatId)).get(pid) ?? folded;
1545
1602
  return { code: 200, body: { view: viewOf(after) } };
1546
1603
  }
1604
+ reopenLaunch(chatId, folded, resolution, instance) {
1605
+ const proposal = { ...resolution };
1606
+ // A Go-only opt-in belongs to that attempt; a reshape card keeps its own prior choice.
1607
+ if (folded.proposal.reducedAssurance === true)
1608
+ proposal.reducedAssurance = true;
1609
+ else
1610
+ delete proposal.reducedAssurance;
1611
+ if (!this.write(chatId, { at: this.now(), turnId: folded.turnId, kind: 'proposal', proposal }, instance))
1612
+ return null;
1613
+ return foldProposals(this.deps.records(chatId)).get(resolution.pid) ?? null;
1614
+ }
1547
1615
  /** Record the answer (and audit exactly what was answered); `false` when the chat is no longer this instance. */
1548
1616
  decided(chatId, turnId, pid, actor, decision, result, resolution, edits, instance, power) {
1549
1617
  if (!this.write(chatId, { at: this.now(), turnId, kind: 'proposal_decided', pid, actor: actor.id, decision, result }, instance))
@@ -1571,7 +1639,7 @@ export class ChatProposals {
1571
1639
  async onNewHead(p) {
1572
1640
  if (p.kind !== 'refine' || p.target === undefined)
1573
1641
  return p;
1574
- const kept = await this.protectedOf(p.target.ref, p.target.base, p.touches ?? []);
1642
+ const kept = await this.protectedOf(p.target.ref, p.target.base, [...(p.touches ?? []), ...(p.anchors ?? [])]);
1575
1643
  return 'error' in kept ? { ...p, protected: [], blocked: kept.error } : { ...p, protected: kept.entries, blocked: p.blocked };
1576
1644
  }
1577
1645
  /** The identity a Go is named by (DES §4.3 step 2). */
@@ -1949,6 +2017,7 @@ export class ChatProposals {
1949
2017
  inputs['url'] = { kind: 'url', value: block.url };
1950
2018
  const facts = {
1951
2019
  card: g.card,
2020
+ title: block.title !== undefined && ownTitle(block.title, words) ? block.title : null,
1952
2021
  option: g.option,
1953
2022
  depth: g.depth,
1954
2023
  words,
@@ -2188,7 +2257,7 @@ export class ChatProposals {
2188
2257
  const open = [...foldProposals(this.deps.records(chatId)).values()].find((f) => (f.state === 'open' || f.state === 'revising') && f.proposal.shape !== undefined);
2189
2258
  if (open !== undefined) {
2190
2259
  const p = open.proposal;
2191
- 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 ?? []) };
2260
+ 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 ?? []) };
2192
2261
  }
2193
2262
  const job = this.launchedJob(chatId);
2194
2263
  if (job !== null && this.deps.heldPlan !== undefined) {
@@ -2214,32 +2283,62 @@ export class ChatProposals {
2214
2283
  * (OpenCode), which are kept only when no other seat can work (crew#1590). A setting that is set but can't be read,
2215
2284
  * or is invalid, is a LIVE state, never a stored one: `refusal`, and the card is drawn as if nothing were picked,
2216
2285
  * but it reads blocked with the reason wherever it is served (`withSeatsSetting`) and Start refuses it
2217
- * (`seatsSettingRefusal`) until the setting reads again. Fixing the setting lifts the block everywhere at once;
2218
- * nothing on the transcript has to change.
2286
+ * (`seatsSettingRefusal`) until the setting reads again. Cards drawn during the refusal are marked so Start
2287
+ * redraws their seats after repair, before the person can launch them.
2219
2288
  */
2220
2289
  async seatPool() {
2221
2290
  if (this.deps.newWorkSeats === undefined)
2222
2291
  return jobSeatPool(this.deps.rosterEligible(), null);
2223
2292
  try {
2224
- const pool = jobSeatPool(this.deps.rosterEligible(), await this.deps.newWorkSeats());
2225
- this.seatsRefusal = null;
2226
- return pool;
2293
+ return jobSeatPool(this.deps.rosterEligible(), await this.deps.newWorkSeats());
2227
2294
  }
2228
2295
  catch (err) {
2229
2296
  const refusal = err instanceof NewWorkSeatsRefusal
2230
2297
  ? { code: err.code, message: err.message }
2231
2298
  : { code: 'settings_unavailable', message: `crew can't read which seats new work may use (newWorkSeats): ${err instanceof Error ? err.message : String(err)}; it won't start new work on every seat instead. ${NEW_WORK_SEATS_FIX[0].toUpperCase()}${NEW_WORK_SEATS_FIX.slice(1)}` };
2232
- this.seatsRefusal = refusal;
2233
2299
  return { ...jobSeatPool(this.deps.rosterEligible(), null), refusal };
2234
2300
  }
2235
2301
  }
2236
- /** (F1/F2) A seated proposal refused at Start, fresh or again, while `newWorkSeats` is set but unreadable or invalid;
2237
- * `null` when it starts no seat or the setting reads. */
2238
- async seatsSettingRefusal(p, folded) {
2302
+ /** Refuse an unreadable setting, or redraw a card that was drawn without it. Called under the chat lock. */
2303
+ async seatsSettingRefusal(chatId, p, folded, instance) {
2239
2304
  if (!SEATED_KINDS.has(p.kind))
2240
2305
  return null;
2241
- const { refusal } = await this.seatPool();
2242
- return refusal === undefined ? null : { code: 409, body: { code: refusal.code, error: refusal.message, view: viewOf(folded) } };
2306
+ const { pool, refusal } = await this.seatPool();
2307
+ if (refusal !== undefined)
2308
+ return { code: 409, body: { code: refusal.code, error: refusal.message, view: viewOf(folded) } };
2309
+ if (!p.seatsUnread && !folded.proposal.seatsUnread)
2310
+ return null;
2311
+ const current = foldProposals(this.deps.records(chatId)).get(p.pid);
2312
+ if (current === undefined || current.state !== folded.state) {
2313
+ return { code: 409, body: { code: 'proposal_stale', error: 'this proposal changed; check the card again', ...(current !== undefined ? { view: viewOf(current) } : {}) } };
2314
+ }
2315
+ const recorded = current.accepting?.resolution ?? current.proposal;
2316
+ if (recorded.seatsUnread) {
2317
+ const base = { ...recorded };
2318
+ delete base.seatsUnread;
2319
+ let fresh;
2320
+ if (recorded.shape !== undefined) {
2321
+ const chat = this.jobChat(chatId) ?? {
2322
+ projectId: recorded.filedIn.projectId,
2323
+ repos: (recorded.repoRefs ?? []).map((id, i) => ({ id, name: recorded.repos[i] ?? id })),
2324
+ lead: null, seats: [],
2325
+ };
2326
+ const ctx = await this.jobContext(chatId, recorded.pid, recorded.turnId, recorded.seat, chat, {
2327
+ revises: recorded.revises ?? null, lineage: recorded.lineage ?? recorded.pid, notes: [],
2328
+ ...(recorded.request !== undefined ? { request: recorded.request } : {}),
2329
+ ...(recorded.answers !== undefined ? { answers: recorded.answers } : {}),
2330
+ });
2331
+ fresh = { ...base, ...keepReshape(await this.proposalOf(chatId, recorded.pid, { ...factsOf(recorded), lead: null, seats: null }, ctx, this.deps.records(chatId), true, recorded), recorded) };
2332
+ }
2333
+ else {
2334
+ const helpers = this.helpers({ lead: null, seats: [] }, undefined, pool);
2335
+ fresh = { ...base, helpers, blocked: helpers === null ? NEEDS_HELPER : recorded.blocked === NEEDS_HELPER ? null : recorded.blocked };
2336
+ }
2337
+ if (!this.write(chatId, { at: this.now(), turnId: current.turnId, kind: 'proposal', proposal: fresh }, instance))
2338
+ return this.gone(chatId);
2339
+ }
2340
+ const after = foldProposals(this.deps.records(chatId)).get(p.pid);
2341
+ return { code: 409, body: { code: 'seats_redrawn', error: 'the seats setting reads again; check the redrawn card and press Start', view: viewOf(after) } };
2243
2342
  }
2244
2343
  /** (F1/F2) A proposal view as it is served: an open job or document reads blocked while `newWorkSeats` can't be
2245
2344
  * honored (read now), exactly as `withSeatsSetting` serves its record. */
@@ -2275,10 +2374,12 @@ export class ChatProposals {
2275
2374
  return records.map((r) => this.seatsBlocked(r, refusal, open));
2276
2375
  }
2277
2376
  /** A document's two default helpers from the pool, and the line that blocks it when there are none. */
2278
- async docHelpers(chat) {
2279
- const { pool } = await this.seatPool();
2280
- const helpers = this.helpers(chat, undefined, pool);
2281
- return { helpers, block: helpers === null ? NEEDS_HELPER : null };
2377
+ async docHelpers(chat, chosen) {
2378
+ const { pool, refusal } = await this.seatPool();
2379
+ 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);
2381
+ const helpers = this.helpers(chat, seats, pool);
2382
+ return { helpers, block: helpers === null ? NEEDS_HELPER : null, ...(refusal !== undefined ? { seatsUnread: true } : {}) };
2282
2383
  }
2283
2384
  async jobContext(chatId, pid, turnId, seat, chat, extra) {
2284
2385
  if (this.deps.served === undefined)
@@ -2293,8 +2394,8 @@ export class ChatProposals {
2293
2394
  const projectLabel = chat.projectId === null ? 'Not in a project · this chat' : ((await this.deps.projectName(chat.projectId)) ?? chat.projectId);
2294
2395
  const qeOff = (await this.deps.qeOff?.().catch(() => false)) === true;
2295
2396
  const powerPresets = (await this.deps.powerPresets?.(chat.projectId).catch(() => null)) ?? null;
2296
- const { eligible: roster, pool } = await this.seatPool();
2297
- return { chatId, pid, turnId, seat, chat, served, roster, pool, projectLabel, qeOff, powerPresets, ...extra };
2397
+ const { eligible: roster, pool, refusal } = await this.seatPool();
2398
+ 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 } : {}) };
2298
2399
  }
2299
2400
  /** Source availability matters only to a card that shows this input. Keep a failed read a named refusal. */
2300
2401
  async loadJobSources(facts, ctx) {
@@ -2396,10 +2497,21 @@ export class ChatProposals {
2396
2497
  const turnId = ctx.turnId ?? `person:${pid.slice(pid.lastIndexOf(':') + 1)}`;
2397
2498
  // Crew's kind line goes first, as `withBriefLines` puts it on a run: a long request is cut at its end, never the line.
2398
2499
  const words = [r.resolved.brief ?? '', briefOf(facts)].filter((x) => x !== '').join('\n\n');
2399
- 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 });
2500
+ const chosen = facts.lead === null && facts.seats === null ? undefined
2501
+ : [...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 });
2400
2503
  if (made === null)
2401
2504
  throw new JobRefusal('operation_unavailable', 'studio cannot start a document from a chat on this daemon yet', 409);
2402
2505
  const shape = { card: card.id, option: r.option?.id ?? null, depth: null, by: facts.by, source: facts.source, ...(facts.guess !== undefined ? { guess: facts.guess } : {}) };
2506
+ const nameOf = (key) => ctx.roster.find((s) => s.key === key)?.name ?? key;
2507
+ const extra = (chosen ?? []).filter((k) => ctx.roster.some((s) => s.key === k)).slice(2);
2508
+ const helperNotes = extra.length > 0 ? [`${extra.map(nameOf).join(', ')} left out: a document uses two helpers`] : [];
2509
+ 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 } }));
2510
+ const seatsTok = {
2511
+ id: 'seats', kind: 'seats',
2512
+ label: made.helpers === null ? 'two helpers needed' : `${nameOf(made.helpers.seats[0])} writes, ${nameOf(made.helpers.seats[1])} checks`,
2513
+ swap: choices.length > 0 ? { choices } : null,
2514
+ };
2403
2515
  const kindTok = { id: 'kind', kind: (card.variant !== undefined ? 'option' : 'card'), label: nounOf(card, shape.option), swap: null };
2404
2516
  const checksTok = { id: 'checks', kind: 'checks', label: checksLabel(r.resolved.gate), swap: null };
2405
2517
  const documentsInput = r.resolved.inputs.find((i) => i.id === 'documents');
@@ -2431,8 +2543,9 @@ export class ChatProposals {
2431
2543
  command: r.option?.command ?? card.command,
2432
2544
  gate: [...r.resolved.gate],
2433
2545
  words: facts.words,
2546
+ ...(facts.title !== null ? { namedTitle: facts.title } : {}),
2434
2547
  details: [...facts.details],
2435
- 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) },
2548
+ 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) },
2436
2549
  suggestions: [],
2437
2550
  question,
2438
2551
  revises: ctx.revises,
@@ -2442,10 +2555,13 @@ export class ChatProposals {
2442
2555
  };
2443
2556
  }
2444
2557
  /** Resolve facts to their proposal. `previous` marks a rebuild; null is a held job without a stored parent. */
2445
- async proposalOf(chatId, pid, facts, ctx, records, allowHidden = false, previous) {
2558
+ async proposalOf(chatId, pid, facts, ctx, records, allowHidden = false, previous, relaunch = previous?.relaunch) {
2446
2559
  const card = CATALOG_V2_CARDS.find((c) => c.id === facts.card);
2447
2560
  const r = card === undefined ? null : resolveOption(card.id, optionFor(card, facts.option), ctx.served);
2448
2561
  await this.loadJobSources(facts, ctx);
2562
+ if (relaunch !== undefined && this.deps.coverage !== undefined) {
2563
+ ctx = { ...ctx, coverage: (keys, bound) => this.deps.coverage(keys, bound, relaunch) };
2564
+ }
2449
2565
  ctx = await this.reviewRoster(facts, ctx);
2450
2566
  if (r?.resolved.inputs.some((i) => i.id === 'documents')) {
2451
2567
  if (facts.inputs['documents'] === undefined) {
@@ -2466,9 +2582,10 @@ export class ChatProposals {
2466
2582
  ctx = { ...ctx, documents: await this.authorizeDocumentsAt(chatId, input?.kind === 'documents' ? input.tokens : [], records, ctx.turnId ?? '\u0000', r !== null && proposalKindOf(r) === 'create', true) };
2467
2583
  }
2468
2584
  // An unsure reading holds no Start wherever the proposal is rebuilt (a Go's edits, a refresh; codex r4).
2469
- if (r !== null && proposalKindOf(r) === 'create')
2470
- return withAskOverlay(await this.documentProposal(chatId, pid, facts, ctx, records));
2471
- return withAskOverlay(resolveJob(facts, ctx, { allowHidden }));
2585
+ const proposal = r !== null && proposalKindOf(r) === 'create'
2586
+ ? await this.documentProposal(chatId, pid, facts, ctx, records)
2587
+ : resolveJob(facts, ctx, { allowHidden });
2588
+ return withAskOverlay({ ...proposal, ...(ctx.seatsUnread ? { seatsUnread: true } : {}) });
2472
2589
  }
2473
2590
  refusalOf(err) {
2474
2591
  if (err instanceof JobRefusal)
@@ -2533,6 +2650,7 @@ export class ChatProposals {
2533
2650
  }
2534
2651
  const facts = {
2535
2652
  card,
2653
+ title: null,
2536
2654
  option,
2537
2655
  depth: body.depth ?? null,
2538
2656
  words: (body.words ?? '').slice(0, 8000),
@@ -2602,7 +2720,7 @@ export class ChatProposals {
2602
2720
  : new Set();
2603
2721
  const confirmed = confirmIds !== null;
2604
2722
  delete edits.confirmLoss;
2605
- const ctx0 = await this.jobContext(chatId, src.pid, src.turnId, fromPerson ? 'person' : (parent.proposal.seat ?? 'seat'), chat, {
2723
+ let ctx0 = await this.jobContext(chatId, src.pid, src.turnId, fromPerson ? 'person' : (parent.proposal.seat ?? 'seat'), chat, {
2606
2724
  revises: parent.proposal.pid,
2607
2725
  lineage: parent.proposal.lineage ?? parent.proposal.pid,
2608
2726
  notes: [],
@@ -2614,6 +2732,17 @@ export class ChatProposals {
2614
2732
  // the person never asked for in their own words changes nothing. On the person's route, only the press applies it.
2615
2733
  let qe = null;
2616
2734
  const extraNotes = [];
2735
+ // studio#1094: only the person's repository answer can set the chat's first scope.
2736
+ if (src.person !== null && edits.repoRef !== undefined && parent.proposal.needs?.some((n) => n.id === 'repo') === true && chat.repos.length === 0 && this.deps.pickFirstRepo !== undefined) {
2737
+ const picked = await this.deps.pickFirstRepo(chatId, edits.repoRef, src.person, src.pid);
2738
+ if (!picked.ok)
2739
+ return { code: picked.status, body: { code: 'chat_scope_refused', error: picked.error } };
2740
+ const scoped = this.jobChat(chatId);
2741
+ if (scoped === null)
2742
+ return { code: 409, body: { code: 'chat_gone', error: `chat ${chatId} has ended; start a new one` } };
2743
+ ctx0 = { ...ctx0, chat: scoped };
2744
+ extraNotes.push(`This chat now reads ${picked.name}: you picked it for this job.`);
2745
+ }
2617
2746
  if (edits.skipQe !== undefined && !confirmed) {
2618
2747
  const reason = edits.skipQe.reason;
2619
2748
  delete edits.skipQe;
@@ -2779,7 +2908,7 @@ export class ChatProposals {
2779
2908
  // (F1/F2) What a removal did, from the card as published (never from the merge, which a loss question can hold).
2780
2909
  // A document's workers are its helpers (a revision can make a job a document; codex r2).
2781
2910
  const workers = candidate.seats !== undefined ? candidate.seats.keys : (candidate.helpers?.seats ?? []);
2782
- const removal = seatRemovalNote(edits.removeSeats, parent.proposal.seats?.keys ?? [], workers, (k) => ctx.roster.find((s) => s.key === k)?.name ?? k, candidate.seats !== undefined);
2911
+ const removal = seatRemovalNote(edits.removeSeats, parent.proposal.seats?.keys ?? parent.proposal.helpers?.seats ?? [], workers, (k) => ctx.roster.find((s) => s.key === k)?.name ?? k);
2783
2912
  const proposal = removal.length === 0 || candidate.sentence === undefined ? candidate : { ...candidate, sentence: { ...candidate.sentence, notes: [...candidate.sentence.notes, ...removal] } };
2784
2913
  if (!this.write(chatId, { at: this.now(), turnId: src.turnId ?? `person:${src.pid.slice(src.pid.lastIndexOf(':') + 1)}`, kind: 'proposal', proposal }, instance))
2785
2914
  return this.gone(chatId);
@@ -2909,6 +3038,49 @@ export class ChatProposals {
2909
3038
  return released;
2910
3039
  });
2911
3040
  }
3041
+ /** A read redraws a seat-held job from the current pool, without an answer turn (crew#1484). */
3042
+ async recheckHeldSeats(chatId, instance = this.deps.instanceOf(chatId)) {
3043
+ const held = (f) => f.state === 'open' && f.proposal.kind === 'job'
3044
+ && f.proposal.shape !== undefined && !f.proposal.seatsUnread && f.proposal.blocked?.startsWith('Needs ') === true;
3045
+ if (![...foldProposals(this.deps.records(chatId)).values()].some(held))
3046
+ return false;
3047
+ return this.lock.run(`chat\u0000${instance ?? chatId}`, async () => {
3048
+ let changed = false;
3049
+ for (const f of foldProposals(this.deps.records(chatId)).values()) {
3050
+ if (!held(f))
3051
+ continue;
3052
+ const p = f.proposal;
3053
+ // An ended chat's open card is redrawn using its recorded scope and seat order.
3054
+ const chat = this.jobChat(chatId) ?? {
3055
+ projectId: p.filedIn.projectId,
3056
+ repos: (p.repoRefs ?? []).map((id, i) => ({ id, name: p.repos[i] ?? id })),
3057
+ lead: p.seats?.lead ?? null,
3058
+ seats: p.seats?.keys ?? [],
3059
+ };
3060
+ const ctx = await this.jobContext(chatId, p.pid, p.turnId, p.seat, chat, {
3061
+ revises: p.revises ?? null, lineage: p.lineage ?? p.pid, notes: [],
3062
+ ...(p.request !== undefined ? { request: p.request } : {}),
3063
+ ...(p.answers !== undefined ? { answers: p.answers } : {}),
3064
+ });
3065
+ if (ctx.seatsUnread)
3066
+ continue;
3067
+ const r = resolveOption(p.shape.card, p.shape.option, ctx.served);
3068
+ if (r === null || ctx.served.rev !== p.catalogRev || r.resolved.resolution !== p.resolution || p.blocked !== seatsShortLine(r, p.seats?.keys.length ?? 0))
3069
+ continue;
3070
+ if ((ctx.pool ?? ctx.roster).length < seatsNeeded(r))
3071
+ continue;
3072
+ const facts = { ...factsOf(p), lead: null, seats: null };
3073
+ const fresh = keepReshape(await this.proposalOf(chatId, p.pid, facts, ctx, this.deps.records(chatId), true, p), p);
3074
+ if (fresh.seats === undefined || fresh.seats.keys.length < seatsNeeded(r))
3075
+ continue;
3076
+ const current = foldProposals(this.deps.records(chatId)).get(p.pid);
3077
+ if (current === undefined || !held(current) || current.proposal.blocked !== p.blocked)
3078
+ continue;
3079
+ changed = this.write(chatId, { at: this.now(), turnId: current.turnId, kind: 'proposal', proposal: fresh }, instance) || changed;
3080
+ }
3081
+ return changed;
3082
+ });
3083
+ }
2912
3084
  /** A job's Go edits (option, depth, repository, seats, inputs) merged by the revision rules: one that loses a check
2913
3085
  * is refused (that is the person's press on the lost-check question, not an edit at Go). */
2914
3086
  async applyJobEdits(chatId, f, edits) {
@@ -2956,7 +3128,7 @@ export class ChatProposals {
2956
3128
  throw new EditRefusal(`that would drop ${checksLabel(dropped)}; check the job again`);
2957
3129
  if (out.seats !== undefined && out.shape !== undefined) {
2958
3130
  const r = resolveOption(out.shape.card, out.shape.option, ctx.served);
2959
- 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)) {
3131
+ if (r !== null && !(r.workflow !== null && SELF_SEATED.has(r.workflow)) && out.seats.keys.length < seatsNeeded(r)) {
2960
3132
  throw new EditRefusal('this job needs another seat to check the one that builds');
2961
3133
  }
2962
3134
  }
@@ -3086,7 +3258,7 @@ export class ChatProposals {
3086
3258
  if (gone !== null)
3087
3259
  throw new JobRefusal('source_gone', gone, 409);
3088
3260
  }
3089
- proposal = await this.proposalOf(chatId, x.pid, facts, ctx, this.deps.records(chatId), false, heldP ?? null);
3261
+ proposal = await this.proposalOf(chatId, x.pid, facts, ctx, this.deps.records(chatId), false, heldP ?? null, x.relaunch);
3090
3262
  if (x.edits.inputs?.['documents'] !== undefined)
3091
3263
  this.refuseStruckDocuments(proposal);
3092
3264
  else if (heldP !== undefined)
@@ -3212,11 +3384,11 @@ export class ChatProposals {
3212
3384
  const pid = `${base.chatId}:retry:${runId}`;
3213
3385
  if (folded.has(pid))
3214
3386
  return pid;
3215
- // A5 (codex r1): a refine's retry is drawn on the document as it is now (a conflict moved its head), with the
3216
- // protected edits of that head, Keep preselected for every one.
3387
+ // A retry keeps the accepted choices only for edit ids still present on the new head.
3217
3388
  const fresh = base.kind === 'refine' && base.target !== undefined ? await this.refreshTarget(base) : base;
3218
3389
  const retry = {
3219
3390
  ...fresh,
3391
+ ...(base.kind === 'refine' ? { allow: (failed.accepting?.edits?.allow ?? []).filter((id) => fresh.protected?.some((e) => e.id === id)) } : {}),
3220
3392
  pid,
3221
3393
  turnId: null,
3222
3394
  sourceRunId: runId,