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
@@ -38,12 +38,13 @@
38
38
  * situations with five different remedies; collapsing them into an empty result set is the failure
39
39
  * estate's own R3 rule exists to prevent, and it is the failure FINDING-069 actually shipped.
40
40
  */
41
- import { existsSync } from 'node:fs';
42
- import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
43
- import { dirname } from 'node:path';
41
+ import { constants as fsConstants, existsSync, lstatSync } from 'node:fs';
42
+ import { mkdir, open, rename, unlink } from 'node:fs/promises';
43
+ import { randomUUID } from 'node:crypto';
44
+ import { basename, dirname, resolve as resolvePath } from 'node:path';
44
45
  import { ExecOutputTooLarge, execCapped } from '../core/exec.js';
45
46
  import { codeGraphDb, CodeGraphRootUnresolvableError } from '../core/repoPaths.js';
46
- import { projectGraphDb, projectGraphManifest, repoLabel } from './graph-paths.js';
47
+ import { projectGraphDb, projectGraphManifest, projectGraphRoot, repoLabel } from './graph-paths.js';
47
48
  /** The sentence every project-graph response carries. Stated on the wire, not just in this file. */
48
49
  export const CO_LOCATION_NOTE = 'Co-located, not linked: each repo is indexed under its own label and edges do not resolve ' +
49
50
  'across repos. Results are per-repo hits gathered into one answer, never a cross-repo trace.';
@@ -179,9 +180,20 @@ export function resetProjectGraphRefreshStates() {
179
180
  function message(err) {
180
181
  return err instanceof Error ? err.message : String(err);
181
182
  }
182
- async function readManifest(projectId, env) {
183
+ /** Open flags that never follow a link at the last step (`O_NOFOLLOW` is 0 where the platform has none). */
184
+ const NOFOLLOW = fsConstants.O_NOFOLLOW ?? 0;
185
+ export async function readManifest(projectId, env) {
183
186
  try {
184
- const raw = JSON.parse(await readFile(projectGraphManifest(projectId, env), 'utf8'));
187
+ // A link in place of the manifest is not crew's manifest: it reads as missing (re-index everything).
188
+ const fh = await open(projectGraphManifest(projectId, env), fsConstants.O_RDONLY | NOFOLLOW);
189
+ let text;
190
+ try {
191
+ text = await fh.readFile('utf8');
192
+ }
193
+ finally {
194
+ await fh.close();
195
+ }
196
+ const raw = JSON.parse(text);
185
197
  if (raw?.version !== 1 || !Array.isArray(raw.repos))
186
198
  return null;
187
199
  return raw;
@@ -194,13 +206,110 @@ async function readManifest(projectId, env) {
194
206
  return null;
195
207
  }
196
208
  }
197
- async function writeManifest(projectId, manifest, env) {
209
+ export async function writeManifest(projectId, manifest, env) {
198
210
  const path = projectGraphManifest(projectId, env);
199
211
  await mkdir(dirname(path), { recursive: true });
200
- const tmp = `${path}.tmp-${process.pid}`;
201
- await writeFile(tmp, JSON.stringify(manifest, null, 2), 'utf8');
212
+ // crew#1497: a fresh, unguessable temp name created exclusively (`O_EXCL` never follows or reuses whatever is at
213
+ // the name, a link included), then renamed over the manifest (a rename replaces a link; it never writes through one).
214
+ const tmp = `${path}.tmp-${process.pid}-${randomUUID()}`;
215
+ const fh = await open(tmp, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL | NOFOLLOW, 0o644);
216
+ try {
217
+ await fh.writeFile(JSON.stringify(manifest, null, 2), 'utf8');
218
+ }
219
+ catch (err) {
220
+ await fh.close().catch(() => undefined);
221
+ await unlink(tmp).catch(() => undefined);
222
+ throw err;
223
+ }
224
+ await fh.close();
202
225
  await rename(tmp, path);
203
226
  }
227
+ /** Upper bound on estate's writer open plus its journal switch (it waits up to 15 s for other connections). */
228
+ const GRAPH_PREPARE_TIMEOUT_MS = 120_000;
229
+ /**
230
+ * crew#1497: make the project graph readable by a seat that may only read it. A seat's read-only estate refuses a
231
+ * graph whose schema is older than its own build, and cannot open a WAL graph from a directory it cannot write. So the
232
+ * owner does both after its writes, with estate's own binary (only estate's SQLite ever opens estate's graph):
233
+ * `wicked-estate stats --db <graph> --journal delete` is a writer open (estate migrates on every one, even when the
234
+ * refresh indexed nothing) that then leaves the graph in DELETE journal mode (wicked-estate#491, 0.35.7). Returns null
235
+ * when that landed, else why not; the caller records it as a failed refresh, and the project's chat gets no graph.
236
+ */
237
+ export async function prepareGraphForReaders(dbPath, env = process.env, run = execCapped) {
238
+ const why = await prepareOnce(dbPath, env, run);
239
+ noteReaders(dbPath, why);
240
+ return why;
241
+ }
242
+ async function prepareOnce(dbPath, env, run) {
243
+ // Never through a link: the migration and the journal switch would land on whatever it names (codex r2 #18).
244
+ try {
245
+ if (!lstatSync(dbPath).isFile())
246
+ return 'the graph is not a regular file';
247
+ }
248
+ catch (err) {
249
+ return message(err);
250
+ }
251
+ try {
252
+ await run(estateExe(env), ['stats', '--db', dbPath, '--journal', 'delete'], { timeout: GRAPH_PREPARE_TIMEOUT_MS });
253
+ return null;
254
+ }
255
+ catch (err) {
256
+ // The message carries estate's stderr (a locked graph, an older estate without `--journal`): one line for a status.
257
+ return `wicked-estate stats --journal delete failed (${stderrTail(message(err).replace(/\s+/gu, ' '), 400)}); it needs wicked-estate 0.35.7 or later`;
258
+ }
259
+ }
260
+ /** Why each project graph is not ready for read-only seats, by db path; absent when it is (codex r2 #1). */
261
+ const readersNotReady = new Map();
262
+ function noteReaders(dbPath, why) {
263
+ if (why === null)
264
+ readersNotReady.delete(resolvePath(dbPath));
265
+ else
266
+ readersNotReady.set(resolvePath(dbPath), why);
267
+ }
268
+ /** Why the graph at `dbPath` is not ready for read-only seats (its last preparation failed), or null. */
269
+ export function graphReadersError(dbPath) {
270
+ return readersNotReady.get(resolvePath(dbPath)) ?? null;
271
+ }
272
+ /** Whether `dbPath` is a project graph this daemon owns (`<project-graph root>/<id>/code-graph.db`). */
273
+ function isProjectGraphDb(dbPath, env) {
274
+ const abs = resolvePath(dbPath);
275
+ return basename(abs) === PROJECT_GRAPH_DB_NAME && dirname(dirname(abs)) === resolvePath(projectGraphRoot(env));
276
+ }
277
+ const PROJECT_GRAPH_DB_NAME = 'code-graph.db';
278
+ /**
279
+ * crew#1497 (codex r2 #2): estate's CLI opens a graph as a writer for every verb, reads included, and a writer open
280
+ * switches it to WAL. A read-only seat cannot read a WAL graph from a directory it cannot write. So each of crew's own
281
+ * CLI reads of a project graph puts it back in DELETE mode afterwards (a failure is recorded like a failed
282
+ * preparation). Any other graph is read as before.
283
+ */
284
+ export async function readProjectGraph(dbPath, read, env = process.env, run = execCapped) {
285
+ try {
286
+ return await read();
287
+ }
288
+ finally {
289
+ if (isProjectGraphDb(dbPath, env) && existsSync(dbPath))
290
+ noteReaders(dbPath, await prepareOnce(dbPath, env, run));
291
+ }
292
+ }
293
+ /**
294
+ * Prepare one project's graph for read-only seats in that project's refresh slot: after any refresh in flight, so the
295
+ * migration and journal switch never interleave with its index. Returns null when ready, else why not.
296
+ */
297
+ export async function prepareProjectGraphForReaders(projectId, env = process.env, run = execCapped) {
298
+ const running = inFlight.get(projectId);
299
+ if (running !== undefined)
300
+ await running.promise.catch(() => undefined);
301
+ const why = await prepareGraphForReaders(projectGraphDb(projectId, env), env, run);
302
+ // Said where a person sees a refresh fail (the project's refresh status), not only in the log (coord, crew#1597).
303
+ if (why !== null) {
304
+ const at = Date.now();
305
+ const prior = refreshStates.get(projectId);
306
+ refreshStates.set(projectId, {
307
+ ...(prior ?? { state: 'idle', startedAt: at, finishedAt: at, budgetMs: null, repoId: null, repoStartedAt: null, repoBudgetMs: null }),
308
+ lastFailure: { at, repoId: null, label: null, error: `the graph is not ready for read-only seats: ${why}`, timedOut: false, budgetMs: null },
309
+ });
310
+ }
311
+ return why;
312
+ }
204
313
  /**
205
314
  * The project's `crew.repo` members, resolved against the registry.
206
315
  *
@@ -501,6 +610,19 @@ function buildStatus({ projectId, members, manifest, dbExists, env }) {
501
610
  action: 'projects.graph.refresh',
502
611
  };
503
612
  }
613
+ // crew#1497: a graph its seats cannot read (its preparation failed) is never bound to a chat or a run. The state
614
+ // stays what the graph holds; dbPath is withheld, and the detail says why and what fixes it.
615
+ const readers = graphReadersError(dbPath);
616
+ if (readers !== null) {
617
+ return {
618
+ ...base,
619
+ dbPath: null,
620
+ state: indexedCount === 1 ? 'ready-single-repo' : 'ready',
621
+ detail: `This project's code graph could not be prepared for its chats and runs (${readers}), so they get no ` +
622
+ `project graph until a refresh succeeds. Refresh it from the project page.`,
623
+ action: 'projects.graph.refresh',
624
+ };
625
+ }
504
626
  if (indexedCount === 1) {
505
627
  return {
506
628
  ...base,
@@ -649,6 +771,11 @@ async function doRefresh(adapter, projectId, env, force, log) {
649
771
  // The indexes landed but the link step did not publish (codex r1): still a failure, owed by the watcher.
650
772
  lastFailure = { at: Date.now(), repoId: null, label: null, error: `the link step did not publish: ${linkFailed}`, timedOut: false, budgetMs: null };
651
773
  }
774
+ // crew#1497 (codex r2 #1): a graph read-only seats cannot read is a failed refresh, said in its status and owed.
775
+ const readers = graphReadersError(projectGraphDb(projectId, env));
776
+ if (failedRow === undefined && linkFailed === undefined && readers !== null) {
777
+ lastFailure = { at: Date.now(), repoId: null, label: null, error: `the graph is not ready for read-only seats: ${readers}`, timedOut: false, budgetMs: null };
778
+ }
652
779
  if (failedRow !== undefined) {
653
780
  lastFailure = {
654
781
  at: Date.now(),
@@ -683,9 +810,10 @@ async function refreshOnce(adapter, projectId, env, force, st, log) {
683
810
  const skipped = [];
684
811
  const failed = [];
685
812
  const repoRows = [];
686
- if (members.repos.length === 0) {
813
+ // No members and no graph: nothing to build and nothing to prune (crew#1476 prunes an existing one below).
814
+ if (members.repos.length === 0 && !existsSync(dbPath)) {
687
815
  return {
688
- status: buildStatus({ projectId, members, manifest: null, dbExists: existsSync(dbPath), env }),
816
+ status: buildStatus({ projectId, members, manifest: null, dbExists: false, env }),
689
817
  indexed,
690
818
  skipped,
691
819
  failed,
@@ -693,7 +821,7 @@ async function refreshOnce(adapter, projectId, env, force, st, log) {
693
821
  };
694
822
  }
695
823
  assertLabelsUnique(members.repos);
696
- if (!(await estateSupportsMultiRepo(env))) {
824
+ if (members.repos.length > 0 && !(await estateSupportsMultiRepo(env))) {
697
825
  // Refusing is the ONLY safe answer. An estate without `--repo` accepts the flag, drops it, and
698
826
  // exits 0, so proceeding would co-locate three repos into a database holding one of them, with
699
827
  // nothing in any output to say so.
@@ -710,8 +838,27 @@ async function refreshOnce(adapter, projectId, env, force, st, log) {
710
838
  budgets.set(m.label, await adapter.indexBudget(m.repo.root_path));
711
839
  st.budgetMs = [...budgets.values()].reduce((sum, b) => sum + b.budgetMs, 0);
712
840
  await mkdir(dirname(dbPath), { recursive: true });
713
- const dbExisted = existsSync(dbPath);
841
+ let dbExisted = existsSync(dbPath);
714
842
  const prior = dbExisted ? await readManifest(projectId, env) : null;
843
+ const currentLabels = new Set(members.repos.map((m) => m.label));
844
+ const pruned = (prior?.repos ?? []).map((r) => r.label).filter((label) => !currentLabels.has(label));
845
+ if (dbExisted && pruned.length > 0) {
846
+ // crew#1476: estate has no per-label delete; rebuild only on refresh, including journal siblings.
847
+ for (const suffix of ['', '-wal', '-shm', '-journal']) {
848
+ try {
849
+ await unlink(`${dbPath}${suffix}`);
850
+ }
851
+ catch (err) {
852
+ if (err.code !== 'ENOENT')
853
+ throw err;
854
+ }
855
+ }
856
+ dbExisted = false;
857
+ // The old manifest describes the database just deleted. Left in place, the first member to re-index
858
+ // recreates the db and status reads every not-yet-rebuilt member as indexed (`ready` mid-rebuild).
859
+ await writeManifest(projectId, { version: 1, projectId, repos: [] }, env);
860
+ log?.(`project graph ${projectId}: rebuild to prune removed labels ${pruned.join(', ')}`);
861
+ }
715
862
  const priorByLabel = new Map((prior?.repos ?? []).map((r) => [r.label, r]));
716
863
  // Prior rows survive a refresh only if the database they describe does. When it does not, every
717
864
  // repo is re-indexed and the manifest is rebuilt from this run alone.
@@ -854,6 +1001,12 @@ async function refreshOnce(adapter, projectId, env, force, st, log) {
854
1001
  await writeManifest(projectId, manifest, env);
855
1002
  // X1: link LAST, over the current members, once every index of this refresh has finished.
856
1003
  const link = await linkMembers(projectId, dbPath, members.repos.map((m) => m.label), env, log);
1004
+ // crew#1497: the last write of a refresh. Seats read the graph from a directory they cannot write.
1005
+ if (existsSync(dbPath)) {
1006
+ const why = await prepareGraphForReaders(dbPath, env);
1007
+ if (why !== null)
1008
+ log?.(`project graph ${projectId}: ${dbPath} is not ready for read-only seats (${why}); their estate refuses it, with this cause, until the next refresh`);
1009
+ }
857
1010
  return {
858
1011
  status: buildStatus({ projectId, members, manifest, dbExists: existsSync(dbPath), env }),
859
1012
  indexed,
@@ -861,6 +1014,7 @@ async function refreshOnce(adapter, projectId, env, force, st, log) {
861
1014
  failed,
862
1015
  repos: repoRows,
863
1016
  ...(link === undefined ? {} : { link }),
1017
+ ...(pruned.length === 0 ? {} : { pruned }),
864
1018
  };
865
1019
  }
866
1020
  /**
@@ -1027,7 +1181,7 @@ export async function queryable(adapter, projectId, env = process.env) {
1027
1181
  * `null` when the prefix is not a CURRENT member's label: rows of a repo that has since been
1028
1182
  * detached are still in the database (estate has no per-label delete), and returning them under a
1029
1183
  * project-scoped query would answer about a repo the project no longer contains. They are excluded
1030
- * here and named in `status.staleRepos`, which is a different thing from being dropped silently.
1184
+ * here and named in `status.staleRepos` until refresh rebuilds without them (crew#1476).
1031
1185
  */
1032
1186
  function attribute(path, labels) {
1033
1187
  const slash = path.indexOf('/');
@@ -1075,6 +1229,8 @@ function toHit(raw, labels) {
1075
1229
  kind: typeof raw.kind === 'string' ? raw.kind : '',
1076
1230
  file: where.file,
1077
1231
  line: typeof raw.line === 'number' ? raw.line : 0,
1232
+ ...(typeof raw.depth === 'number' ? { depth: raw.depth } : {}),
1233
+ ...(raw.stale === 'modified' || raw.stale === 'deleted' ? { stale: raw.stale } : {}),
1078
1234
  ...(typeof raw.via_crossing === 'string' ? { via_crossing: raw.via_crossing } : {}),
1079
1235
  ...(raw.via_crossing_omitted === true ? { via_crossing_omitted: true } : {}),
1080
1236
  };
@@ -1082,11 +1238,64 @@ function toHit(raw, labels) {
1082
1238
  /** Safety stop for following estate's blast-radius cursor: a server that kept issuing cursors would
1083
1239
  * loop forever. 200 pages of ~235 rows is far past any real answer. */
1084
1240
  const MAX_BLAST_PAGES = 200;
1241
+ /** crew#1556: estate's cap on the stale-file sample, retained across reply pages. */
1242
+ const STALE_FILES_CAP = 20;
1243
+ function mergeFreshness(pages) {
1244
+ const staleFiles = new Map();
1245
+ const indexing = new Set();
1246
+ let commitsBehind;
1247
+ let unindexedFiles = null;
1248
+ let staleFilesTotal = 0;
1249
+ let checkedFiles = 0;
1250
+ let notFileBacked = 0;
1251
+ for (const page of pages) {
1252
+ for (const row of page.stale_files ?? []) {
1253
+ if (!staleFiles.has(row.file) && staleFiles.size < STALE_FILES_CAP)
1254
+ staleFiles.set(row.file, row);
1255
+ }
1256
+ for (const label of page.indexing ?? [])
1257
+ indexing.add(label);
1258
+ if (page.commits_behind === null)
1259
+ commitsBehind = null;
1260
+ else if (commitsBehind !== null && typeof page.commits_behind === 'number') {
1261
+ commitsBehind = Math.max(commitsBehind ?? 0, page.commits_behind);
1262
+ }
1263
+ if (typeof page.unindexed_files === 'number')
1264
+ unindexedFiles = Math.max(unindexedFiles ?? 0, page.unindexed_files);
1265
+ // crew#1556: per-page counts; a file spanning pages counts once on each page.
1266
+ if (typeof page.stale_files_total === 'number')
1267
+ staleFilesTotal += page.stale_files_total;
1268
+ if (typeof page.checked_files === 'number')
1269
+ checkedFiles += page.checked_files;
1270
+ if (typeof page.not_file_backed === 'number')
1271
+ notFileBacked += page.not_file_backed;
1272
+ }
1273
+ const roots = pages.at(-1)?.roots;
1274
+ return {
1275
+ stale_files: [...staleFiles.values()], stale_files_total: staleFilesTotal,
1276
+ checked_files: checkedFiles, not_file_backed: notFileBacked,
1277
+ ...(commitsBehind === undefined ? {} : { commits_behind: commitsBehind }),
1278
+ unindexed_files: unindexedFiles, indexing: [...indexing],
1279
+ ...(roots === undefined ? {} : { roots }),
1280
+ };
1281
+ }
1282
+ /** crew#1555: keep counts intact while attributing the sample and removing host paths. */
1283
+ function attributeFreshness(raw, labels) {
1284
+ const { stale_files, ...rest } = raw;
1285
+ delete rest.roots;
1286
+ return {
1287
+ ...rest,
1288
+ ...(stale_files === undefined ? {} : { stale_files: stale_files.flatMap((row) => {
1289
+ const where = attribute(row.file, labels);
1290
+ return where === null ? [] : [{ ...where, status: row.status }];
1291
+ }) }),
1292
+ };
1293
+ }
1085
1294
  /**
1086
1295
  * `wicked-estate blast-radius --json`, EVERY page of it (operator ruling "full graph"; estate#279,
1087
1296
  * wicked-estate 0.28.0+). estate pages a wide answer: a page names the rest with `next_cursor`
1088
1297
  * (null on the last page), and `--cursor` returns the next rows of the SAME answer. The pages'
1089
- * `dependents` are joined; every other field is the LAST page's, so once every page is in,
1298
+ * `dependents` are joined and freshness is merged (crew#1556); other fields are the LAST page's, so once every page is in,
1090
1299
  * `truncated_dependents` says only what the walk itself cut (and `next_cursor` is null). A cursor
1091
1300
  * still unread at the page cap is left on the answer with that page's `truncated_dependents`, so
1092
1301
  * the unread rows read as cut, never as absent. An estate that does not page sends no
@@ -1094,6 +1303,7 @@ const MAX_BLAST_PAGES = 200;
1094
1303
  */
1095
1304
  export async function readBlastRadiusPages(exe, name, dbPath, opts) {
1096
1305
  const dependents = [];
1306
+ const freshnessPages = [];
1097
1307
  let first = null;
1098
1308
  let last = {};
1099
1309
  let cursor = null;
@@ -1102,6 +1312,9 @@ export async function readBlastRadiusPages(exe, name, dbPath, opts) {
1102
1312
  const { stdout } = await execCapped(exe, args, opts);
1103
1313
  last = JSON.parse(stdout);
1104
1314
  first ??= last;
1315
+ if (last['freshness'] !== null && typeof last['freshness'] === 'object') {
1316
+ freshnessPages.push(last['freshness']);
1317
+ }
1105
1318
  if (Array.isArray(last['dependents']))
1106
1319
  dependents.push(...last['dependents']);
1107
1320
  cursor = typeof last['next_cursor'] === 'string' && last['next_cursor'] !== '' ? last['next_cursor'] : null;
@@ -1111,6 +1324,8 @@ export async function readBlastRadiusPages(exe, name, dbPath, opts) {
1111
1324
  if (first === last)
1112
1325
  return last;
1113
1326
  const merged = { ...last, dependents };
1327
+ if (freshnessPages.length > 0)
1328
+ merged['freshness'] = mergeFreshness(freshnessPages);
1114
1329
  // The joined rows' window: from the first page's start, over the last page's total.
1115
1330
  const p0 = first?.['page'];
1116
1331
  const pn = last['page'];
@@ -1121,15 +1336,12 @@ export async function readBlastRadiusPages(exe, name, dbPath, opts) {
1121
1336
  }
1122
1337
  /** Dependents of a symbol across every member repo, each hit attributed to the repo it is in. */
1123
1338
  export async function projectBlastRadius(q, name, env = process.env) {
1124
- const raw = (await readBlastRadiusPages(estateExe(env), name, q.dbPath, { timeout: QUERY_TIMEOUT_MS }));
1339
+ const raw = (await readProjectGraph(q.dbPath, () => readBlastRadiusPages(estateExe(env), name, q.dbPath, { timeout: QUERY_TIMEOUT_MS }), env));
1125
1340
  const { hits: allHits, byRepo } = attributeHits(raw.dependents, q.labels);
1126
1341
  // X1: estate lists the same (shallowest, capped) crossings on every page; the last page's list.
1127
1342
  // Only crossings between CURRENT members count: a removed member's links stay in the database
1128
1343
  // until the next refresh relinks without it, and must not make an answer read `linked`.
1129
- const members = new Set(q.labels.keys());
1130
- const listed = Array.isArray(raw.crossings) ? raw.crossings : [];
1131
- const crossings = listed.filter((c) => members.has(c.from?.repo) && members.has(c.to?.repo));
1132
- const dropped = new Set(listed.filter((c) => !crossings.includes(c)).map((c) => c.id));
1344
+ const { crossings, dropped } = memberCrossings(raw.crossings, q.labels);
1133
1345
  // A hit reached through a dropped crossing loses its provenance claim along with the crossing.
1134
1346
  const hits = allHits.map((h) => {
1135
1347
  if (h.via_crossing === undefined || !dropped.has(h.via_crossing))
@@ -1157,6 +1369,9 @@ export async function projectBlastRadius(q, name, env = process.env) {
1157
1369
  };
1158
1370
  return {
1159
1371
  ...causes,
1372
+ ...(typeof raw.resolved === 'boolean' ? { resolved: raw.resolved } : {}),
1373
+ ...(raw.freshness === undefined ? {} : { freshness: attributeFreshness(raw.freshness, q.labels) }),
1374
+ ...blastCoverage(raw.link, q.status.projectId, q.labels),
1160
1375
  projectId: q.status.projectId,
1161
1376
  target: typeof raw.target === 'string' ? raw.target : name,
1162
1377
  dependents: hits,
@@ -1177,6 +1392,104 @@ export async function projectBlastRadius(q, name, env = process.env) {
1177
1392
  ...(linked && stale ? { link_stale: true, link_stale_labels: [...new Set(staleLabels)].sort() } : {}),
1178
1393
  };
1179
1394
  }
1395
+ /** crew#1476: only crossings between current members can substantiate a project answer. */
1396
+ function memberCrossings(raw, labels) {
1397
+ const listed = Array.isArray(raw) ? raw : [];
1398
+ const crossings = listed.filter((c) => labels.has(c.from?.repo) && labels.has(c.to?.repo));
1399
+ return { crossings, dropped: new Set(listed.filter((c) => !crossings.includes(c)).map((c) => c.id)) };
1400
+ }
1401
+ /** crew#1476, crew#1477: shared coverage attribution; omitted metrics stay unknown. */
1402
+ function memberCoverage(state, labels) {
1403
+ return [...labels].sort(([a], [b]) => a.localeCompare(b)).map(([repo, repoId]) => {
1404
+ const row = state.coverage?.find((c) => c.label === repo);
1405
+ return {
1406
+ repoId, repo,
1407
+ ...(typeof row?.links_in === 'number' ? { links_in: row.links_in } : {}),
1408
+ ...(typeof row?.links_out === 'number' ? { links_out: row.links_out } : {}),
1409
+ ...(typeof row?.incomplete === 'boolean' ? { incomplete: row.incomplete } : {}),
1410
+ ...(typeof row?.package_imports === 'number' ? { package_imports: row.package_imports } : {}),
1411
+ ...(typeof row?.manifests === 'number' ? { manifests: row.manifests } : {}),
1412
+ ...(row?.boundary_counts === undefined ? {} : { boundary_counts: row.boundary_counts }),
1413
+ };
1414
+ });
1415
+ }
1416
+ function blastCoverage(raw, projectId, labels) {
1417
+ const state = (Array.isArray(raw) ? raw : []).find((s) => s.project === projectId);
1418
+ return state === undefined ? {} : { coverage: memberCoverage(state, labels) };
1419
+ }
1420
+ function pathEnd(raw, labels) {
1421
+ // estate emits a bare `{symbol}` only if an endpoint is missing from its own result: not attributable.
1422
+ if (typeof raw.file !== 'string')
1423
+ return null;
1424
+ const where = attribute(raw.file, labels);
1425
+ return where === null ? null : { ...where, symbol: raw.symbol, name: raw.name, kind: raw.kind, line: raw.line_1based };
1426
+ }
1427
+ /** crew#1476: an estate route is a project answer only when every endpoint is a current member. */
1428
+ export async function projectGraphPath(q, from, to, maxDepth, env = process.env) {
1429
+ const { stdout } = await readProjectGraph(q.dbPath, () => execCapped(estateExe(env), [
1430
+ 'path', from, to, '--db', q.dbPath, '--json', ...(maxDepth === undefined ? [] : ['--max-depth', String(maxDepth)]),
1431
+ ], { timeout: QUERY_TIMEOUT_MS }), env);
1432
+ const raw = JSON.parse(stdout);
1433
+ const hops = [];
1434
+ let excluded = false;
1435
+ for (const hop of raw.hops) {
1436
+ const source = pathEnd(hop.source, q.labels);
1437
+ const target = pathEnd(hop.target, q.labels);
1438
+ if (source === null || target === null) {
1439
+ excluded = true;
1440
+ break;
1441
+ }
1442
+ hops.push({ source, target, kind: hop.kind, ...(typeof hop.confidence === 'number' ? { confidence: hop.confidence } : {}) });
1443
+ }
1444
+ const { crossings } = memberCrossings(raw.crossings, q.labels);
1445
+ const linked = crossings.length > 0;
1446
+ return {
1447
+ projectId: q.status.projectId, from: raw.from, to: raw.to, found: excluded ? false : raw.found,
1448
+ ...(typeof raw.resolved === 'boolean' ? { resolved: raw.resolved } : {}),
1449
+ unresolved: raw.unresolved, hops: excluded ? [] : hops,
1450
+ depth_bounded: raw.depth_bounded, node_bounded: raw.node_bounded,
1451
+ ...(Array.isArray(raw.crossings) ? { crossings } : {}),
1452
+ ...(excluded ? { excluded: 'the route found runs through a repository that is no longer in this project; refresh the project graph' } : {}),
1453
+ reposSearched: [...q.labels.keys()].sort(), missingRepos: q.status.missingRepos,
1454
+ linkage: linked ? 'linked' : 'co-located',
1455
+ note: `${linked ? LINKED_NOTE : CO_LOCATION_NOTE}${raw.depth_bounded || raw.node_bounded ? ' The search stopped at its depth or node bound, so a route it did not find may still exist.' : ''}`,
1456
+ };
1457
+ }
1458
+ /** crew#1477: possible boundaries are imports the linker could not prove, never graph edges. */
1459
+ export async function projectGraphBoundaries(q, env = process.env) {
1460
+ const base = { projectId: q.status.projectId, linked: false, possible: [], members: [] };
1461
+ if (!(await estateSupportsLink(env)))
1462
+ return {
1463
+ ...base, note: 'this wicked-estate cannot link repositories (X1, wicked-estate 0.34.0+); upgrade it to see boundaries',
1464
+ };
1465
+ const { stdout } = await readProjectGraph(q.dbPath, () => execCapped(estateExe(env), [
1466
+ 'link', '--project', q.status.projectId, '--status', '--json', '--db', q.dbPath,
1467
+ ], { timeout: QUERY_TIMEOUT_MS }), env);
1468
+ const raw = JSON.parse(stdout);
1469
+ if (raw === null)
1470
+ return { ...base, note: 'this project has not been linked yet; refresh its code graph' };
1471
+ const possible = [];
1472
+ for (const row of raw.coverage ?? []) {
1473
+ const repoId = q.labels.get(row.label);
1474
+ if (repoId === undefined)
1475
+ continue;
1476
+ for (const [reason, packages] of Object.entries(row.boundaries ?? {})) {
1477
+ for (const pkg of packages)
1478
+ possible.push({ repoId, repo: row.label, reason, package: pkg });
1479
+ }
1480
+ }
1481
+ possible.sort((a, b) => a.repo.localeCompare(b.repo) || a.reason.localeCompare(b.reason) || a.package.localeCompare(b.package));
1482
+ return {
1483
+ projectId: q.status.projectId, linked: true,
1484
+ ...(raw.generation === undefined ? {} : { generation: raw.generation }),
1485
+ ...(raw.stale === undefined ? {} : { stale: raw.stale }),
1486
+ stale_labels: (raw.stale_labels ?? []).filter((label) => q.labels.has(label)),
1487
+ ...(raw.last_error === undefined ? {} : { last_error: raw.last_error }),
1488
+ members: memberCoverage(raw, q.labels), possible: possible.slice(0, 500),
1489
+ ...(possible.length > 500 ? { possible_total: possible.length, possible_truncated: true } : {}),
1490
+ note: 'possible = imports estate could not prove are links to another member, by reason; never edges',
1491
+ };
1492
+ }
1180
1493
  /**
1181
1494
  * Symbol search across every member repo — exact name, which is what estate's `resolve` answers.
1182
1495
  *
@@ -1187,9 +1500,7 @@ export async function projectBlastRadius(q, name, env = process.env) {
1187
1500
  * against a co-located graph it returns every repo's matches in one call.
1188
1501
  */
1189
1502
  export async function projectSymbolSearch(q, name, env = process.env) {
1190
- const { stdout } = await execCapped(estateExe(env), ['resolve', name, '--db', q.dbPath, '--json'], {
1191
- timeout: QUERY_TIMEOUT_MS,
1192
- });
1503
+ const { stdout } = await readProjectGraph(q.dbPath, () => execCapped(estateExe(env), ['resolve', name, '--db', q.dbPath, '--json'], { timeout: QUERY_TIMEOUT_MS }), env);
1193
1504
  const { hits, byRepo } = attributeHits(JSON.parse(stdout), q.labels);
1194
1505
  return {
1195
1506
  projectId: q.status.projectId,