wicked-crew 0.18.19 → 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 (395) 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 +13 -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 +30 -0
  29. package/dist/api/chat-proposals.d.ts.map +1 -1
  30. package/dist/api/chat-proposals.js +157 -21
  31. package/dist/api/chat-proposals.js.map +1 -1
  32. package/dist/api/chat-scope.d.ts +9 -9
  33. package/dist/api/chat-scope.d.ts.map +1 -1
  34. package/dist/api/chat-scope.js +29 -19
  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/gate-cache.d.ts +1 -0
  43. package/dist/api/gate-cache.d.ts.map +1 -1
  44. package/dist/api/gate-cache.js +19 -6
  45. package/dist/api/gate-cache.js.map +1 -1
  46. package/dist/api/governance-steering.d.ts +4 -4
  47. package/dist/api/mcp.d.ts +10 -2
  48. package/dist/api/mcp.d.ts.map +1 -1
  49. package/dist/api/mcp.js +53 -12
  50. package/dist/api/mcp.js.map +1 -1
  51. package/dist/api/product.d.ts +1 -1
  52. package/dist/api/proposal-onboard.d.ts +9 -1
  53. package/dist/api/proposal-onboard.d.ts.map +1 -1
  54. package/dist/api/proposal-onboard.js +41 -3
  55. package/dist/api/proposal-onboard.js.map +1 -1
  56. package/dist/api/recording.d.ts +1 -1
  57. package/dist/api/requirements.d.ts +2 -16
  58. package/dist/api/requirements.d.ts.map +1 -1
  59. package/dist/api/requirements.js.map +1 -1
  60. package/dist/api/retry-index.d.ts +2 -0
  61. package/dist/api/retry-index.d.ts.map +1 -1
  62. package/dist/api/retry-index.js +16 -8
  63. package/dist/api/retry-index.js.map +1 -1
  64. package/dist/api/roster-standing.d.ts +2 -0
  65. package/dist/api/roster-standing.d.ts.map +1 -1
  66. package/dist/api/roster-standing.js +8 -1
  67. package/dist/api/roster-standing.js.map +1 -1
  68. package/dist/api/routes.d.ts +23 -9
  69. package/dist/api/routes.d.ts.map +1 -1
  70. package/dist/api/routes.js +501 -153
  71. package/dist/api/routes.js.map +1 -1
  72. package/dist/api/run-documents.d.ts +9 -1
  73. package/dist/api/run-documents.d.ts.map +1 -1
  74. package/dist/api/run-documents.js +63 -5
  75. package/dist/api/run-documents.js.map +1 -1
  76. package/dist/api/run-timing-index.d.ts +2 -0
  77. package/dist/api/run-timing-index.d.ts.map +1 -1
  78. package/dist/api/run-timing-index.js +62 -86
  79. package/dist/api/run-timing-index.js.map +1 -1
  80. package/dist/api/seat-container-login.js +2 -2
  81. package/dist/api/seat-container-login.js.map +1 -1
  82. package/dist/api/server.d.ts.map +1 -1
  83. package/dist/api/server.js +79 -20
  84. package/dist/api/server.js.map +1 -1
  85. package/dist/api/stall-watchdog.d.ts +6 -0
  86. package/dist/api/stall-watchdog.d.ts.map +1 -1
  87. package/dist/api/stall-watchdog.js +28 -0
  88. package/dist/api/stall-watchdog.js.map +1 -1
  89. package/dist/api/system-snapshot.d.ts +5 -0
  90. package/dist/api/system-snapshot.d.ts.map +1 -1
  91. package/dist/api/system-snapshot.js +17 -7
  92. package/dist/api/system-snapshot.js.map +1 -1
  93. package/dist/api/testing.d.ts +2 -2
  94. package/dist/api/ui-text.js +2 -2
  95. package/dist/api/ui-text.js.map +1 -1
  96. package/dist/apps/actions/api-action.js +5 -2
  97. package/dist/apps/actions/api-action.js.map +1 -1
  98. package/dist/apps/actions/write-path.d.ts +9 -0
  99. package/dist/apps/actions/write-path.d.ts.map +1 -1
  100. package/dist/apps/actions/write-path.js +17 -9
  101. package/dist/apps/actions/write-path.js.map +1 -1
  102. package/dist/apps/exec/executor.d.ts +8 -15
  103. package/dist/apps/exec/executor.d.ts.map +1 -1
  104. package/dist/apps/exec/executor.js +10 -3
  105. package/dist/apps/exec/executor.js.map +1 -1
  106. package/dist/apps/exec/redescribe.d.ts +37 -0
  107. package/dist/apps/exec/redescribe.d.ts.map +1 -0
  108. package/dist/apps/exec/redescribe.js +86 -0
  109. package/dist/apps/exec/redescribe.js.map +1 -0
  110. package/dist/apps/exec/source-stage.d.ts +3 -1
  111. package/dist/apps/exec/source-stage.d.ts.map +1 -1
  112. package/dist/apps/exec/source-stage.js +13 -3
  113. package/dist/apps/exec/source-stage.js.map +1 -1
  114. package/dist/apps/exec/sources.d.ts +6 -0
  115. package/dist/apps/exec/sources.d.ts.map +1 -1
  116. package/dist/apps/exec/sources.js +8 -0
  117. package/dist/apps/exec/sources.js.map +1 -1
  118. package/dist/apps/publish/manifest.d.ts +6 -1
  119. package/dist/apps/publish/manifest.d.ts.map +1 -1
  120. package/dist/apps/publish/manifest.js +6 -0
  121. package/dist/apps/publish/manifest.js.map +1 -1
  122. package/dist/apps/publish/run.d.ts +4 -1
  123. package/dist/apps/publish/run.d.ts.map +1 -1
  124. package/dist/apps/publish/run.js +4 -1
  125. package/dist/apps/publish/run.js.map +1 -1
  126. package/dist/apps/routes.d.ts +1 -0
  127. package/dist/apps/routes.d.ts.map +1 -1
  128. package/dist/apps/routes.js +13 -0
  129. package/dist/apps/routes.js.map +1 -1
  130. package/dist/apps-server/Dockerfile +2 -2
  131. package/dist/apps-server/runners/sqlite-runner.mjs +28 -11
  132. package/dist/apps-server/server/lib/bundle/server.mjs +243 -149
  133. package/dist/cli/governance.d.ts +5 -2
  134. package/dist/cli/governance.d.ts.map +1 -1
  135. package/dist/cli/governance.js +8 -5
  136. package/dist/cli/governance.js.map +1 -1
  137. package/dist/cli/index.d.ts.map +1 -1
  138. package/dist/cli/index.js +6 -5
  139. package/dist/cli/index.js.map +1 -1
  140. package/dist/cli/service.d.ts +10 -6
  141. package/dist/cli/service.d.ts.map +1 -1
  142. package/dist/cli/service.js +39 -23
  143. package/dist/cli/service.js.map +1 -1
  144. package/dist/core/adapter.d.ts +38 -21
  145. package/dist/core/adapter.d.ts.map +1 -1
  146. package/dist/core/adapter.js +155 -57
  147. package/dist/core/adapter.js.map +1 -1
  148. package/dist/core/assurance.d.ts +37 -44
  149. package/dist/core/assurance.d.ts.map +1 -1
  150. package/dist/core/assurance.js +53 -69
  151. package/dist/core/assurance.js.map +1 -1
  152. package/dist/core/deliver-text.d.ts +12 -0
  153. package/dist/core/deliver-text.d.ts.map +1 -1
  154. package/dist/core/deliver-text.js +40 -2
  155. package/dist/core/deliver-text.js.map +1 -1
  156. package/dist/core/deliver.d.ts +23 -0
  157. package/dist/core/deliver.d.ts.map +1 -1
  158. package/dist/core/deliver.js +52 -7
  159. package/dist/core/deliver.js.map +1 -1
  160. package/dist/core/engine-roster.d.ts +2 -0
  161. package/dist/core/engine-roster.d.ts.map +1 -1
  162. package/dist/core/engine-roster.js +13 -0
  163. package/dist/core/engine-roster.js.map +1 -1
  164. package/dist/core/estate-mcp-client.d.ts +13 -14
  165. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  166. package/dist/core/estate-mcp-client.js +47 -62
  167. package/dist/core/estate-mcp-client.js.map +1 -1
  168. package/dist/core/pr-checks-helper.d.ts +8 -4
  169. package/dist/core/pr-checks-helper.d.ts.map +1 -1
  170. package/dist/core/pr-checks-helper.js +39 -17
  171. package/dist/core/pr-checks-helper.js.map +1 -1
  172. package/dist/core/repoPaths.d.ts +2 -4
  173. package/dist/core/repoPaths.d.ts.map +1 -1
  174. package/dist/core/repoPaths.js +4 -6
  175. package/dist/core/repoPaths.js.map +1 -1
  176. package/dist/core/types.d.ts.map +1 -1
  177. package/dist/core/types.js +2 -0
  178. package/dist/core/types.js.map +1 -1
  179. package/dist/decisions/rules-brief.d.ts +2 -0
  180. package/dist/decisions/rules-brief.d.ts.map +1 -1
  181. package/dist/decisions/rules-brief.js.map +1 -1
  182. package/dist/editors/csp.d.ts +6 -0
  183. package/dist/editors/csp.d.ts.map +1 -1
  184. package/dist/editors/csp.js +10 -0
  185. package/dist/editors/csp.js.map +1 -1
  186. package/dist/editors/pack-install.d.ts.map +1 -1
  187. package/dist/editors/pack-install.js +1 -0
  188. package/dist/editors/pack-install.js.map +1 -1
  189. package/dist/editors/registry.d.ts +5 -1
  190. package/dist/editors/registry.d.ts.map +1 -1
  191. package/dist/editors/registry.js +16 -3
  192. package/dist/editors/registry.js.map +1 -1
  193. package/dist/editors/routes.d.ts +4 -2
  194. package/dist/editors/routes.d.ts.map +1 -1
  195. package/dist/editors/routes.js +23 -6
  196. package/dist/editors/routes.js.map +1 -1
  197. package/dist/evals/shape-corrections.js +1 -1
  198. package/dist/evals/shape-corrections.js.map +1 -1
  199. package/dist/evals/workflow.d.ts.map +1 -1
  200. package/dist/evals/workflow.js +1 -0
  201. package/dist/evals/workflow.js.map +1 -1
  202. package/dist/governance/rule-revision.d.ts +7 -0
  203. package/dist/governance/rule-revision.d.ts.map +1 -0
  204. package/dist/governance/rule-revision.js +23 -0
  205. package/dist/governance/rule-revision.js.map +1 -0
  206. package/dist/insights/review-service.d.ts +2 -0
  207. package/dist/insights/review-service.d.ts.map +1 -1
  208. package/dist/insights/review-service.js +27 -0
  209. package/dist/insights/review-service.js.map +1 -1
  210. package/dist/interactive/bridge-pool.d.ts +2 -0
  211. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  212. package/dist/interactive/bridge-pool.js +12 -4
  213. package/dist/interactive/bridge-pool.js.map +1 -1
  214. package/dist/interactive/chat-events.d.ts +3 -0
  215. package/dist/interactive/chat-events.d.ts.map +1 -1
  216. package/dist/interactive/chat-events.js +13 -4
  217. package/dist/interactive/chat-events.js.map +1 -1
  218. package/dist/interactive/doc-delete-routes.d.ts +1 -0
  219. package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
  220. package/dist/interactive/doc-delete-routes.js +126 -123
  221. package/dist/interactive/doc-delete-routes.js.map +1 -1
  222. package/dist/interactive/draft-events.d.ts +8 -7
  223. package/dist/interactive/draft-events.d.ts.map +1 -1
  224. package/dist/interactive/draft-events.js +24 -14
  225. package/dist/interactive/draft-events.js.map +1 -1
  226. package/dist/interactive/proposal-create.d.ts +9 -11
  227. package/dist/interactive/proposal-create.d.ts.map +1 -1
  228. package/dist/interactive/proposal-create.js +27 -21
  229. package/dist/interactive/proposal-create.js.map +1 -1
  230. package/dist/interactive/proposal-refine.d.ts +4 -4
  231. package/dist/interactive/proposal-refine.d.ts.map +1 -1
  232. package/dist/interactive/proposal-refine.js +25 -7
  233. package/dist/interactive/proposal-refine.js.map +1 -1
  234. package/dist/interactive/proxy-routes.d.ts +10 -5
  235. package/dist/interactive/proxy-routes.d.ts.map +1 -1
  236. package/dist/interactive/proxy-routes.js +108 -11
  237. package/dist/interactive/proxy-routes.js.map +1 -1
  238. package/dist/interactive/source-packet.d.ts +5 -1
  239. package/dist/interactive/source-packet.d.ts.map +1 -1
  240. package/dist/interactive/source-packet.js +62 -29
  241. package/dist/interactive/source-packet.js.map +1 -1
  242. package/dist/knowledge/adapters/toolbox/memory.d.ts +2 -0
  243. package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -0
  244. package/dist/knowledge/adapters/toolbox/memory.js +43 -0
  245. package/dist/knowledge/adapters/toolbox/memory.js.map +1 -0
  246. package/dist/knowledge/adapters/toolbox/supervisor.d.ts +9 -3
  247. package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
  248. package/dist/knowledge/adapters/toolbox/supervisor.js +40 -6
  249. package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
  250. package/dist/knowledge/gate/gate.d.ts.map +1 -1
  251. package/dist/knowledge/gate/gate.js +4 -1
  252. package/dist/knowledge/gate/gate.js.map +1 -1
  253. package/dist/knowledge/gate/record.d.ts +15 -2
  254. package/dist/knowledge/gate/record.d.ts.map +1 -1
  255. package/dist/knowledge/gate/record.js +108 -29
  256. package/dist/knowledge/gate/record.js.map +1 -1
  257. package/dist/knowledge/registry/entry.d.ts +7 -0
  258. package/dist/knowledge/registry/entry.d.ts.map +1 -1
  259. package/dist/knowledge/registry/entry.js +4 -0
  260. package/dist/knowledge/registry/entry.js.map +1 -1
  261. package/dist/learn/scheduler.d.ts.map +1 -1
  262. package/dist/learn/scheduler.js +2 -1
  263. package/dist/learn/scheduler.js.map +1 -1
  264. package/dist/learnings/estate.d.ts.map +1 -1
  265. package/dist/learnings/estate.js +3 -14
  266. package/dist/learnings/estate.js.map +1 -1
  267. package/dist/mcp/broker.js +1 -1
  268. package/dist/mcp/broker.js.map +1 -1
  269. package/dist/mcp/env.d.ts +12 -4
  270. package/dist/mcp/env.d.ts.map +1 -1
  271. package/dist/mcp/env.js +24 -4
  272. package/dist/mcp/env.js.map +1 -1
  273. package/dist/mcp/estate-relay.d.ts.map +1 -1
  274. package/dist/mcp/estate-relay.js +2 -4
  275. package/dist/mcp/estate-relay.js.map +1 -1
  276. package/dist/mcp/invoke.d.ts.map +1 -1
  277. package/dist/mcp/invoke.js +4 -3
  278. package/dist/mcp/invoke.js.map +1 -1
  279. package/dist/mcp/probe.d.ts +14 -1
  280. package/dist/mcp/probe.d.ts.map +1 -1
  281. package/dist/mcp/probe.js +55 -10
  282. package/dist/mcp/probe.js.map +1 -1
  283. package/dist/mcp/registry-store.d.ts +12 -0
  284. package/dist/mcp/registry-store.d.ts.map +1 -1
  285. package/dist/mcp/registry-store.js +10 -0
  286. package/dist/mcp/registry-store.js.map +1 -1
  287. package/dist/mcp/registry.d.ts +13 -5
  288. package/dist/mcp/registry.d.ts.map +1 -1
  289. package/dist/mcp/registry.js +61 -9
  290. package/dist/mcp/registry.js.map +1 -1
  291. package/dist/mcp/rest.js +1 -1
  292. package/dist/mcp/rest.js.map +1 -1
  293. package/dist/mcp/secrets.d.ts +1 -1
  294. package/dist/mcp/secrets.d.ts.map +1 -1
  295. package/dist/mcp/secrets.js +10 -11
  296. package/dist/mcp/secrets.js.map +1 -1
  297. package/dist/mcp/upstream-error.d.ts +1 -1
  298. package/dist/mcp/upstream-error.d.ts.map +1 -1
  299. package/dist/projects/graph.d.ts +10 -2
  300. package/dist/projects/graph.d.ts.map +1 -1
  301. package/dist/projects/graph.js +190 -10
  302. package/dist/projects/graph.js.map +1 -1
  303. package/dist/projects/repo-watch.d.ts +2 -2
  304. package/dist/projects/repo-watch.d.ts.map +1 -1
  305. package/dist/projects/repo-watch.js +26 -9
  306. package/dist/projects/repo-watch.js.map +1 -1
  307. package/dist/projects/routes.d.ts +2 -0
  308. package/dist/projects/routes.d.ts.map +1 -1
  309. package/dist/projects/routes.js +50 -1
  310. package/dist/projects/routes.js.map +1 -1
  311. package/dist/projects/state-home-registry.d.ts.map +1 -1
  312. package/dist/projects/state-home-registry.js +3 -0
  313. package/dist/projects/state-home-registry.js.map +1 -1
  314. package/dist/projects/state-home.d.ts +7 -0
  315. package/dist/projects/state-home.d.ts.map +1 -1
  316. package/dist/projects/state-home.js +11 -0
  317. package/dist/projects/state-home.js.map +1 -1
  318. package/dist/qe/author-workflow.d.ts +4 -0
  319. package/dist/qe/author-workflow.d.ts.map +1 -1
  320. package/dist/qe/author-workflow.js +4 -0
  321. package/dist/qe/author-workflow.js.map +1 -1
  322. package/dist/qe/test-sets.d.ts +4 -5
  323. package/dist/qe/test-sets.d.ts.map +1 -1
  324. package/dist/qe/test-sets.js +2 -1
  325. package/dist/qe/test-sets.js.map +1 -1
  326. package/dist/sources/ask.d.ts.map +1 -1
  327. package/dist/sources/ask.js +12 -12
  328. package/dist/sources/ask.js.map +1 -1
  329. package/dist/sources/dialer.d.ts +6 -1
  330. package/dist/sources/dialer.d.ts.map +1 -1
  331. package/dist/sources/dialer.js +53 -31
  332. package/dist/sources/dialer.js.map +1 -1
  333. package/dist/sources/drivers/mysql.d.ts +2 -0
  334. package/dist/sources/drivers/mysql.d.ts.map +1 -1
  335. package/dist/sources/drivers/mysql.js +18 -2
  336. package/dist/sources/drivers/mysql.js.map +1 -1
  337. package/dist/sources/drivers/postgres.d.ts +2 -0
  338. package/dist/sources/drivers/postgres.d.ts.map +1 -1
  339. package/dist/sources/drivers/postgres.js +10 -3
  340. package/dist/sources/drivers/postgres.js.map +1 -1
  341. package/dist/sources/drivers/sqlite.d.ts +22 -5
  342. package/dist/sources/drivers/sqlite.d.ts.map +1 -1
  343. package/dist/sources/drivers/sqlite.js +10 -9
  344. package/dist/sources/drivers/sqlite.js.map +1 -1
  345. package/dist/sources/drivers/types.d.ts +3 -1
  346. package/dist/sources/drivers/types.d.ts.map +1 -1
  347. package/dist/sources/drivers/types.js +3 -1
  348. package/dist/sources/drivers/types.js.map +1 -1
  349. package/dist/sources/uploads.d.ts +2 -15
  350. package/dist/sources/uploads.d.ts.map +1 -1
  351. package/dist/sources/uploads.js +30 -440
  352. package/dist/sources/uploads.js.map +1 -1
  353. package/dist/standing-orders/history.d.ts +5 -3
  354. package/dist/standing-orders/history.d.ts.map +1 -1
  355. package/dist/standing-orders/history.js +6 -2
  356. package/dist/standing-orders/history.js.map +1 -1
  357. package/dist/studio/apps-standalone/fixture.js +3 -3
  358. package/dist/studio/apps-standalone/runtime.js +1 -1
  359. package/dist/studio/assets/{KnowledgeGraph-DWw0I8RJ.js → KnowledgeGraph-dfq7Flyj.js} +1 -1
  360. package/dist/studio/assets/index-Bame65hj.js +1108 -0
  361. package/dist/studio/assets/index-CtB1BJRI.css +32 -0
  362. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  363. package/dist/studio/editors/wicked-apps/index.html +2 -2
  364. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  365. package/dist/studio/editors/wicked-deck/index.html +2 -2
  366. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  367. package/dist/studio/editors/wicked-doc/index.html +1 -1
  368. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  369. package/dist/studio/editors/wicked-insights/index.html +1 -1
  370. package/dist/studio/editors/wicked-page/editor.json +1 -1
  371. package/dist/studio/editors/wicked-page/index.html +1 -1
  372. package/dist/studio/editors/wicked-video/editor.json +1 -1
  373. package/dist/studio/editors/wicked-video/index.html +1 -1
  374. package/dist/studio/index.html +2 -2
  375. package/dist/studio/testid-inventory.json +402 -11
  376. package/dist/team/routes.d.ts +11 -1
  377. package/dist/team/routes.d.ts.map +1 -1
  378. package/dist/team/routes.js +6 -3
  379. package/dist/team/routes.js.map +1 -1
  380. package/dist/workflow-catalog/catalog-data-v2.d.ts +6 -2
  381. package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
  382. package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
  383. package/dist/workflow-catalog/shape.d.ts +1 -1
  384. package/dist/working-doc/event-lines.d.ts +7 -0
  385. package/dist/working-doc/event-lines.d.ts.map +1 -1
  386. package/dist/working-doc/event-lines.js +24 -3
  387. package/dist/working-doc/event-lines.js.map +1 -1
  388. package/endpoint-manifest.json +89 -6
  389. package/evals/corpora/shape-v1.json +1 -1
  390. package/package.json +4 -4
  391. package/runners/sqlite-runner.mjs +28 -11
  392. package/runners/upload-parse.d.mts +13 -0
  393. package/runners/upload-parse.mjs +364 -0
  394. package/dist/studio/assets/index-C4Xj-zxa.css +0 -32
  395. package/dist/studio/assets/index-CrNY3d06.js +0 -1109
@@ -1,3 +1,4 @@
1
+ import { RuleChangedError, ruleRevision } from '../governance/rule-revision.js';
1
2
  import { builtinDefs as deriveBuiltinDefs, engineDefOf } from './builtin-catalog.js';
2
3
  import { createRequire } from 'node:module';
3
4
  import { attachEngineBus, detachEngineBus } from './bus.js';
@@ -5,7 +6,8 @@ import { mkdir, access, readFile, writeFile, chmod, rm, link, rename, realpath,
5
6
  import { existsSync, readFileSync } from 'node:fs';
6
7
  import { join, dirname, resolve, isAbsolute, relative, sep } from 'node:path';
7
8
  import { isPlainRunId, WALKTHROUGH_AUTHOR_SUBDIR, walkthroughRootDir } from './walkthrough-root.js';
8
- import { crewStateHome, isDefaultStateHome } from '../projects/state-home.js';
9
+ import { mcpStateDir } from '../mcp/registry-store.js';
10
+ import { crewStateHome, isDefaultStateHome, wickedWorkRoot } from '../projects/state-home.js';
9
11
  import { fileURLToPath } from 'node:url';
10
12
  import { homedir } from 'node:os';
11
13
  import { randomUUID } from 'node:crypto';
@@ -13,12 +15,14 @@ import { AskError, AskUnsupportedError } from './types.js';
13
15
  import { DEFAULT_SETTINGS } from './types.js';
14
16
  import { BASE_SKILL_REF_SHAPE } from '../skills/base-skill.js';
15
17
  import { execCapped } from './exec.js';
18
+ import { gitCommitIdents, usableGitIdent } from '../setup/known.js';
16
19
  import { composeDeliverWorkflow, DELIVER_PHASE_ID, deliverPresetStep, deliverIdentityFor, deliverRepoFor, isGitHubLogin, pushIdentityOf, readDeliverOriginUrl } from './deliver.js';
17
20
  import { engineCampaignDef, engineRosterJson } from './engine-roster.js';
18
21
  import { composeDeliverableFloor } from './deliverable-floor.js';
19
22
  import { deliverCredentialsProbe } from './deliver-credentials.js';
20
23
  import { isSyntheticWorkflowId, resolveRunIdentity, verifiedEvidenceCatalog, wireIdentity, withPresetSystemFlag, withSystemFlag, } from './run-identity.js';
21
- const TERMINAL_RUN_STATUSES = new Set(['completed', 'cancelled', 'failed']);
24
+ export const TERMINAL_RUN_STATUSES = new Set(['completed', 'cancelled', 'failed']);
25
+ const ACTIVE_RUN_STATUSES = new Set(['planning', 'distributing', 'executing']);
22
26
  import { resolveProjectGraphBinding } from '../projects/graph.js';
23
27
  import { applyGovernanceStoreEnv, isStoreSpec } from './governance-store.js';
24
28
  import { isCouncilSize, isCouncilStaggerMs } from './council-settings.js';
@@ -27,11 +31,6 @@ import { QE_OFF_REASON, launchRequiresQe, qeAcceptanceMode, qeSettingSkipReason
27
31
  import { applyVaultBinEnv, BOOT_VAULT_BIN, resolveShippedVaultBin } from './vault-bin.js';
28
32
  import { withFolderFindings } from './repoPaths.js';
29
33
  import { NEW_WORK_SEATS_FIX, NewWorkSeatsRefusal, isSeatKeyList } from './job-seats.js';
30
- /** Resolved path under the user's home directory. */
31
- export function wickedDir(...parts) {
32
- const home = process.env.HOME ?? process.env.USERPROFILE ?? '/tmp';
33
- return join(home, '.wicked', ...parts);
34
- }
35
34
  /**
36
35
  * Parse a JSON string a napi binding returned. The bindings type their return loosely (`unknown`
37
36
  * until a `ts_return_type` regen), so guard BOTH a non-string return and invalid JSON with an error
@@ -113,6 +112,8 @@ export async function readNewWorkSeats() {
113
112
  // Absent only when no entry is there at all: a settings link whose target is gone is a file that can't be read.
114
113
  if (err.code === 'ENOENT' && !(await lstat(path).then(() => true, () => false)))
115
114
  return null;
115
+ if (err instanceof NewWorkSeatsRefusal)
116
+ throw err;
116
117
  const why = err.code ?? (err instanceof Error ? err.message : String(err));
117
118
  throw new NewWorkSeatsRefusal('settings_unavailable', `crew can't read its settings file (${why}), so it can't tell which seats new work may use (newWorkSeats); it won't start new work on every seat instead. Fix ${path}, or ${NEW_WORK_SEATS_FIX}`);
118
119
  }
@@ -140,25 +141,31 @@ export async function readNewWorkSeats() {
140
141
  * crew#756 migration, once: a non-default state home with no settings file of its own starts from a
141
142
  * COPY of the shared file, so a daemon upgraded onto this rule keeps its configuration while every
142
143
  * later write stays in its own state home. Exclusive copy (never overwrites); a missing shared file
143
- * is no seed. A daemon with an explicit `WICKED_CREW_SYSTEM_SETTINGS` or on the default home skips it.
144
+ * seeds an empty object. An unreadable or invalid shared file leaves the home unseeded for a retry.
145
+ * A daemon with an explicit `WICKED_CREW_SYSTEM_SETTINGS` or on the default home skips it.
144
146
  */
145
147
  async function seedStateHomeSettings(path) {
146
148
  const override = process.env['WICKED_CREW_SYSTEM_SETTINGS'];
147
149
  if ((override !== undefined && override !== '') || isDefaultStateHome() || existsSync(path))
148
150
  return;
149
- // The seed is a VALIDATED snapshot: the shared file's text only when it parses as a JSON object,
150
- // else an empty object — so a missing, partial or corrupt shared file starts the home empty and is
151
- // never retried (Copilot on #760). Published with `link`, which is atomic and never replaces an
152
- // existing file: a racing first read either publishes or finds a complete file.
151
+ // Published with `link`, so a racing first read either publishes or finds a complete file.
152
+ const shared = sharedSettingsFilePath();
153
153
  let body = '{}';
154
154
  try {
155
- const raw = await readFile(sharedSettingsFilePath(), 'utf8');
156
- const parsed = JSON.parse(raw);
157
- if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed))
158
- body = raw;
155
+ body = await readFile(shared, 'utf8');
159
156
  }
160
- catch {
161
- /* absent or not JSON: start empty */
157
+ catch (err) {
158
+ if (err.code !== 'ENOENT') {
159
+ throw new NewWorkSeatsRefusal('settings_unavailable', `Cannot read ${shared}: ${err instanceof Error ? err.message : String(err)}. Fix this file to start new work.`);
160
+ }
161
+ }
162
+ try {
163
+ const parsed = JSON.parse(body);
164
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
165
+ throw new Error('expected a JSON object');
166
+ }
167
+ catch (err) {
168
+ throw new NewWorkSeatsRefusal('settings_unavailable', `Cannot use ${shared}: ${err instanceof Error ? err.message : String(err)}. Fix this file to start new work.`);
162
169
  }
163
170
  await publishSettingsFile(path, body, false);
164
171
  }
@@ -566,6 +573,22 @@ function addonAtLeast(maj, min, pat) {
566
573
  // ── Built-in workflows (X-MIG M11) ───────────────────────────────────────────
567
574
  // No mirrors: the built-ins are the engine's built-in presets, read once at boot and laid over the
568
575
  // phase catalog (`core/builtin-catalog.ts`, `loadBuiltinCatalog`). One source; nothing to drift.
576
+ /** Refusing new work while this daemon drains; restarting clears the in-memory state. */
577
+ export class MaintenanceDrainError extends Error {
578
+ code = 'maintenance_drain';
579
+ hint = 'Wait for maintenance to finish, or POST /api/v1/maintenance with {"drain":false} to admit work again.';
580
+ constructor() {
581
+ super('This daemon is draining for maintenance and is refusing new work.');
582
+ this.name = 'MaintenanceDrainError';
583
+ }
584
+ }
585
+ /** The linked engine predates repository removal (wicked-core `unregisterRepo`). */
586
+ export class RepoUnregisterUnsupportedError extends Error {
587
+ constructor() {
588
+ super('Removing a repository requires an engine with unregisterRepo; upgrade wicked-core-ts.');
589
+ this.name = 'RepoUnregisterUnsupportedError';
590
+ }
591
+ }
569
592
  /**
570
593
  * Chat is not available in this deployment at all — a capability gap, never a bad request.
571
594
  *
@@ -774,6 +797,7 @@ export class CoreAdapter {
774
797
  /** crew#1145: what each engine launch awaits first (`setLaunchGate`); `null` = nothing. */
775
798
  launchGate = null;
776
799
  closed = false;
800
+ drainSince = null;
777
801
  /**
778
802
  * The estate db the Core actor was spawned over (`CoreAdapterOptions.dbPath` — the `--db`
779
803
  * flag / `~/.wicked-crew/core.db` default). Kept because some engine bindings take the db
@@ -1175,6 +1199,17 @@ export class CoreAdapter {
1175
1199
  if (failure !== null)
1176
1200
  throw failure.err instanceof Error ? failure.err : new Error(String(failure.err));
1177
1201
  }
1202
+ /** Toggle admission without persisting a setting; repeated enable keeps the original time. */
1203
+ setDraining(drain) {
1204
+ this.drainSince = drain ? (this.drainSince ?? Date.now()) : null;
1205
+ }
1206
+ /** Parked and human-held runs are idle for maintenance, but still hold their repository. */
1207
+ async maintenanceState() {
1208
+ const active = (await this.sessionsDetail())
1209
+ .filter((v) => ACTIVE_RUN_STATUSES.has(v.session.status))
1210
+ .map((v) => ({ runId: v.session.id, status: v.session.status }));
1211
+ return { draining: this.drainSince !== null, since: this.drainSince, idle: active.length === 0, active };
1212
+ }
1178
1213
  /**
1179
1214
  * Hand a launch to the engine with its notices: `handed` BEFORE the call (the pin is open before
1180
1215
  * any spawn can read the env), `rejected` when the call throws (nothing will spawn — the pin is
@@ -1186,10 +1221,12 @@ export class CoreAdapter {
1186
1221
  * never swallowed (codex round 6). A listener failing on `rejected` cannot un-launch anything;
1187
1222
  * the primary error keeps precedence and the secondary one is logged, not lost.
1188
1223
  */
1189
- async handedToEngine(kind, id, call, workflow) {
1224
+ async handedToEngine(kind, id, call, workflow, resumesWork = true) {
1190
1225
  // No gate, no extra turn: a launch without one is handed exactly as before.
1191
1226
  if (this.launchGate !== null)
1192
1227
  await this.launchGate();
1228
+ if (resumesWork && this.drainSince !== null)
1229
+ throw new MaintenanceDrainError();
1193
1230
  try {
1194
1231
  this.notifyLaunch({ kind, id, status: 'handed', ...(workflow !== undefined ? { workflow } : {}) });
1195
1232
  }
@@ -1243,6 +1280,10 @@ export class CoreAdapter {
1243
1280
  static roster() {
1244
1281
  return JSON.parse(Core.registryRoster());
1245
1282
  }
1283
+ /** The engine's judge coverage, absent on an addon that predates the static. */
1284
+ static judgeCoverage(clisJson, bound) {
1285
+ return typeof Core.judgeCoverage === 'function' ? Core.judgeCoverage(clisJson, bound) : null;
1286
+ }
1246
1287
  /**
1247
1288
  * core#920: the seats the engine benches on a run bound to one repository, keyed by seat with the
1248
1289
  * engine's reason — or `null` when the linked addon predates the predicate. `seats` must be
@@ -1324,16 +1365,19 @@ export class CoreAdapter {
1324
1365
  */
1325
1366
  async resolveDeliverIdentity(repoRef) {
1326
1367
  let login = '';
1368
+ let authorNoreply = false;
1327
1369
  let source = 'setting';
1328
1370
  try {
1329
- ({ login, source } = deliverIdentityFor(await this.getSettings(), repoRef));
1371
+ const settings = await this.getSettings();
1372
+ ({ login, source } = deliverIdentityFor(settings, repoRef));
1373
+ authorNoreply = settings.deliverAuthorNoreply === true;
1330
1374
  }
1331
1375
  catch {
1332
1376
  // A settings file that cannot be read leaves the identity unconfigured rather than
1333
1377
  // failing the launch — the deliver script still cross-checks gh against git's credential.
1334
1378
  login = '';
1335
1379
  }
1336
- return { login, source };
1380
+ return { login, source, authorNoreply };
1337
1381
  }
1338
1382
  /**
1339
1383
  * The origin the deliver push will actually go to (F2) so the deliver GATE CARD says what will
@@ -1369,6 +1413,24 @@ export class CoreAdapter {
1369
1413
  return null;
1370
1414
  }
1371
1415
  }
1416
+ /** (crew#1667) Read once at compose from the registered root, as for the F2 origin read.
1417
+ * The future run worktree shares this config. No repo means no author sentence. */
1418
+ async resolveDeliverCommitIdents(repoRef) {
1419
+ if (repoRef === null || repoRef === undefined || repoRef === '')
1420
+ return undefined;
1421
+ try {
1422
+ const hit = deliverRepoFor(await this.listRepos(), repoRef);
1423
+ if (hit === undefined || hit.root_path === '')
1424
+ return undefined;
1425
+ const idents = await gitCommitIdents({ cwd: hit.root_path });
1426
+ return idents !== null && usableGitIdent(idents.author) && usableGitIdent(idents.committer)
1427
+ ? { author: idents.author, committer: idents.committer }
1428
+ : null;
1429
+ }
1430
+ catch {
1431
+ return null;
1432
+ }
1433
+ }
1372
1434
  /** The launcher's `deliver` step for a plan (`name` null) or a preset launch (DES-TEAMING-002
1373
1435
  * §8.5): the engine appends it to the plan and puts it in the floor. */
1374
1436
  deliverStep(name, phases, input,
@@ -1377,7 +1439,7 @@ export class CoreAdapter {
1377
1439
  /** (crew#737) The identity this launch resolved — launch-local, never adapter state. */
1378
1440
  identity,
1379
1441
  /** (crew#720) The provider credential preflight this launch read. */
1380
- credentials) {
1442
+ credentials, commitIdents) {
1381
1443
  return deliverPresetStep(name, phases, input.sessionId, input.problem, {
1382
1444
  repoRef: input.repoRef ?? null,
1383
1445
  apiOrigin: this.deliverApiOrigin?.() ?? null,
@@ -1386,8 +1448,10 @@ export class CoreAdapter {
1386
1448
  ghTokenPinned: typeof process.env['GH_TOKEN'] === 'string' && process.env['GH_TOKEN'] !== '',
1387
1449
  originUrl,
1388
1450
  deliverIdentity: identity.login,
1451
+ deliverAuthorNoreply: identity.authorNoreply,
1389
1452
  deliverIdentitySource: identity.source,
1390
1453
  credentials,
1454
+ ...(commitIdents !== undefined ? { commitIdents } : {}),
1391
1455
  });
1392
1456
  }
1393
1457
  /** Launch an interactive, resumable run → the run id. */
@@ -1398,6 +1462,7 @@ export class CoreAdapter {
1398
1462
  // (F2) And the origin the push would go to — read once, for the gate card's target sentence.
1399
1463
  // Only a delivering launch composes a deliver phase, so only a delivering launch pays for it.
1400
1464
  const deliverOriginUrl = input.deliver === 'pr' ? await this.resolveDeliverOrigin(input.repoRef) : null;
1465
+ const deliverCommitIdents = input.deliver === 'pr' ? await this.resolveDeliverCommitIdents(input.repoRef) : undefined;
1401
1466
  // (crew#720) And whether the provider credential is there — presence only, read once.
1402
1467
  const deliverCredentials = input.deliver === 'pr' ? await deliverCredentialsProbe(deliverOriginUrl, process.env, undefined, pushIdentityOf(deliverIdentity.login)) : null;
1403
1468
  const opts = {
@@ -1577,7 +1642,7 @@ export class CoreAdapter {
1577
1642
  this.passLaunchDeliverables(opts, input.requireDeliverables ?? [], 'a plan');
1578
1643
  // T8: a delivering plan hands the engine its deliver step, exactly as a preset launch does.
1579
1644
  if (input.deliver === 'pr') {
1580
- opts.deliverStepJson = JSON.stringify(this.deliverStep(null, [], input, deliverOriginUrl, deliverIdentity, deliverCredentials));
1645
+ opts.deliverStepJson = JSON.stringify(this.deliverStep(null, [], input, deliverOriginUrl, deliverIdentity, deliverCredentials, deliverCommitIdents));
1581
1646
  }
1582
1647
  }
1583
1648
  // DES-TEAMING-002 T3: a workflow that names a PRESET is a plan the engine floor-fills and gates.
@@ -1598,7 +1663,7 @@ export class CoreAdapter {
1598
1663
  // Only a DELIVERING preset gets the deliver step: a preset launched for its deliverables alone
1599
1664
  // pushes nothing (codex r1 on #930).
1600
1665
  if (input.deliver === 'pr') {
1601
- const step = this.deliverStep(input.workflow, this.getWorkflow(input.workflow)?.phases ?? [], input, deliverOriginUrl, deliverIdentity, deliverCredentials);
1666
+ const step = this.deliverStep(input.workflow, this.getWorkflow(input.workflow)?.phases ?? [], input, deliverOriginUrl, deliverIdentity, deliverCredentials, deliverCommitIdents);
1602
1667
  opts.deliverStepJson = JSON.stringify(step);
1603
1668
  }
1604
1669
  opts.workflow = input.workflow;
@@ -1668,10 +1733,12 @@ export class CoreAdapter {
1668
1733
  // F2 — the origin the push will actually go to, so the gate card cannot promise a
1669
1734
  // pull request on a remote that can never carry one.
1670
1735
  originUrl: deliverOriginUrl,
1736
+ ...(deliverCommitIdents !== undefined ? { commitIdents: deliverCommitIdents } : {}),
1671
1737
  // crew#549 — the configured deliver identity, baked into the script so the refusal
1672
1738
  // holds on a daemon started without GH_ACCOUNT exported; crew#737 — the repository's
1673
1739
  // own pin wins, and the card says when it is not signed in here.
1674
1740
  deliverIdentity: deliverIdentity.login,
1741
+ deliverAuthorNoreply: deliverIdentity.authorNoreply,
1675
1742
  deliverIdentitySource: deliverIdentity.source,
1676
1743
  // crew#720 — the provider credential preflight, said on the card before approval.
1677
1744
  credentials: deliverCredentials,
@@ -1780,6 +1847,7 @@ export class CoreAdapter {
1780
1847
  // (operator ruling 2026-10-11) WHO answered — recorded by the gate route just before this call
1781
1848
  // (`recordGateActor`), consumed once. The engine records it when the answer is an operator
1782
1849
  // judgment ("judged by operator", core-ts ≥ 0.9.7); an older addon ignores the trailing argument.
1850
+ const resumesWork = plan !== undefined || approve || (action !== undefined && action !== 'reject');
1783
1851
  const actorLabel = this.gateActors.get(runId);
1784
1852
  this.gateActors.delete(runId);
1785
1853
  if (expect !== undefined) {
@@ -1798,7 +1866,7 @@ export class CoreAdapter {
1798
1866
  return plan !== undefined
1799
1867
  ? core.confirmGate(runId, true, note ?? null, 'edit_plan', null, JSON.stringify(plan), actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null)
1800
1868
  : core.confirmGate(runId, approve, amend ?? null, action ?? null, amendScope ?? null, null, actorLabel ?? null, expect.ord ?? null, expect.planRev ?? null);
1801
- });
1869
+ }, undefined, resumesWork);
1802
1870
  }
1803
1871
  return this.handedToEngine('run', runId, () => {
1804
1872
  if (actorLabel !== undefined && plan === undefined) {
@@ -1836,7 +1904,7 @@ export class CoreAdapter {
1836
1904
  // The 0.7.27 binding takes the two trailing optionals; typed here until the pin moves.
1837
1905
  const core = this.core;
1838
1906
  return core.confirmGate(runId, approve, amend, action, amendScope);
1839
- });
1907
+ }, undefined, resumesWork);
1840
1908
  }
1841
1909
  /** Cancel a run → the status token. */
1842
1910
  cancelRun(runId) {
@@ -1995,6 +2063,8 @@ export class CoreAdapter {
1995
2063
  }
1996
2064
  /** (program DES-POWER-MODE) Answer a power run's checkpoint pause; resolves to its `PowerState`. */
1997
2065
  async answerPowerPause(runId, decision, note, actor) {
2066
+ if (decision !== 'stop' && this.drainSince !== null)
2067
+ throw new MaintenanceDrainError();
1998
2068
  if (typeof this.core.answerPowerPause !== 'function')
1999
2069
  throw new Error('refused: this wicked-core build has no power mode');
2000
2070
  return JSON.parse(await this.core.answerPowerPause(runId, decision, note, actor));
@@ -2330,6 +2400,7 @@ export class CoreAdapter {
2330
2400
  // (F2) The preview shows the deliver step's gate-card text, so it reads the same origin the
2331
2401
  // launch would. Local to this call, like the launch's.
2332
2402
  const previewOriginUrl = opts.deliver === true ? await this.resolveDeliverOrigin(opts.repoRef) : null;
2403
+ const previewCommitIdents = opts.deliver === true ? await this.resolveDeliverCommitIdents(opts.repoRef) : undefined;
2333
2404
  const previewIdentity = await this.resolveDeliverIdentity(opts.repoRef);
2334
2405
  const previewCredentials = opts.deliver === true ? await deliverCredentialsProbe(previewOriginUrl, process.env, undefined, pushIdentityOf(previewIdentity.login)) : null;
2335
2406
  const deliverStep = opts.deliver === true
@@ -2341,7 +2412,7 @@ export class CoreAdapter {
2341
2412
  problem: '',
2342
2413
  clisJson: '[]',
2343
2414
  ...(opts.repoRef !== undefined ? { repoRef: opts.repoRef } : {}),
2344
- }, previewOriginUrl, previewIdentity, previewCredentials))
2415
+ }, previewOriginUrl, previewIdentity, previewCredentials, previewCommitIdents))
2345
2416
  : null;
2346
2417
  return JSON.parse(await fn.call(this.core, JSON.stringify(plan), opts.projectId ?? null, opts.humanConfirm ?? null, opts.repoRef ?? null, deliverStep));
2347
2418
  }
@@ -2572,12 +2643,18 @@ export class CoreAdapter {
2572
2643
  const real = await realpath(rootPath).catch(() => rootPath);
2573
2644
  return JSON.parse(await this.core.registerRepo(name, real));
2574
2645
  }
2646
+ /** Remove only the engine registration; the checkout and graph stay on disk. */
2647
+ async unregisterRepo(id) {
2648
+ if (typeof this.core.unregisterRepo !== 'function')
2649
+ throw new RepoUnregisterUnsupportedError();
2650
+ return parseEngineJson(await this.core.unregisterRepo(id), 'unregisterRepo');
2651
+ }
2575
2652
  /**
2576
2653
  * Clone a remote git URL and return the persisted `RepoEntry` from registration.
2577
- * `checkoutPath` overrides the default clone destination (`~/.wicked/repos/<name>`).
2654
+ * `checkoutPath` overrides the state-home-derived repos destination.
2578
2655
  */
2579
2656
  async cloneAndRegister(name, gitUrl, checkoutPath, opts = {}) {
2580
- const reposRoot = wickedDir('repos');
2657
+ const reposRoot = wickedWorkRoot('repos');
2581
2658
  let cloneDir;
2582
2659
  if (checkoutPath) {
2583
2660
  // Expand leading ~/ so callers can use home-relative paths.
@@ -2842,9 +2919,30 @@ export class CoreAdapter {
2842
2919
  async upsertPolicy(policy) {
2843
2920
  await this.core.upsertPolicy(JSON.stringify(policy));
2844
2921
  }
2845
- /** Upsert a conformance rule via the single-writer actor. */
2846
- async upsertConformanceRule(rule) {
2847
- await this.core.upsertConformanceRule(JSON.stringify(rule));
2922
+ ruleWriteTails = new Map();
2923
+ ruleExclusively(id, write) {
2924
+ const result = (this.ruleWriteTails.get(id) ?? Promise.resolve()).then(write);
2925
+ const tail = result.catch(() => undefined);
2926
+ this.ruleWriteTails.set(id, tail);
2927
+ void tail.then(() => {
2928
+ if (this.ruleWriteTails.get(id) === tail)
2929
+ this.ruleWriteTails.delete(id);
2930
+ });
2931
+ return result;
2932
+ }
2933
+ /** Compare and write under the same lock as every crew writer of this rule. */
2934
+ async upsertConformanceRule(rule, expectedRevision) {
2935
+ return this.ruleExclusively(rule.id, async () => {
2936
+ if (expectedRevision !== undefined) {
2937
+ const current = (await this.listConformanceRules()).find((r) => r.id === rule.id);
2938
+ const revision = current === undefined ? null : ruleRevision(current);
2939
+ if (revision !== expectedRevision)
2940
+ throw new RuleChangedError(revision);
2941
+ }
2942
+ const stored = { ...rule };
2943
+ delete stored.revision;
2944
+ await this.core.upsertConformanceRule(JSON.stringify(stored));
2945
+ });
2848
2946
  }
2849
2947
  /**
2850
2948
  * Withdraw a policy from enforcement. Resolves `true` if a policy with that id existed.
@@ -2862,11 +2960,13 @@ export class CoreAdapter {
2862
2960
  }
2863
2961
  /** Withdraw a conformance rule from recall. Same contract as {@link retirePolicy}. */
2864
2962
  async retireConformanceRule(id) {
2865
- const retire = this.core.retireConformanceRule;
2866
- if (typeof retire !== 'function') {
2867
- throw new Error('Retiring a conformance rule is not yet supported by this wicked-core build');
2868
- }
2869
- return JSON.parse(await retire.call(this.core, id));
2963
+ return this.ruleExclusively(id, async () => {
2964
+ const retire = this.core.retireConformanceRule;
2965
+ if (typeof retire !== 'function') {
2966
+ throw new Error('Retiring a conformance rule is not yet supported by this wicked-core build');
2967
+ }
2968
+ return JSON.parse(await retire.call(this.core, id));
2969
+ });
2870
2970
  }
2871
2971
  /** Recall conformance rules matching a facet query (read-only, does not block actor). */
2872
2972
  async recallRulesPreview(query) {
@@ -3019,19 +3119,16 @@ export class CoreAdapter {
3019
3119
  return typeof this.core.governanceEvals === 'function';
3020
3120
  }
3021
3121
  /**
3022
- * `WICKED_CREW_KNOWLEDGE_DB` overrides the estate knowledge db the evals seams hand the
3023
- * engine — the same escape hatch `WICKED_CREW_SYSTEM_SETTINGS` gives {@link settingsFilePath}.
3024
- * Unset/empty (production) omits `knowledgeDb` from the args so the engine resolves its own
3025
- * default — which is `~/.wicked-estate/knowledge.db` (evals.rs `default_knowledge_db()`, HOME-
3026
- * derived), NOT a dbPath-derived sidecar. That home default is exactly why the test harness
3027
- * arms this seam (tests/setup/hermetic-home.ts): an un-armed corpus-import test writes
3028
- * `evals:` junk into the OPERATOR's real estate knowledge store — the store the mem/search
3029
- * domains answer from (crew#396). Read at call time, not construction time, so a test may
3030
- * re-aim it per fixture.
3122
+ * Explicit WICKED_CREW_KNOWLEDGE_DB wins; isolated homes use <state home>/mcp/evals-knowledge.db,
3123
+ * a file of its own because the engine's vendored store must not share the estate binary's knowledge.db.
3124
+ * The default home omits it so the engine keeps its HOME-derived ~/.wicked-estate/knowledge.db
3125
+ * (evals.rs default_knowledge_db); this is why tests/setup/hermetic-home.ts arms the env seam (crew#396).
3031
3126
  */
3032
- static knowledgeDbOverride() {
3127
+ static governanceKnowledgeDb() {
3033
3128
  const override = process.env['WICKED_CREW_KNOWLEDGE_DB'];
3034
- return override !== undefined && override !== '' ? override : undefined;
3129
+ if (override !== undefined && override !== '')
3130
+ return override;
3131
+ return isDefaultStateHome() ? undefined : join(mcpStateDir(), 'evals-knowledge.db');
3035
3132
  }
3036
3133
  /**
3037
3134
  * Run the governance evals: every sample of the corpus (`corpus` = an `evals:<name>` estate
@@ -3042,8 +3139,8 @@ export class CoreAdapter {
3042
3139
  *
3043
3140
  * `dbPath` rides the args because the eval run opens its own read-only connection to the
3044
3141
  * steering store — the SAME store this adapter's actor writes (`this.dbPath`, the one spelling
3045
- * of where it lives). `knowledgeDb` is normally omitted so the engine resolves its own default
3046
- * (`~/.wicked-estate/knowledge.db`) — {@link knowledgeDbOverride} is the env escape hatch.
3142
+ * of where it lives). {@link governanceKnowledgeDb} pins isolated homes; the default home keeps
3143
+ * the engine default (`~/.wicked-estate/knowledge.db`) unless explicitly overridden.
3047
3144
  *
3048
3145
  * Presence-gated (the campaigns doctrine): throws {@link GovernanceEvalsUnsupportedError} on
3049
3146
  * an addon that predates the binding, which the route maps to 501 ("upgrade the engine").
@@ -3053,7 +3150,7 @@ export class CoreAdapter {
3053
3150
  if (typeof fn !== 'function') {
3054
3151
  throw new GovernanceEvalsUnsupportedError('Running governance evals');
3055
3152
  }
3056
- const knowledgeDb = CoreAdapter.knowledgeDbOverride();
3153
+ const knowledgeDb = CoreAdapter.governanceKnowledgeDb();
3057
3154
  const payload = {
3058
3155
  ...(args.type !== undefined ? { type: args.type } : {}),
3059
3156
  ...(args.corpus !== undefined ? { corpus: args.corpus } : {}),
@@ -3065,8 +3162,7 @@ export class CoreAdapter {
3065
3162
  /**
3066
3163
  * Import a named eval corpus into the knowledge store under the `evals:<name>` scope (the
3067
3164
  * string a later {@link runGovernanceEvals} names as `corpus`). `knowledgeDb` resolves the
3068
- * same way as in {@link runGovernanceEvals} — normally omitted (engine default:
3069
- * `~/.wicked-estate/knowledge.db`), {@link knowledgeDbOverride} wins when set.
3165
+ * same way as in {@link runGovernanceEvals}, through {@link governanceKnowledgeDb}.
3070
3166
  *
3071
3167
  * Gated on the `governanceEvals` sentinel as well as the binding itself: the two ship
3072
3168
  * together, and importing a corpus no engine on this host can ever run would be a trap, not
@@ -3077,7 +3173,7 @@ export class CoreAdapter {
3077
3173
  if (typeof this.core.governanceEvals !== 'function' || typeof importFn !== 'function') {
3078
3174
  throw new GovernanceEvalsUnsupportedError('Importing an eval corpus');
3079
3175
  }
3080
- const knowledgeDb = CoreAdapter.knowledgeDbOverride();
3176
+ const knowledgeDb = CoreAdapter.governanceKnowledgeDb();
3081
3177
  return parseEngineJson(await importFn.call(this.core, JSON.stringify({ name, samples, ...(knowledgeDb !== undefined ? { knowledgeDb } : {}) })), 'governanceCorpusImport');
3082
3178
  }
3083
3179
  // ── Workflow viewer + builder (crew#44) ────────────────────────────────────
@@ -3195,12 +3291,12 @@ export class CoreAdapter {
3195
3291
  return def.id;
3196
3292
  }
3197
3293
  /**
3198
- * Save an inline script to `~/.wicked/scripts/<name>.<ext>`, make it executable,
3294
+ * Save an inline script under the state-home-derived scripts root, make it executable,
3199
3295
  * and return the absolute path. Tool-executor phases use this path as their command.
3200
3296
  */
3201
3297
  async saveScript(name, content, lang) {
3202
3298
  const ext = lang === 'python' ? 'py' : 'sh';
3203
- const dir = wickedDir('scripts');
3299
+ const dir = wickedWorkRoot('scripts');
3204
3300
  await mkdir(dir, { recursive: true });
3205
3301
  const filename = `${name.replace(/[^a-z0-9_-]/gi, '_')}.${ext}`;
3206
3302
  const path = join(dir, filename);
@@ -3282,8 +3378,8 @@ export class CoreAdapter {
3282
3378
  /** The settings as read, and whether the read succeeded: a file that could not be read, parsed or
3283
3379
  * validated serves the defaults (`ok: false`), which the engine's QE mirror reads as a failure. */
3284
3380
  async readSettings() {
3285
- await seedStateHomeSettings(settingsFilePath());
3286
3381
  try {
3382
+ await seedStateHomeSettings(settingsFilePath());
3287
3383
  const raw = await readFile(settingsFilePath(), 'utf8');
3288
3384
  const parsed = JSON.parse(raw);
3289
3385
  // Validate numeric fields; drop anything out-of-range rather than propagate bad values.
@@ -3292,6 +3388,8 @@ export class CoreAdapter {
3292
3388
  if (typeof v !== 'number' || !Number.isInteger(v) || v < 1 || v > 10000)
3293
3389
  delete parsed.graphNodeLimit;
3294
3390
  }
3391
+ if ('deliverAuthorNoreply' in parsed && typeof parsed.deliverAuthorNoreply !== 'boolean')
3392
+ delete parsed.deliverAuthorNoreply;
3295
3393
  // deliverIdentityLogin (crew#549): a LOGIN, and the same charset PUT /settings enforces —
3296
3394
  // a hand-edited settings.json must not enable a value the API rejects (and must never be
3297
3395
  // able to put anything but a login into the deliver script's shell literal). Anything else