wicked-crew 0.17.1 → 0.18.1

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 (520) hide show
  1. package/README.md +49 -14
  2. package/adapters/web-source.lock +1314 -0
  3. package/dist/api/audit.d.ts +5 -0
  4. package/dist/api/audit.d.ts.map +1 -1
  5. package/dist/api/audit.js +20 -0
  6. package/dist/api/audit.js.map +1 -1
  7. package/dist/api/auth.d.ts.map +1 -1
  8. package/dist/api/auth.js +3 -0
  9. package/dist/api/auth.js.map +1 -1
  10. package/dist/api/chat-context.js +1 -1
  11. package/dist/api/chat-history.d.ts +3 -0
  12. package/dist/api/chat-history.d.ts.map +1 -1
  13. package/dist/api/chat-history.js +6 -1
  14. package/dist/api/chat-history.js.map +1 -1
  15. package/dist/api/chat-jobs.d.ts +30 -1
  16. package/dist/api/chat-jobs.d.ts.map +1 -1
  17. package/dist/api/chat-jobs.js +172 -10
  18. package/dist/api/chat-jobs.js.map +1 -1
  19. package/dist/api/chat-proposals.d.ts +178 -8
  20. package/dist/api/chat-proposals.d.ts.map +1 -1
  21. package/dist/api/chat-proposals.js +775 -54
  22. package/dist/api/chat-proposals.js.map +1 -1
  23. package/dist/api/chat-requirements.d.ts +54 -0
  24. package/dist/api/chat-requirements.d.ts.map +1 -0
  25. package/dist/api/chat-requirements.js +282 -0
  26. package/dist/api/chat-requirements.js.map +1 -0
  27. package/dist/api/chat-scope.d.ts +56 -0
  28. package/dist/api/chat-scope.d.ts.map +1 -1
  29. package/dist/api/chat-scope.js +175 -5
  30. package/dist/api/chat-scope.js.map +1 -1
  31. package/dist/api/chat-transcripts.d.ts +7 -0
  32. package/dist/api/chat-transcripts.d.ts.map +1 -1
  33. package/dist/api/chat-transcripts.js +17 -1
  34. package/dist/api/chat-transcripts.js.map +1 -1
  35. package/dist/api/delivery-index.d.ts +109 -5
  36. package/dist/api/delivery-index.d.ts.map +1 -1
  37. package/dist/api/delivery-index.js +199 -7
  38. package/dist/api/delivery-index.js.map +1 -1
  39. package/dist/api/mcp.d.ts +7 -2
  40. package/dist/api/mcp.d.ts.map +1 -1
  41. package/dist/api/mcp.js +1 -1
  42. package/dist/api/mcp.js.map +1 -1
  43. package/dist/api/needs.d.ts.map +1 -1
  44. package/dist/api/needs.js +19 -1
  45. package/dist/api/needs.js.map +1 -1
  46. package/dist/api/product.d.ts +9 -2
  47. package/dist/api/product.d.ts.map +1 -1
  48. package/dist/api/product.js +10 -2
  49. package/dist/api/product.js.map +1 -1
  50. package/dist/api/proposal-theme.d.ts +23 -0
  51. package/dist/api/proposal-theme.d.ts.map +1 -0
  52. package/dist/api/proposal-theme.js +30 -0
  53. package/dist/api/proposal-theme.js.map +1 -0
  54. package/dist/api/recording.d.ts +70 -10
  55. package/dist/api/recording.d.ts.map +1 -1
  56. package/dist/api/recording.js +278 -39
  57. package/dist/api/recording.js.map +1 -1
  58. package/dist/api/repo-input.d.ts +55 -0
  59. package/dist/api/repo-input.d.ts.map +1 -0
  60. package/dist/api/repo-input.js +113 -0
  61. package/dist/api/repo-input.js.map +1 -0
  62. package/dist/api/requirements.d.ts +75 -0
  63. package/dist/api/requirements.d.ts.map +1 -1
  64. package/dist/api/requirements.js +97 -9
  65. package/dist/api/requirements.js.map +1 -1
  66. package/dist/api/review-change.d.ts +64 -0
  67. package/dist/api/review-change.d.ts.map +1 -0
  68. package/dist/api/review-change.js +214 -0
  69. package/dist/api/review-change.js.map +1 -0
  70. package/dist/api/roster-standing.d.ts +4 -0
  71. package/dist/api/roster-standing.d.ts.map +1 -1
  72. package/dist/api/roster-standing.js +43 -10
  73. package/dist/api/roster-standing.js.map +1 -1
  74. package/dist/api/routes.d.ts +63 -6
  75. package/dist/api/routes.d.ts.map +1 -1
  76. package/dist/api/routes.js +818 -269
  77. package/dist/api/routes.js.map +1 -1
  78. package/dist/api/run-documents.d.ts +97 -0
  79. package/dist/api/run-documents.d.ts.map +1 -0
  80. package/dist/api/run-documents.js +458 -0
  81. package/dist/api/run-documents.js.map +1 -0
  82. package/dist/api/run-sources.d.ts +51 -0
  83. package/dist/api/run-sources.d.ts.map +1 -0
  84. package/dist/api/run-sources.js +133 -0
  85. package/dist/api/run-sources.js.map +1 -0
  86. package/dist/api/runtime-state.d.ts +41 -0
  87. package/dist/api/runtime-state.d.ts.map +1 -0
  88. package/dist/api/runtime-state.js +75 -0
  89. package/dist/api/runtime-state.js.map +1 -0
  90. package/dist/api/seat-container-login.d.ts +51 -0
  91. package/dist/api/seat-container-login.d.ts.map +1 -1
  92. package/dist/api/seat-container-login.js +317 -1
  93. package/dist/api/seat-container-login.js.map +1 -1
  94. package/dist/api/seat-images.d.ts.map +1 -1
  95. package/dist/api/seat-images.js +7 -0
  96. package/dist/api/seat-images.js.map +1 -1
  97. package/dist/api/server.d.ts +7 -0
  98. package/dist/api/server.d.ts.map +1 -1
  99. package/dist/api/server.js +206 -25
  100. package/dist/api/server.js.map +1 -1
  101. package/dist/api/skills.d.ts +8 -0
  102. package/dist/api/skills.d.ts.map +1 -1
  103. package/dist/api/skills.js +21 -0
  104. package/dist/api/skills.js.map +1 -1
  105. package/dist/api/system-snapshot.d.ts +7 -2
  106. package/dist/api/system-snapshot.d.ts.map +1 -1
  107. package/dist/api/system-snapshot.js +31 -7
  108. package/dist/api/system-snapshot.js.map +1 -1
  109. package/dist/api/testing.d.ts +3 -3
  110. package/dist/api/ui-text.d.ts +45 -0
  111. package/dist/api/ui-text.d.ts.map +1 -0
  112. package/dist/api/ui-text.js +188 -0
  113. package/dist/api/ui-text.js.map +1 -0
  114. package/dist/apps/actions/card.d.ts +62 -0
  115. package/dist/apps/actions/card.d.ts.map +1 -0
  116. package/dist/apps/actions/card.js +111 -0
  117. package/dist/apps/actions/card.js.map +1 -0
  118. package/dist/apps/actions/write-path.d.ts.map +1 -1
  119. package/dist/apps/actions/write-path.js +26 -77
  120. package/dist/apps/actions/write-path.js.map +1 -1
  121. package/dist/apps/exec/sources.d.ts.map +1 -1
  122. package/dist/apps/exec/sources.js +3 -0
  123. package/dist/apps/exec/sources.js.map +1 -1
  124. package/dist/apps/publish/artifacts.d.ts +18 -0
  125. package/dist/apps/publish/artifacts.d.ts.map +1 -0
  126. package/dist/apps/publish/artifacts.js +87 -0
  127. package/dist/apps/publish/artifacts.js.map +1 -0
  128. package/dist/apps/publish/check.d.ts +103 -0
  129. package/dist/apps/publish/check.d.ts.map +1 -0
  130. package/dist/apps/publish/check.js +235 -0
  131. package/dist/apps/publish/check.js.map +1 -0
  132. package/dist/apps/publish/image.d.ts +2 -0
  133. package/dist/apps/publish/image.d.ts.map +1 -1
  134. package/dist/apps/publish/image.js +2 -1
  135. package/dist/apps/publish/image.js.map +1 -1
  136. package/dist/apps/publish/render.d.ts +71 -0
  137. package/dist/apps/publish/render.d.ts.map +1 -0
  138. package/dist/apps/publish/render.js +122 -0
  139. package/dist/apps/publish/render.js.map +1 -0
  140. package/dist/apps/publish/run.d.ts +35 -0
  141. package/dist/apps/publish/run.d.ts.map +1 -0
  142. package/dist/apps/publish/run.js +127 -0
  143. package/dist/apps/publish/run.js.map +1 -0
  144. package/dist/apps/routes.d.ts +54 -2
  145. package/dist/apps/routes.d.ts.map +1 -1
  146. package/dist/apps/routes.js +124 -7
  147. package/dist/apps/routes.js.map +1 -1
  148. package/dist/apps/spec.d.ts +8 -8
  149. package/dist/apps/store.d.ts +84 -5
  150. package/dist/apps/store.d.ts.map +1 -1
  151. package/dist/apps/store.js +191 -4
  152. package/dist/apps/store.js.map +1 -1
  153. package/dist/apps/turns.d.ts +19 -1
  154. package/dist/apps/turns.d.ts.map +1 -1
  155. package/dist/apps/turns.js +60 -2
  156. package/dist/apps/turns.js.map +1 -1
  157. package/dist/apps/views.d.ts +5 -1
  158. package/dist/apps/views.d.ts.map +1 -1
  159. package/dist/apps/views.js +18 -7
  160. package/dist/apps/views.js.map +1 -1
  161. package/dist/apps-server/Dockerfile +25 -0
  162. package/dist/apps-server/runners/sqlite-runner.mjs +110 -0
  163. package/dist/apps-server/server/lib/bundle/server.mjs +92523 -0
  164. package/dist/apps-server/server/node_modules/@pgsql/types/LICENSE +22 -0
  165. package/dist/apps-server/server/node_modules/@pgsql/types/README.md +106 -0
  166. package/dist/apps-server/server/node_modules/@pgsql/types/enums.d.ts +76 -0
  167. package/dist/apps-server/server/node_modules/@pgsql/types/enums.js +2 -0
  168. package/dist/apps-server/server/node_modules/@pgsql/types/esm/enums.js +1 -0
  169. package/dist/apps-server/server/node_modules/@pgsql/types/esm/index.js +2 -0
  170. package/dist/apps-server/server/node_modules/@pgsql/types/esm/types.js +1 -0
  171. package/dist/apps-server/server/node_modules/@pgsql/types/index.d.ts +2 -0
  172. package/dist/apps-server/server/node_modules/@pgsql/types/index.js +18 -0
  173. package/dist/apps-server/server/node_modules/@pgsql/types/package.json +36 -0
  174. package/dist/apps-server/server/node_modules/@pgsql/types/types.d.ts +2488 -0
  175. package/dist/apps-server/server/node_modules/@pgsql/types/types.js +2 -0
  176. package/dist/apps-server/server/node_modules/libpg-query/LICENSE +22 -0
  177. package/dist/apps-server/server/node_modules/libpg-query/README.md +275 -0
  178. package/dist/apps-server/server/node_modules/libpg-query/package.json +58 -0
  179. package/dist/apps-server/server/node_modules/libpg-query/wasm/index.cjs +369 -0
  180. package/dist/apps-server/server/node_modules/libpg-query/wasm/index.d.ts +48 -0
  181. package/dist/apps-server/server/node_modules/libpg-query/wasm/index.js +344 -0
  182. package/dist/apps-server/server/node_modules/libpg-query/wasm/libpg-query.js +2 -0
  183. package/dist/apps-server/server/node_modules/libpg-query/wasm/libpg-query.wasm +0 -0
  184. package/dist/apps-server/server/shim/host.css +22 -0
  185. package/dist/apps-server/server/shim/host.js +1 -0
  186. package/dist/cli/apps-check.d.ts +18 -0
  187. package/dist/cli/apps-check.d.ts.map +1 -1
  188. package/dist/cli/apps-check.js +179 -5
  189. package/dist/cli/apps-check.js.map +1 -1
  190. package/dist/cli/apps-produce.d.ts +9 -0
  191. package/dist/cli/apps-produce.d.ts.map +1 -0
  192. package/dist/cli/apps-produce.js +27 -0
  193. package/dist/cli/apps-produce.js.map +1 -0
  194. package/dist/cli/index.d.ts.map +1 -1
  195. package/dist/cli/index.js +15 -3
  196. package/dist/cli/index.js.map +1 -1
  197. package/dist/cli/insights-facts.d.ts +17 -0
  198. package/dist/cli/insights-facts.d.ts.map +1 -0
  199. package/dist/cli/insights-facts.js +56 -0
  200. package/dist/cli/insights-facts.js.map +1 -0
  201. package/dist/core/adapter.d.ts +74 -15
  202. package/dist/core/adapter.d.ts.map +1 -1
  203. package/dist/core/adapter.js +245 -53
  204. package/dist/core/adapter.js.map +1 -1
  205. package/dist/core/engine-roster.d.ts.map +1 -1
  206. package/dist/core/engine-roster.js +1 -0
  207. package/dist/core/engine-roster.js.map +1 -1
  208. package/dist/core/estate-mcp-client.d.ts +3 -2
  209. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  210. package/dist/core/estate-mcp-client.js +3 -2
  211. package/dist/core/estate-mcp-client.js.map +1 -1
  212. package/dist/core/run-identity.d.ts.map +1 -1
  213. package/dist/core/run-identity.js +3 -0
  214. package/dist/core/run-identity.js.map +1 -1
  215. package/dist/core/types.d.ts +5 -0
  216. package/dist/core/types.d.ts.map +1 -1
  217. package/dist/core/types.js.map +1 -1
  218. package/dist/editors/conformance-runtime.d.ts +107 -0
  219. package/dist/editors/conformance-runtime.d.ts.map +1 -1
  220. package/dist/editors/conformance-runtime.js +268 -13
  221. package/dist/editors/conformance-runtime.js.map +1 -1
  222. package/dist/editors/csp.d.ts +2 -2
  223. package/dist/editors/csp.d.ts.map +1 -1
  224. package/dist/editors/csp.js +4 -2
  225. package/dist/editors/csp.js.map +1 -1
  226. package/dist/editors/pack-install.d.ts +28 -13
  227. package/dist/editors/pack-install.d.ts.map +1 -1
  228. package/dist/editors/pack-install.js +96 -48
  229. package/dist/editors/pack-install.js.map +1 -1
  230. package/dist/editors/registry.d.ts +111 -8
  231. package/dist/editors/registry.d.ts.map +1 -1
  232. package/dist/editors/registry.js +183 -7
  233. package/dist/editors/registry.js.map +1 -1
  234. package/dist/editors/routes.d.ts +66 -13
  235. package/dist/editors/routes.d.ts.map +1 -1
  236. package/dist/editors/routes.js +277 -44
  237. package/dist/editors/routes.js.map +1 -1
  238. package/dist/evals/replay.d.ts +6 -0
  239. package/dist/evals/replay.d.ts.map +1 -1
  240. package/dist/evals/replay.js +24 -1
  241. package/dist/evals/replay.js.map +1 -1
  242. package/dist/evals/routes.d.ts.map +1 -1
  243. package/dist/evals/routes.js +17 -2
  244. package/dist/evals/routes.js.map +1 -1
  245. package/dist/evals/runner.d.ts.map +1 -1
  246. package/dist/evals/runner.js +5 -0
  247. package/dist/evals/runner.js.map +1 -1
  248. package/dist/evals/shape-corrections.d.ts +146 -0
  249. package/dist/evals/shape-corrections.d.ts.map +1 -0
  250. package/dist/evals/shape-corrections.js +394 -0
  251. package/dist/evals/shape-corrections.js.map +1 -0
  252. package/dist/evals/shape.d.ts +145 -0
  253. package/dist/evals/shape.d.ts.map +1 -0
  254. package/dist/evals/shape.js +376 -0
  255. package/dist/evals/shape.js.map +1 -0
  256. package/dist/evals/types.d.ts +2 -2
  257. package/dist/evals/types.d.ts.map +1 -1
  258. package/dist/evals/types.js +2 -1
  259. package/dist/evals/types.js.map +1 -1
  260. package/dist/insights/analyze.d.ts +14 -1
  261. package/dist/insights/analyze.d.ts.map +1 -1
  262. package/dist/insights/analyze.js +35 -8
  263. package/dist/insights/analyze.js.map +1 -1
  264. package/dist/insights/cost.d.ts +123 -0
  265. package/dist/insights/cost.d.ts.map +1 -0
  266. package/dist/insights/cost.js +221 -0
  267. package/dist/insights/cost.js.map +1 -0
  268. package/dist/insights/review-service.d.ts +20 -1
  269. package/dist/insights/review-service.d.ts.map +1 -1
  270. package/dist/insights/review-service.js +50 -25
  271. package/dist/insights/review-service.js.map +1 -1
  272. package/dist/insights/routes.d.ts +29 -0
  273. package/dist/insights/routes.d.ts.map +1 -1
  274. package/dist/insights/routes.js +62 -0
  275. package/dist/insights/routes.js.map +1 -1
  276. package/dist/insights/run-facts.d.ts +16 -0
  277. package/dist/insights/run-facts.d.ts.map +1 -1
  278. package/dist/insights/run-facts.js +26 -3
  279. package/dist/insights/run-facts.js.map +1 -1
  280. package/dist/interactive/bridge-pool.d.ts +11 -2
  281. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  282. package/dist/interactive/bridge-pool.js +10 -1
  283. package/dist/interactive/bridge-pool.js.map +1 -1
  284. package/dist/interactive/chat-events.d.ts +74 -1
  285. package/dist/interactive/chat-events.d.ts.map +1 -1
  286. package/dist/interactive/chat-events.js +338 -6
  287. package/dist/interactive/chat-events.js.map +1 -1
  288. package/dist/interactive/doc-binding.d.ts +15 -0
  289. package/dist/interactive/doc-binding.d.ts.map +1 -1
  290. package/dist/interactive/doc-binding.js +4 -0
  291. package/dist/interactive/doc-binding.js.map +1 -1
  292. package/dist/interactive/doc-checks-routes.d.ts +34 -1
  293. package/dist/interactive/doc-checks-routes.d.ts.map +1 -1
  294. package/dist/interactive/doc-checks-routes.js +84 -0
  295. package/dist/interactive/doc-checks-routes.js.map +1 -1
  296. package/dist/interactive/draft-events.d.ts +7 -0
  297. package/dist/interactive/draft-events.d.ts.map +1 -1
  298. package/dist/interactive/draft-events.js +38 -6
  299. package/dist/interactive/draft-events.js.map +1 -1
  300. package/dist/interactive/draft-skill.d.ts +76 -6
  301. package/dist/interactive/draft-skill.d.ts.map +1 -1
  302. package/dist/interactive/draft-skill.js +219 -17
  303. package/dist/interactive/draft-skill.js.map +1 -1
  304. package/dist/interactive/edit-events.d.ts.map +1 -1
  305. package/dist/interactive/edit-events.js +4 -2
  306. package/dist/interactive/edit-events.js.map +1 -1
  307. package/dist/interactive/landing-guard.d.ts +47 -0
  308. package/dist/interactive/landing-guard.d.ts.map +1 -0
  309. package/dist/interactive/landing-guard.js +43 -0
  310. package/dist/interactive/landing-guard.js.map +1 -0
  311. package/dist/interactive/landing-record.d.ts +68 -0
  312. package/dist/interactive/landing-record.d.ts.map +1 -0
  313. package/dist/interactive/landing-record.js +154 -0
  314. package/dist/interactive/landing-record.js.map +1 -0
  315. package/dist/interactive/proposal-create.d.ts +3 -1
  316. package/dist/interactive/proposal-create.d.ts.map +1 -1
  317. package/dist/interactive/proposal-create.js +14 -2
  318. package/dist/interactive/proposal-create.js.map +1 -1
  319. package/dist/interactive/proposal-refine.d.ts +48 -0
  320. package/dist/interactive/proposal-refine.d.ts.map +1 -0
  321. package/dist/interactive/proposal-refine.js +99 -0
  322. package/dist/interactive/proposal-refine.js.map +1 -0
  323. package/dist/interactive/protected-edits.d.ts +67 -0
  324. package/dist/interactive/protected-edits.d.ts.map +1 -0
  325. package/dist/interactive/protected-edits.js +160 -0
  326. package/dist/interactive/protected-edits.js.map +1 -0
  327. package/dist/interactive/proxy-routes.js +2 -2
  328. package/dist/interactive/review-events.js +1 -1
  329. package/dist/interactive/run-units.d.ts +1 -1
  330. package/dist/interactive/run-units.d.ts.map +1 -1
  331. package/dist/interactive/run-units.js +8 -2
  332. package/dist/interactive/run-units.js.map +1 -1
  333. package/dist/interactive/source-packet.d.ts +66 -1
  334. package/dist/interactive/source-packet.d.ts.map +1 -1
  335. package/dist/interactive/source-packet.js +309 -60
  336. package/dist/interactive/source-packet.js.map +1 -1
  337. package/dist/interactive/theme-events.js +1 -1
  338. package/dist/knowledge/adapters/web/egress.d.ts +99 -0
  339. package/dist/knowledge/adapters/web/egress.d.ts.map +1 -0
  340. package/dist/knowledge/adapters/web/egress.js +330 -0
  341. package/dist/knowledge/adapters/web/egress.js.map +1 -0
  342. package/dist/knowledge/adapters/web/engine.d.ts +54 -0
  343. package/dist/knowledge/adapters/web/engine.d.ts.map +1 -0
  344. package/dist/knowledge/adapters/web/engine.js +101 -0
  345. package/dist/knowledge/adapters/web/engine.js.map +1 -0
  346. package/dist/knowledge/adapters/web/fetch.d.ts +131 -0
  347. package/dist/knowledge/adapters/web/fetch.d.ts.map +1 -0
  348. package/dist/knowledge/adapters/web/fetch.js +325 -0
  349. package/dist/knowledge/adapters/web/fetch.js.map +1 -0
  350. package/dist/knowledge/adapters/web/gate-web.d.ts +182 -0
  351. package/dist/knowledge/adapters/web/gate-web.d.ts.map +1 -0
  352. package/dist/knowledge/adapters/web/gate-web.js +496 -0
  353. package/dist/knowledge/adapters/web/gate-web.js.map +1 -0
  354. package/dist/knowledge/adapters/web/routes.d.ts +36 -0
  355. package/dist/knowledge/adapters/web/routes.d.ts.map +1 -0
  356. package/dist/knowledge/adapters/web/routes.js +99 -0
  357. package/dist/knowledge/adapters/web/routes.js.map +1 -0
  358. package/dist/knowledge/adapters/web/searxng.d.ts +89 -0
  359. package/dist/knowledge/adapters/web/searxng.d.ts.map +1 -0
  360. package/dist/knowledge/adapters/web/searxng.js +274 -0
  361. package/dist/knowledge/adapters/web/searxng.js.map +1 -0
  362. package/dist/knowledge/adapters/web/source.d.ts +65 -0
  363. package/dist/knowledge/adapters/web/source.d.ts.map +1 -0
  364. package/dist/knowledge/adapters/web/source.js +192 -0
  365. package/dist/knowledge/adapters/web/source.js.map +1 -0
  366. package/dist/knowledge/gate/gate.d.ts +22 -0
  367. package/dist/knowledge/gate/gate.d.ts.map +1 -1
  368. package/dist/knowledge/gate/gate.js +62 -1
  369. package/dist/knowledge/gate/gate.js.map +1 -1
  370. package/dist/knowledge/gate/sources.d.ts +2 -0
  371. package/dist/knowledge/gate/sources.d.ts.map +1 -1
  372. package/dist/knowledge/gate/sources.js +5 -2
  373. package/dist/knowledge/gate/sources.js.map +1 -1
  374. package/dist/knowledge/package.d.ts +7 -0
  375. package/dist/knowledge/package.d.ts.map +1 -1
  376. package/dist/knowledge/package.js +15 -1
  377. package/dist/knowledge/package.js.map +1 -1
  378. package/dist/knowledge/trackers/actions.js +1 -1
  379. package/dist/knowledge/trackers/actions.js.map +1 -1
  380. package/dist/knowledge/trackers/bindings.d.ts +3 -3
  381. package/dist/knowledge/trackers/bindings.d.ts.map +1 -1
  382. package/dist/knowledge/trackers/bindings.js +36 -23
  383. package/dist/knowledge/trackers/bindings.js.map +1 -1
  384. package/dist/knowledge/trackers/routes.js +1 -1
  385. package/dist/knowledge/trackers/routes.js.map +1 -1
  386. package/dist/learnings/service.d.ts.map +1 -1
  387. package/dist/learnings/service.js +2 -0
  388. package/dist/learnings/service.js.map +1 -1
  389. package/dist/mcp/broker.d.ts +8 -0
  390. package/dist/mcp/broker.d.ts.map +1 -1
  391. package/dist/mcp/broker.js +48 -3
  392. package/dist/mcp/broker.js.map +1 -1
  393. package/dist/mcp/estate-relay.d.ts +43 -1
  394. package/dist/mcp/estate-relay.d.ts.map +1 -1
  395. package/dist/mcp/estate-relay.js +38 -2
  396. package/dist/mcp/estate-relay.js.map +1 -1
  397. package/dist/mcp/registry.d.ts +6 -0
  398. package/dist/mcp/registry.d.ts.map +1 -1
  399. package/dist/mcp/registry.js +42 -3
  400. package/dist/mcp/registry.js.map +1 -1
  401. package/dist/mcp/run-fence.d.ts +57 -0
  402. package/dist/mcp/run-fence.d.ts.map +1 -0
  403. package/dist/mcp/run-fence.js +86 -0
  404. package/dist/mcp/run-fence.js.map +1 -0
  405. package/dist/mcp/tool-list.d.ts +5 -0
  406. package/dist/mcp/tool-list.d.ts.map +1 -1
  407. package/dist/mcp/tool-list.js +7 -3
  408. package/dist/mcp/tool-list.js.map +1 -1
  409. package/dist/presets/routes.d.ts.map +1 -1
  410. package/dist/presets/routes.js +6 -0
  411. package/dist/presets/routes.js.map +1 -1
  412. package/dist/projects/routes.d.ts +1 -1
  413. package/dist/projects/state-home-preflight.d.ts.map +1 -1
  414. package/dist/projects/state-home-preflight.js +2 -0
  415. package/dist/projects/state-home-preflight.js.map +1 -1
  416. package/dist/setup/tool-path.d.ts +16 -0
  417. package/dist/setup/tool-path.d.ts.map +1 -0
  418. package/dist/setup/tool-path.js +66 -0
  419. package/dist/setup/tool-path.js.map +1 -0
  420. package/dist/skills/plugin-source.d.ts +46 -88
  421. package/dist/skills/plugin-source.d.ts.map +1 -1
  422. package/dist/skills/plugin-source.js +144 -100
  423. package/dist/skills/plugin-source.js.map +1 -1
  424. package/dist/skills/runtime.d.ts +47 -0
  425. package/dist/skills/runtime.d.ts.map +1 -1
  426. package/dist/skills/runtime.js +110 -14
  427. package/dist/skills/runtime.js.map +1 -1
  428. package/dist/skills/store.d.ts +2 -0
  429. package/dist/skills/store.d.ts.map +1 -1
  430. package/dist/skills/store.js +29 -14
  431. package/dist/skills/store.js.map +1 -1
  432. package/dist/skills/usage.d.ts +238 -0
  433. package/dist/skills/usage.d.ts.map +1 -0
  434. package/dist/skills/usage.js +789 -0
  435. package/dist/skills/usage.js.map +1 -0
  436. package/dist/skills/venv.d.ts +18 -2
  437. package/dist/skills/venv.d.ts.map +1 -1
  438. package/dist/skills/venv.js +2 -2
  439. package/dist/skills/venv.js.map +1 -1
  440. package/dist/sources/routes.d.ts +3 -1
  441. package/dist/sources/routes.d.ts.map +1 -1
  442. package/dist/sources/routes.js +11 -0
  443. package/dist/sources/routes.js.map +1 -1
  444. package/dist/standing-orders/parse.d.ts +19 -0
  445. package/dist/standing-orders/parse.d.ts.map +1 -1
  446. package/dist/standing-orders/parse.js +61 -18
  447. package/dist/standing-orders/parse.js.map +1 -1
  448. package/dist/studio/apps-standalone/fixture.html +12 -0
  449. package/dist/studio/apps-standalone/fixture.js +10 -0
  450. package/dist/studio/apps-standalone/runtime.css +139 -0
  451. package/dist/studio/apps-standalone/runtime.js +1 -0
  452. package/dist/studio/assets/{KnowledgeGraph-Cpm46tEp.js → KnowledgeGraph-BT5Y-B8b.js} +1 -1
  453. package/dist/studio/assets/index-B_JwrHVF.css +32 -0
  454. package/dist/studio/assets/index-Bl9m8ldl.js +1104 -0
  455. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  456. package/dist/studio/editors/wicked-apps/index.html +2 -2
  457. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  458. package/dist/studio/editors/wicked-deck/index.html +14 -1
  459. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  460. package/dist/studio/editors/wicked-doc/index.html +1 -1
  461. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  462. package/dist/studio/editors/wicked-insights/index.html +1 -1
  463. package/dist/studio/editors/wicked-page/editor.json +10 -1
  464. package/dist/studio/editors/wicked-page/index.html +2 -2
  465. package/dist/studio/editors/wicked-video/editor.json +7 -2
  466. package/dist/studio/editors/wicked-video/index.html +14 -11
  467. package/dist/studio/index.html +2 -2
  468. package/dist/studio/testid-inventory.json +2073 -240
  469. package/dist/team/routes.d.ts +1 -1
  470. package/dist/workflow-catalog/build-v2.d.ts +6 -2
  471. package/dist/workflow-catalog/build-v2.d.ts.map +1 -1
  472. package/dist/workflow-catalog/build-v2.js +37 -13
  473. package/dist/workflow-catalog/build-v2.js.map +1 -1
  474. package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
  475. package/dist/workflow-catalog/catalog-data-v2.js +310 -105
  476. package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
  477. package/dist/workflow-catalog/catalog-data.d.ts.map +1 -1
  478. package/dist/workflow-catalog/catalog-data.js +2 -20
  479. package/dist/workflow-catalog/catalog-data.js.map +1 -1
  480. package/dist/workflow-catalog/detect-service.d.ts +95 -0
  481. package/dist/workflow-catalog/detect-service.d.ts.map +1 -0
  482. package/dist/workflow-catalog/detect-service.js +239 -0
  483. package/dist/workflow-catalog/detect-service.js.map +1 -0
  484. package/dist/workflow-catalog/detect.d.ts +213 -0
  485. package/dist/workflow-catalog/detect.d.ts.map +1 -0
  486. package/dist/workflow-catalog/detect.js +653 -0
  487. package/dist/workflow-catalog/detect.js.map +1 -0
  488. package/dist/workflow-catalog/shape.d.ts +3 -1
  489. package/dist/workflow-catalog/shape.d.ts.map +1 -1
  490. package/dist/workflow-catalog/shape.js +7 -1
  491. package/dist/workflow-catalog/shape.js.map +1 -1
  492. package/dist/working-doc/bridge-backend.js +2 -2
  493. package/dist/working-doc/event-lines.d.ts +67 -2
  494. package/dist/working-doc/event-lines.d.ts.map +1 -1
  495. package/dist/working-doc/event-lines.js +155 -8
  496. package/dist/working-doc/event-lines.js.map +1 -1
  497. package/dist/working-doc/notes-index.d.ts +35 -0
  498. package/dist/working-doc/notes-index.d.ts.map +1 -0
  499. package/dist/working-doc/notes-index.js +82 -0
  500. package/dist/working-doc/notes-index.js.map +1 -0
  501. package/dist/working-doc/routes.js +4 -4
  502. package/dist/working-doc/sections.js +2 -2
  503. package/dist/working-doc/service.d.ts +260 -21
  504. package/dist/working-doc/service.d.ts.map +1 -1
  505. package/dist/working-doc/service.js +791 -90
  506. package/dist/working-doc/service.js.map +1 -1
  507. package/dist/working-doc/store.d.ts +50 -1
  508. package/dist/working-doc/store.d.ts.map +1 -1
  509. package/dist/working-doc/store.js +4 -1
  510. package/dist/working-doc/store.js.map +1 -1
  511. package/endpoint-manifest.json +187 -3
  512. package/evals/corpora/shape-corrections-v1.json +594 -0
  513. package/evals/corpora/shape-corrections-v1.seat-fixture.json +186 -0
  514. package/evals/corpora/shape-v1.json +2113 -0
  515. package/evals/corpora/shape-v1.seat-fixture.json +1800 -0
  516. package/package.json +11 -7
  517. package/scripts/apps-render.py +226 -0
  518. package/workflows/detect-shape.json +29 -0
  519. package/dist/studio/assets/index-BRBwWQMH.css +0 -32
  520. package/dist/studio/assets/index-CVrWDGRP.js +0 -1097
@@ -8,21 +8,26 @@
8
8
  * The Demo experience (wicked-studio#373, migration M9b): a demo of a local app, made by a governed
9
9
  * run of the built-in `demo` preset — the wicked-garden demo skill's plan → record → review.
10
10
  *
11
- * POST /projects/:id/demo mints the run's DEMO ROOT (a per-run directory on the daemon host),
12
- * writes the brief there, and launches `demo` THROUGH `POST /runs`
13
- * (one launch path), with the root as the run's only extra write root.
11
+ * POST /projects/:id/demo mints the run's DEMO ROOT (a per-run directory on the daemon host) and
12
+ * launches `demo` (or `demo-human-review`, for an app whose rows may not
13
+ * reach a model) THROUGH `POST /runs` (one launch path). Since
14
+ * DES-DEMO-RECORD-001 the run's only write root is `<root>/plan` (the brief,
15
+ * script, chapters, storyline.json); the root is the run's evidence root,
16
+ * where the engine's jailed Tools write `probe/`, `demo-video/`, `review/`,
17
+ * and the engine `approved/` and `takes/`; crew writes `launch.json`.
14
18
  * GET /runs/:id/demo what studio shows: the stage, the presenter script and chapter list
15
19
  * (the plan gate), per-chapter record progress, the contact sheets and
16
20
  * the reviewer's verdicts (the review gate), and the chaptered MP4.
17
21
  * GET /runs/:id/demo/file one file of the root (a contact sheet, the MP4 — with Range).
18
- * PUT /runs/:id/demo/script the presenter's edit of `script.md` while the plan gate is open.
22
+ * PUT /runs/:id/demo/script the presenter's edit of `plan/script.md` while the plan gate is open.
19
23
  * POST /runs/:id/demo/export a GIF (`demo-video/demo.gif`) or a poster frame (`demo-video/poster.jpg`)
20
24
  * of the stitched MP4, encoded by ffmpeg with an ASYNC spawn and a
21
25
  * timeout (EP-C3): the daemon keeps answering while it encodes.
22
26
  *
23
27
  * The gates are the run's ordinary gates (`POST /runs/:id/gate`): approve, or `request_changes` with a
24
- * note — at the plan gate it re-runs `plan`, at the review gate it rewinds to `record` (re-record one
25
- * chapter). Nothing here decides a gate.
28
+ * note — at the plan gate it re-runs `plan`; at the review gate it goes back to `plan` too (the engine records
29
+ * a new approved storyline afresh; a demo a seat recorded before rewound to `record`). Nothing here decides a
30
+ * gate.
26
31
  *
27
32
  * Every file is read from the root the daemon minted for THIS run id, never from a path a caller or a
28
33
  * worker names: `path` is resolved inside it, symlinks included, and only the deliverable types studio
@@ -70,6 +75,19 @@ import { pairRemovedByOverride, resolveWalkthroughGate, walkthroughCheckStates }
70
75
  const V = API_PREFIX;
71
76
  /** The preset a demo run launches (wicked-core `builtin_presets`). */
72
77
  export const DEMO_PRESET = 'demo';
78
+ /** (DES-DEMO-RECORD-001 §3.7) The preset for an app whose rows may not reach a model: no model review step; the
79
+ * person reviews the take at the record step's own gate. */
80
+ export const DEMO_HUMAN_REVIEW_PRESET = 'demo-human-review';
81
+ export const DEMO_PRESETS = [DEMO_PRESET, DEMO_HUMAN_REVIEW_PRESET];
82
+ /**
83
+ * (DES-DEMO-RECORD-001 §3.2) The demo root's layout. The run's ONLY write root is `plan/` (the plan seat's brief,
84
+ * script, chapters and storyline); the engine's jailed Tools write `probe/`, `demo-video/` and `review/`; the engine
85
+ * writes `approved/` (the snapshot the plan gate shows and the recorder records) and `takes/`; crew writes
86
+ * `launch.json` (what it decided about the app) before the launch. A demo recorded before this layout keeps its
87
+ * files at the root: every read here tries `plan/` first, then the root.
88
+ */
89
+ export const DEMO_PLAN_DIR = 'plan';
90
+ const DEMO_TOOL_DIRS = ['probe', 'demo-video', 'review'];
73
91
  /** Studio's Unfiled mount (`/p/default/…`): the daemon's synthesized project, never a launch's `projectId`. */
74
92
  const UNFILED_PROJECT = 'default';
75
93
  /** The biggest script studio shows or accepts back: a presenter script is prose. */
@@ -135,12 +153,79 @@ export async function existingDemoRootDir(runId) {
135
153
  return legacy;
136
154
  return current;
137
155
  }
156
+ export const demoLaunchRoots = new Map();
157
+ const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '[::1]']);
138
158
  /**
139
- * The demo root of each demo launch in flight, keyed by the run id the demo route minted. `POST /runs`
140
- * takes no write roots from its body; it reads this in-process entry, so the root is never something a
141
- * caller can ask for (the capture route's pattern).
159
+ * The app URL a demo may record: an http(s) URL on this machine (127.0.0.1, localhost or [::1]), split into its
160
+ * origin with an explicit port and its path (and query). `null` for any other host: the recorder's jail opens one
161
+ * loopback port and nothing else (a remote app is post-mvp, wicked-core#1296).
142
162
  */
143
- export const demoLaunchRoots = new Map();
163
+ export function demoAppTarget(url) {
164
+ let u;
165
+ try {
166
+ u = new URL(url);
167
+ }
168
+ catch {
169
+ return null;
170
+ }
171
+ // A fragment (`#/reports`) is the app's own client-side route, which the recorder cannot open: refused rather than
172
+ // silently recording the page without it.
173
+ if (!/^https?:$/.test(u.protocol) || !LOOPBACK_HOSTS.has(u.hostname) || u.username !== '' || u.password !== '' || u.hash !== '')
174
+ return null;
175
+ const port = u.port !== '' ? u.port : u.protocol === 'https:' ? '443' : '80';
176
+ const launchPath = `${u.pathname || '/'}${u.search}`;
177
+ if (!/^\/[A-Za-z0-9._~%/?&=+-]*$/.test(launchPath) || launchPath.startsWith('//'))
178
+ return null;
179
+ return { appOrigin: `${u.protocol}//${u.hostname}:${port}`, launchPath };
180
+ }
181
+ /** The crew app a demo URL names on THIS daemon (`/apps/<id>` on crew's own port), else `null`. */
182
+ export function crewAppOf(appOrigin, launchPath, crewUrl) {
183
+ if (crewUrl === null || crewUrl === undefined || crewUrl === '')
184
+ return null;
185
+ let crew;
186
+ try {
187
+ crew = new URL(crewUrl);
188
+ }
189
+ catch {
190
+ return null;
191
+ }
192
+ const app = new URL(appOrigin);
193
+ // The URL API drops a default port (`:80`, `:443`): both sides are compared with it written out.
194
+ const portOf = (u) => (u.port !== '' ? u.port : u.protocol === 'https:' ? '443' : '80');
195
+ // Loopback names are one machine: 127.0.0.1 and localhost on crew's port are crew.
196
+ if (portOf(app) !== portOf(crew) || !LOOPBACK_HOSTS.has(crew.hostname) || app.protocol !== crew.protocol)
197
+ return null;
198
+ const m = /^\/apps\/([A-Za-z0-9._-]{1,128})(?:[/?]|$)/.exec(launchPath);
199
+ return m?.[1] ?? null;
200
+ }
201
+ /** The built-in sources whose rows are crew's own (its runs, its knowledge): not a person's data source. */
202
+ const BUILTIN_APP_SOURCES = new Set(['crew', 'estate']);
203
+ /** Whether a crew app's rows may reach a model: every source it reads is built-in or agent-queryable. */
204
+ export async function crewAppRowsMayReachModels(slug, deps, projectId = null) {
205
+ if (deps.appSources === undefined || deps.agentQueryAllowed === undefined)
206
+ return false;
207
+ let sources;
208
+ try {
209
+ sources = await deps.appSources(slug);
210
+ }
211
+ catch {
212
+ return false;
213
+ }
214
+ if (sources === null)
215
+ return false;
216
+ for (const src of sources) {
217
+ if (BUILTIN_APP_SOURCES.has(src))
218
+ continue;
219
+ try {
220
+ if ((await deps.agentQueryAllowed(src, projectId)) !== true)
221
+ return false;
222
+ }
223
+ catch {
224
+ return false;
225
+ }
226
+ }
227
+ return true;
228
+ }
144
229
  export const DemoLaunchSchema = z.strictObject({
145
230
  url: z.string().trim().superRefine(zod3Url).max(2048).refine((u) => /^https?:\/\//i.test(u), 'url must be http(s)'),
146
231
  audience: z.string().trim().min(1).max(2000),
@@ -156,28 +241,57 @@ export const DemoLaunchSchema = z.strictObject({
156
241
  * run's demo root and brief, then the shared launch function runs the demo preset (its own plan gate is the hold). A
157
242
  * chat Go passes the proposal's derived run id: a retry finds that run and adopts it instead.
158
243
  */
159
- export async function demoLaunch(launchRun, projectId, body, ctx, extra = {}) {
244
+ export async function demoLaunch(launchRun, projectId, body, ctx, extra = {}, deps = {}) {
160
245
  const parsed = DemoLaunchSchema.safeParse(body ?? {});
161
246
  if (!parsed.success) {
162
247
  return { code: 400, body: { error: 'Invalid demo body', details: parsed.error.issues } };
163
248
  }
249
+ // The engine must record on the host (wicked-core's `demo_record` Tool): an engine without it would hand the
250
+ // recording to a seat that cannot reach the app (wicked-core#1249). Refuse rather than launch a demo that can
251
+ // never reach its review gate.
252
+ if (deps.engineRecordsDemos !== undefined && !(await deps.engineRecordsDemos().catch(() => false))) {
253
+ return { code: 501, body: { error: 'this wicked-core cannot record a demo on the host (no demo_record Tool): upgrade wicked-core-ts' } };
254
+ }
255
+ const target = demoAppTarget(parsed.data.url);
256
+ if (target === null) {
257
+ return {
258
+ code: 400,
259
+ body: { error: 'a demo records an app on this machine: use http://127.0.0.1:<port>/…, http://localhost:<port>/… or http://[::1]:<port>/… (the recorder reaches no other host), with no #fragment' },
260
+ };
261
+ }
262
+ // (DES-DEMO-RECORD-001 §3.7) What crew decides about the app, from its own state: whether it is one of crew's
263
+ // apps (its one query and event stream are then the recorder's), and whether its rows may reach a model
264
+ // (DES-APPS-001 S5: every source it reads passes the data gate's predicate for this run's project).
265
+ const crewApp = crewAppOf(target.appOrigin, target.launchPath, process.env['WICKED_CREW_URL']);
266
+ const live = crewApp === null ? true : await crewAppRowsMayReachModels(crewApp, deps, projectId !== UNFILED_PROJECT ? projectId : null);
267
+ const manifest = {
268
+ app_origin: target.appOrigin,
269
+ launch_path: target.launchPath,
270
+ target: crewApp === null ? { kind: 'loopback_app' } : { kind: 'crew_app', id: crewApp },
271
+ live_data_to_models: live,
272
+ };
164
273
  const derived = extra.common?.['sessionId'];
165
274
  const runId = typeof derived === 'string' ? derived : randomUUID();
166
275
  const root = demoRootDir(runId);
167
- await fsp.mkdir(root, { recursive: true });
168
- const briefPath = join(root, 'BRIEF.md');
169
- await fsp.writeFile(briefPath, demoBrief(root, parsed.data), 'utf8');
170
- demoLaunchRoots.set(runId, root);
276
+ const plan = join(root, DEMO_PLAN_DIR);
277
+ // Every directory a seat mounts must exist before the launch: the plan (write), the probe and, when the rows may
278
+ // reach a model, the review sheets (read-only).
279
+ for (const d of [plan, ...DEMO_TOOL_DIRS.map((t) => join(root, t))])
280
+ await fsp.mkdir(d, { recursive: true });
281
+ await fsp.writeFile(join(root, 'launch.json'), JSON.stringify(manifest, null, 2), 'utf8');
282
+ const briefPath = join(plan, 'BRIEF.md');
283
+ await fsp.writeFile(briefPath, demoBrief(plan, parsed.data), 'utf8');
284
+ demoLaunchRoots.set(runId, { root, write: plan, read: live ? [join(root, 'probe'), join(root, 'review')] : [join(root, 'probe')] });
171
285
  let launched;
172
286
  try {
173
287
  launched = await launchRun({
174
288
  // ONE path (the worker's only way to the brief; the brief names the root). crew#813 made it
175
289
  // follow the state home — studio masks the path where it prints the problem (studio#520).
176
- problem: `Make a demo of ${parsed.data.url} with the wicked-garden-demo skill: follow the demo brief at ${briefPath} — its directory is the demo root, where every file this demo makes goes.`,
290
+ problem: `Make a demo of ${parsed.data.url} with the wicked-garden-demo skill: follow the demo brief at ${briefPath} — its directory is the plan directory, where your files go; the app's page summary is in ${join(root, 'probe')}.`,
177
291
  sessionId: runId,
178
292
  // Unfiled (studio's `default` mount) is no project to file into: the run launches unfiled.
179
293
  ...(projectId !== UNFILED_PROJECT ? { projectId } : {}),
180
- workflow: DEMO_PRESET,
294
+ workflow: live ? DEMO_PRESET : DEMO_HUMAN_REVIEW_PRESET,
181
295
  deliver: 'none',
182
296
  ...(parsed.data.clisJson !== undefined ? { clisJson: parsed.data.clisJson } : {}),
183
297
  ...(parsed.data.reducedAssurance === true ? { reducedAssurance: true } : {}),
@@ -340,7 +454,7 @@ export function demoBrief(root, b) {
340
454
  '# Demo brief',
341
455
  '',
342
456
  `- **App:** ${b.url}`,
343
- `- **Demo root:** ${root} (every file this demo makes goes here, nowhere else)`,
457
+ `- **Plan directory:** ${root} (your files go here, nowhere else: the recording is the engine's)`,
344
458
  '',
345
459
  '## Who it is for',
346
460
  '',
@@ -352,7 +466,9 @@ export function demoBrief(root, b) {
352
466
  '',
353
467
  '## Rules',
354
468
  '',
355
- '- Use the wicked-garden-demo skill: plan, then record, then review.',
469
+ '- Use the wicked-garden-demo skill\'s `plan` action as its "In a crew Demo video run" section says: write',
470
+ ' `script.md`, `chapters.json` and `storyline.json` (data, never a module). The engine records it on this',
471
+ ' machine after the plan gate; nobody in the run records by hand.',
356
472
  '- Read-only against the app: navigate, hover, scroll, open panels and type, but never submit,',
357
473
  ' launch, approve, delete, create, cancel or save. The recorder blocks every write and fails the',
358
474
  ' chapter; show a control without pressing it.',
@@ -364,10 +480,10 @@ export function demoBrief(root, b) {
364
480
  /** A demo run: launched from the `demo` preset — read off the engine's plan state, or, before the
365
481
  * launch is scored and `team_plan` exists, off the run's identity (resolved from the launch record). */
366
482
  export function isDemoRun(view) {
367
- if (view.session.team_plan?.preset === DEMO_PRESET)
483
+ if (DEMO_PRESETS.includes(view.session.team_plan?.preset ?? ''))
368
484
  return true;
369
485
  const id = view.session.run_identity;
370
- return id?.kind === 'preset' && id.name === DEMO_PRESET;
486
+ return id?.kind === 'preset' && typeof id.name === 'string' && DEMO_PRESETS.includes(id.name);
371
487
  }
372
488
  /** The unit for one of the preset's steps (`<run>:plan` …). */
373
489
  function stepUnit(view, step) {
@@ -396,13 +512,16 @@ export function demoStage(view) {
396
512
  // After `review`: its own gate when it passed, the engine's escalation gate when it did not.
397
513
  if (done('review') || stepUnit(view, 'review')?.status === 'rejected')
398
514
  return 'review_gate';
515
+ // The human-review preset has no `review` step: the person reviews the take at `record`'s own gate.
516
+ if (stepUnit(view, 'review') === undefined && done('record'))
517
+ return 'review_gate';
399
518
  // Only while `record` has not started: a record the engine rejected parks at ITS escalation gate,
400
519
  // which is no plan gate (the script is not editable once the recorder has run).
401
520
  const record = stepUnit(view, 'record')?.status;
402
521
  if (done('plan') && (record === 'pending' || record === 'distributed'))
403
522
  return 'plan_gate';
404
523
  }
405
- if (step === 'plan')
524
+ if (step === 'plan' || step === 'probe')
406
525
  return 'planning';
407
526
  if (step === 'record')
408
527
  return 'recording';
@@ -540,18 +659,76 @@ function briefFields(brief) {
540
659
  const audience = /## Who it is for\n\n([\s\S]*?)\n\n## /.exec(brief)?.[1]?.trim() ?? null;
541
660
  return { url, audience };
542
661
  }
662
+ /** A plan file: `plan/<name>` (the layout since DES-DEMO-RECORD-001), else `<name>` at the root (a demo before it). */
663
+ async function planText(root, name) {
664
+ return (await readText(root, `${DEMO_PLAN_DIR}/${name}`)) ?? (await readText(root, name));
665
+ }
666
+ /**
667
+ * The plan the person approves and the engine records (DES-DEMO-RECORD-001 §3.3), read as ONE pair from ONE pointer:
668
+ * - `approved`: the engine's snapshot for THIS run (`approved/current.json` names the run and the generation);
669
+ * - `none`: no snapshot yet (before the plan step passed, or a demo recorded before snapshots): the plan's own files;
670
+ * - `unavailable`: a pointer that exists but cannot be trusted (another run's, malformed, a file missing): nothing is
671
+ * shown as the plan, never the live, editable files in its place.
672
+ */
673
+ async function approvedPlan(root, runId) {
674
+ // Present at all (a dangling or outside link counts as present): only a pointer that is not there is "none".
675
+ const present = await fsp.lstat(join(root, 'approved', 'current.json')).then(() => true, () => false);
676
+ if (!present)
677
+ return { state: 'none' };
678
+ const current = await readText(root, 'approved/current.json');
679
+ if (current === null)
680
+ return { state: 'unavailable' };
681
+ let ptr;
682
+ try {
683
+ const v = JSON.parse(current);
684
+ if (v === null || typeof v !== 'object' || Array.isArray(v))
685
+ return { state: 'unavailable' };
686
+ ptr = v;
687
+ }
688
+ catch {
689
+ return { state: 'unavailable' };
690
+ }
691
+ const gen = ptr.gen;
692
+ if (typeof gen !== 'number' || !Number.isInteger(gen) || gen < 1 || ptr.run !== runId)
693
+ return { state: 'unavailable' };
694
+ const [chapters, storyline] = await Promise.all([readText(root, `approved/${gen}/chapters.json`), readText(root, `approved/${gen}/storyline.json`)]);
695
+ if (chapters === null || storyline === null)
696
+ return { state: 'unavailable' };
697
+ return { state: 'approved', chapters, storyline };
698
+ }
699
+ /** The app a modern demo records: crew's own `launch.json` (the seat cannot write it), else `null`. */
700
+ async function launchManifest(root) {
701
+ const raw = await readText(root, 'launch.json');
702
+ if (raw === null)
703
+ return null;
704
+ try {
705
+ const m = JSON.parse(raw);
706
+ return typeof m.app_origin === 'string' && typeof m.launch_path === 'string' ? m : null;
707
+ }
708
+ catch {
709
+ return null;
710
+ }
711
+ }
543
712
  /** Everything studio renders for a demo run, read from its root and its units. */
544
713
  export async function demoView(adapter, view) {
545
714
  const runId = view.session.id;
546
715
  const root = await existingDemoRootDir(runId);
547
716
  // Every read is resolved inside the root: the run can write here, so a symlink it made is never followed out.
548
- const [brief, script, chaptersRaw, markersRaw, recordingRaw] = await Promise.all([
549
- readText(root, 'BRIEF.md'),
550
- readText(root, 'script.md'),
551
- readText(root, 'chapters.json'),
717
+ // The chapters and storyline the person approves (and the recorder records) are the engine's snapshot once the
718
+ // plan step passed; before that, the plan's own files.
719
+ const [brief, script, approved, manifest, planChapters, planStoryline, markersRaw, recordRaw, legacyRecordingRaw] = await Promise.all([
720
+ planText(root, 'BRIEF.md'),
721
+ planText(root, 'script.md'),
722
+ approvedPlan(root, runId),
723
+ launchManifest(root),
724
+ planText(root, 'chapters.json'),
725
+ planText(root, 'storyline.json'),
552
726
  readText(root, 'demo-video/chapters.md'),
727
+ readText(root, 'demo-video/record.json'),
553
728
  readText(root, 'demo-video/recording.json'),
554
729
  ]);
730
+ const chaptersRaw = approved.state === 'approved' ? approved.chapters : approved.state === 'none' ? planChapters : null;
731
+ const storylineRaw = approved.state === 'approved' ? approved.storyline : approved.state === 'none' ? planStoryline : null;
555
732
  const chapters = await Promise.all(parseChapters(chaptersRaw).map(async (c) => ({
556
733
  ...c,
557
734
  recorded: await isFile(root, `demo-video/segments/${c.key}/segment.mp4`),
@@ -563,14 +740,37 @@ export async function demoView(adapter, view) {
563
740
  }
564
741
  const videoBytes = await fileSize(root, 'demo-video/demo.mp4');
565
742
  const video = videoBytes !== null && videoBytes > 0 ? { path: 'demo-video/demo.mp4', bytes: videoBytes } : null;
743
+ // The engine-run recorder's verdict (`record.json`, DES-DEMO-RECORD-001 §3.5), else a hand recorder's
744
+ // `recording.json`.
566
745
  let readOnly = null;
567
- if (recordingRaw !== null) {
746
+ let jail = null;
747
+ const parsedRecord = (raw) => {
748
+ if (raw === null)
749
+ return null;
568
750
  try {
569
- const r = JSON.parse(recordingRaw);
570
- readOnly = typeof r.readOnly === 'boolean' ? r.readOnly : null;
751
+ const v = JSON.parse(raw);
752
+ return v !== null && typeof v === 'object' && !Array.isArray(v) ? v : null;
571
753
  }
572
754
  catch {
573
- readOnly = null;
755
+ return null;
756
+ }
757
+ };
758
+ const rec = parsedRecord(recordRaw);
759
+ if (rec !== null) {
760
+ readOnly = typeof rec.read_only === 'boolean' ? rec.read_only : null;
761
+ jail = typeof rec.jail === 'string' ? rec.jail : null;
762
+ }
763
+ else {
764
+ const legacy = parsedRecord(legacyRecordingRaw);
765
+ readOnly = typeof legacy?.readOnly === 'boolean' ? legacy.readOnly : null;
766
+ }
767
+ let storyline = null;
768
+ if (storylineRaw !== null) {
769
+ try {
770
+ storyline = JSON.parse(storylineRaw);
771
+ }
772
+ catch {
773
+ storyline = null;
574
774
  }
575
775
  }
576
776
  const review = stepUnit(view, 'review');
@@ -580,7 +780,9 @@ export async function demoView(adapter, view) {
580
780
  const { verdict, findings } = parseReview(reviewOutput);
581
781
  return {
582
782
  runId,
783
+ // The app the engine records is crew's own manifest's, never the brief's (the plan seat can edit the brief).
583
784
  ...briefFields(brief),
785
+ ...(manifest !== null ? { url: `${manifest.app_origin}${manifest.launch_path}` } : {}),
584
786
  stage: demoStage(view),
585
787
  script,
586
788
  chapters,
@@ -589,7 +791,10 @@ export async function demoView(adapter, view) {
589
791
  video,
590
792
  recording: { readOnly },
591
793
  review: { verdict, findings, text: reviewOutput, rejected: review?.status === 'rejected' },
592
- seats: { recorder: record?.assigned_cli ?? null, reviewer: review?.assigned_cli ?? null },
794
+ // A `demo_record` unit is the engine's own Tool: it has no seat (its `assigned_cli` names the Tool executor).
795
+ seats: { recorder: record?.catalog === 'demo_record' ? null : (record?.assigned_cli ?? null), reviewer: review?.assigned_cli ?? null },
796
+ producer: record?.catalog === 'demo_record' ? { kind: 'engine', tool: 'demo_record', jail } : record !== undefined ? { kind: 'seat', tool: null, jail: null } : null,
797
+ storyline,
593
798
  syntheticLabelled: script !== null && /synthetic/i.test(script),
594
799
  document: await demoDocumentLink(runId),
595
800
  };
@@ -708,7 +913,8 @@ export async function makeDemoDocument(view, deps) {
708
913
  if (!DEMO_DOCUMENT_STATUSES.has(view.session.status))
709
914
  return { status: 409, body: { error: 'a demo becomes a document once its run has completed (or was cancelled)' } };
710
915
  const root = await existingDemoRootDir(runId);
711
- const chapters = parseChapters(await readText(root, 'chapters.json'));
916
+ const approved = await approvedPlan(root, runId);
917
+ const chapters = parseChapters(approved.state === 'approved' ? approved.chapters : approved.state === 'none' ? await planText(root, 'chapters.json') : null);
712
918
  if (chapters.length === 0)
713
919
  return { status: 409, body: { error: 'the demo has no chapters to import' } };
714
920
  for (const c of chapters) {
@@ -723,7 +929,9 @@ export async function makeDemoDocument(view, deps) {
723
929
  if (call === null)
724
930
  return { status: 404, body: { error: `Project ${projectId} not found` } };
725
931
  const docId = `demo-${runId.replace(/[^a-z0-9]/giu, '').toLowerCase().slice(0, 12)}`;
726
- const { url } = briefFields(await readText(root, 'BRIEF.md'));
932
+ const manifest = await launchManifest(root);
933
+ const { url: briefUrl } = briefFields(await planText(root, 'BRIEF.md'));
934
+ const url = manifest !== null ? `${manifest.app_origin}${manifest.launch_path}` : briefUrl;
727
935
  const title = `Demo of ${url ?? 'the app'}`.replace(/[\r\n]+/gu, ' ').slice(0, 80);
728
936
  const placeholder = `<main><h1>${title.replace(/[&<>"]/gu, '')}</h1><p>The run's demo, imported for editing.</p></main>`;
729
937
  const created = await call('POST', '/api/docs', { name: docId, html: placeholder, ...(projectId !== UNFILED_PROJECT ? { project: projectId } : {}) });
@@ -823,7 +1031,7 @@ export function parseRange(header, size) {
823
1031
  return 'bad';
824
1032
  return { start, end };
825
1033
  }
826
- export function registerDemoRoutes(app, adapter, launchRun) {
1034
+ export function registerDemoRoutes(app, adapter, launchRun, deps = {}) {
827
1035
  // One encode per run and format at a time, since each format writes one file. An identical request
828
1036
  // (a double click) joins the encode in flight; a different poster frame is refused until it ends,
829
1037
  // so two encodes never race to replace the same file.
@@ -855,7 +1063,7 @@ export function registerDemoRoutes(app, adapter, launchRun) {
855
1063
  },
856
1064
  }, async (req, reply) => {
857
1065
  const projectId = req.params.id;
858
- const out = await demoLaunch(launchRun, projectId, req.body, { actor: req.actor ?? LOCAL_ACTOR, log: req.log });
1066
+ const out = await demoLaunch(launchRun, projectId, req.body, { actor: req.actor ?? LOCAL_ACTOR, log: req.log }, {}, deps);
859
1067
  return reply.code(out.code).send(out.body);
860
1068
  });
861
1069
  app.get(`${V}/runs/:id/demo`, { config: { manifest: { responseType: 'DemoView', statusCodes: [200, 404] } } }, async (req, reply) => {
@@ -864,7 +1072,7 @@ export function registerDemoRoutes(app, adapter, launchRun) {
864
1072
  return reply.code(404).send({ error: 'no demo run with that id' });
865
1073
  return demoView(adapter, run);
866
1074
  });
867
- app.get(`${V}/runs/:id/demo/file`, { config: { manifest: { responseType: 'binary (video/mp4, image/png, text)', statusCodes: [200, 206, 400, 404, 416] } } }, async (req, reply) => {
1075
+ app.get(`${V}/runs/:id/demo/file`, { config: { manifest: { responseType: 'binary (video/mp4, image/png, text)', statusCodes: [200, 206, 400, 403, 404, 416] } } }, async (req, reply) => {
868
1076
  const { id } = req.params;
869
1077
  const rel = req.query.path;
870
1078
  if (typeof rel !== 'string')
@@ -875,7 +1083,17 @@ export function registerDemoRoutes(app, adapter, launchRun) {
875
1083
  }
876
1084
  if (!(await isKnownDemoRun(id)))
877
1085
  return reply.code(404).send({ error: 'no demo run with that id' });
878
- const target = await containedPath(await existingDemoRootDir(id), rel);
1086
+ const demoRoot = await existingDemoRootDir(id);
1087
+ // (wicked-core#1249, DES-APPS-001 S5) A demo of an app whose rows may not reach a model is a person's to watch:
1088
+ // an agent or plugin actor gets none of its files (as `/apps/:app/query` refuses them the rows).
1089
+ const actor = req.actor ?? LOCAL_ACTOR;
1090
+ if (actor.kind === 'agent' || actor.kind === 'plugin') {
1091
+ const manifest = await launchManifest(demoRoot);
1092
+ if (manifest !== null && manifest.live_data_to_models !== true) {
1093
+ return reply.code(403).send({ error: "this demo shows an app's live data, which reaches a person only" });
1094
+ }
1095
+ }
1096
+ const target = await containedPath(demoRoot, rel);
879
1097
  if (target === null)
880
1098
  return reply.code(404).send({ error: `no such demo file: ${rel}` });
881
1099
  const st = await fsp.stat(target);
@@ -956,10 +1174,31 @@ export function registerDemoRoutes(app, adapter, launchRun) {
956
1174
  return reply.code(409).send({ error: 'the script can be edited only while the plan gate is open' });
957
1175
  }
958
1176
  // The resolved file, never the joined name: a worker-made symlink is followed only inside the root.
959
- const target = await containedPath(await existingDemoRootDir(id), 'script.md');
1177
+ const demoRoot = await existingDemoRootDir(id);
1178
+ // A demo with a plan directory edits ONLY its own `plan/script.md`, never through a link (a seat-made link
1179
+ // could aim the person's save at the engine's files); a demo from before keeps its root-level script.
1180
+ const planDir = join(demoRoot, DEMO_PLAN_DIR);
1181
+ const hasPlanDir = await fsp.lstat(planDir).then((st) => st.isDirectory(), () => false);
1182
+ let target;
1183
+ if (hasPlanDir) {
1184
+ const st = await fsp.lstat(join(planDir, 'script.md')).catch(() => null);
1185
+ target = st !== null && st.isFile() ? await containedPath(planDir, 'script.md') : null;
1186
+ }
1187
+ else {
1188
+ target = await containedPath(demoRoot, 'script.md');
1189
+ }
960
1190
  if (target === null)
961
1191
  return reply.code(409).send({ error: 'the plan has not written script.md' });
962
- await fsp.writeFile(target, parsed.data.content, 'utf8');
1192
+ // Never through a link, even one swapped in after the check above: the file is opened without following one.
1193
+ const handle = await fsp.open(target, fsConstants.O_WRONLY | fsConstants.O_TRUNC | (fsConstants.O_NOFOLLOW ?? 0)).catch(() => null);
1194
+ if (handle === null)
1195
+ return reply.code(409).send({ error: 'the plan has not written script.md' });
1196
+ try {
1197
+ await handle.writeFile(parsed.data.content, 'utf8');
1198
+ }
1199
+ finally {
1200
+ await handle.close();
1201
+ }
963
1202
  return { bytes };
964
1203
  });
965
1204
  }