@mountaya/studio 0.0.0-stage → 0.2.0

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 (521) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/LICENCE.fr.txt +280 -0
  3. package/LICENSE.txt +262 -0
  4. package/README.md +917 -2
  5. package/dist/agent/index.cjs +2600 -0
  6. package/dist/agent/index.cjs.map +1 -0
  7. package/dist/agent/index.d.cts +1237 -0
  8. package/dist/agent/index.d.ts +1237 -0
  9. package/dist/agent/index.js +2581 -0
  10. package/dist/agent/index.js.map +1 -0
  11. package/dist/chunk-3Oi_Zrtm.js +9 -0
  12. package/dist/chunk-3Oi_Zrtm.js.map +1 -0
  13. package/dist/chunk-B18OPIu_.js +6 -0
  14. package/dist/chunk-B18OPIu_.js.map +1 -0
  15. package/dist/chunk-B5Uz3Qct.cjs +15 -0
  16. package/dist/chunk-B5Uz3Qct.cjs.map +1 -0
  17. package/dist/chunk-BBEJwkd3.d.cts +839 -0
  18. package/dist/chunk-BIEc_SkR.cjs +29 -0
  19. package/dist/chunk-BIEc_SkR.cjs.map +1 -0
  20. package/dist/chunk-BKMFOe-N.js +171 -0
  21. package/dist/chunk-BKMFOe-N.js.map +1 -0
  22. package/dist/chunk-BP4uy7E1.d.ts +11583 -0
  23. package/dist/chunk-BSHTsFiB.js +1403 -0
  24. package/dist/chunk-BSHTsFiB.js.map +1 -0
  25. package/dist/chunk-BTUUABGI.js +17 -0
  26. package/dist/chunk-BTUUABGI.js.map +1 -0
  27. package/dist/chunk-BaPiaz5X.cjs +115 -0
  28. package/dist/chunk-BaPiaz5X.cjs.map +1 -0
  29. package/dist/chunk-BeCVpkYr.cjs +542 -0
  30. package/dist/chunk-BeCVpkYr.cjs.map +1 -0
  31. package/dist/chunk-BgngsvK8.cjs +6202 -0
  32. package/dist/chunk-BgngsvK8.cjs.map +1 -0
  33. package/dist/chunk-BhInd7CJ.d.cts +253 -0
  34. package/dist/chunk-Bn6ZbxkS.cjs +27 -0
  35. package/dist/chunk-By9ZnkVI.js +60 -0
  36. package/dist/chunk-By9ZnkVI.js.map +1 -0
  37. package/dist/chunk-BzqPhxsz.cjs +367 -0
  38. package/dist/chunk-BzqPhxsz.cjs.map +1 -0
  39. package/dist/chunk-C2mMX81q.d.ts +443 -0
  40. package/dist/chunk-C2rr9Q0V.cjs +1402 -0
  41. package/dist/chunk-C2rr9Q0V.cjs.map +1 -0
  42. package/dist/chunk-CDJCbwIQ.d.cts +78 -0
  43. package/dist/chunk-CLGvBOVH.d.cts +1654 -0
  44. package/dist/chunk-COdw1dc6.d.ts +525 -0
  45. package/dist/chunk-CQCJnT2i.d.ts +511 -0
  46. package/dist/chunk-CSyHY67q.cjs +353 -0
  47. package/dist/chunk-CSyHY67q.cjs.map +1 -0
  48. package/dist/chunk-CiK1Iqrv.js +950 -0
  49. package/dist/chunk-CiK1Iqrv.js.map +1 -0
  50. package/dist/chunk-CmJBgSwZ.cjs +24 -0
  51. package/dist/chunk-CmJBgSwZ.cjs.map +1 -0
  52. package/dist/chunk-CnrsRK2u.cjs +83 -0
  53. package/dist/chunk-CnrsRK2u.cjs.map +1 -0
  54. package/dist/chunk-Co782_9r.js +326 -0
  55. package/dist/chunk-Co782_9r.js.map +1 -0
  56. package/dist/chunk-Csr3KDpZ.cjs +32 -0
  57. package/dist/chunk-Csr3KDpZ.cjs.map +1 -0
  58. package/dist/chunk-CwkmccXv.js +89 -0
  59. package/dist/chunk-CwkmccXv.js.map +1 -0
  60. package/dist/chunk-D0Q4iL9B.cjs +255 -0
  61. package/dist/chunk-D0Q4iL9B.cjs.map +1 -0
  62. package/dist/chunk-DFwiSzUS.cjs +72 -0
  63. package/dist/chunk-DFwiSzUS.cjs.map +1 -0
  64. package/dist/chunk-DIFayl2P.d.cts +443 -0
  65. package/dist/chunk-DIGF58ux.d.cts +525 -0
  66. package/dist/chunk-DKuuuld5.js +101 -0
  67. package/dist/chunk-DKuuuld5.js.map +1 -0
  68. package/dist/chunk-DMePkFEo.js +5054 -0
  69. package/dist/chunk-DMePkFEo.js.map +1 -0
  70. package/dist/chunk-DO5SIBgu.js +305 -0
  71. package/dist/chunk-DO5SIBgu.js.map +1 -0
  72. package/dist/chunk-DOQ_7eE5.d.ts +6662 -0
  73. package/dist/chunk-DThaaNeb.d.cts +15 -0
  74. package/dist/chunk-DThaaNeb.d.ts +15 -0
  75. package/dist/chunk-DUQzjUJy.d.ts +78 -0
  76. package/dist/chunk-DX37IPhV.cjs +1903 -0
  77. package/dist/chunk-DX37IPhV.cjs.map +1 -0
  78. package/dist/chunk-Damps5Tk.cjs +155 -0
  79. package/dist/chunk-Damps5Tk.cjs.map +1 -0
  80. package/dist/chunk-DbK5PhpJ.d.ts +1654 -0
  81. package/dist/chunk-De0vAASv.d.ts +253 -0
  82. package/dist/chunk-DhSZ7YZt.d.cts +6662 -0
  83. package/dist/chunk-DjEvqvPA.cjs +43 -0
  84. package/dist/chunk-DjEvqvPA.cjs.map +1 -0
  85. package/dist/chunk-DkwDzwvu.d.cts +121 -0
  86. package/dist/chunk-DkwDzwvu.d.ts +121 -0
  87. package/dist/chunk-Dmszv9If.js +71 -0
  88. package/dist/chunk-Dmszv9If.js.map +1 -0
  89. package/dist/chunk-Dp_ftNWY.d.cts +511 -0
  90. package/dist/chunk-DsHQySz0.js +31 -0
  91. package/dist/chunk-DsHQySz0.js.map +1 -0
  92. package/dist/chunk-DwoUyHHh.js +281 -0
  93. package/dist/chunk-DwoUyHHh.js.map +1 -0
  94. package/dist/chunk-IaIDQflj.d.cts +2315 -0
  95. package/dist/chunk-IaIDQflj.d.ts +2315 -0
  96. package/dist/chunk-cVXLsZfL.d.ts +839 -0
  97. package/dist/chunk-mIaCX9EJ.d.cts +11583 -0
  98. package/dist/chunk-nJQxbOwQ.cjs +8962 -0
  99. package/dist/chunk-nJQxbOwQ.cjs.map +1 -0
  100. package/dist/chunk-o9jaxhCO.js +8852 -0
  101. package/dist/chunk-o9jaxhCO.js.map +1 -0
  102. package/dist/chunk-p-Tt_Lwz.js +14 -0
  103. package/dist/chunk-p-Tt_Lwz.js.map +1 -0
  104. package/dist/engines/index.cjs +2091 -0
  105. package/dist/engines/index.cjs.map +1 -0
  106. package/dist/engines/index.d.cts +2176 -0
  107. package/dist/engines/index.d.ts +2176 -0
  108. package/dist/engines/index.js +2075 -0
  109. package/dist/engines/index.js.map +1 -0
  110. package/dist/handlers/index.cjs +53 -0
  111. package/dist/handlers/index.cjs.map +1 -0
  112. package/dist/handlers/index.d.cts +403 -0
  113. package/dist/handlers/index.d.ts +403 -0
  114. package/dist/handlers/index.js +33 -0
  115. package/dist/handlers/index.js.map +1 -0
  116. package/dist/index.cjs +3511 -0
  117. package/dist/index.cjs.map +1 -0
  118. package/dist/index.d.cts +8 -0
  119. package/dist/index.d.ts +8 -0
  120. package/dist/index.js +3033 -0
  121. package/dist/index.js.map +1 -0
  122. package/dist/plugins/index.cjs +510 -0
  123. package/dist/plugins/index.cjs.map +1 -0
  124. package/dist/plugins/index.d.cts +296 -0
  125. package/dist/plugins/index.d.ts +296 -0
  126. package/dist/plugins/index.js +489 -0
  127. package/dist/plugins/index.js.map +1 -0
  128. package/dist/seams/index.cjs +89 -0
  129. package/dist/seams/index.cjs.map +1 -0
  130. package/dist/seams/index.d.cts +452 -0
  131. package/dist/seams/index.d.ts +452 -0
  132. package/dist/seams/index.js +49 -0
  133. package/dist/seams/index.js.map +1 -0
  134. package/dist/strings/fr/index.cjs +2135 -0
  135. package/dist/strings/fr/index.cjs.map +1 -0
  136. package/dist/strings/fr/index.d.cts +17 -0
  137. package/dist/strings/fr/index.d.ts +17 -0
  138. package/dist/strings/fr/index.js +2130 -0
  139. package/dist/strings/fr/index.js.map +1 -0
  140. package/dist/strings/index.cjs +2384 -0
  141. package/dist/strings/index.cjs.map +1 -0
  142. package/dist/strings/index.d.cts +3 -0
  143. package/dist/strings/index.d.ts +3 -0
  144. package/dist/strings/index.js +2353 -0
  145. package/dist/strings/index.js.map +1 -0
  146. package/dist/testing/index.cjs +230 -0
  147. package/dist/testing/index.cjs.map +1 -0
  148. package/dist/testing/index.d.cts +246 -0
  149. package/dist/testing/index.d.ts +246 -0
  150. package/dist/testing/index.js +219 -0
  151. package/dist/testing/index.js.map +1 -0
  152. package/dist/time/index.cjs +28 -0
  153. package/dist/time/index.cjs.map +1 -0
  154. package/dist/time/index.d.cts +41 -0
  155. package/dist/time/index.d.ts +41 -0
  156. package/dist/time/index.js +23 -0
  157. package/dist/time/index.js.map +1 -0
  158. package/package.json +224 -4
  159. package/src/agent/engines/agentThreads.ts +1601 -0
  160. package/src/agent/engines/directorChat.ts +500 -0
  161. package/src/agent/index.ts +67 -0
  162. package/src/agent/rules/agentEditLock.ts +115 -0
  163. package/src/agent/rules/agentErrorCopy.ts +44 -0
  164. package/src/agent/rules/copilotOrganization.ts +36 -0
  165. package/src/agent/rules/playbook.gen.ts +444 -0
  166. package/src/agent/rules/router.ts +518 -0
  167. package/src/agent/rules/stateDelta.ts +29 -0
  168. package/src/agent/rules/studioRouter.ts +123 -0
  169. package/src/agent/rules/surfaces.gen.ts +633 -0
  170. package/src/agent/rules/threadsUrl.ts +48 -0
  171. package/src/agent/rules/transcriptObserver.ts +90 -0
  172. package/src/agent/stores/agentThreads.ts +451 -0
  173. package/src/bus/contracts/noData.ts +18 -0
  174. package/src/bus/contracts/shared.ts +172 -0
  175. package/src/bus/contracts/studioTools.ts +224 -0
  176. package/src/bus/rules/bus.ts +857 -0
  177. package/src/bus/rules/confirmation.ts +22 -0
  178. package/src/bus/rules/defineRegistry.ts +24 -0
  179. package/src/bus/rules/errors.ts +401 -0
  180. package/src/bus/rules/handlerErrors.ts +103 -0
  181. package/src/bus/rules/handlerRegistry.ts +627 -0
  182. package/src/bus/rules/inputSchema.ts +232 -0
  183. package/src/bus/rules/invalidInput.ts +441 -0
  184. package/src/bus/rules/lateBoundTools.ts +100 -0
  185. package/src/bus/rules/studioRegistry.ts +324 -0
  186. package/src/bus/rules/studioToolBus.ts +73 -0
  187. package/src/bus/rules/types.ts +804 -0
  188. package/src/chrome/contracts/alert.ts +42 -0
  189. package/src/chrome/contracts/itinerary.ts +26 -0
  190. package/src/chrome/contracts/map.ts +23 -0
  191. package/src/chrome/contracts/overlay.ts +46 -0
  192. package/src/chrome/contracts/panel.ts +29 -0
  193. package/src/chrome/contracts/question.ts +52 -0
  194. package/src/chrome/contracts/selection.ts +26 -0
  195. package/src/chrome/contracts/sidenav.ts +23 -0
  196. package/src/chrome/contracts/snapshot.ts +319 -0
  197. package/src/chrome/contracts/state.ts +22 -0
  198. package/src/chrome/contracts/tabs.ts +56 -0
  199. package/src/chrome/handlers/alert.ts +91 -0
  200. package/src/chrome/handlers/introspection.ts +180 -0
  201. package/src/chrome/handlers/panels.ts +42 -0
  202. package/src/chrome/handlers/question.ts +24 -0
  203. package/src/chrome/handlers/sidenav.ts +116 -0
  204. package/src/chrome/handlers/snapshot.ts +451 -0
  205. package/src/chrome/handlers/stateDelta.ts +125 -0
  206. package/src/chrome/handlers/tabs.ts +143 -0
  207. package/src/chrome/handlers/timestamp.ts +19 -0
  208. package/src/chrome/rules/agentSelectors.ts +210 -0
  209. package/src/chrome/rules/mapAlert.ts +13 -0
  210. package/src/chrome/rules/question.ts +25 -0
  211. package/src/chrome/rules/tabs.ts +13 -0
  212. package/src/chrome/stores/activeDraftSession.ts +134 -0
  213. package/src/chrome/stores/chrome.ts +527 -0
  214. package/src/chrome/stores/uiStore.ts +575 -0
  215. package/src/collab/contracts/collab.ts +261 -0
  216. package/src/collab/handlers/collab.ts +468 -0
  217. package/src/collab/rules/toolNames.ts +33 -0
  218. package/src/collab/stores/collab.ts +899 -0
  219. package/src/collections/contracts/collection.ts +182 -0
  220. package/src/collections/handlers/collectionAttach.ts +141 -0
  221. package/src/collections/handlers/collections.ts +499 -0
  222. package/src/collections/handlers/heldCollection.ts +42 -0
  223. package/src/collections/handlers/restCollections.ts +386 -0
  224. package/src/collections/rules/collections.ts +138 -0
  225. package/src/collections/rules/entityCollections.ts +53 -0
  226. package/src/collections/stores/collections.ts +133 -0
  227. package/src/data/contracts/data.ts +233 -0
  228. package/src/data/contracts/itinerary.ts +71 -0
  229. package/src/data/handlers/activityResolve.ts +76 -0
  230. package/src/data/handlers/data.ts +200 -0
  231. package/src/data/handlers/graphql.ts +26 -0
  232. package/src/data/handlers/mutationSink.ts +1577 -0
  233. package/src/data/handlers/profile.ts +83 -0
  234. package/src/data/handlers/writeThrough.ts +417 -0
  235. package/src/data/rules/cache.ts +181 -0
  236. package/src/data/rules/dataTypes.ts +40 -0
  237. package/src/data/rules/keys.ts +106 -0
  238. package/src/data/rules/persistence.ts +1058 -0
  239. package/src/data/rules/requestBody.ts +43 -0
  240. package/src/data/rules/restErrors.ts +354 -0
  241. package/src/data/rules/sessionSurface.ts +156 -0
  242. package/src/data/rules/toolResultData.ts +73 -0
  243. package/src/data/rules/uuid.ts +24 -0
  244. package/src/edit/contracts/edit.ts +37 -0
  245. package/src/edit/contracts/itinerary.ts +57 -0
  246. package/src/edit/handlers/draftCommit.ts +257 -0
  247. package/src/edit/handlers/editDiscard.ts +34 -0
  248. package/src/edit/handlers/editLock.ts +949 -0
  249. package/src/edit/handlers/editor.ts +203 -0
  250. package/src/edit/handlers/formUnsaved.ts +24 -0
  251. package/src/edit/rules/draftMetadata.ts +117 -0
  252. package/src/edit/rules/editKeyboard.ts +222 -0
  253. package/src/edit/rules/editShortcuts.ts +102 -0
  254. package/src/edit/rules/editTooltip.ts +174 -0
  255. package/src/edit/rules/editorTaken.ts +49 -0
  256. package/src/edit/rules/history.ts +26 -0
  257. package/src/edit/rules/unsavedWork.ts +60 -0
  258. package/src/edit/stores/editorReservation.ts +70 -0
  259. package/src/edit/stores/formsUnsaved.ts +54 -0
  260. package/src/embed/contracts/embed.ts +48 -0
  261. package/src/embed/engines/embedFraming.ts +1329 -0
  262. package/src/embed/engines/embedReady.ts +353 -0
  263. package/src/embed/engines/framingPageSession.ts +169 -0
  264. package/src/embed/handlers/embed.ts +130 -0
  265. package/src/embed/rules/allowedDomains.ts +71 -0
  266. package/src/embed/rules/bridgeMessages.ts +224 -0
  267. package/src/embed/rules/defaults.ts +173 -0
  268. package/src/embed/rules/displaySeed.ts +115 -0
  269. package/src/embed/rules/embedAllowlist.ts +146 -0
  270. package/src/embed/rules/embedConstraints.ts +215 -0
  271. package/src/embed/rules/embedElements.ts +277 -0
  272. package/src/embed/rules/embedSectionFields.ts +126 -0
  273. package/src/embed/rules/embedSecurity.ts +116 -0
  274. package/src/embed/rules/fieldDependencies.ts +89 -0
  275. package/src/embed/rules/fieldOptions.ts +138 -0
  276. package/src/embed/rules/layerOptions.ts +161 -0
  277. package/src/embed/rules/readyProtocol.ts +66 -0
  278. package/src/embed/rules/safetyRules.ts +215 -0
  279. package/src/embed/rules/snippet.ts +531 -0
  280. package/src/embed/rules/tableCode.ts +270 -0
  281. package/src/embed/stores/embed.ts +60 -0
  282. package/src/embed/stores/embedContent.ts +77 -0
  283. package/src/engines/index.ts +81 -0
  284. package/src/handlers/index.ts +66 -0
  285. package/src/index.ts +1065 -0
  286. package/src/itinerary/contracts/itinerary.ts +705 -0
  287. package/src/itinerary/engines/itineraryPace.ts +612 -0
  288. package/src/itinerary/engines/profileMarker.ts +238 -0
  289. package/src/itinerary/handlers/importStaging.ts +352 -0
  290. package/src/itinerary/handlers/itinerary.ts +572 -0
  291. package/src/itinerary/handlers/itineraryDuplicate.ts +177 -0
  292. package/src/itinerary/handlers/itineraryExport.ts +117 -0
  293. package/src/itinerary/handlers/itineraryImport.ts +783 -0
  294. package/src/itinerary/handlers/itineraryPublish.ts +118 -0
  295. package/src/itinerary/handlers/itinerarySelection.ts +354 -0
  296. package/src/itinerary/handlers/itinerarySuggest.ts +1186 -0
  297. package/src/itinerary/handlers/itineraryUnpublish.ts +101 -0
  298. package/src/itinerary/handlers/publicationScope.ts +118 -0
  299. package/src/itinerary/handlers/restItineraries.ts +752 -0
  300. package/src/itinerary/handlers/restItineraryExport.ts +70 -0
  301. package/src/itinerary/handlers/restItineraryImport.ts +311 -0
  302. package/src/itinerary/handlers/restItineraryPace.ts +87 -0
  303. package/src/itinerary/handlers/restItineraryRecord.ts +36 -0
  304. package/src/itinerary/handlers/suggestParams.ts +379 -0
  305. package/src/itinerary/handlers/suggestStaging.ts +363 -0
  306. package/src/itinerary/handlers/surfaceOpen.ts +389 -0
  307. package/src/itinerary/rules/activity.ts +139 -0
  308. package/src/itinerary/rules/analysis.ts +42 -0
  309. package/src/itinerary/rules/ceiling.ts +49 -0
  310. package/src/itinerary/rules/createFlow.ts +107 -0
  311. package/src/itinerary/rules/densify.ts +440 -0
  312. package/src/itinerary/rules/draftSurface.ts +219 -0
  313. package/src/itinerary/rules/editorView.ts +83 -0
  314. package/src/itinerary/rules/export.ts +159 -0
  315. package/src/itinerary/rules/friendlyName.ts +77 -0
  316. package/src/itinerary/rules/import.ts +1050 -0
  317. package/src/itinerary/rules/importFiles.ts +140 -0
  318. package/src/itinerary/rules/importTotals.ts +77 -0
  319. package/src/itinerary/rules/liveSegment.ts +712 -0
  320. package/src/itinerary/rules/lngLat.ts +17 -0
  321. package/src/itinerary/rules/mapSync.ts +100 -0
  322. package/src/itinerary/rules/previewRender.ts +416 -0
  323. package/src/itinerary/rules/profileReadout.ts +216 -0
  324. package/src/itinerary/rules/routing.ts +707 -0
  325. package/src/itinerary/rules/suggest.ts +522 -0
  326. package/src/itinerary/rules/suggestionPreview.ts +119 -0
  327. package/src/itinerary/rules/view.ts +61 -0
  328. package/src/itinerary/stores/importSession.ts +319 -0
  329. package/src/itinerary/stores/itinerary.ts +331 -0
  330. package/src/itinerary/stores/itineraryDuplicate.ts +76 -0
  331. package/src/itinerary/stores/sessionIdentity.ts +43 -0
  332. package/src/itinerary/stores/suggestSession.ts +418 -0
  333. package/src/layers/contracts/itinerary.ts +46 -0
  334. package/src/layers/contracts/overlay.ts +132 -0
  335. package/src/layers/handlers/enrichment.ts +36 -0
  336. package/src/layers/handlers/overlay.ts +406 -0
  337. package/src/layers/handlers/restLayers.ts +94 -0
  338. package/src/layers/handlers/tiles.ts +25 -0
  339. package/src/layers/rules/layers.ts +212 -0
  340. package/src/layers/rules/overlayInstant.ts +12 -0
  341. package/src/layers/rules/reachabilityIcon.ts +18 -0
  342. package/src/layers/rules/readout.ts +102 -0
  343. package/src/layers/stores/layers.ts +262 -0
  344. package/src/map/contracts/contextmenu.ts +33 -0
  345. package/src/map/contracts/geolocate.ts +37 -0
  346. package/src/map/contracts/map.ts +146 -0
  347. package/src/map/contracts/streetview.ts +53 -0
  348. package/src/map/contracts/terrain.ts +152 -0
  349. package/src/map/handlers/contextMenu.ts +135 -0
  350. package/src/map/handlers/geolocate.ts +52 -0
  351. package/src/map/handlers/map.ts +391 -0
  352. package/src/map/handlers/streetview.ts +94 -0
  353. package/src/map/handlers/terrain.ts +663 -0
  354. package/src/map/rules/baseTerrain.ts +75 -0
  355. package/src/map/rules/clickTargets.ts +464 -0
  356. package/src/map/rules/constraints.ts +32 -0
  357. package/src/map/rules/contextMenuReadout.ts +67 -0
  358. package/src/map/rules/coordinates.ts +71 -0
  359. package/src/map/rules/itineraryFit.ts +8 -0
  360. package/src/map/rules/mapEvents.ts +64 -0
  361. package/src/map/rules/mapProjection.ts +476 -0
  362. package/src/map/rules/terrainReading.ts +62 -0
  363. package/src/plugins/contracts/ids.ts +66 -0
  364. package/src/plugins/contracts/plugin.ts +202 -0
  365. package/src/plugins/contracts/slots.ts +137 -0
  366. package/src/plugins/engines/studioPlugin.ts +1365 -0
  367. package/src/plugins/index.ts +111 -0
  368. package/src/plugins/rules/contributions.ts +152 -0
  369. package/src/plugins/rules/errors.ts +60 -0
  370. package/src/plugins/rules/ids.ts +42 -0
  371. package/src/plugins/rules/validation.ts +249 -0
  372. package/src/rules/listeners.ts +57 -0
  373. package/src/rules/origin.ts +13 -0
  374. package/src/rules/storeWrite.ts +37 -0
  375. package/src/rules/types.ts +136 -0
  376. package/src/seams/index.ts +79 -0
  377. package/src/seams/rules/clock.ts +28 -0
  378. package/src/seams/rules/formatters.ts +211 -0
  379. package/src/seams/rules/ids.ts +102 -0
  380. package/src/seams/rules/links.ts +66 -0
  381. package/src/seams/rules/navigation.ts +222 -0
  382. package/src/seams/rules/notify.ts +49 -0
  383. package/src/seams/rules/persistenceDrawer.ts +220 -0
  384. package/src/seams/rules/saveFile.ts +101 -0
  385. package/src/seams/rules/seams.ts +156 -0
  386. package/src/seams/rules/storage.ts +116 -0
  387. package/src/search/contracts/overlay.ts +74 -0
  388. package/src/search/contracts/search.ts +197 -0
  389. package/src/search/handlers/pois.ts +57 -0
  390. package/src/search/handlers/search.ts +280 -0
  391. package/src/search/rules/params.ts +925 -0
  392. package/src/search/rules/poiGroups.ts +138 -0
  393. package/src/search/rules/searchFetch.ts +139 -0
  394. package/src/search/rules/timeWindow.ts +30 -0
  395. package/src/search/stores/search.ts +51 -0
  396. package/src/segments/contracts/itinerary.ts +433 -0
  397. package/src/segments/contracts/segment.ts +35 -0
  398. package/src/segments/engines/segmentDraft.ts +926 -0
  399. package/src/segments/handlers/chainGuards.ts +67 -0
  400. package/src/segments/handlers/directions.ts +44 -0
  401. package/src/segments/handlers/itineraryEcho.ts +45 -0
  402. package/src/segments/handlers/roadAccessDialog.ts +34 -0
  403. package/src/segments/handlers/segment.ts +111 -0
  404. package/src/segments/handlers/segmentEdit.ts +1341 -0
  405. package/src/segments/handlers/segmentGroups.ts +347 -0
  406. package/src/segments/handlers/segmentStructure.ts +1144 -0
  407. package/src/segments/rules/chain.ts +196 -0
  408. package/src/segments/rules/chainModel.ts +217 -0
  409. package/src/segments/rules/colors.ts +11 -0
  410. package/src/segments/rules/commit.ts +76 -0
  411. package/src/segments/rules/draft.ts +90 -0
  412. package/src/segments/rules/draftDisposition.ts +43 -0
  413. package/src/segments/rules/draftSegmentEdit.ts +129 -0
  414. package/src/segments/rules/engine.ts +222 -0
  415. package/src/segments/rules/groupSave.ts +234 -0
  416. package/src/segments/rules/hazardPrompt.ts +60 -0
  417. package/src/segments/rules/itineraryEcho.ts +40 -0
  418. package/src/segments/rules/liveSegmentProjection.ts +55 -0
  419. package/src/segments/rules/merge.ts +51 -0
  420. package/src/segments/rules/metrics.ts +456 -0
  421. package/src/segments/rules/naming.ts +168 -0
  422. package/src/segments/rules/segmentArming.ts +144 -0
  423. package/src/segments/rules/splitPick.ts +84 -0
  424. package/src/segments/rules/viaSimplify.ts +230 -0
  425. package/src/segments/stores/directions.ts +77 -0
  426. package/src/segments/stores/roadAccessDialog.ts +58 -0
  427. package/src/segments/stores/segmentEdit.ts +922 -0
  428. package/src/segments/stores/segmentGroupEdit.ts +84 -0
  429. package/src/segments/stores/segmentSplit.ts +77 -0
  430. package/src/share/contracts/share.ts +39 -0
  431. package/src/share/contracts/shareLink.ts +63 -0
  432. package/src/share/engines/shareLink.ts +1053 -0
  433. package/src/share/handlers/share.ts +47 -0
  434. package/src/share/handlers/shareLink.ts +231 -0
  435. package/src/share/handlers/shareScope.ts +54 -0
  436. package/src/share/rules/link.ts +89 -0
  437. package/src/share/rules/shareLink.ts +218 -0
  438. package/src/share/rules/targets.ts +92 -0
  439. package/src/share/rules/viewConfig.ts +95 -0
  440. package/src/share/stores/share.ts +58 -0
  441. package/src/strings/fr/index.ts +18 -0
  442. package/src/strings/fr/rules/fr.ts +2368 -0
  443. package/src/strings/index.ts +98 -0
  444. package/src/strings/rules/confirmCopy.ts +156 -0
  445. package/src/strings/rules/draftToolNames.ts +94 -0
  446. package/src/strings/rules/en.ts +2519 -0
  447. package/src/strings/rules/failureAlert.ts +115 -0
  448. package/src/strings/rules/formError.ts +400 -0
  449. package/src/strings/rules/maneuvers.ts +107 -0
  450. package/src/strings/rules/outputOptions.ts +126 -0
  451. package/src/strings/rules/publicationState.ts +100 -0
  452. package/src/strings/rules/routeHazardCopy.ts +62 -0
  453. package/src/strings/rules/searchLabels.ts +50 -0
  454. package/src/strings/rules/segmentChainVerbs.ts +62 -0
  455. package/src/strings/rules/studioCopy.ts +130 -0
  456. package/src/strings/rules/unitOptions.ts +119 -0
  457. package/src/testing/checkedBus.ts +226 -0
  458. package/src/testing/index.ts +30 -0
  459. package/src/testing/plugins.ts +106 -0
  460. package/src/testing/studio.ts +267 -0
  461. package/src/testing/urlSeam.ts +153 -0
  462. package/src/time/index.ts +12 -0
  463. package/src/time/rules/sun.ts +78 -0
  464. package/src/video/contracts/cameraSchemas.ts +266 -0
  465. package/src/video/contracts/profileSchemas.ts +37 -0
  466. package/src/video/contracts/video.ts +601 -0
  467. package/src/video/handlers/video.ts +1638 -0
  468. package/src/video/handlers/videoDirector.ts +114 -0
  469. package/src/video/rules/previewRefresh.ts +76 -0
  470. package/src/video/rules/profileSource.ts +51 -0
  471. package/src/video/rules/routeSpans.ts +79 -0
  472. package/src/video/rules/shotDefaults.ts +28 -0
  473. package/src/video/rules/stepOrder.ts +17 -0
  474. package/src/video/rules/videoSnapshot.ts +136 -0
  475. package/src/video/stores/directorThreads.ts +167 -0
  476. package/src/video/stores/videoExport.ts +290 -0
  477. package/src/viewer/contracts/preferences.ts +40 -0
  478. package/src/viewer/handlers/preferences.ts +91 -0
  479. package/src/viewer/rules/capabilities.ts +42 -0
  480. package/src/viewer/rules/config.ts +266 -0
  481. package/src/viewer/rules/context.ts +375 -0
  482. package/src/viewer/rules/ownership.ts +134 -0
  483. package/src/viewer/rules/platformViewer.ts +199 -0
  484. package/src/viewer/rules/scope.ts +197 -0
  485. package/src/viewer/rules/url.ts +145 -0
  486. package/src/viewer/rules/viewer.ts +307 -0
  487. package/src/viewer/rules/viewerSeam.ts +49 -0
  488. package/src/viewer/rules/viewerUnits.ts +34 -0
  489. package/src/waypoints/contracts/itinerary.ts +417 -0
  490. package/src/waypoints/handlers/poiWaypointStyle.ts +32 -0
  491. package/src/waypoints/handlers/waypointDetailsDialog.ts +38 -0
  492. package/src/waypoints/handlers/waypointEdit.ts +1073 -0
  493. package/src/waypoints/rules/amenities.ts +30 -0
  494. package/src/waypoints/rules/defaults.ts +31 -0
  495. package/src/waypoints/rules/details.ts +213 -0
  496. package/src/waypoints/rules/detailsDraft.ts +312 -0
  497. package/src/waypoints/rules/detailsPreview.ts +76 -0
  498. package/src/waypoints/rules/detailsSave.ts +356 -0
  499. package/src/waypoints/rules/draftDirty.ts +45 -0
  500. package/src/waypoints/rules/icons.ts +32 -0
  501. package/src/waypoints/rules/liveWaypoint.ts +63 -0
  502. package/src/waypoints/rules/naming.ts +185 -0
  503. package/src/waypoints/rules/sections.ts +77 -0
  504. package/src/waypoints/rules/waypointDraft.ts +62 -0
  505. package/src/waypoints/stores/waypointDetails.ts +62 -0
  506. package/src/waypoints/stores/waypointEdit.ts +566 -0
  507. package/src/zones/contracts/collection.ts +37 -0
  508. package/src/zones/contracts/zone.ts +528 -0
  509. package/src/zones/engines/zoneForm.ts +1773 -0
  510. package/src/zones/handlers/restZones.ts +287 -0
  511. package/src/zones/handlers/zonePublish.ts +206 -0
  512. package/src/zones/handlers/zoneUnpublish.ts +56 -0
  513. package/src/zones/handlers/zones.ts +2254 -0
  514. package/src/zones/rules/geometry.ts +946 -0
  515. package/src/zones/rules/zoneDefaults.ts +34 -0
  516. package/src/zones/rules/zoneDraft.ts +54 -0
  517. package/src/zones/rules/zoneForm.ts +563 -0
  518. package/src/zones/rules/zoneMetadata.ts +29 -0
  519. package/src/zones/rules/zoneSource.ts +87 -0
  520. package/src/zones/rules/zoneSourceRefusal.ts +104 -0
  521. package/src/zones/stores/zoneEdit.ts +998 -0
@@ -0,0 +1,1237 @@
1
+ import { U as UiState, a as StudioToolContext, io as StudioToolInputs } from "../chunk-mIaCX9EJ.cjs";
2
+ import { t as ToolBus } from "../chunk-Dp_ftNWY.cjs";
3
+ import { Bt as TabSurface } from "../chunk-CLGvBOVH.cjs";
4
+ import { a as StudioIds } from "../chunk-DkwDzwvu.cjs";
5
+ import { t as StudioStrings } from "../chunk-IaIDQflj.cjs";
6
+ import { t as SEARCH_TAB_ID } from "../chunk-DThaaNeb.cjs";
7
+ import { i as VideoDirectorStoreApi, n as VideoDirectorState } from "../chunk-CDJCbwIQ.cjs";
8
+ import { AgentTransport } from "@mountaya/client/events";
9
+ import { AgentEngineState, AgentErrorCopy, ConversationState, PendingConfirmation, QuestionOption, SuggestionCardCandidate, ToolActivityOutcome, ToolDispatcher, TranscriptEntry } from "@mountaya/elements/agent";
10
+ /**
11
+ * RouterState is the slice of the studio snapshot the router reads. It is
12
+ * deliberately narrow and structural rather than the whole snapshot: the router
13
+ * is a pure function, and a wide input would let it drift into depending on
14
+ * things that have nothing to do with which tools a task needs.
15
+ *
16
+ * Every field is here because a surface lock of the compiled tables reads it, which
17
+ * its suite asserts both ways: a lock naming a field this interface does not carry
18
+ * fails to compile in lockHolds, and a field no lock reads is a slice the router
19
+ * pays to assemble and never consults.
20
+ */
21
+ interface RouterState {
22
+ /** The kind of edit session currently armed, if any. */
23
+ editSession?: "segment" | "waypoint" | "zone" | null | undefined;
24
+ /** Whether an import draft is open. */
25
+ importDraft?: boolean | undefined;
26
+ /**
27
+ * The kind of resource the editor currently holds open, if any. It is distinct
28
+ * from `editSession`, which reports only an ARMED geometry engine: a computed
29
+ * zone is open without arming one (reshaping it by hand would replace the query
30
+ * it is generated from), so a run about the zone the user is looking at has no
31
+ * armed session to be recognised by.
32
+ */
33
+ openResource?: "itinerary" | "zone" | null | undefined;
34
+ /** Whether a route-suggestion draft is open. */
35
+ suggestDraft?: boolean | undefined;
36
+ /** Whether the video wizard is open. */
37
+ videoOpen?: boolean | undefined;
38
+ }
39
+ /**
40
+ * RouterDecision is the routed surface set plus why it was chosen. The reason is
41
+ * not decoration: a misroute is otherwise invisible, and recording which signal
42
+ * fired is what makes the router's accuracy measurable once telemetry carries
43
+ * the surfaces a run actually used.
44
+ */
45
+ interface RouterDecision {
46
+ reason: "lock" | "skill" | "intent" | "sticky" | "wide";
47
+ surfaces: readonly string[];
48
+ }
49
+ /**
50
+ * recoveryFor returns what to do about a specific failure of a specific tool, or undefined when
51
+ * the playbook has nothing for that pair.
52
+ */
53
+ export declare const recoveryFor: (tool: string, code: string | undefined) => string | undefined;
54
+ /** selectSurfaces chooses the surfaces a turn's manifest is built from. */
55
+ export declare const selectSurfaces: (message: string, state?: RouterState, previous?: readonly string[]) => RouterDecision;
56
+ /** surfaceTools resolves a surface set to the tool names it permits. */
57
+ export declare const surfaceTools: (surfaces: readonly string[]) => ReadonlySet<string>;
58
+ /**
59
+ * RecoveryAddendum is a host's own remedy for a failed call, which the model reads after the
60
+ * playbook's recovery for that call.
61
+ *
62
+ * The playbook ships with the studio and states what any host's model can do about a failure:
63
+ * stop, report it, change the arguments. What a reader can do about it in one product, such as
64
+ * where a scope that holds the feature is or which settings page adds what is missing, is that
65
+ * product's to say, and this is where it says it.
66
+ *
67
+ * It is asked for every failed call that carries a code, with the tool's name and the code, and
68
+ * answers the sentence to append or undefined for none. A blank answer appends nothing, and a
69
+ * throw appends nothing and reaches the program as an uncaught error on a microtask, so the
70
+ * model still reads the playbook's recovery.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * import type { RecoveryAddendum } from "@mountaya/studio/agent";
75
+ *
76
+ * const recoveryAddendum: RecoveryAddendum = (_tool, code) =>
77
+ * code === "upgrade-required"
78
+ * ? "Offer the organizations listed on the account page, which include this feature."
79
+ * : undefined;
80
+ * ```
81
+ */
82
+ type RecoveryAddendum = (tool: string, code: string) => string | undefined;
83
+ /**
84
+ * The co-pilot's slice of the URL: which conversations are open, and which run each one waits
85
+ * on.
86
+ *
87
+ * Declared beside the engine that reads it rather than beside a React provider, because the
88
+ * seam is what a host answers and {@link AgentThreadsEngine} is what asks: a host that binds the
89
+ * co-pilot to a router of its own, or drives the engine from a surface of its own, names both
90
+ * types without installing a framework binding.
91
+ */
92
+ /**
93
+ * AgentThreadMirror is one in-flight conversation as a URL carries it: which thread, and which
94
+ * run it is waiting on.
95
+ */
96
+ interface AgentThreadMirror {
97
+ id: string;
98
+ runId: string | null;
99
+ }
100
+ /**
101
+ * AgentThreadsUrlSeam is how a host lets the co-pilot survive a reload.
102
+ *
103
+ * Two members and no router, for the reason {@link StudioUrlSeam} gives: a surface that mirrors
104
+ * state would otherwise have to know a route tree, a path and a search schema by name, and none
105
+ * of those are its own. `readOnce` is the init source, read once when the engine is constructed
106
+ * and never subscribed: the seed creates each thread once, and a subscribing read would create
107
+ * it again every time the mirror it just wrote came back. `write` mirrors the current set.
108
+ *
109
+ * A host may hand `readOnce` what its URL spelled, unbounded and unchecked. The engine restores
110
+ * at most `MAX_OPEN_COPILOT_TABS` threads from it, none under a pseudo-tab's id (`SEARCH_TAB_ID`,
111
+ * `WITHHELD_TAB_ID`), and none for a viewer withheld the co-pilot. It skips an entry that is no
112
+ * thread, restores nothing from a `threads` that is no list, and throws on neither.
113
+ *
114
+ * It is a seam of its own rather than a widening of {@link MirroredSearch}, and that is a
115
+ * decision about who the studio is for: the mirrored values there are scalars every studio wants
116
+ * in its URL, where a run id is a Mountaya-shaped fact a licensee may well want nowhere near
117
+ * theirs.
118
+ *
119
+ * Its absence is defined: nothing is restored and nothing is mirrored, so the co-pilot opens on
120
+ * a fresh conversation, which is exactly right for an embed or a render-free test.
121
+ */
122
+ interface AgentThreadsUrlSeam {
123
+ readOnce: () => {
124
+ activeThreadId?: string | undefined;
125
+ threads?: readonly AgentThreadMirror[] | undefined;
126
+ };
127
+ write: (next: {
128
+ activeThreadId: string | null;
129
+ threads: readonly AgentThreadMirror[];
130
+ }) => void;
131
+ }
132
+ /**
133
+ * WITHHELD_TAB_ID is the reserved id of the co-pilot tab a viewer without the `copilot`
134
+ * entitlement lands on. It is never a conversation's id (those come from the ids seam) and never
135
+ * in the threads map, so the panel branches on it by value: while it is the active tab, the panel
136
+ * renders whatever the host's co-pilot seam answers in place of a conversation. An entitled viewer
137
+ * never lands on it: a URL that names it restores Search for them, and the tab verbs answer
138
+ * `not-found` for it.
139
+ *
140
+ * The id says WHERE, never WHAT. Nothing in this package draws what stands there: the node
141
+ * rendered there is the host's, read off their seam, so the studio puts no commercial terms in
142
+ * front of a licensee's users. It is a URL value too (a reload restores the tab it names), which
143
+ * is why it is published rather than private.
144
+ */
145
+ export declare const WITHHELD_TAB_ID = "withheld";
146
+ /**
147
+ * ThreadState is one chat's reactive state: its run id (null until a run opens),
148
+ * the run lifecycle the panel renders against, the role-structured transcript
149
+ * (errors AND tool actions live in the transcript as their own turns, not separate
150
+ * fields), and the destructive-tool confirmation the run is currently waiting on
151
+ * (null unless a card is showing). One studio workspace hosts many of these:
152
+ * switching tabs switches which thread's state the panel shows, never the shared
153
+ * map/itinerary.
154
+ */
155
+ interface ThreadState extends ConversationState<TranscriptEntry> {
156
+ pendingConfirmation: PendingConfirmation | null;
157
+ }
158
+ /**
159
+ * AgentThreadsState is the studio's whole set of chats: the ordered thread ids
160
+ * (tab order), the active AI thread, the active TAB (which may be the search
161
+ * pseudo-tab or an AI thread), and each thread's state keyed by id. The order
162
+ * array drives the tab strip; the map holds the per-thread reactive state read
163
+ * with narrow selectors so a streaming token re-renders only the active panel.
164
+ *
165
+ * activeTabId is the SINGLE source of truth for which tab the panel shows. It
166
+ * is SEARCH_TAB_ID when the search pseudo-tab is active, an AI thread id when
167
+ * one of the AI tabs is active, or null only when no AI tabs exist AND search
168
+ * is also not selected (a transient state `AgentThreadsEngine` does not produce).
169
+ * activeId mirrors the active AI thread (so the agent surface keeps writing to
170
+ * the right thread when search is selected); switching back to an AI tab
171
+ * re-points activeTabId to activeId.
172
+ */
173
+ interface AgentThreadsState {
174
+ activeId: string | null;
175
+ activeTabId: string | null;
176
+ order: string[];
177
+ threads: Record<string, ThreadState>;
178
+ }
179
+ /**
180
+ * AgentThreadsActions mutate the chat set. The engine (the only writer)
181
+ * calls these as the sessions it owns report run ids, state transitions, and
182
+ * streamed/settled text; the UI only reads.
183
+ *
184
+ * - createThread seeds an idle thread; closeThread drops it and re-points the active
185
+ * thread.
186
+ * - The transcript mutators append a user turn, append/accumulate an assistant turn,
187
+ * append an error turn, and reset on a fresh run. appendToolActivity records one tool
188
+ * action as a permanent row keyed by its call id, and settleToolActivity settles that
189
+ * row in place once the tool returns.
190
+ * - setActiveTab points the panel at either the search pseudo-tab or an AI thread id;
191
+ * addCopilotTab and closeCopilotTab are the tab-level wrappers the tool bus dispatches
192
+ * through (Search is implicit and never created or closed).
193
+ * - setPendingConfirmation and clearPendingConfirmation raise and drop the in-chat
194
+ * confirmation card a destructive tool blocks on; a fresh user message does NOT clear
195
+ * it: only the user's decision, a stop, or session teardown does.
196
+ * - appendQuestion records a structured question as an open card keyed by its call id;
197
+ * answerQuestion settles that card with the picked label; a typed user message settles
198
+ * every still-open card with no pick, since the reply supersedes the buttons.
199
+ * - appendSuggestions records a generated route-candidate batch as an open card
200
+ * (superseding any prior open batch); chooseSuggestion settles that card with the
201
+ * picked candidate's seed; a typed user message settles every still-open suggestions
202
+ * card too, since the run may be about to regenerate.
203
+ */
204
+ interface AgentThreadsActions {
205
+ addCopilotTab: (threadId: string) => void;
206
+ answerQuestion: (threadId: string, entryId: string, label: string) => void;
207
+ appendAssistantDelta: (threadId: string, delta: string) => void;
208
+ appendChecksUnmet: (threadId: string, unmet: readonly string[]) => void;
209
+ appendError: (threadId: string, message: string) => void;
210
+ appendQuestion: (threadId: string, question: {
211
+ options: readonly QuestionOption[];
212
+ question: string;
213
+ toolCallId: string;
214
+ }) => void;
215
+ appendSuggestions: (threadId: string, suggestions: {
216
+ candidates: readonly SuggestionCardCandidate[];
217
+ entryId: string;
218
+ }) => void;
219
+ appendToolActivity: (threadId: string, activity: {
220
+ input: string | null;
221
+ name: string;
222
+ toolCallId: string;
223
+ }) => void;
224
+ appendUserMessage: (threadId: string, content: string) => void;
225
+ chooseSuggestion: (threadId: string, entryId: string, seed: number) => void;
226
+ clearPendingConfirmation: (threadId: string) => void;
227
+ closeCopilotTab: (threadId: string) => void;
228
+ closeThread: (threadId: string) => void;
229
+ createThread: (threadId: string, runId?: string | null) => void;
230
+ setActive: (threadId: string) => void;
231
+ setActiveTab: (tabId: string) => void;
232
+ setAssistantMessage: (threadId: string, content: string, messageIndex?: number) => void;
233
+ setPendingConfirmation: (threadId: string, confirmation: PendingConfirmation) => void;
234
+ setRunId: (threadId: string, runId: string | null) => void;
235
+ setSessionState: (threadId: string, state: AgentEngineState) => void;
236
+ settleToolActivity: (threadId: string, toolCallId: string, outcome: ToolActivityOutcome) => void;
237
+ }
238
+ /** AgentThreadsStore is the store's whole value: the {@link AgentThreadsState} and its actions. */
239
+ type AgentThreadsStore = AgentThreadsActions & AgentThreadsState;
240
+ /**
241
+ * AgentThreadsStoreApi is the vanilla store {@link createAgentThreadsStore} builds, the
242
+ * object an `AgentThreadsEngine` writes and a surface reads with narrow selectors.
243
+ */
244
+ type AgentThreadsStoreApi = ReturnType<typeof createAgentThreadsStore>;
245
+ /**
246
+ * createAgentThreadsStore builds the per-mount vanilla store for the studio's
247
+ * chats. `AgentThreadsEngine` writes it, and builds one when its host passes none;
248
+ * the tab strip and the prompt panel read it with narrow selectors, so a
249
+ * high-frequency token update re-renders only the components that select the
250
+ * changing thread.
251
+ *
252
+ * It is one literal on purpose: every action is a transition over the one `set`
253
+ * this closure holds, each a few lines that name a transcript rule, so a split
254
+ * by concern would pass `set` between modules and move no decision out.
255
+ */
256
+ export declare const createAgentThreadsStore: () => import("zustand/vanilla").StoreApi<AgentThreadsStore>;
257
+ /**
258
+ * selectAgentDriving is true while any conversation reads `running`: from the
259
+ * moment its message is sent, which is before a first message's run exists,
260
+ * until its turn settles. It is the single derived flag the studio reads to
261
+ * lock every human interaction surface and dim the workspace: the agent and a
262
+ * clicking human share one bus + tool context, so the lock cannot be a
263
+ * bus-capability gate (that would block the agent too) and must live at the UI
264
+ * layer keyed off this run state. Reads the order array once and
265
+ * short-circuits on the first running thread.
266
+ */
267
+ export declare const selectAgentDriving: (state: AgentThreadsState) => boolean;
268
+ /**
269
+ * AgentThreadsTabsSeam is where an {@link AgentThreadsEngine} publishes its tab strip, so a
270
+ * studio verb dispatched from outside the co-pilot (`studio.tabs.create` from an editor's
271
+ * "ask the co-pilot" entry) reaches the engine's threads through `ctx.tabs`.
272
+ *
273
+ * The engine registers its surface when the first subscriber resumes it and unregisters it
274
+ * when the last one parks it, so a tab verb dispatched while nothing watches the co-pilot
275
+ * answers the structured failure an absent `ctx.tabs` defines. A host whose tool context reads
276
+ * `tabs` through a late-bound getter answers both members with the slot that getter reads.
277
+ */
278
+ interface AgentThreadsTabsSeam {
279
+ /** Publishes the engine's tab surface. */
280
+ readonly register: (surface: TabSurface) => void;
281
+ /** Withdraws it, after which a tab verb answers a structured failure. */
282
+ readonly unregister: () => void;
283
+ }
284
+ /**
285
+ * AgentThreadsConfig is what the co-pilot's conversations run against, all of it replaceable
286
+ * mid-life through {@link AgentThreadsEngine.configure}.
287
+ *
288
+ * Every member is read when it is used rather than when the engine is built: a session built
289
+ * after a change runs on the new transport and bus, and an error or a confirmation card raised
290
+ * after a locale change reads the new words.
291
+ */
292
+ interface AgentThreadsConfig {
293
+ /**
294
+ * The studio's bus, whole. A run reads the manifest it advertises for the context's
295
+ * capabilities and dispatches with the model as its origin, and the engine dispatches the tab,
296
+ * framing and suggestion verbs through it.
297
+ */
298
+ readonly bus: ToolBus<StudioToolContext, StudioToolInputs>;
299
+ /**
300
+ * The studio's tool context, which every conversation drives. A run's dispatches layer the
301
+ * in-chat confirmation and the agent origin over it with `layerToolContext`, so its late-bound
302
+ * getters (the map, the tabs, the collaboration session) stay live.
303
+ */
304
+ readonly context: StudioToolContext;
305
+ /**
306
+ * The localized copy a terminal run error resolves onto, the same object the video director
307
+ * reads, so the two surfaces phrase a budget ceiling or a rate limit identically.
308
+ */
309
+ readonly errorCopy: AgentErrorCopy;
310
+ /**
311
+ * Marks an organization's AI configuration stale after a start the gateway refused for want
312
+ * of one. Omitted, the refusal still surfaces its words and the configuration is re-read on
313
+ * the next natural fetch, the defined answer for a host with no cache of its own.
314
+ */
315
+ readonly invalidateAiConfig?: ((organizationId: string) => void) | undefined;
316
+ /**
317
+ * Marks the viewer's memberships stale after the gateway refused or ended a run for want of
318
+ * access: a start or its stream answered 402, 403 or 404, a follow-up found its run gone, or a
319
+ * run ended `access-revoked` because its member may not run it there any more (no write role in
320
+ * its organization, or an agreement that does not include Map Studio). The co-pilot's gate reads
321
+ * the memberships, so the notice that follows the refresh says why the co-pilot is withheld.
322
+ * Omitted, the refusal still surfaces its words and the memberships are re-read on the next
323
+ * natural fetch.
324
+ */
325
+ readonly invalidateMemberships?: (() => void) | undefined;
326
+ /**
327
+ * Tells the host the API refused the credential a run rides on: its start, its stream (a
328
+ * restored run's included) or a message into it answered 401. Under the browser's own session
329
+ * that is a sign-in the API no longer accepts, after a sign-out or a revoked session, so the
330
+ * host asks whether the person is still signed in and, when nobody is, sends them to sign in.
331
+ * Called once per refusal, once the fault is written. A 401 says nothing of the viewer's
332
+ * access, so the memberships are not read again for it.
333
+ *
334
+ * Pass it where the runs ride the browser's own session. Under a publishable key a 401 refuses
335
+ * the key or the session token beside it, which is no sign-in a host can ask about. Omitted, a
336
+ * refusal still surfaces its words.
337
+ */
338
+ readonly onSignInRefused?: (() => void) | undefined;
339
+ /**
340
+ * The host's own remedy for a failed call, appended to the playbook's recovery the model reads
341
+ * with it. Omitted, the model reads the playbook's recovery alone.
342
+ */
343
+ readonly recoveryAddendum?: RecoveryAddendum | undefined;
344
+ /**
345
+ * Whether a run names the server tools its model sees, from the tools the conversation's
346
+ * surfaces route to: a run's start and each routing update then carry the routed set.
347
+ *
348
+ * Off by default, and to stay off under a publishable key, the credential a studio embedded in
349
+ * a product runs under: a run under a key calls no server tool, and the API refuses a start or
350
+ * an update that names any. Off, a run names none and keeps every server tool its credential
351
+ * reaches. A host on the browser's own session turns it on to narrow them.
352
+ *
353
+ * @default false
354
+ */
355
+ readonly routesServerTools?: boolean | undefined;
356
+ /** The words the conversations write: fault lines, confirmation cards, the staging error. */
357
+ readonly strings: Pick<StudioStrings, "confirm" | "copilot" | "editing" | "editor" | "prompt" | "share">;
358
+ /**
359
+ * How the open conversations survive a reload. Its `readOnce` is read by the constructor
360
+ * alone, from the options; replacing the seam later changes where `write` mirrors to.
361
+ * Omitted, nothing is restored and nothing is mirrored.
362
+ */
363
+ readonly threadsUrl?: AgentThreadsUrlSeam | undefined;
364
+ /** The event transport every run is started, sent into and read over. */
365
+ readonly transport: AgentTransport;
366
+ }
367
+ /**
368
+ * AgentThreadsEngineOptions is the {@link AgentThreadsConfig} an engine starts with, plus the
369
+ * settings fixed for its life.
370
+ */
371
+ interface AgentThreadsEngineOptions extends AgentThreadsConfig {
372
+ /**
373
+ * Where a new conversation's id comes from. Pass the host's `ids` seam, or
374
+ * `sequentialStudioIds()` where the ids must be a function of the input.
375
+ */
376
+ readonly ids: StudioIds;
377
+ /**
378
+ * The store the conversations are written into, for a host that reads it with narrow
379
+ * selectors of its own. It is seeded by the constructor, so it starts empty.
380
+ *
381
+ * @default a new `createAgentThreadsStore()`
382
+ */
383
+ readonly store?: AgentThreadsStoreApi | undefined;
384
+ /**
385
+ * Where the tab strip is published while the engine runs. Omitted, a tab verb dispatched
386
+ * from outside the co-pilot answers a structured failure, and the engine's own tab commands
387
+ * still work.
388
+ */
389
+ readonly tabs?: AgentThreadsTabsSeam | undefined;
390
+ }
391
+ /**
392
+ * AgentThreadsEngine runs the studio co-pilot's concurrent conversations: one `AgentEngine`
393
+ * session per thread, each driving the same studio through the same bus and tool context, so
394
+ * switching tabs switches the conversation and never the workspace.
395
+ *
396
+ * The snapshot is the threads store's state (`AgentThreadsState`): the tab order, the active
397
+ * tab, and each thread's run id, lifecycle state, transcript and pending confirmation. A
398
+ * surface reads it with narrow selectors over the store rather than re-rendering on every
399
+ * streamed token. No member of {@link AgentThreadsConfig} keys it, so there is no previous
400
+ * question whose answer a configuration change could show.
401
+ *
402
+ * What the conversations do, in the order a run meets it:
403
+ *
404
+ * - **Seeding.** The constructor restores the threads the URL names, with their run ids, and
405
+ * the tab it names when that tab still exists; otherwise it lands on Search, with one fresh
406
+ * thread for a viewer entitled to the co-pilot and none for one who is not. It restores at
407
+ * most `MAX_OPEN_COPILOT_TABS` threads, never one under a pseudo-tab's id, and none at all for a
408
+ * viewer withheld the co-pilot: the URL is the visitor's to write, so the engine bounds it
409
+ * and a host's route need not. What the URL names is kept for a viewer withheld at
410
+ * construction, and restored once that viewer is entitled: when the viewer seam tells the
411
+ * change, at the next resume, or ahead of the next command, whichever comes first, and once,
412
+ * and the URL is written with the conversations that restore holds. The entitlement is read
413
+ * from the viewer seam wherever the engine acts on it, so a reveal or a close made after the
414
+ * change follows the viewer as it stands then.
415
+ * - **Routing.** Every message picks the surfaces its turn offers, keeping the thread's
416
+ * previous pick as the stickiness input, and a tool settle re-picks from live state with the
417
+ * thread's last message, so a surface the run unlocks reaches the manifest before its next
418
+ * turn.
419
+ * - **Turns.** A conversation reads `running` from the moment its message is sent, so the
420
+ * workspace locks before the run's context is captured and its start is made. It returns to
421
+ * `awaiting_input` when the turn settles, which its session reports, and at once when the
422
+ * message opens no run.
423
+ * - **Confirmations.** A destructive tool, server or client, raises an in-chat card instead of a
424
+ * modal. The user's decision, a stop, a tab close or a park settles it, so a run never waits
425
+ * on a decision that can no longer arrive.
426
+ * - **Tool calls.** An editor verb locks the entity it names for the run, a verb that takes an
427
+ * entity back lowers the hand-off, a question renders as a card, and a settled generate
428
+ * renders the live suggest session as a suggestions card, framed once while its thread is on
429
+ * screen. The suggest session is one workspace-wide slot, so only the generate that still
430
+ * owns it may render or discard it.
431
+ * - **Faults.** A start refused for access or configuration, a submit with no organization to
432
+ * scope a run to, and a stream that faults each land as an error turn and re-enable input.
433
+ *
434
+ * Every listener is told of a change, and one that throws stops neither the engine nor the
435
+ * listeners after it: its fault reaches the program as an uncaught error on a microtask, never
436
+ * as the outcome of a command or of a session's callback. A URL seam or a tab seam that throws
437
+ * is answered the same way.
438
+ *
439
+ * The lifecycle is the listeners, the way `SearchEngine`'s is. The first subscriber builds a
440
+ * host per thread, reconnects every thread that has a run id, mirrors the driving flag into
441
+ * `ctx.ui`, subscribes to the viewer seam and publishes the tab strip; the last unsubscribe
442
+ * disposes every host, denies every parked confirmation, resets the driving flag, the edit locks
443
+ * and the hand-off, releases the viewer seam and withdraws the tab strip. A configuration that
444
+ * carries another UI store or another viewer moves the mirror or the subscription to it. A park
445
+ * ends no conversation: each keeps its run id, so the next resume reconnects it, and reads the
446
+ * state it read, except one that read `running`, which settles on `awaiting_input`. React's
447
+ * StrictMode mounts, unmounts and mounts again, which parks and resumes with one live session per
448
+ * thread at the end. A command does nothing while the engine is parked or disposed: a run opened
449
+ * with nobody watching could be neither seen nor stopped. {@link AgentThreadsEngine.dispose} is
450
+ * the latch, for an owner that is not a component.
451
+ *
452
+ * A reconnect is read by a new session, which its thread's host hands the position the parked
453
+ * session had reached in the run's stream. The stream resumes after it, so the transcript the
454
+ * park kept is written to by the frames it has not read and by no frame a second time. A thread
455
+ * restored from the URL has no such position and an empty transcript: its run's history is read
456
+ * from the first event and writes each entry once.
457
+ *
458
+ * No clock and no timer: nothing here waits on product time. Ids come from the `ids` option,
459
+ * so a thread id is as deterministic as the host's seam.
460
+ *
461
+ * @example
462
+ * ```ts
463
+ * import type { AgentTransport } from "@mountaya/client/events";
464
+ * import type { StudioToolContext, StudioToolInputs, ToolBus } from "@mountaya/studio";
465
+ * import {
466
+ * AgentThreadsEngine,
467
+ * type AgentThreadsState,
468
+ * agentErrorCopy,
469
+ * } from "@mountaya/studio/agent";
470
+ * import { sequentialStudioIds } from "@mountaya/studio/seams";
471
+ * import { studioStrings } from "@mountaya/studio/strings";
472
+ *
473
+ * declare const bus: ToolBus<StudioToolContext, StudioToolInputs>;
474
+ * declare const context: StudioToolContext;
475
+ * declare const transport: AgentTransport;
476
+ * declare function render(state: AgentThreadsState): void;
477
+ *
478
+ * const threads = new AgentThreadsEngine({
479
+ * bus,
480
+ * context,
481
+ * errorCopy: agentErrorCopy(studioStrings.en),
482
+ * ids: sequentialStudioIds("thread"),
483
+ * strings: studioStrings.en,
484
+ * transport,
485
+ * });
486
+ * const release = threads.subscribe(() => render(threads.getSnapshot()));
487
+ *
488
+ * threads.submit("Plan a loop from here");
489
+ * release();
490
+ * ```
491
+ */
492
+ export declare class AgentThreadsEngine {
493
+ private config;
494
+ private readonly ids;
495
+ private readonly store;
496
+ private readonly tabs;
497
+ private readonly subscriptions;
498
+ /** The store subscription the listeners are notified through, while the engine runs. */
499
+ private releaseStore;
500
+ /** The UI store the driving flag is mirrored into, while the engine runs. */
501
+ private mirrored;
502
+ /**
503
+ * What the URL named at construction, kept while the viewer the seed read is withheld the
504
+ * co-pilot and restored for that viewer once entitled. Null for a seed that read an entitled
505
+ * viewer, and once restored.
506
+ */
507
+ private unrestored;
508
+ /** The viewer seam the engine hears a change of the entitlement from, while it runs. */
509
+ private heard;
510
+ /** One host per thread: its session and its started guard. */
511
+ private readonly hosts;
512
+ /** The resolver of each thread's parked confirmation. */
513
+ private readonly confirmations;
514
+ /** The surfaces each thread's run is routed to; a thread with none offers every tool. */
515
+ private readonly surfaces;
516
+ /** The last message each thread routed on, replayed by a re-route from state. */
517
+ private readonly lastRouted;
518
+ /** The generate call that owns the workspace's one suggest session, and its thread. */
519
+ private suggestBatchOwner;
520
+ /** The suggestions cards whose pick is still applying, by entry id. */
521
+ private readonly stagingPicks;
522
+ /**
523
+ * The threads whose last message is out and whose turn the session has not picked up. While
524
+ * a thread is here, its session's `awaiting_input` is the run being readied and never the
525
+ * turn settling.
526
+ */
527
+ private readonly awaitingTurn;
528
+ /**
529
+ * The state each thread's session last reported, and no entry for one that has reported none,
530
+ * which reads `awaiting_input`. It says whether a message is sent into a turn under way, which
531
+ * the session answers with no report of `running`.
532
+ */
533
+ private readonly sessionStates;
534
+ /** Whether nobody is watching. A parked engine opens nothing and answers no command. */
535
+ private parked;
536
+ private disposed;
537
+ /**
538
+ * The tab strip the studio's tab verbs mutate through. Every member but the two reads,
539
+ * `countOpen` and `hasTab`, does nothing while the engine is parked, and an opening member
540
+ * then answers the tab already shown.
541
+ */
542
+ private readonly tabSurface;
543
+ /**
544
+ * Constructing one seeds the store and does nothing else: it reads the URL seam once and the
545
+ * viewer's entitlement as it stands, builds no host, opens no run and writes no URL. A React
546
+ * binding constructs during a render React is free to throw away, and a constructor with a side
547
+ * effect outside its own store would leave the discarded copy acting.
548
+ */
549
+ constructor(options: AgentThreadsEngineOptions);
550
+ /** getSnapshot returns the conversations' state, by reference and stable between changes. */
551
+ getSnapshot(): AgentThreadsState;
552
+ /**
553
+ * subscribe registers a listener for every change of the snapshot, and returns its own
554
+ * unsubscribe, which is idempotent.
555
+ *
556
+ * The first listener resumes the engine and the last one leaving parks it, which is the whole
557
+ * lifecycle a component can express correctly: React tears an effect down and sets it up
558
+ * again with the same object under StrictMode, so a latch here would leave a live surface
559
+ * bound to a dead engine. Each call is its own subscription, so two owners subscribing one
560
+ * shared function each hold the engine until they release it.
561
+ */
562
+ subscribe(listener: () => void): () => void;
563
+ /**
564
+ * configure replaces the configuration. Nothing is asked and no session is rebuilt: every
565
+ * member is read when it is used, so a binding may call this on every render and an unchanged
566
+ * configuration costs an assignment. Two things move with the context: the driving flag's
567
+ * mirror, when it carries a different UI store (the store it leaves is reset, and the new one is
568
+ * brought in line with the conversations), and the subscription to the viewer, when it carries
569
+ * a different viewer.
570
+ */
571
+ configure(config: AgentThreadsConfig): void;
572
+ /**
573
+ * dispose parks the engine and drops every listener, for good.
574
+ *
575
+ * Idempotent, and every call after it is a no-op rather than an error, a subscription
576
+ * included: an owner torn down mid-run should not have to guard the calls it already queued.
577
+ */
578
+ dispose(): void;
579
+ /**
580
+ * answerQuestion settles the active conversation's question card with the picked option, then
581
+ * sends its label as the next message. Settling first is what makes the send's sweep of open
582
+ * cards leave the pick marked.
583
+ *
584
+ * It does nothing unless `entryId` names a question card of the conversation that is still
585
+ * open: a second answer to one card, and an answer to a card a typed reply already settled,
586
+ * send no message, since the run is waiting on neither.
587
+ */
588
+ answerQuestion(entryId: string, label: string): void;
589
+ /**
590
+ * chooseSuggestion applies one suggested route from a suggestions card, settles the card, and
591
+ * sends the pick's label as the next message.
592
+ *
593
+ * The pick is applied client-side through `studio.itinerary.suggest.applyCandidate`, which
594
+ * reshapes the segment the batch was generated for or appends the route as a new one, so the
595
+ * route is on the map before the model reads the reply. It applies to the open itinerary and
596
+ * never creates one. A second pick on a card whose apply is still out does nothing, since two
597
+ * appends would put the route in the itinerary twice. A failed apply leaves the card open and
598
+ * writes the staging error, so the user can pick again; an apply a host's bus rejects, or
599
+ * answers with no result, is a failed one. A pick whose confirmation was withheld (the user
600
+ * kept a staged draft the apply would drop, or left the prompt to expire) leaves the card open
601
+ * and writes nothing. A pick whose apply lands after the engine parked, or after its
602
+ * conversation closed, writes nothing and opens no run.
603
+ */
604
+ chooseSuggestion(entryId: string, seed: number, label: string): void;
605
+ /** closeAiTab closes one conversation through `studio.tabs.close`. */
606
+ closeAiTab(tabId: string): void;
607
+ /** newAiTab opens a conversation through `studio.tabs.create`. */
608
+ newAiTab(): void;
609
+ /**
610
+ * previewCandidate paints one staged suggestion on the map through
611
+ * `studio.itinerary.suggest.select`, the call the suggestions panel's own rows make, so
612
+ * hovering a card option and hovering a panel row cannot diverge.
613
+ */
614
+ previewCandidate(seed: number): void;
615
+ /**
616
+ * resolveConfirmation settles the active conversation's confirmation card with the user's
617
+ * decision and clears the card. With nothing pending (a stale click after a stop already
618
+ * settled it) it does nothing.
619
+ */
620
+ resolveConfirmation(approved: boolean): void;
621
+ /**
622
+ * stopActive ends the active conversation's run: it denies a pending confirmation, asks the
623
+ * gateway to close the run (a run the session gave up reading included), swaps a fresh session
624
+ * in under the same thread so the next message opens a clean run, drops the run id and parks
625
+ * the thread on `awaiting_input`. The close is what stops the run spending model budget: a
626
+ * session torn down without it leaves the run going until the gateway's own timeout. The
627
+ * transcript stays, since a stop is the user's choice rather than a failure.
628
+ */
629
+ stopActive(): void;
630
+ /**
631
+ * submit sends a message into the active conversation: the first one opens a run scoped to
632
+ * the organization of the resource the co-pilot is open on, with the studio snapshot as its
633
+ * context, and a later one is delivered into the open run.
634
+ *
635
+ * The conversation reads `running` from the submit, so the workspace locks and a surface
636
+ * offers its Stop before the run's context is captured and its start is made. It returns to
637
+ * `awaiting_input` when the turn settles, and at once when there is no organization to scope
638
+ * a run to or the gateway refuses the start.
639
+ */
640
+ submit(message: string): void;
641
+ /** switchTab shows another tab, a conversation or a pseudo-tab, through `studio.tabs.switch`. */
642
+ switchTab(tabId: string): void;
643
+ /**
644
+ * live reports whether something watches the engine, which is when it acts. Every command asks
645
+ * it first, so a live engine restores the URL's conversations for a viewer entitled since the
646
+ * seed (see {@link restoreForEntitled}) ahead of the act: a host whose viewer tells no change
647
+ * still meets them there.
648
+ */
649
+ private live;
650
+ /**
651
+ * isOpen reports whether an answer for a conversation still has somewhere to land: the engine
652
+ * is live and the conversation has not closed. An answer that arrives after either belongs to
653
+ * nobody.
654
+ */
655
+ private isOpen;
656
+ /** activeThread is the conversation a command acts on, or null while the engine is not live. */
657
+ private activeThread;
658
+ /** shownTab is the tab the strip shows, what an opening tab verb answers while parked. */
659
+ private shownTab;
660
+ /**
661
+ * withheld reads whether the viewer is withheld the co-pilot, from the viewer seam as it
662
+ * answers now. A membership resolves after a host has mounted and an entitlement can lapse
663
+ * mid-session, so the answer is never held: each decision that turns on it asks again.
664
+ */
665
+ private withheld;
666
+ /**
667
+ * seed writes the conversations a mount opens with, from the URL and the entitlement.
668
+ *
669
+ * A viewer withheld the co-pilot is restored none, whatever the URL names: their one way into
670
+ * the co-pilot is the withheld tab. What the URL named is kept for them, and
671
+ * {@link restoreForEntitled} restores it once they are entitled.
672
+ */
673
+ private seed;
674
+ /**
675
+ * restore writes the conversations of an entitled viewer, from what the URL names, and answers
676
+ * the ids it created.
677
+ *
678
+ * The URL's list passes through {@link restorableThreads} first, and a conversation already
679
+ * open keeps its place. With none to restore, a viewer holding no conversation is opened a
680
+ * fresh one, and the panel lands on Search. Otherwise it lands on the tab the URL names when
681
+ * that tab is now open, and on Search when it is not: the withheld tab is never an entitled
682
+ * viewer's.
683
+ */
684
+ private restore;
685
+ /**
686
+ * restoreForEntitled restores what the URL named at construction for a viewer the seed read as
687
+ * withheld and the viewer seam now answers as entitled. It runs once: a viewer who loses the
688
+ * entitlement afterwards and regains it is not restored a second time. A live engine connects
689
+ * each conversation it restores, so one carrying a run id reconnects to its run; a parked one
690
+ * leaves that to the next resume. The URL is written with what the restore holds: a withheld
691
+ * viewer's reveal may have mirrored the withheld tab over the conversations it named.
692
+ */
693
+ private restoreForEntitled;
694
+ /**
695
+ * hearViewer subscribes to a viewer seam's changes, releasing the one heard before, so a
696
+ * viewer entitled while the engine runs is restored the URL's conversations as the seam tells.
697
+ */
698
+ private hearViewer;
699
+ /**
700
+ * connect builds a thread's host and resumes its session, reconnecting to the run the thread
701
+ * carries. A resume that faults drops the stale run id, mirrors the drop and leaves the
702
+ * conversation usable, through the thread's faults, which also tell the host a reconnect
703
+ * refused 401.
704
+ */
705
+ private connect;
706
+ /** resume starts the engine for its first subscriber. */
707
+ private resume;
708
+ /** park stops the engine when its last subscriber leaves. */
709
+ private park;
710
+ /**
711
+ * tellSeam calls one of the host's seams the engine writes to on its own paths: the URL
712
+ * mirror and the tab strip's slot. A seam that throws stops neither the resume, the park nor
713
+ * the command that reached it, and its fault is surfaced apart, as a listener's is.
714
+ */
715
+ private tellSeam;
716
+ /**
717
+ * send hands a message to a thread's host, with the conversation on `running` from this
718
+ * moment: the workspace is the model's from the submit, across the capture of the run's
719
+ * context, its start and the opening of its stream.
720
+ *
721
+ * Written before the host is called, so a submit the host answers at once (no organization
722
+ * to scope a run to) returns the conversation to `awaiting_input` through its fault.
723
+ */
724
+ private send;
725
+ /**
726
+ * settle returns a conversation to `awaiting_input`: its turn settled, its run faulted or was
727
+ * stopped. It ends the wait for a turn, so the next report of its session is read as it is.
728
+ */
729
+ private settle;
730
+ /**
731
+ * reportSessionState writes the lifecycle state a thread's session reports, while the engine
732
+ * is live.
733
+ *
734
+ * A session reports `ended` as it is disposed, and the park disposes every one of them. The
735
+ * park ends no conversation, so what its teardown reports is not written: a conversation that
736
+ * never ran keeps reading `awaiting_input`, and a host reading the store sees no state the
737
+ * park passed through.
738
+ *
739
+ * While a thread waits on its turn, its session's `awaiting_input` is not written either: a
740
+ * session that read a run before reports it as it readies the next one, which would lower the
741
+ * lock between the submit and the turn. The wait ends when the session reports `running`,
742
+ * which it does from the message it takes, and its reports are the conversation's from
743
+ * there: the turn's settle is one of them, whether or not the turn carried a frame of its own.
744
+ */
745
+ private reportSessionState;
746
+ /** writeSessionState writes a thread's state when it differs from the one it reads. */
747
+ private writeSessionState;
748
+ /** hasOpenQuestion reports whether `entryId` is a question card the thread has not settled. */
749
+ private hasOpenQuestion;
750
+ /**
751
+ * settleStreamingThreads returns every conversation that reads `running` to `awaiting_input`
752
+ * once the park has disposed its session.
753
+ *
754
+ * No session streams the turn any more, and the session the next resume builds starts on
755
+ * `awaiting_input` and reports a change only. A conversation left on `running` would raise
756
+ * the driving lock at that resume with nothing to lower it. Its run id stays, so the resume
757
+ * reconnects the run and the turn's frames report `running` again.
758
+ */
759
+ private settleStreamingThreads;
760
+ /** mirrorInto starts mirroring the driving flag into `ui`, brought in line at once. */
761
+ private mirrorInto;
762
+ /**
763
+ * releaseMirror stops mirroring, leaving the UI store with no driving flag, no edit lock and
764
+ * no hand-off: a studio the co-pilot left is never stranded inert.
765
+ */
766
+ private releaseMirror;
767
+ /**
768
+ * syncDriving writes the driving flag through to the UI store on a real flip only, so a token
769
+ * stream does not churn it.
770
+ *
771
+ * When the runs yield the workspace, the entities they locked are released, except the one a
772
+ * run left in an open edit session for the user to adjust and save: that draft outlives the
773
+ * run, and so does the co-pilot's authorship of it.
774
+ */
775
+ private syncDriving;
776
+ /** syncUrl mirrors the thread ids, their run ids and the active tab through the URL seam. */
777
+ private syncUrl;
778
+ /**
779
+ * tabsContext is the tool context a tab verb is dispatched with: the studio's own, with this
780
+ * engine's tab strip layered over it and every other seam left live.
781
+ */
782
+ private tabsContext;
783
+ /** ensureHost returns a thread's host, building it on first use. */
784
+ private ensureHost;
785
+ /**
786
+ * hostFor builds one thread's host. The run is scoped to the organization of the resource the
787
+ * co-pilot is open on, read through the rule the panel's gate reads, so a run opens for the
788
+ * organization whose card the panel shows and a personal resource opens none. A snapshot that
789
+ * fails to build opens the run without a context rather than blocking the message.
790
+ */
791
+ private hostFor;
792
+ /**
793
+ * sessionFor builds one thread's session. Both confirmation gates, the server tool's and the
794
+ * client tool's the bus raises through `ctx.confirm`, park on that thread's in-chat card, and
795
+ * a client tool's card reads its localized body with the request's values, so a merge names
796
+ * the rows it is about to join.
797
+ */
798
+ private sessionFor;
799
+ /**
800
+ * observerFor maps one thread's session onto its transcript, then layers the co-pilot's own
801
+ * side effects over it: the URL mirror of a new run id, the question card, the suggest
802
+ * session's owner, the edit lock and the hand-off, the suggestions card and the re-route.
803
+ */
804
+ private observerFor;
805
+ /**
806
+ * appendQuestionCard renders a question call as its own card, parsed with the tool's own
807
+ * schema, and reports whether it did. A malformed input falls through to the ordinary
808
+ * activity row, whose dispatch then settles red, which is the honest rendering of that call.
809
+ */
810
+ private appendQuestionCard;
811
+ /** isGenerate reports whether a thread recorded `toolCallId` as a generate's activity row. */
812
+ private isGenerate;
813
+ /**
814
+ * appendSuggestionsCard renders the live suggest session's candidates as the thread's
815
+ * suggestions card, keyed off the generating call so a replayed settle appends no duplicate,
816
+ * and frames the batch once while the thread is the tab on screen.
817
+ *
818
+ * It snapshots the SESSION, never the model's echo, so every candidate shows its true colour
819
+ * and metrics. A settle whose call no longer owns the session renders nothing: another thread
820
+ * re-pointed the session, and its candidates belong to that conversation.
821
+ */
822
+ private appendSuggestionsCard;
823
+ /**
824
+ * stagePick applies one suggested route through the bus, and answers how it ended.
825
+ *
826
+ * A tool bus's dispatch never rejects and always answers a result, and a host's own may do
827
+ * neither: an apply that rejects answers the refusal the bus would have made of the throw, and
828
+ * one whose answer states no outcome is refused as `internal`.
829
+ */
830
+ private stagePick;
831
+ /**
832
+ * applyPick runs one suggestions-card pick, releasing the card's guard however it ends.
833
+ *
834
+ * The apply asks before it drops a staged draft. A reader who keeps theirs (a confirmation
835
+ * denied or left to expire) refused nothing: the card stays pickable and nothing is written.
836
+ */
837
+ private applyPick;
838
+ /**
839
+ * requestConfirmation parks a thread's decision on its in-chat card. A decision already parked
840
+ * on the thread is denied first, so no resolver is stranded, and one requested while the
841
+ * engine is parked, or for a conversation that has closed, is denied at once: no card could
842
+ * show it.
843
+ */
844
+ private requestConfirmation;
845
+ /** denyPendingConfirmation denies a thread's parked decision, if any, and clears its card. */
846
+ private denyPendingConfirmation;
847
+ /**
848
+ * faultsFor binds the shared fault handling to one thread. The missing-organization line
849
+ * depends on why there is none, read when the fault happens: with nothing open it asks for an
850
+ * itinerary or a zone, and with a personal one open it says the co-pilot works on an
851
+ * organization's.
852
+ */
853
+ private faultsFor;
854
+ /** routeForMessage picks the surfaces a thread's next turn offers, from its message. */
855
+ private routeForMessage;
856
+ /**
857
+ * routeForState re-picks from live state, replaying the thread's last message: its words
858
+ * carry the keyword and skill matches, and dropping them would narrow the manifest at the
859
+ * moment the run needs it wider.
860
+ */
861
+ private routeForState;
862
+ /** route records a thread's pick, with its previous one as the stickiness input. */
863
+ private route;
864
+ /** openTab opens a conversation, with its host built so the tools and a submit find it. */
865
+ private openTab;
866
+ /**
867
+ * closeTab finishes one conversation's run and disposes its session, and the others run on.
868
+ *
869
+ * A pending confirmation is denied, and the suggest session is discarded when it is headless
870
+ * (no draft, no open panel) and this thread staged it or nobody did: a session the human is
871
+ * using stays, and so does one another conversation owns. Closing the last conversation of an
872
+ * entitled viewer opens a fresh one, so the strip always carries one.
873
+ */
874
+ private closeTab;
875
+ /**
876
+ * showTab points the panel at a tab and mirrors it. The withheld tab is Search for an entitled
877
+ * viewer, so no caller shows them the host's own content over their conversations.
878
+ */
879
+ private showTab;
880
+ /**
881
+ * resetThreads clears the co-pilot for a switched-to resource: every conversation closes, so
882
+ * the one about the resource being left cannot leak into the next, and the panel lands on
883
+ * Search behind the fresh conversation the last close opens.
884
+ */
885
+ private resetThreads;
886
+ /**
887
+ * openOrReveal reveals the co-pilot, focusing a conversation rather than opening a second one:
888
+ * a withheld viewer lands on the withheld tab, an entitled one on their latest
889
+ * conversation, and a new one opens only when there is none.
890
+ */
891
+ private openOrReveal;
892
+ }
893
+ /**
894
+ * DirectorChatConfig is what the video director's conversation runs against, all of it
895
+ * replaceable mid-life through {@link DirectorChatEngine.configure}. Every member is read when
896
+ * it is used, so a session built after a change runs on the new values.
897
+ */
898
+ interface DirectorChatConfig {
899
+ /**
900
+ * The bus the run advertises and dispatches through: the camera-scoped one
901
+ * `createVideoDirectorBus` builds, so the model is offered the camera verbs and nothing that
902
+ * edits an itinerary or the map.
903
+ */
904
+ readonly bus: ToolDispatcher<StudioToolContext>;
905
+ /**
906
+ * The studio's tool context. The camera verbs dispatch through it unscoped, so they edit the
907
+ * same camera plan a slider does and keep each handler's own entitlement gate; only the manifest
908
+ * is narrowed, by the bus.
909
+ */
910
+ readonly context: StudioToolContext;
911
+ /** The localized copy a terminal run error resolves onto, the co-pilot's own object. */
912
+ readonly errorCopy: AgentErrorCopy;
913
+ /**
914
+ * Marks an organization's AI configuration stale after a start the gateway refused for want
915
+ * of one, which turns the wizard's director slot into its setup card. Omitted, the refusal
916
+ * still surfaces its words.
917
+ */
918
+ readonly invalidateAiConfig?: ((organizationId: string) => void) | undefined;
919
+ /**
920
+ * The organization that owns the wizard's itinerary, or null while its detail loads. It is
921
+ * the wizard's own itinerary rather than the studio's open one, which may be another or none,
922
+ * so a run is never scoped to the wrong organization; a submit before it loads writes the
923
+ * still-loading line instead of opening a run.
924
+ */
925
+ readonly organizationId: string | null;
926
+ /**
927
+ * The host's own remedy for a failed camera verb, appended to the playbook's recovery the model
928
+ * reads with it. Omitted, the model reads the playbook's recovery alone.
929
+ */
930
+ readonly recoveryAddendum?: RecoveryAddendum | undefined;
931
+ /** The words the conversation writes: fault lines and the server-tool confirmation prompt. */
932
+ readonly strings: Pick<StudioStrings, "confirm" | "copilot" | "director" | "prompt">;
933
+ /** The event transport the run is started, sent into and read over. */
934
+ readonly transport: AgentTransport;
935
+ }
936
+ /**
937
+ * DirectorChatEngineOptions is the {@link DirectorChatConfig} an engine starts with, plus the
938
+ * store it writes, which is fixed for its life.
939
+ */
940
+ interface DirectorChatEngineOptions extends DirectorChatConfig {
941
+ /**
942
+ * The store the conversation is written into, for a host that reads it with narrow selectors
943
+ * of its own.
944
+ *
945
+ * @default a new `createVideoDirectorStore()`
946
+ */
947
+ readonly store?: VideoDirectorStoreApi | undefined;
948
+ }
949
+ /**
950
+ * DirectorChatEngine runs the video wizard's AI director: one conversation, one `AgentEngine`
951
+ * session over the camera-scoped bus, with the camera plan as the run's context.
952
+ *
953
+ * The snapshot is the director store's state (`VideoDirectorState`): the run id, the lifecycle
954
+ * state, the transcript and the live tool summary the directing indicator reads. No member of
955
+ * {@link DirectorChatConfig} keys it, so there is no previous question whose answer a
956
+ * configuration change could show.
957
+ *
958
+ * Its failures are the co-pilot's, handled by the same fault rules and phrased by the same
959
+ * copy, so a refused start, a lost credential and a budget ceiling read identically on both
960
+ * surfaces. It differs from {@link AgentThreadsEngine} in three deliberate ways: it mirrors no
961
+ * driving flag into `ctx.ui`, whose studio-wide lock would freeze the wizard it lives in; it
962
+ * confirms a destructive server tool through the context's own `confirm` rather than an in-chat
963
+ * card, since its camera verbs are all non-destructive client tools and the path is a backstop;
964
+ * and it persists no run id, so a reload opens a fresh conversation.
965
+ *
966
+ * A conversation reads `running` from the moment an instruction is sent, before its run has
967
+ * started, and returns to `awaiting_input` when the turn settles, which its session reports,
968
+ * and at once when the instruction opens no run.
969
+ *
970
+ * Every listener is told of a change, and one that throws stops neither the engine nor the
971
+ * listeners after it: its fault reaches the program as an uncaught error on a microtask, never
972
+ * as the outcome of a command.
973
+ *
974
+ * The lifecycle is the listeners. The first subscriber starts it, and the last unsubscribe
975
+ * parks it: the session is disposed, which aborts an open run's stream and asks the gateway
976
+ * nothing, and the conversation keeps its run id and its transcript, so the next subscriber
977
+ * reconnects the run, as {@link AgentThreadsEngine} does. A park ends no conversation: one that
978
+ * read `running` settles on `awaiting_input`, and any other reads the state it read.
979
+ * React's StrictMode mounts, unmounts and mounts again, which parks and resumes with the run
980
+ * still going. A command does nothing while the engine is parked or disposed.
981
+ *
982
+ * The reconnect is read by a new session, which the conversation's host hands the position the
983
+ * parked session had reached in the run's stream. The stream resumes after it, so the transcript
984
+ * the park kept is written to by the frames it has not read and by no frame a second time.
985
+ *
986
+ * {@link DirectorChatEngine.dispose} is the latch, for an owner that is not a component, and
987
+ * the one teardown that ends the run: the gateway is asked to close it, since nothing reads it
988
+ * again. A binding whose surface goes away for good calls it, or {@link DirectorChatEngine.stop}
989
+ * first, so the run stops spending model budget then and not at the gateway's own timeout.
990
+ *
991
+ * @example
992
+ * ```ts
993
+ * import type { AgentTransport } from "@mountaya/client/events";
994
+ * import type { StudioToolContext } from "@mountaya/studio";
995
+ * import { agentErrorCopy, DirectorChatEngine } from "@mountaya/studio/agent";
996
+ * import { createVideoDirectorBus } from "@mountaya/studio/handlers";
997
+ * import { studioStrings } from "@mountaya/studio/strings";
998
+ *
999
+ * declare const context: StudioToolContext;
1000
+ * declare const transport: AgentTransport;
1001
+ * declare function render(state: ReturnType<DirectorChatEngine["getSnapshot"]>): void;
1002
+ *
1003
+ * const director = new DirectorChatEngine({
1004
+ * bus: createVideoDirectorBus(),
1005
+ * context,
1006
+ * errorCopy: agentErrorCopy(studioStrings.en),
1007
+ * organizationId: "org-1",
1008
+ * strings: studioStrings.en,
1009
+ * transport,
1010
+ * });
1011
+ * const release = director.subscribe(() => render(director.getSnapshot()));
1012
+ *
1013
+ * director.submit("Orbit the summit, then pull back");
1014
+ * release();
1015
+ * ```
1016
+ */
1017
+ export declare class DirectorChatEngine {
1018
+ private config;
1019
+ private readonly store;
1020
+ private readonly subscriptions;
1021
+ /** The store subscription the listeners are notified through, while the engine runs. */
1022
+ private releaseStore;
1023
+ /** The conversation's host: its one session and its started guard, built on first use. */
1024
+ private host;
1025
+ /**
1026
+ * Whether the last instruction is out and the session has not picked its turn up. While it
1027
+ * is, the session's `awaiting_input` is the run being readied and never the turn settling.
1028
+ */
1029
+ private awaitingTurn;
1030
+ /**
1031
+ * The state the conversation's session last reported, `awaiting_input` for one that has
1032
+ * reported none. It says whether an instruction is sent into a turn under way, which the
1033
+ * session answers with no report of `running`.
1034
+ */
1035
+ private sessionState;
1036
+ /** Whether nobody is watching. A parked engine opens nothing and answers no command. */
1037
+ private parked;
1038
+ private disposed;
1039
+ /**
1040
+ * Constructing one holds the options and does nothing else: no host, no session, no run. A
1041
+ * React binding constructs during a render React is free to throw away.
1042
+ */
1043
+ constructor(options: DirectorChatEngineOptions);
1044
+ /** getSnapshot returns the conversation's state, by reference and stable between changes. */
1045
+ getSnapshot(): VideoDirectorState;
1046
+ /**
1047
+ * subscribe registers a listener for every change of the snapshot, and returns its own
1048
+ * unsubscribe, which is idempotent. The first listener starts the engine, reconnecting the
1049
+ * run a park left behind, and the last one leaving parks it; each call is its own
1050
+ * subscription.
1051
+ */
1052
+ subscribe(listener: () => void): () => void;
1053
+ /**
1054
+ * configure replaces the configuration. Nothing is asked and no session is rebuilt, since
1055
+ * every member is read when it is used, so a binding may call this on every render.
1056
+ */
1057
+ configure(config: DirectorChatConfig): void;
1058
+ /**
1059
+ * dispose parks the engine and drops every listener, for good, and asks the gateway to close
1060
+ * the conversation's run: nothing reads it again, and a run left open spends model budget
1061
+ * until the gateway's own timeout. The conversation is left on `awaiting_input` with no run
1062
+ * id and its transcript intact. Idempotent, and every call after it is a no-op rather than an
1063
+ * error.
1064
+ */
1065
+ dispose(): void;
1066
+ /**
1067
+ * stop ends the run: the gateway is asked to close it (a run the session gave up reading
1068
+ * included), a fresh session is swapped in so the next instruction opens a clean run, and the
1069
+ * conversation is parked on `awaiting_input`. The close is what stops the run spending model
1070
+ * budget: a session torn down without it leaves the run going until the gateway's own timeout.
1071
+ * The transcript stays, since a stop is the user's choice and nothing the run did may vanish.
1072
+ */
1073
+ stop(): void;
1074
+ /**
1075
+ * submit sends an instruction: the first one opens a run scoped to the wizard itinerary's
1076
+ * organization, with the camera plan as its context, and a later one is delivered into the
1077
+ * open run.
1078
+ *
1079
+ * The conversation reads `running` from the submit, so a surface offers its Stop before the
1080
+ * run has started. It returns to `awaiting_input` when the turn settles, and at once when the
1081
+ * itinerary's organization is not known yet or the gateway refuses the start.
1082
+ */
1083
+ submit(message: string): void;
1084
+ /** live reports whether something watches the engine, which is when it acts. */
1085
+ private live;
1086
+ /**
1087
+ * resume starts the engine for its first subscriber, and reconnects the run a park left
1088
+ * behind. A reconnect that faults drops the stale run id and leaves the conversation usable.
1089
+ * With no run to reconnect it builds nothing: the session is built by the first instruction.
1090
+ */
1091
+ private resume;
1092
+ /**
1093
+ * park stops the engine when its last subscriber leaves: the session is disposed with no
1094
+ * close, so the run goes on at the gateway and the conversation keeps its id for the next
1095
+ * subscriber to reconnect.
1096
+ *
1097
+ * A conversation that read `running` settles on `awaiting_input`: no session streams it any
1098
+ * more, and the session the next resume builds starts on `awaiting_input` and reports a
1099
+ * change only. A conversation at rest is left as it is, so a remount writes nothing.
1100
+ */
1101
+ private park;
1102
+ /**
1103
+ * closeRun asks the gateway to close the conversation's run, for {@link dispose}.
1104
+ *
1105
+ * While the engine runs, the session holds the run and knows whether a close is still owed,
1106
+ * so the host finishes it. After a park no session holds it: the close is posted through the
1107
+ * transport for the run id the park kept, unless that run had already ended. A close the
1108
+ * gateway refuses is dropped, since the run it names is gone or expires on the gateway's own
1109
+ * timeout, and nothing is left to report it to.
1110
+ */
1111
+ private closeRun;
1112
+ /**
1113
+ * settle returns the conversation to `awaiting_input`: its turn settled or its run faulted.
1114
+ * It ends the wait for a turn, so the next report of its session is read as it is.
1115
+ */
1116
+ private settle;
1117
+ /**
1118
+ * reportSessionState writes the lifecycle state the session reports, while the engine is
1119
+ * live: a session reports `ended` as the park disposes it, and the park ends no conversation.
1120
+ * While the conversation waits on its turn, the session's `awaiting_input` is not written
1121
+ * either: it is the run being readied. The wait ends when the session reports `running`,
1122
+ * which it does from the message it takes, and its reports are the conversation's from
1123
+ * there: the turn's settle is one of them, whether or not the turn carried a frame of its own.
1124
+ */
1125
+ private reportSessionState;
1126
+ /** writeSessionState writes the conversation's state when it differs from the one it reads. */
1127
+ private writeSessionState;
1128
+ /** ensureHost returns the conversation's host, building it on first use. */
1129
+ private ensureHost;
1130
+ /** session builds the conversation's session over the camera-scoped bus. */
1131
+ private session;
1132
+ /**
1133
+ * faults binds the shared fault handling to the conversation. No URL is mirrored, so nothing
1134
+ * follows a fault that dropped the run id.
1135
+ */
1136
+ private faults;
1137
+ }
1138
+ /**
1139
+ * agentErrorCopy builds the localized copy a terminal run error resolves onto, from the studio's
1140
+ * strings.
1141
+ *
1142
+ * Its answer is the `errorCopy` both {@link AgentThreadsEngine} and {@link DirectorChatEngine}
1143
+ * take, and what `resolveAgentError` of `@mountaya/elements/agent` chooses between: a budget
1144
+ * ceiling by the dimension it exhausted, a rate limit, a run that stopped itself for repeating one
1145
+ * action, a run stopped because its member may not run it there any more (no write role in its
1146
+ * organization, or an agreement that does not include Map Studio), an organization with no AI
1147
+ * provider configured, and the generic line for everything else. Every AI surface builds its copy
1148
+ * here, so the co-pilot and the video director phrase one failure in the same words whoever mounted
1149
+ * them: the failure is the gateway's, never the surface's.
1150
+ *
1151
+ * `strings` is the two sections it reads, in the language already resolved. Pass the bundle
1152
+ * `resolveStudioStrings` answers, or the two sections alone. Pure: it holds nothing and reads no
1153
+ * language of its own, so a locale change is a second call with the new bundle. A binding that
1154
+ * hands the answer to an engine on every render memoizes the call on the bundle.
1155
+ *
1156
+ * @example
1157
+ * ```ts
1158
+ * declare const strings: StudioStrings;
1159
+ * declare const options: Omit<AgentThreadsEngineOptions, "errorCopy">;
1160
+ *
1161
+ * const threads = new AgentThreadsEngine({ ...options, errorCopy: agentErrorCopy(strings) });
1162
+ * ```
1163
+ */
1164
+ export declare const agentErrorCopy: (strings: Pick<StudioStrings, "copilot" | "prompt">) => AgentErrorCopy;
1165
+ /**
1166
+ * copilotOrganizationId reads the organization a co-pilot run is scoped to off the open editor
1167
+ * resource, and tells the two ways of having none apart.
1168
+ *
1169
+ * - A string is the organization that owns the open resource, and a run opens for it.
1170
+ * - `null` is an open resource that belongs to no organization: a personal itinerary or zone.
1171
+ * A run belongs to an organization, whose AI provider it runs on, so there is no run to open,
1172
+ * and the reader is told why rather than asked to open the thing they already have open.
1173
+ * - `undefined` is nothing open at all, and asking the reader to open something is right.
1174
+ *
1175
+ * The open resource decides, never whether its organization is set. A personal itinerary is an
1176
+ * answer rather than a gap, so it is not filled in from a zone open beside it, which would open
1177
+ * the run for an organization the itinerary is not in. An open itinerary decides first, then a
1178
+ * saved zone, then an armed zone create, whose organization rides the session because nothing is
1179
+ * persisted yet. An edit session carries no organization of its own: the zone it edits answers.
1180
+ *
1181
+ * One rule for every surface that asks, because the question comes up in more than one place:
1182
+ * whether the co-pilot panel offers a run at all, and which organization a run it starts opens
1183
+ * for. Reading each from here is what keeps the card a reader sees and the run that opens from
1184
+ * disagreeing about which resource the co-pilot is on.
1185
+ */
1186
+ export declare const copilotOrganizationId: (state: UiState) => string | null | undefined;
1187
+ /**
1188
+ * GeneratedPlaybookEntry is one tool's compiled playbook: the description the
1189
+ * model reads, plus the classification a parity test holds against the live tool
1190
+ * definition. The authored YAML carries far more (examples, mistakes, recovery);
1191
+ * none of it ships to a model, so none of it is here.
1192
+ */
1193
+ interface GeneratedPlaybookEntry {
1194
+ /** Mirrors the tool's capability. Absent for a Data API operation. */
1195
+ capability?: string | undefined;
1196
+ confirms: boolean;
1197
+ description: string;
1198
+ id: string;
1199
+ kind: string;
1200
+ /**
1201
+ * What to do about a specific failure code. Attached to a failing result rather
1202
+ * than stated in the prompt, so it costs nothing for the codes that never fire
1203
+ * and arrives at the moment it is actionable.
1204
+ */
1205
+ recovery: readonly GeneratedRecovery[];
1206
+ surfaces: readonly string[];
1207
+ }
1208
+ /** GeneratedRecovery is the instruction for one failure code. */
1209
+ interface GeneratedRecovery {
1210
+ code: string;
1211
+ do: string;
1212
+ }
1213
+ /**
1214
+ * PLAYBOOK is the compiled entry table, sorted by id.
1215
+ */
1216
+ export declare const PLAYBOOK: readonly GeneratedPlaybookEntry[];
1217
+ /**
1218
+ * GeneratedSurface is one semantic tool subset, with the routing hints the
1219
+ * surface router reads.
1220
+ */
1221
+ interface GeneratedSurface {
1222
+ always: boolean;
1223
+ id: string;
1224
+ keywords: readonly string[];
1225
+ members: readonly string[];
1226
+ purpose: string;
1227
+ title: string;
1228
+ wideFallback: boolean;
1229
+ }
1230
+ /**
1231
+ * SURFACES is the compiled surface table. Membership patterns are expanded at
1232
+ * generation, so a pattern matching nothing fails the build rather than quietly
1233
+ * yielding an empty surface.
1234
+ */
1235
+ export declare const SURFACES: readonly GeneratedSurface[];
1236
+ export { type AgentThreadMirror, type AgentThreadsActions, type AgentThreadsConfig, type AgentThreadsEngineOptions, type AgentThreadsState, type AgentThreadsStore, type AgentThreadsStoreApi, type AgentThreadsTabsSeam, type AgentThreadsUrlSeam, type DirectorChatConfig, type DirectorChatEngineOptions, type GeneratedPlaybookEntry, type GeneratedRecovery, type GeneratedSurface, type RecoveryAddendum, type RouterDecision, type RouterState, SEARCH_TAB_ID, type ThreadState };
1237
+ //# sourceMappingURL=index.d.cts.map