wicked-crew 0.16.11 → 0.16.13

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 (341) hide show
  1. package/README.md +28 -8
  2. package/dist/api/artifact-outline.d.ts +64 -0
  3. package/dist/api/artifact-outline.d.ts.map +1 -0
  4. package/dist/api/artifact-outline.js +254 -0
  5. package/dist/api/artifact-outline.js.map +1 -0
  6. package/dist/api/beneath.d.ts +76 -0
  7. package/dist/api/beneath.d.ts.map +1 -0
  8. package/dist/api/beneath.js +214 -0
  9. package/dist/api/beneath.js.map +1 -0
  10. package/dist/api/capture.d.ts +2 -2
  11. package/dist/api/chat-citations.d.ts +25 -1
  12. package/dist/api/chat-citations.d.ts.map +1 -1
  13. package/dist/api/chat-citations.js +186 -61
  14. package/dist/api/chat-citations.js.map +1 -1
  15. package/dist/api/chat-context.d.ts +236 -0
  16. package/dist/api/chat-context.d.ts.map +1 -0
  17. package/dist/api/chat-context.js +808 -0
  18. package/dist/api/chat-context.js.map +1 -0
  19. package/dist/api/chat-history.d.ts +20 -0
  20. package/dist/api/chat-history.d.ts.map +1 -1
  21. package/dist/api/chat-history.js +46 -1
  22. package/dist/api/chat-history.js.map +1 -1
  23. package/dist/api/chat-proposals.d.ts +534 -0
  24. package/dist/api/chat-proposals.d.ts.map +1 -0
  25. package/dist/api/chat-proposals.js +1562 -0
  26. package/dist/api/chat-proposals.js.map +1 -0
  27. package/dist/api/chat-scope.d.ts +41 -0
  28. package/dist/api/chat-scope.d.ts.map +1 -1
  29. package/dist/api/chat-scope.js +87 -15
  30. package/dist/api/chat-scope.js.map +1 -1
  31. package/dist/api/chat-transcripts.d.ts +27 -2
  32. package/dist/api/chat-transcripts.d.ts.map +1 -1
  33. package/dist/api/chat-transcripts.js +105 -4
  34. package/dist/api/chat-transcripts.js.map +1 -1
  35. package/dist/api/diagnostics.d.ts +15 -0
  36. package/dist/api/diagnostics.d.ts.map +1 -1
  37. package/dist/api/diagnostics.js +56 -0
  38. package/dist/api/diagnostics.js.map +1 -1
  39. package/dist/api/elicitation-cache.d.ts +13 -0
  40. package/dist/api/elicitation-cache.d.ts.map +1 -1
  41. package/dist/api/elicitation-cache.js +12 -0
  42. package/dist/api/elicitation-cache.js.map +1 -1
  43. package/dist/api/eval-sample.d.ts +12 -12
  44. package/dist/api/frame-guard.d.ts +62 -0
  45. package/dist/api/frame-guard.d.ts.map +1 -0
  46. package/dist/api/frame-guard.js +97 -0
  47. package/dist/api/frame-guard.js.map +1 -0
  48. package/dist/api/governance-steering.d.ts +4 -4
  49. package/dist/api/multiscope.d.ts +3 -0
  50. package/dist/api/multiscope.d.ts.map +1 -1
  51. package/dist/api/multiscope.js +13 -0
  52. package/dist/api/multiscope.js.map +1 -1
  53. package/dist/api/needs.d.ts +6 -0
  54. package/dist/api/needs.d.ts.map +1 -1
  55. package/dist/api/needs.js +31 -4
  56. package/dist/api/needs.js.map +1 -1
  57. package/dist/api/product.d.ts.map +1 -1
  58. package/dist/api/product.js +13 -2
  59. package/dist/api/product.js.map +1 -1
  60. package/dist/api/project-aggregates.d.ts +6 -6
  61. package/dist/api/project-aggregates.d.ts.map +1 -1
  62. package/dist/api/project-aggregates.js +16 -24
  63. package/dist/api/project-aggregates.js.map +1 -1
  64. package/dist/api/requirements.d.ts +261 -6
  65. package/dist/api/requirements.d.ts.map +1 -1
  66. package/dist/api/requirements.js +344 -64
  67. package/dist/api/requirements.js.map +1 -1
  68. package/dist/api/routes.d.ts +156 -4
  69. package/dist/api/routes.d.ts.map +1 -1
  70. package/dist/api/routes.js +851 -78
  71. package/dist/api/routes.js.map +1 -1
  72. package/dist/api/run-brief.d.ts +78 -0
  73. package/dist/api/run-brief.d.ts.map +1 -0
  74. package/dist/api/run-brief.js +318 -0
  75. package/dist/api/run-brief.js.map +1 -0
  76. package/dist/api/run-files.d.ts.map +1 -1
  77. package/dist/api/run-files.js +5 -1
  78. package/dist/api/run-files.js.map +1 -1
  79. package/dist/api/run-timing-index.d.ts +27 -0
  80. package/dist/api/run-timing-index.d.ts.map +1 -1
  81. package/dist/api/run-timing-index.js +65 -0
  82. package/dist/api/run-timing-index.js.map +1 -1
  83. package/dist/api/seat-images.d.ts +102 -0
  84. package/dist/api/seat-images.d.ts.map +1 -0
  85. package/dist/api/seat-images.js +333 -0
  86. package/dist/api/seat-images.js.map +1 -0
  87. package/dist/api/server.d.ts +3 -0
  88. package/dist/api/server.d.ts.map +1 -1
  89. package/dist/api/server.js +265 -2
  90. package/dist/api/server.js.map +1 -1
  91. package/dist/api/steering-landing.d.ts +48 -1
  92. package/dist/api/steering-landing.d.ts.map +1 -1
  93. package/dist/api/steering-landing.js +116 -42
  94. package/dist/api/steering-landing.js.map +1 -1
  95. package/dist/api/system-snapshot.d.ts +51 -2
  96. package/dist/api/system-snapshot.d.ts.map +1 -1
  97. package/dist/api/system-snapshot.js +151 -15
  98. package/dist/api/system-snapshot.js.map +1 -1
  99. package/dist/api/testing.d.ts +4 -4
  100. package/dist/api/testing.js +2 -2
  101. package/dist/api/testing.js.map +1 -1
  102. package/dist/apps/spec.d.ts +3009 -0
  103. package/dist/apps/spec.d.ts.map +1 -0
  104. package/dist/apps/spec.js +870 -0
  105. package/dist/apps/spec.js.map +1 -0
  106. package/dist/campaigns/routes.js +1 -1
  107. package/dist/campaigns/routes.js.map +1 -1
  108. package/dist/cli/index.js +3 -3
  109. package/dist/cli/index.js.map +1 -1
  110. package/dist/core/adapter.d.ts +12 -0
  111. package/dist/core/adapter.d.ts.map +1 -1
  112. package/dist/core/adapter.js +36 -1
  113. package/dist/core/adapter.js.map +1 -1
  114. package/dist/core/deliver-text.d.ts.map +1 -1
  115. package/dist/core/deliver-text.js +22 -10
  116. package/dist/core/deliver-text.js.map +1 -1
  117. package/dist/core/estate-mcp-client.d.ts +7 -1
  118. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  119. package/dist/core/estate-mcp-client.js +10 -2
  120. package/dist/core/estate-mcp-client.js.map +1 -1
  121. package/dist/core/exec.d.ts +12 -0
  122. package/dist/core/exec.d.ts.map +1 -1
  123. package/dist/core/exec.js +23 -0
  124. package/dist/core/exec.js.map +1 -1
  125. package/dist/core/reassign-refusal.d.ts.map +1 -1
  126. package/dist/core/reassign-refusal.js +23 -3
  127. package/dist/core/reassign-refusal.js.map +1 -1
  128. package/dist/core/repoPaths.d.ts +32 -7
  129. package/dist/core/repoPaths.d.ts.map +1 -1
  130. package/dist/core/repoPaths.js +56 -9
  131. package/dist/core/repoPaths.js.map +1 -1
  132. package/dist/core/requirements-graph-setting.d.ts +32 -0
  133. package/dist/core/requirements-graph-setting.d.ts.map +1 -0
  134. package/dist/core/requirements-graph-setting.js +84 -0
  135. package/dist/core/requirements-graph-setting.js.map +1 -0
  136. package/dist/core/run-boot-resume.d.ts +4 -1
  137. package/dist/core/run-boot-resume.d.ts.map +1 -1
  138. package/dist/core/run-boot-resume.js +6 -1
  139. package/dist/core/run-boot-resume.js.map +1 -1
  140. package/dist/core/run-identity.d.ts.map +1 -1
  141. package/dist/core/run-identity.js +6 -0
  142. package/dist/core/run-identity.js.map +1 -1
  143. package/dist/core/types.d.ts +14 -0
  144. package/dist/core/types.d.ts.map +1 -1
  145. package/dist/core/types.js.map +1 -1
  146. package/dist/decisions/chat-recorder.d.ts +14 -3
  147. package/dist/decisions/chat-recorder.d.ts.map +1 -1
  148. package/dist/decisions/chat-recorder.js +54 -9
  149. package/dist/decisions/chat-recorder.js.map +1 -1
  150. package/dist/editors/csp.d.ts +24 -4
  151. package/dist/editors/csp.d.ts.map +1 -1
  152. package/dist/editors/csp.js +35 -8
  153. package/dist/editors/csp.js.map +1 -1
  154. package/dist/editors/registry.d.ts +46 -21
  155. package/dist/editors/registry.d.ts.map +1 -1
  156. package/dist/editors/registry.js +13 -2
  157. package/dist/editors/registry.js.map +1 -1
  158. package/dist/editors/routes.d.ts +4 -1
  159. package/dist/editors/routes.d.ts.map +1 -1
  160. package/dist/editors/routes.js +30 -3
  161. package/dist/editors/routes.js.map +1 -1
  162. package/dist/editors/visuals.d.ts +51 -0
  163. package/dist/editors/visuals.d.ts.map +1 -0
  164. package/dist/editors/visuals.js +164 -0
  165. package/dist/editors/visuals.js.map +1 -0
  166. package/dist/editors/webrtc-guard.d.ts +94 -0
  167. package/dist/editors/webrtc-guard.d.ts.map +1 -0
  168. package/dist/editors/webrtc-guard.js +506 -0
  169. package/dist/editors/webrtc-guard.js.map +1 -0
  170. package/dist/inspect/reading.d.ts +110 -0
  171. package/dist/inspect/reading.d.ts.map +1 -0
  172. package/dist/inspect/reading.js +325 -0
  173. package/dist/inspect/reading.js.map +1 -0
  174. package/dist/inspect/routes.d.ts +14 -0
  175. package/dist/inspect/routes.d.ts.map +1 -0
  176. package/dist/inspect/routes.js +44 -0
  177. package/dist/inspect/routes.js.map +1 -0
  178. package/dist/inspect/service.d.ts +161 -0
  179. package/dist/inspect/service.d.ts.map +1 -0
  180. package/dist/inspect/service.js +466 -0
  181. package/dist/inspect/service.js.map +1 -0
  182. package/dist/interactive/bridge-pool.d.ts +11 -2
  183. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  184. package/dist/interactive/bridge-pool.js +10 -1
  185. package/dist/interactive/bridge-pool.js.map +1 -1
  186. package/dist/interactive/doc-binding.d.ts +156 -0
  187. package/dist/interactive/doc-binding.d.ts.map +1 -0
  188. package/dist/interactive/doc-binding.js +277 -0
  189. package/dist/interactive/doc-binding.js.map +1 -0
  190. package/dist/interactive/doc-delete-routes.d.ts +3 -0
  191. package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
  192. package/dist/interactive/doc-delete-routes.js +4 -0
  193. package/dist/interactive/doc-delete-routes.js.map +1 -1
  194. package/dist/interactive/draft-events.d.ts +89 -3
  195. package/dist/interactive/draft-events.d.ts.map +1 -1
  196. package/dist/interactive/draft-events.js +441 -30
  197. package/dist/interactive/draft-events.js.map +1 -1
  198. package/dist/interactive/draft-skill.d.ts +7 -0
  199. package/dist/interactive/draft-skill.d.ts.map +1 -1
  200. package/dist/interactive/draft-skill.js +10 -3
  201. package/dist/interactive/draft-skill.js.map +1 -1
  202. package/dist/interactive/edit-events.d.ts +2 -0
  203. package/dist/interactive/edit-events.d.ts.map +1 -1
  204. package/dist/interactive/edit-events.js +11 -0
  205. package/dist/interactive/edit-events.js.map +1 -1
  206. package/dist/interactive/proposal-create.d.ts +143 -0
  207. package/dist/interactive/proposal-create.d.ts.map +1 -0
  208. package/dist/interactive/proposal-create.js +318 -0
  209. package/dist/interactive/proposal-create.js.map +1 -0
  210. package/dist/interactive/proxy-routes.d.ts +60 -3
  211. package/dist/interactive/proxy-routes.d.ts.map +1 -1
  212. package/dist/interactive/proxy-routes.js +217 -3
  213. package/dist/interactive/proxy-routes.js.map +1 -1
  214. package/dist/interactive/source-packet.d.ts +126 -0
  215. package/dist/interactive/source-packet.d.ts.map +1 -0
  216. package/dist/interactive/source-packet.js +482 -0
  217. package/dist/interactive/source-packet.js.map +1 -0
  218. package/dist/learnings/estate.d.ts +16 -0
  219. package/dist/learnings/estate.d.ts.map +1 -0
  220. package/dist/learnings/estate.js +68 -0
  221. package/dist/learnings/estate.js.map +1 -0
  222. package/dist/learnings/extract.d.ts +56 -0
  223. package/dist/learnings/extract.d.ts.map +1 -0
  224. package/dist/learnings/extract.js +252 -0
  225. package/dist/learnings/extract.js.map +1 -0
  226. package/dist/learnings/recall.d.ts +43 -0
  227. package/dist/learnings/recall.d.ts.map +1 -0
  228. package/dist/learnings/recall.js +104 -0
  229. package/dist/learnings/recall.js.map +1 -0
  230. package/dist/learnings/service.d.ts +183 -0
  231. package/dist/learnings/service.d.ts.map +1 -0
  232. package/dist/learnings/service.js +571 -0
  233. package/dist/learnings/service.js.map +1 -0
  234. package/dist/mcp/ask-server.d.ts.map +1 -1
  235. package/dist/mcp/ask-server.js +37 -4
  236. package/dist/mcp/ask-server.js.map +1 -1
  237. package/dist/mcp/broker.d.ts +12 -1
  238. package/dist/mcp/broker.d.ts.map +1 -1
  239. package/dist/mcp/broker.js +24 -5
  240. package/dist/mcp/broker.js.map +1 -1
  241. package/dist/mcp/invoke.d.ts +26 -2
  242. package/dist/mcp/invoke.d.ts.map +1 -1
  243. package/dist/mcp/invoke.js +51 -5
  244. package/dist/mcp/invoke.js.map +1 -1
  245. package/dist/persona/routes.d.ts +92 -0
  246. package/dist/persona/routes.d.ts.map +1 -0
  247. package/dist/persona/routes.js +69 -0
  248. package/dist/persona/routes.js.map +1 -0
  249. package/dist/persona/store.d.ts +104 -0
  250. package/dist/persona/store.d.ts.map +1 -0
  251. package/dist/persona/store.js +176 -0
  252. package/dist/persona/store.js.map +1 -0
  253. package/dist/persona/voice.d.ts +4 -0
  254. package/dist/persona/voice.d.ts.map +1 -0
  255. package/dist/persona/voice.js +58 -0
  256. package/dist/persona/voice.js.map +1 -0
  257. package/dist/projects/routes.d.ts +2 -2
  258. package/dist/setup/known.d.ts +56 -0
  259. package/dist/setup/known.d.ts.map +1 -0
  260. package/dist/setup/known.js +159 -0
  261. package/dist/setup/known.js.map +1 -0
  262. package/dist/setup/routes.d.ts +13 -0
  263. package/dist/setup/routes.d.ts.map +1 -0
  264. package/dist/setup/routes.js +20 -0
  265. package/dist/setup/routes.js.map +1 -0
  266. package/dist/standing-orders/history.d.ts +2 -0
  267. package/dist/standing-orders/history.d.ts.map +1 -1
  268. package/dist/standing-orders/history.js +1 -0
  269. package/dist/standing-orders/history.js.map +1 -1
  270. package/dist/studio/assets/WickedSans-Regular-fb698rcD.woff2 +0 -0
  271. package/dist/studio/assets/WickedSans-SemiBold-CD53n1AC.woff2 +0 -0
  272. package/dist/studio/assets/WickedScript-Regular-CY5juO6I.woff2 +0 -0
  273. package/dist/studio/assets/WickedSerif-Regular-mdPEjaVZ.woff2 +0 -0
  274. package/dist/studio/assets/index-BUZ_-Syk.css +32 -0
  275. package/dist/studio/assets/index-u4O_7N-b.js +986 -0
  276. package/dist/studio/editors/wicked-deck/editor.json +6 -1
  277. package/dist/studio/editors/wicked-deck/icon.svg +1 -0
  278. package/dist/studio/editors/wicked-deck/index.html +1 -1
  279. package/dist/studio/editors/wicked-doc/editor.json +6 -1
  280. package/dist/studio/editors/wicked-doc/icon.svg +1 -0
  281. package/dist/studio/editors/wicked-doc/index.html +1 -1
  282. package/dist/studio/editors/wicked-insights/editor.json +6 -1
  283. package/dist/studio/editors/wicked-insights/icon.svg +1 -0
  284. package/dist/studio/editors/wicked-insights/index.html +1 -1
  285. package/dist/studio/editors/wicked-page/editor.json +6 -1
  286. package/dist/studio/editors/wicked-page/icon.svg +1 -0
  287. package/dist/studio/editors/wicked-page/index.html +1 -1
  288. package/dist/studio/editors/wicked-video/editor.json +6 -1
  289. package/dist/studio/editors/wicked-video/icon.svg +1 -0
  290. package/dist/studio/editors/wicked-video/index.html +1 -1
  291. package/dist/studio/index.html +2 -2
  292. package/dist/studio/testid-inventory.json +5155 -2707
  293. package/dist/voice/dashboard.d.ts +376 -0
  294. package/dist/voice/dashboard.d.ts.map +1 -0
  295. package/dist/voice/dashboard.js +92 -0
  296. package/dist/voice/dashboard.js.map +1 -0
  297. package/dist/voice/inject-input.d.ts +51 -0
  298. package/dist/voice/inject-input.d.ts.map +1 -0
  299. package/dist/voice/inject-input.js +126 -0
  300. package/dist/voice/inject-input.js.map +1 -0
  301. package/dist/voice/routes.d.ts +41 -0
  302. package/dist/voice/routes.d.ts.map +1 -0
  303. package/dist/voice/routes.js +116 -0
  304. package/dist/voice/routes.js.map +1 -0
  305. package/dist/voice/service.d.ts +177 -0
  306. package/dist/voice/service.d.ts.map +1 -0
  307. package/dist/voice/service.js +400 -0
  308. package/dist/voice/service.js.map +1 -0
  309. package/dist/workflow-catalog/build.d.ts +35 -0
  310. package/dist/workflow-catalog/build.d.ts.map +1 -0
  311. package/dist/workflow-catalog/build.js +229 -0
  312. package/dist/workflow-catalog/build.js.map +1 -0
  313. package/dist/workflow-catalog/catalog-data.d.ts +36 -0
  314. package/dist/workflow-catalog/catalog-data.d.ts.map +1 -0
  315. package/dist/workflow-catalog/catalog-data.js +430 -0
  316. package/dist/workflow-catalog/catalog-data.js.map +1 -0
  317. package/dist/working-doc/event-lines.d.ts +76 -0
  318. package/dist/working-doc/event-lines.d.ts.map +1 -0
  319. package/dist/working-doc/event-lines.js +247 -0
  320. package/dist/working-doc/event-lines.js.map +1 -0
  321. package/dist/working-doc/routes.d.ts +1 -1
  322. package/dist/working-doc/routes.d.ts.map +1 -1
  323. package/dist/working-doc/routes.js +2 -1
  324. package/dist/working-doc/routes.js.map +1 -1
  325. package/dist/working-doc/sections.d.ts +3 -1
  326. package/dist/working-doc/sections.d.ts.map +1 -1
  327. package/dist/working-doc/sections.js +4 -2
  328. package/dist/working-doc/sections.js.map +1 -1
  329. package/dist/working-doc/service.d.ts +66 -1
  330. package/dist/working-doc/service.d.ts.map +1 -1
  331. package/dist/working-doc/service.js +298 -22
  332. package/dist/working-doc/service.js.map +1 -1
  333. package/dist/working-doc/store.d.ts +8 -2
  334. package/dist/working-doc/store.d.ts.map +1 -1
  335. package/dist/working-doc/store.js.map +1 -1
  336. package/endpoint-manifest.json +205 -2
  337. package/package.json +5 -4
  338. package/workflows/distill-learnings.json +27 -0
  339. package/workflows/inspect-unit.json +27 -0
  340. package/dist/studio/assets/index-B-f_VEL2.css +0 -32
  341. package/dist/studio/assets/index-DhkxIK-0.js +0 -845
@@ -0,0 +1,236 @@
1
+ /**
2
+ * THE CHAT SEES ARTIFACTS AND RUNS (DES-CHAT-ARTIFACTS-001 §5.1, §5.3; slice A1): the per-turn block crew adds to a
3
+ * chat message, built from crew's own reads.
4
+ *
5
+ * Studio sends `context` beside the person's words (`ChatMessageBody.context`): the artifact open on the surface the
6
+ * message came from (`<mount>/<doc>`, the version they are looking at, the parts they selected), the tab's appearance,
7
+ * and studio's page summary. Crew then, for every turn:
8
+ *
9
+ * 1. checks the SCOPE before anything is read or copied (the caller has already checked the chat's owner): a chat
10
+ * filed in a project sees that project's documents and runs; any other chat sees what is on this daemon. What
11
+ * fails is named in the block with its reason, never read. (DES §4.1 also lets a project chat read the Unfiled
12
+ * documents it made; no chat makes documents before slice A3, which brings the durable per-document binding that
13
+ * records it — so until then that exception has nothing to admit, and it is not inferred from run records.);
14
+ * 2. copies the viewed version and the latest into the chat's scratch root (`open/<mount>__<doc>-v<n>.html`): ids are
15
+ * validated against their grammar, file names come from ids, the document directory must be a real directory
16
+ * inside the project's docs root, each file is opened without following a link or blocking, capped, and written
17
+ * exclusively read-only; a different content already under a copy's name is an error, never an overwrite;
18
+ * 3. writes a run brief (`context/run-<id>-<sha8>.md`, named by its content like the source packet's run briefs, so
19
+ * a later turn's brief never replaces the bytes an earlier turn was given; `run-brief.ts`) for each run the person
20
+ * names in this message: an id in their words that resolves on this daemon, a run chip, or the run page the chat
21
+ * is on;
22
+ * 4. lists the ids the seat may use: recent turns, attachments, and the runs and documents named in this chat;
23
+ * 5. labels everything as data: the person's words stay theirs, studio's page summary is studio's, and artifact
24
+ * content and run outputs are fenced data the seat must never take instructions from.
25
+ *
26
+ * The block rides the turn's instructions after the person's words; the binding (what was given, and what was
27
+ * refused) is recorded as the turn's `context` transcript record, so a later turn can name what this one saw.
28
+ *
29
+ * Two phases: {@link buildTurnContext} reads and assembles everything in memory (it awaits), and the result's
30
+ * `publish()` writes the copies and briefs synchronously. The route calls `publish()` only after its last await and
31
+ * generation check, so a message whose chat was closed (and its id reopened) meanwhile writes nothing into the new
32
+ * chat's scratch root.
33
+ */
34
+ import { z } from 'zod';
35
+ import type { ChatContextBinding, ChatTranscriptRecord, SessionView } from '../core/types.js';
36
+ /** The Unfiled mount in an artifact ref (studio's mount alias `default` is read as it). */
37
+ export declare const UNFILED_MOUNT = "_unfiled";
38
+ /** `<mount>/<doc>`: a project id or `_unfiled`, then interactive's document-name grammar. */
39
+ export declare const ARTIFACT_REF: RegExp;
40
+ /** A `data-wid`: what interactive stamps on each addressable node. */
41
+ export declare const ANCHOR_WID: RegExp;
42
+ /** `context.page`, in characters. */
43
+ export declare const CONTEXT_PAGE_MAX: number;
44
+ export declare const CONTEXT_ANCHORS_MAX = 16;
45
+ /** A version copy past this size is not made: the seat is told to open it in studio. */
46
+ export declare const ARTIFACT_COPY_MAX: number;
47
+ /** Runs briefed in one turn, at most. */
48
+ export declare const RUNS_PER_TURN_MAX = 8;
49
+ /** Run ids looked at in one turn, at most (the rest are named as not looked at). */
50
+ export declare const RUN_TOKENS_MAX = 24;
51
+ /** The strict wire schema of `ChatMessageBody.context` (api-types 0.169.0). */
52
+ export declare const ChatMessageContextSchema: z.ZodObject<{
53
+ artifact: z.ZodOptional<z.ZodObject<{
54
+ ref: z.ZodString;
55
+ version: z.ZodNumber;
56
+ anchors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
57
+ }, "strict", z.ZodTypeAny, {
58
+ version: number;
59
+ ref: string;
60
+ anchors?: string[] | undefined;
61
+ }, {
62
+ version: number;
63
+ ref: string;
64
+ anchors?: string[] | undefined;
65
+ }>>;
66
+ appearance: z.ZodOptional<z.ZodObject<{
67
+ theme: z.ZodOptional<z.ZodString>;
68
+ accent_h: z.ZodOptional<z.ZodNumber>;
69
+ accent_s: z.ZodOptional<z.ZodNumber>;
70
+ accent_l: z.ZodOptional<z.ZodNumber>;
71
+ ambient: z.ZodOptional<z.ZodBoolean>;
72
+ ambient_still: z.ZodOptional<z.ZodBoolean>;
73
+ previewOf: z.ZodOptional<z.ZodString>;
74
+ }, "strict", z.ZodTypeAny, {
75
+ theme?: string | undefined;
76
+ accent_h?: number | undefined;
77
+ accent_s?: number | undefined;
78
+ accent_l?: number | undefined;
79
+ ambient?: boolean | undefined;
80
+ ambient_still?: boolean | undefined;
81
+ previewOf?: string | undefined;
82
+ }, {
83
+ theme?: string | undefined;
84
+ accent_h?: number | undefined;
85
+ accent_s?: number | undefined;
86
+ accent_l?: number | undefined;
87
+ ambient?: boolean | undefined;
88
+ ambient_still?: boolean | undefined;
89
+ previewOf?: string | undefined;
90
+ }>>;
91
+ page: z.ZodOptional<z.ZodString>;
92
+ }, "strict", z.ZodTypeAny, {
93
+ artifact?: {
94
+ version: number;
95
+ ref: string;
96
+ anchors?: string[] | undefined;
97
+ } | undefined;
98
+ page?: string | undefined;
99
+ appearance?: {
100
+ theme?: string | undefined;
101
+ accent_h?: number | undefined;
102
+ accent_s?: number | undefined;
103
+ accent_l?: number | undefined;
104
+ ambient?: boolean | undefined;
105
+ ambient_still?: boolean | undefined;
106
+ previewOf?: string | undefined;
107
+ } | undefined;
108
+ }, {
109
+ artifact?: {
110
+ version: number;
111
+ ref: string;
112
+ anchors?: string[] | undefined;
113
+ } | undefined;
114
+ page?: string | undefined;
115
+ appearance?: {
116
+ theme?: string | undefined;
117
+ accent_h?: number | undefined;
118
+ accent_s?: number | undefined;
119
+ accent_l?: number | undefined;
120
+ ambient?: boolean | undefined;
121
+ ambient_still?: boolean | undefined;
122
+ previewOf?: string | undefined;
123
+ } | undefined;
124
+ }>;
125
+ /** The parsed body field (the wire's `ChatMessageContext`, as zod reads it). */
126
+ export type ParsedChatMessageContext = z.infer<typeof ChatMessageContextSchema>;
127
+ export interface ParsedRef {
128
+ /** Canonical: `_unfiled` for an Unfiled document. */
129
+ mount: string;
130
+ doc: string;
131
+ /** The project the mount names (`default` for Unfiled). */
132
+ projectId: string;
133
+ ref: string;
134
+ }
135
+ /** Parse and canonicalize an artifact ref; `null` when it is not one. */
136
+ export declare function parseArtifactRef(ref: string): ParsedRef | null;
137
+ /** The mount a chat's project is (`null` = a chat in no project). */
138
+ export declare function chatMount(projectId: string | null | undefined): string | null;
139
+ export interface ChatContextDeps {
140
+ /** The docs root a project id resolves to (`default` = Unfiled); `null` = no such project. */
141
+ docsRoot(projectId: string): Promise<string | null>;
142
+ /** Every run, decorated as `GET /runs` serves it (`project_id`, `document_id`, `chat_id`, `title`, times). */
143
+ runs(): Promise<SessionView[]>;
144
+ /** A unit's captured output. */
145
+ workOutput(unitId: string): Promise<string | null>;
146
+ /** The run's acceptance line. */
147
+ acceptanceLine?(view: SessionView): Promise<string | null>;
148
+ /** The style recorded when the document was created (`ppt`, `web`, …), when there is one. */
149
+ docStyle?(docsRoot: string, doc: string): string | undefined;
150
+ }
151
+ export interface TurnContextInput {
152
+ chatId: string;
153
+ /** The chat's scratch root (`scope.cwd`). */
154
+ scratchRoot: string;
155
+ /** The project the chat is filed in; `null` = none. */
156
+ projectId: string | null;
157
+ /** The person's typed words. */
158
+ text: string;
159
+ context?: ParsedChatMessageContext | undefined;
160
+ /** The chat's transcript so far. */
161
+ records: readonly ChatTranscriptRecord[];
162
+ /** This chat's attachment ids. */
163
+ attachmentIds: readonly string[];
164
+ }
165
+ export interface TurnContext {
166
+ /** The section appended to the turn's instructions after the person's words; `''` when there is nothing. */
167
+ block: string;
168
+ /** What to record as the turn's `context` transcript record; `null` when nothing was given or refused. */
169
+ binding: ChatContextBinding | null;
170
+ /**
171
+ * Write the copies and briefs the block names into the scratch root. Synchronous, so the route can call it after
172
+ * its last await. Throws when the scratch root is not what it was (a link, a non-directory, a planted entry).
173
+ */
174
+ publish(): void;
175
+ }
176
+ /** Whether this platform can open files beneath a root without following links (`beneath.ts`). */
177
+ export declare function beneathSupported(): boolean;
178
+ /** The directories the seat reads the copies and briefs from: read roots of the chat's run, made at its launch. */
179
+ export declare function contextReadRoots(scratchRoot: string): {
180
+ open: string;
181
+ context: string;
182
+ };
183
+ /**
184
+ * The scratch root as a seat sees it: its real path. A seat in a container sees a read root at its canonical path
185
+ * only (macOS's `/var/folders/…` is `/private/var/folders/…`; the non-canonical spelling does not exist in a Linux
186
+ * seat), so every path crew hands the seat, and every read root it launches with, is the real one.
187
+ */
188
+ export declare function seatPathOf(path: string): string;
189
+ /** Create `dir` (one level below the chat's scratch root, private), proven a real directory beneath it, never a link. */
190
+ export declare function ensureRealDir(dir: string): string;
191
+ interface RunToken {
192
+ token: string;
193
+ /** Said as a run (`run 1a2b3c4d`, `runs a, b and c`, `run:<id>`, a run chip): an unresolved one is reported. */
194
+ explicit: boolean;
195
+ }
196
+ /**
197
+ * The run ids named in the person's words: every run-shaped hex id (a full uuid or an 8–32 digit prefix), explicit
198
+ * when said as a run (`run …`, a `runs …, … and …` list, `run:<id>` for any id); and in studio's page summary only
199
+ * the run of the page they are on (silently, when it is not a run) and the runs they added as chips (explicitly) —
200
+ * never its recent-runs list.
201
+ */
202
+ export declare function runTokensOf(text: string, page: string | undefined): RunToken[];
203
+ /** Build the turn's block and binding in memory; `publish()` writes its files. Throws only on a fault of crew itself. */
204
+ export declare function buildTurnContext(input: TurnContextInput, deps: ChatContextDeps): Promise<TurnContext>;
205
+ /**
206
+ * Whether `<docsRoot>/<doc>` is a real document directory inside the docs root whose latest version (0 included) is
207
+ * a regular file (`POST /chats {seedFromArtifact}`'s access check): `ok`, `missing`, or `unsupported` (this platform
208
+ * cannot open files without following links). Everything is opened beneath the docs root: no link is followed in any
209
+ * component.
210
+ */
211
+ export declare function artifactStatus(docsRoot: string, doc: string): 'ok' | 'missing' | 'unsupported';
212
+ /** Whether `<docsRoot>/<doc>` is a document crew can read ({@link artifactStatus} `ok`). */
213
+ export declare function artifactExists(docsRoot: string, doc: string): boolean;
214
+ /**
215
+ * DES-CHAT-ARTIFACTS-001 §4.2-§4.3 (A2): the latest version of `<docsRoot>/<doc>`, read the way {@link artifactStatus}
216
+ * reads it (beneath the docs root, no link followed in any folder), or `null` when it is not a document. A proposal
217
+ * records it as a refine's base, and Go checks it has not moved.
218
+ */
219
+ export declare function artifactHead(docsRoot: string, doc: string): number | null;
220
+ /**
221
+ * What crew recorded about a document when it was created and drafted (`crew-grounding.json`), read beneath the docs
222
+ * root like every other A1 read (capped, non-blocking, no link followed): the style, and the repositories it was
223
+ * grounded on — the draft launch's resolved list when there is one, else the create request's — however many the
224
+ * writer recorded. `null` when there is no sidecar; `{unreadable}` when there is one crew cannot read or does not
225
+ * recognise (never read as "no repositories": a seed then refuses rather than skipping its membership check).
226
+ */
227
+ export declare function readGroundingBeneath(docsRoot: string, doc: string): {
228
+ style?: string;
229
+ repoRefs: string[];
230
+ } | {
231
+ unreadable: true;
232
+ } | null;
233
+ /** sha256 of a string, hex (tests and the route's binding). */
234
+ export declare function sha256Hex(s: string | Buffer): string;
235
+ export {};
236
+ //# sourceMappingURL=chat-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-context.d.ts","sourceRoot":"","sources":["../../src/api/chat-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM9F,2FAA2F;AAC3F,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,6FAA6F;AAC7F,eAAO,MAAM,YAAY,QAA6E,CAAC;AACvG,sEAAsE;AACtE,eAAO,MAAM,UAAU,QAAwC,CAAC;AAKhE,qCAAqC;AACrC,eAAO,MAAM,gBAAgB,QAAY,CAAC;AAC1C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,QAAkB,CAAC;AAGjD,yCAAyC;AACzC,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,oFAAoF;AACpF,eAAO,MAAM,cAAc,KAAK,CAAC;AAUjC,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyB1B,CAAC;AAEZ,gFAAgF;AAChF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF,MAAM,WAAW,SAAS;IACxB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,yEAAyE;AACzE,wB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