@uniqbit/mate-core 1.0.0-canary.9 → 1.0.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 (232) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/package.json +5 -4
  3. package/src/cli/commands/artifact/delivery/link.ts +1 -1
  4. package/src/cli/commands/artifact/delivery/output.ts +10 -1
  5. package/src/cli/commands/artifact/delivery/resolve.ts +3 -2
  6. package/src/cli/commands/artifact/delivery/submit.ts +9 -4
  7. package/src/cli/commands/artifact/delivery/take.ts +12 -9
  8. package/src/cli/commands/artifact/finish/command.ts +16 -14
  9. package/src/cli/commands/artifact/finish/engine.ts +8 -8
  10. package/src/cli/commands/artifact/project/command.ts +2 -3
  11. package/src/cli/commands/companion/hub.ts +11 -6
  12. package/src/cli/commands/companion/link.ts +173 -46
  13. package/src/cli/commands/report/contract.ts +0 -17
  14. package/src/cli/commands/studio/access.ts +4 -0
  15. package/src/cli/commands/studio/actions.ts +35 -2
  16. package/src/cli/commands/studio/mcp-manager.ts +162 -0
  17. package/src/cli/commands/studio/routes.ts +12 -0
  18. package/src/cli/commands/studio/selection.ts +44 -11
  19. package/src/cli/commands/studio/server.ts +246 -2
  20. package/src/cli/commands/studio/services.ts +26 -0
  21. package/src/cli/commands/studio/terminal-launch.ts +21 -4
  22. package/src/cli/commands/studio/terminal.ts +3 -14
  23. package/src/cli/commands/studio/work-requests.ts +9 -0
  24. package/src/cli/commands/studio/work.ts +473 -0
  25. package/src/cli/commands/vscode/release-vsix.json +2 -2
  26. package/src/cli/commands/working/cleanup.ts +1 -18
  27. package/src/cli/companion-link-wizard.tsx +158 -91
  28. package/src/cli/usage.ts +1 -1
  29. package/src/lib/agent-credential.ts +131 -0
  30. package/src/lib/credential-kinds.ts +7 -0
  31. package/src/lib/delivery/merge-git.ts +16 -0
  32. package/src/lib/delivery/record-delivery.ts +12 -6
  33. package/src/lib/delivery/record.ts +5 -0
  34. package/src/lib/delivery/refresh.ts +34 -6
  35. package/src/lib/delivery/staging/refs.ts +9 -4
  36. package/src/lib/delivery/staging/submit.ts +81 -22
  37. package/src/lib/mcp-manager/resolve.ts +27 -9
  38. package/src/lib/mcp-manager/store.ts +35 -11
  39. package/src/lib/mcp-manager/types.ts +14 -0
  40. package/src/lib/mcp-manager/validate.ts +6 -10
  41. package/src/lib/opencode-server.ts +2 -17
  42. package/src/lib/orchestrator/repo-local-store.ts +14 -0
  43. package/src/lib/orchestrator/repository-link.ts +80 -52
  44. package/src/lib/orchestrator/root-context.ts +17 -1
  45. package/src/lib/studio-chat/agent.ts +139 -0
  46. package/src/lib/studio-chat/companion-context.ts +136 -0
  47. package/src/lib/studio-chat/credential.ts +79 -0
  48. package/src/lib/studio-chat/harness-chat-agent.ts +334 -0
  49. package/src/lib/studio-chat/host-sandbox.ts +578 -0
  50. package/src/lib/studio-chat/prepare-bridges.ts +95 -0
  51. package/src/lib/studio-chat/session.ts +15 -0
  52. package/src/lib/studio-chat/turns.ts +112 -0
  53. package/src/lib/workset/claims.ts +85 -0
  54. package/src/lib/workset/execution.ts +71 -0
  55. package/src/lib/workset/git-transaction.ts +74 -0
  56. package/src/lib/workset/groups.ts +176 -0
  57. package/src/lib/workset/inventory.ts +196 -0
  58. package/src/lib/workset/projection.ts +237 -0
  59. package/src/lib/workset/record.ts +101 -36
  60. package/src/lib/workset/repositories.ts +24 -0
  61. package/src/lib/workset/sharing.ts +951 -0
  62. package/src/lib/workset/stages.ts +50 -14
  63. package/src/lib/workset/transactions.ts +158 -0
  64. package/src/runtime/companion-git-state.ts +1 -0
  65. package/src/runtime/companion-guidance.ts +2 -2
  66. package/src/runtime/forge-remote.ts +6 -0
  67. package/src/runtime/host-process.ts +28 -0
  68. package/src/runtime/secret-guard.ts +18 -1
  69. package/src/runtime/secret-patterns.ts +4 -3
  70. package/src/runtime/submitted-arrivals.ts +28 -2
  71. package/src/runtime/write-atomic.ts +2 -2
  72. package/src/studio.ts +52 -8
  73. package/src/templates/capabilities/openspec-cap/mate-full/schema.yaml +1 -1
  74. package/src/templates/capabilities/openspec-cap/mate-full/templates/proposal.md +1 -1
  75. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +3 -2
  76. package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +5 -3
  77. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +3 -2
  78. package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +5 -3
  79. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +12 -12
  80. package/src/tools/setup/capabilities/mcp-manager.ts +1 -2
  81. package/src/tools/setup/dynamic-plugins/declarations.ts +0 -26
  82. package/src/tools/setup/plugins/gitignore.ts +1 -0
  83. package/src/tools/setup/providers/claude-format.ts +1 -5
  84. package/src/tools/setup/providers/claude.ts +28 -3
  85. package/src/tools/setup/providers/opencode.ts +7 -18
  86. package/src/tools/setup/providers/relative-path-warnings.ts +26 -0
  87. package/studio-dist/THIRD-PARTY-NOTICES.md +297 -0
  88. package/studio-dist/client/THIRD-PARTY-LICENSES.md +4294 -0
  89. package/studio-dist/client/assets/DialogTitle-DOhjDa7H.js +1 -0
  90. package/studio-dist/client/assets/app-CG3vCgyA.css +2 -0
  91. package/studio-dist/client/assets/bundle-mjs-CdK3cBzO.js +1 -0
  92. package/studio-dist/client/assets/button-upSzkd-q.js +1 -0
  93. package/studio-dist/client/assets/chat-DbaMXb8H.js +157 -0
  94. package/studio-dist/client/assets/cn-BCnYnarL.js +1 -0
  95. package/studio-dist/client/assets/combobox-cP9OsRf2.js +1 -0
  96. package/studio-dist/client/assets/{companion-view-C1F0_jbt.js → companion-view-B54_Lj0S.js} +1 -1
  97. package/studio-dist/client/assets/fields-DNZ4a89M.js +1 -0
  98. package/studio-dist/client/assets/friction-DgEimeDB.js +1 -0
  99. package/studio-dist/client/assets/getting-started-BTfYCt5s.js +1 -0
  100. package/studio-dist/client/assets/{getting-started-BN4aTpsz.js → getting-started-CAszmdDJ.js} +1 -1
  101. package/studio-dist/client/assets/getting-started._topic-CHJMf0pa.js +1 -0
  102. package/studio-dist/client/assets/getting-started.index-MR6HftWs.js +1 -0
  103. package/studio-dist/client/assets/{graph-canvas-Be5qgdDt.js → graph-canvas-BdNk2F9O.js} +1 -1
  104. package/studio-dist/client/assets/graph-hRijsC89.js +2 -0
  105. package/studio-dist/client/assets/guides-CwFnh08E.js +1 -0
  106. package/studio-dist/client/assets/highlighted-body-JLMTFACH-BcroQey-.js +1 -0
  107. package/studio-dist/client/assets/index-D5oGyvG8.js +41 -0
  108. package/studio-dist/client/assets/{markdown-view-dku7MGPn.js → markdown-view-CJ8JsLb7.js} +1 -1
  109. package/studio-dist/client/assets/marked.esm-vFuq1cCd.js +65 -0
  110. package/studio-dist/client/assets/mcp-BE9M-bkO.js +4 -0
  111. package/studio-dist/client/assets/mermaid-WFAXDIZX-BjSsakrn.js +1 -0
  112. package/studio-dist/client/assets/panel-CDQ6Lryw.js +1 -0
  113. package/studio-dist/client/assets/plugins._service._view-DRVPUAWN.js +1 -0
  114. package/studio-dist/client/assets/{prepaint-BkoDSw5X.js → prepaint-sD_LlrDN.js} +1 -1
  115. package/studio-dist/client/assets/{queries-CMvC2OkU.js → queries-COL925ML.js} +1 -1
  116. package/studio-dist/client/assets/react-dom-K3Hp2Cdj.js +1 -0
  117. package/studio-dist/client/assets/{react-BYUSgtBs.js → react-h2xQ_NSp.js} +1 -1
  118. package/studio-dist/client/assets/reports-BClsojkb.js +1 -0
  119. package/studio-dist/client/assets/routes-CJQ2MAej.js +1 -0
  120. package/studio-dist/client/assets/search-DhWdEiKT.js +1 -0
  121. package/studio-dist/client/assets/select-B2FsN9FY.js +1 -0
  122. package/studio-dist/client/assets/skills-SoUHk77W.js +1 -0
  123. package/studio-dist/client/assets/{specs-Bqd1ajyD.js → specs-C_tZnAvF.js} +1 -1
  124. package/studio-dist/client/assets/specs-view-C6t3Y5IT.js +1 -0
  125. package/studio-dist/client/assets/steps-CF3-Zpmh.js +1 -0
  126. package/studio-dist/client/assets/{store-BYnEU33C.js → store-pY9gU4uS.js} +1 -1
  127. package/studio-dist/client/assets/studio-X7bnFrRe.js +36 -0
  128. package/studio-dist/client/assets/studio-queries-CKtAnIKP.js +2 -0
  129. package/studio-dist/client/assets/usage-BaaqUpTG.js +55 -0
  130. package/studio-dist/client/assets/useAnchoredPopupScrollLock-BspHR7Wt.js +1 -0
  131. package/studio-dist/client/assets/useBlocker-BQOfcu_f.js +1 -0
  132. package/studio-dist/client/assets/useMutation-DKeEoP5S.js +1 -0
  133. package/studio-dist/client/assets/useOpenInteractionType-CtaZCaFT.js +1 -0
  134. package/studio-dist/client/assets/usePopupHandleStore-Bc7Q4bnF.js +1 -0
  135. package/studio-dist/client/assets/vault-sAPFUnPN.js +1 -0
  136. package/studio-dist/client/assets/{warnings-Cnw99ugO.js → warnings-D7YY1HSG.js} +1 -1
  137. package/studio-dist/client/assets/work-BZek_LGB.js +5 -0
  138. package/studio-dist/client/assets/workflow-N5boHXFz.js +1 -0
  139. package/studio-dist/server/THIRD-PARTY-LICENSES.md +4371 -0
  140. package/studio-dist/server/assets/DialogTitle-DnKSl2V0.js +421 -0
  141. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-CS3QRY4Q.js → __23tanstack-start-server-fn-resolver-Bli9bpSB.js} +38 -18
  142. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +91 -59
  143. package/studio-dist/server/assets/{actions-D8erOphH.js → actions-CHEFA1i9.js} +33 -1
  144. package/studio-dist/server/assets/{cn-DWFJaP_9.js → bundle-mjs-Ot6dQ8Pq.js} +1 -2056
  145. package/studio-dist/server/assets/{button-Ct_WeYLc.js → button-BqA1urbl.js} +14 -7
  146. package/studio-dist/server/assets/chat-zl332Tvu.js +49486 -0
  147. package/studio-dist/server/assets/cn-B0fl6NWK.js +2057 -0
  148. package/studio-dist/server/assets/{combobox-17vO5Uz8.js → combobox-iTjvPCtS.js} +7 -6
  149. package/studio-dist/server/assets/{companion-view-JkxnGLlp.js → companion-view-DIQ6AFIY.js} +2 -2
  150. package/studio-dist/server/assets/{companions-YNLsbnch.js → companions-aVwjRL8j.js} +1 -1
  151. package/studio-dist/server/assets/{fields-VytPpqBq.js → fields-BMap2_Ju.js} +10 -3
  152. package/studio-dist/server/assets/{friction-BW86PCPM.js → friction-BER50hoD.js} +2 -2
  153. package/studio-dist/server/assets/{friction-B6osqFSm.js → friction-BPs9KWdq.js} +8 -8
  154. package/studio-dist/server/assets/{getting-started-CFHSeX5h.js → getting-started-DGfRVmZ_.js} +2 -2
  155. package/studio-dist/server/assets/{getting-started._topic-BK2eU6AS.js → getting-started._topic-BgrBA4Vj.js} +2 -2
  156. package/studio-dist/server/assets/{getting-started.index-DZLuXnNO.js → getting-started.index-BaFfQ9Mn.js} +2 -2
  157. package/studio-dist/server/assets/{graph-BJVZBevL.js → graph-Cgzlrv3P.js} +8 -8
  158. package/studio-dist/server/assets/{graph-DGZHV-Ek.js → graph-DODpuOy_.js} +1 -1
  159. package/studio-dist/server/assets/{graph-canvas-lrNT6jbl.js → graph-canvas-DW_zU1nA.js} +2 -2
  160. package/studio-dist/server/assets/{guides-_G8Vucsk.js → guides-CA_EMG7E.js} +1 -1
  161. package/studio-dist/server/assets/{guides-CEwLOZb9.js → guides-D0SpoD32.js} +1 -1
  162. package/studio-dist/server/assets/{guides.server-ZWFKX2XJ.js → guides.server-DJjQuy03.js} +1 -1
  163. package/studio-dist/server/assets/highlighted-body-JLMTFACH-BeHllu-r.js +41 -0
  164. package/studio-dist/server/assets/{markdown-view-Bmjghg_Z.js → markdown-view-CvVBGMZV.js} +1 -1
  165. package/studio-dist/server/assets/mcp-BU0fLYyJ.js +1103 -0
  166. package/studio-dist/server/assets/mcp-manager-D9YctTQe.js +50 -0
  167. package/studio-dist/server/assets/mermaid-WFAXDIZX-B1yDN6vG.js +1 -0
  168. package/studio-dist/server/assets/{panel-DvRjyil3.js → panel-D1K6Bsux.js} +4 -32
  169. package/studio-dist/server/assets/{plugins._service._view-B32LzraG.js → plugins._service._view-DdO1nELF.js} +4 -4
  170. package/studio-dist/server/assets/{prepaint-BEHwKl51.js → prepaint-BB3dwSmz.js} +1 -1
  171. package/studio-dist/server/assets/{queries-D6Vq0AuZ.js → queries-BwiDxQy5.js} +1 -1
  172. package/studio-dist/server/assets/{react-CiBZPDs8.js → react-B2cLiz-i.js} +1 -1
  173. package/studio-dist/server/assets/{reports-Dn92pLap.js → reports-9Pr7Bz6o.js} +7 -7
  174. package/studio-dist/server/assets/{reports-DDaH5k0H.js → reports-Cc9M3phM.js} +1 -1
  175. package/studio-dist/server/assets/{router-Bjf4S9tO.js → router-DcWe0J7Y.js} +827 -548
  176. package/studio-dist/server/assets/{routes-B4sNiE0X.js → routes-BEXxl0py.js} +8 -8
  177. package/studio-dist/server/assets/{search-DKeJRvg8.js → search-bltT7gwy.js} +39 -7
  178. package/studio-dist/server/assets/{select-CVHYL7oR.js → select-CZvHgGCi.js} +7 -6
  179. package/studio-dist/server/assets/{shell-BxbYYaAk.js → shell-BQ0vMKXN.js} +13 -4
  180. package/studio-dist/server/assets/{skills-Bj8eOgzR.js → skills-Be_52h0i.js} +1 -1
  181. package/studio-dist/server/assets/{skills-B4-0qpqN.js → skills-BpGGUl6L.js} +8 -8
  182. package/studio-dist/server/assets/{specs-rfMug6qW.js → specs-CCGgXE-V.js} +5 -5
  183. package/studio-dist/server/assets/{specs-view-qi1SE1Sl.js → specs-view-DtL5JxYM.js} +12 -11
  184. package/studio-dist/server/assets/{steps-rger6HJc.js → steps-BWFSO6dM.js} +1 -1
  185. package/studio-dist/server/assets/{store-Dg9T7oWs.js → store-X7yLPp7v.js} +1 -1
  186. package/studio-dist/server/assets/{studio-queries-CeFfmIuM.js → studio-queries-ur1ygXi3.js} +117 -13
  187. package/studio-dist/server/assets/{studio-D79JzDLc.js → studio-qzH-UETC.js} +209 -180
  188. package/studio-dist/server/assets/{usage-Dw_UQFX-.js → usage-C1o0DLzS.js} +1 -1
  189. package/studio-dist/server/assets/{usage-BJgYWRCX.js → usage-DWbSPrPD.js} +10 -9
  190. package/studio-dist/server/assets/{useAnchoredPopupScrollLock-ciS_sEq3.js → useAnchoredPopupScrollLock-DLDmv6kM.js} +4 -135
  191. package/studio-dist/server/assets/useBlocker-CQtANHK8.js +111 -0
  192. package/studio-dist/server/assets/{useMutation-DnWK0PhO.js → useMutation-NjlA8oFY.js} +2 -2
  193. package/studio-dist/server/assets/useOpenInteractionType-CZYscfOb.js +136 -0
  194. package/studio-dist/server/assets/usePopupHandleStore-DEEXJYv0.js +26 -0
  195. package/studio-dist/server/assets/{vault-BzarssiL.js → vault-B_kfi1h-.js} +1 -1
  196. package/studio-dist/server/assets/{vault-CvlrLd2H.js → vault-dL79JlKH.js} +8 -115
  197. package/studio-dist/server/assets/{views-CAxwKHMK.js → views-BSGH56lb.js} +3 -3
  198. package/studio-dist/server/assets/{warnings-BpVCugHm.js → warnings-DtUVPV-k.js} +2 -2
  199. package/studio-dist/server/assets/work-D789VXGH.js +110 -0
  200. package/studio-dist/server/assets/work-DsCEfhmK.js +3817 -0
  201. package/studio-dist/server/assets/work-requests-BLhOmQFO.js +11 -0
  202. package/studio-dist/server/assets/{workflow-BdrzcCt8.js → workflow-BOZ2sRYg.js} +9 -9
  203. package/studio-dist/server/server.js +3 -3
  204. package/wrappers/bin/openspec +87 -2
  205. package/studio-dist/client/assets/app-ggXJ_QVh.css +0 -2
  206. package/studio-dist/client/assets/button-C9SQW3kI.js +0 -1
  207. package/studio-dist/client/assets/cn-DC80MJV0.js +0 -1
  208. package/studio-dist/client/assets/combobox-D7mKYCBb.js +0 -1
  209. package/studio-dist/client/assets/fields-CEep8IFT.js +0 -1
  210. package/studio-dist/client/assets/friction-D9dBU7WN.js +0 -1
  211. package/studio-dist/client/assets/getting-started-BDyGvHhc.js +0 -1
  212. package/studio-dist/client/assets/getting-started._topic-B9ajbF4o.js +0 -1
  213. package/studio-dist/client/assets/getting-started.index-CYiBPtb7.js +0 -1
  214. package/studio-dist/client/assets/graph-ah7ZXfTa.js +0 -2
  215. package/studio-dist/client/assets/guides-CsL0660B.js +0 -1
  216. package/studio-dist/client/assets/index-zmRH87D4.js +0 -40
  217. package/studio-dist/client/assets/panel-COgk0vP5.js +0 -1
  218. package/studio-dist/client/assets/plugins._service._view-Cn3WBHab.js +0 -1
  219. package/studio-dist/client/assets/reports-C_AqLBYH.js +0 -1
  220. package/studio-dist/client/assets/routes-BokQmHtC.js +0 -1
  221. package/studio-dist/client/assets/search-DxidNK2M.js +0 -1
  222. package/studio-dist/client/assets/select-CYFCbHUd.js +0 -1
  223. package/studio-dist/client/assets/skills-R3vttWHM.js +0 -1
  224. package/studio-dist/client/assets/specs-view-znqFPx9p.js +0 -1
  225. package/studio-dist/client/assets/steps-tVDWn7j6.js +0 -1
  226. package/studio-dist/client/assets/studio-ndtFcS2Y.js +0 -100
  227. package/studio-dist/client/assets/studio-queries-CkUSByy7.js +0 -2
  228. package/studio-dist/client/assets/usage-Kuhr8dSl.js +0 -55
  229. package/studio-dist/client/assets/useAnchoredPopupScrollLock-dc_kP4Go.js +0 -1
  230. package/studio-dist/client/assets/useMutation-CqtM9COw.js +0 -1
  231. package/studio-dist/client/assets/vault-CSP8kwRg.js +0 -1
  232. package/studio-dist/client/assets/workflow-BPJAmmZi.js +0 -1
@@ -1,23 +1,26 @@
1
1
  import { a as useRouter, c as _getAssetMatches, m as createNonReactiveReadonlyStore, p as createNonReactiveMutableStore, u as RouterCore } from "./useSelector-DUmCUXAs.js";
2
2
  import { i as __exportAll, n as require_react, o as __toESM, t as require_jsx_runtime } from "./jsx-runtime-Bt0s0YKS.js";
3
- import { a as QueryObserver, d as focusManager, f as Subscribable, i as defaultThrowOnError, l as onlineManager, m as useQueryClient, o as Query, p as QueryClientProvider, r as useBaseQuery, t as cn, u as notifyManager } from "./cn-DWFJaP_9.js";
4
- import { D as TERMINAL_SOCKET_ROUTE, E as TERMINAL_SESSIONS_ROUTE, F as functionalUpdate, H as matchQuery, I as hashKey, K as replaceEqualDeep, L as hashQueryKeyByOptions, O as TERMINAL_WASM, T as TERMINAL_SESSIONS_END_ROUTE, U as noop, V as matchMutation, W as partialMatchKey, X as skipToken, a as companionViewQuery, at as useNavigate, b as studioFetch, c as pluginAttentionQuery, it as Link, k as queryOptions, l as reportsQuery, m as vaultQuery, n as afterRefresh, nt as createFileRoute, ot as useParams, q as resolveQueryValue, rt as createRootRouteWithContext, s as holdShellForMode, t as afterEvent, tt as lazyRouteComponent, u as shellQuery, v as getShell, w as STUDIO_EVENTS_ROUTE, x as probeStudio, y as createSsrRpc } from "./studio-queries-CeFfmIuM.js";
3
+ import { a as Query, c as onlineManager, d as Subscribable, f as QueryClientProvider, i as QueryObserver, l as notifyManager, n as useBaseQuery, p as useQueryClient, r as defaultThrowOnError, t as cn, u as focusManager } from "./cn-B0fl6NWK.js";
4
+ import { $ as resolveQueryValue, A as STUDIO_EVENTS_ROUTE, C as studioFetch, F as queryOptions, H as hashKey, J as matchQuery, M as TERMINAL_SESSIONS_ROUTE, N as TERMINAL_SOCKET_ROUTE, P as TERMINAL_WASM, Q as replaceEqualDeep, S as createSsrRpc, T as CHAT_CREDENTIAL_ROUTE, U as hashQueryKeyByOptions, V as functionalUpdate, X as partialMatchKey, Y as noop, c as holdShellForMode, ct as createFileRoute, d as shellQuery, dt as useNavigate, ft as useParams, g as workQuery, h as vaultQuery, j as TERMINAL_SESSIONS_END_ROUTE, l as pluginAttentionQuery, lt as createRootRouteWithContext, n as afterRefresh, nt as skipToken, o as companionViewQuery, q as matchMutation, st as lazyRouteComponent, t as afterEvent, u as reportsQuery, ut as Link, w as probeStudio, x as getShell } from "./studio-queries-ur1ygXi3.js";
5
5
  import { r as redirect } from "./redirect-BaZ_QyqF.js";
6
6
  import { a as useMatches, c as appendUniqueUserTags, d as resolveManifestCssLink, i as require_react_dom, l as getAssetCrossOrigin, n as createServerFn, o as Outlet, s as useHydrated, u as getScriptPreloadAttrs } from "../server.js";
7
7
  import { s as escapeHtml } from "./utils-C9CX1kcy.js";
8
- import { D as SHARED_VIEWS, E as MODE_VIEWS, N as viewsFor, O as STUDIO_MODES, S as COMPANION_DIGEST_PATTERN, g as MARK_STATES, i as stepStage, n as LIGHT_PALETTE, p as defaultWorkflow, r as stagesBeforeWork, t as DARK_PALETTE } from "./studio-D79JzDLc.js";
9
- import { a as VAULT_TREE_STORAGE_KEY, i as THEME_STORAGE_KEY, n as RAIL_STORAGE_KEY, r as STUDIO_PREPAINT_SCRIPT, t as COMPANION_STORAGE_KEY } from "./prepaint-BEHwKl51.js";
10
- import { n as loadView, r as registeredCompanion, t as loadHeld } from "./queries-D6Vq0AuZ.js";
8
+ import { A as STUDIO_MODES, F as viewsFor, T as COMPANION_DIGEST_PATTERN, a as LIGHT_PALETTE, g as defaultWorkflow, i as DARK_PALETTE, k as SHARED_VIEWS, o as stagesBeforeWork, s as stepStage, y as MARK_STATES } from "./studio-qzH-UETC.js";
9
+ import { a as VAULT_TREE_STORAGE_KEY, i as THEME_STORAGE_KEY, n as RAIL_STORAGE_KEY, r as STUDIO_PREPAINT_SCRIPT, t as COMPANION_STORAGE_KEY } from "./prepaint-BB3dwSmz.js";
10
+ import { n as loadView, r as registeredCompanion, t as loadHeld } from "./queries-BwiDxQy5.js";
11
11
  import { t as formatCollectedAt } from "./model-PyPALjii.js";
12
- import { a as FRICTION_VIEW_DAYS, i as validateStudioSearch, n as oneOf, o as frictionViewDays, r as validateSpecsSearch, t as canonicalHref } from "./search-DKeJRvg8.js";
13
- import { t as create } from "./react-CiBZPDs8.js";
14
- import { A as useFloatingParentNodeId, An as android, Ar as NOOP, At as clamp, B as FocusGuard, Bn as imperativeAction, Bt as getOppositeAxisPlacements, C as useAnimationsFinished, Cn as activeElement, Cr as isTableElement, Ct as getGridNavigatedIndex, D as FloatingNode, Dr as mergeProps, En as getTarget, Er as useRenderElement, F as CLICK_TRIGGER_IDENTIFIER, Ft as getAlignmentAxis, G as useValueAsRef, Gn as keyboard, Gt as max, H as visuallyHiddenInput, Hn as inputClear, Ht as getPaddingObject, I as DISABLED_TRANSITIONS_STYLE, In as closePress, Ir as useControlled, It as getAlignmentSides, J as Timeout, Jt as round, K as mergeCleanups, Kt as min, Ln as disabled, Lr as useQuery, Lt as getAxisLength, M as FloatingPortal, Mn as mac, Mr as useMergedRefs, Mt as evaluate, N as useFloatingPortalNode, Nr as useRefWithInit, Nt as floor, O as FloatingTree, On as gecko, Or as EMPTY_ARRAY, Ot as isIndexOutOfListBounds, Pn as CompositeList, Pr as useBaseUiId, Pt as getAlignment, Q as fastComponentRef, Qn as triggerPress, Qt as stopEvent, R as POPUP_COLLISION_AVOIDANCE, Rn as escapeKey, Rt as getExpandedPlacements, S as useOpenChangeComplete, T as useDismiss, Tn as contains, Tr as isWebKit, Un as inputPress, Ut as getSide, V as visuallyHidden, Vn as inputChange, Vt as getOppositePlacement, Wn as itemPress, Wt as getSideAxis, X as useOnMount, Xn as triggerFocus, Y as useTimeout, Yn as pointer, Yt as isMouseLikePointerType, Z as fastComponent, Zn as triggerHover, _ as usePopupInteractionProps, _r as isContainingBlock, a as ReactStore, an as isTypeableElement, ar as formatErrorMessage, at as PageHeader, b as useTriggerDataForwarding, br as isLastTraversableNode, bt as isOutsideEvent, c as PopupTriggerMap, cn as popupStateMapping, cr as getComputedStyle$1, d as applyPopupOpenChange, dn as triggerOpenStateMapping, dr as getFrameElement, dt as ToggleGroup, en as getNodeChildren, er as createChangeEventDetails, f as attachPreventUnmountOnClose, fr as getNodeName, ft as ToggleGroupItem, g as useOpenStateTransitions, gr as getWindow, h as useImplicitActiveTrigger, hr as getParentNode, ht as COMPOSITE_KEYS, ir as ownerDocument, j as useFloatingTree, jn as ios, jt as createCoords, k as useFloatingNodeId, kn as webkit, kr as EMPTY_OBJECT, l as FOCUSABLE_POPUP_PROPS, ln as popupTransitionStateMapping, lr as getContainingBlock, lt as StatusWord, m as createPopupOpenState, mr as getOverflowAncestors, mt as useDirection, nn as isInteractiveElement, nr as useCompositeListItem, on as matchesFocusVisible, or as useIsoLayoutEffect, p as createDefaultInitialFocus, pr as getNodeScroll, pt as useToolbarRootContext, q as addEventListener, qn as none, qt as rectToClientRect, r as Icon, rn as isTargetInsideEnabledTrigger, rr as useButton, rt as ListCard, s as require_shim, sn as triggerDisabled, sr as useStableCallback, t as Button, tr as createGenericEventDetails, tt as Count, u as PopupHandleAttachment, un as pressableTriggerOpenStateMapping, ur as getDocumentElement, v as usePopupRootStore, vn as transitionStatusMapping, vr as isElement, wn as closest, wr as isTopLayer, x as useUnmountAfterClose, xr as isOverflowElement, y as usePopupRootSync, yr as isHTMLElement, yt as getTabbableNearElement, z as createAttribute, zn as focusOut, zt as getOppositeAxis } from "./button-Ct_WeYLc.js";
15
- import { _ as inertValue, a as InternalBackdrop, c as useLabelableId, d as useRegisterFieldControl, f as DEFAULT_FIELD_ROOT_CONTEXT, g as fieldValidityMapping, h as DEFAULT_FIELD_STATE_ATTRIBUTES, i as useScrollLock, l as useLabelableContext, m as useFieldRootContext, n as Kbd, o as useSetFieldFocused, p as FieldRootContext, r as Separator, s as useValueChanged, t as Input, u as useFormContext, v as FloatingFocusManager } from "./fields-VytPpqBq.js";
16
- import { n as Mutation, t as useMutation } from "./useMutation-DnWK0PhO.js";
17
- import "./__23tanstack-start-server-fn-resolver-CS3QRY4Q.js";
18
- import { t as getGuide } from "./guides-_G8Vucsk.js";
19
- import { n as popupStoreSelectors, t as createInitialPopupStoreState } from "./store-Dg9T7oWs.js";
20
- import { S as useClick, _ as resolveSelectedIndex, a as hasNullItemLabel, b as useListNavigation, d as compareItemEquality, f as defaultItemEquality, g as removeItem, h as isSelectedValueDirty, i as flattenLeafItems, l as stringifyAsLabel, m as findSelectionIndex, n as useOpenInteractionType, o as isGroupedItems, p as findItemIndex, r as useOpenMethodTriggerProps, t as useAnchoredPopupScrollLock, u as stringifyAsValue, v as selectedValueIncludes, x as useFloatingRootContext, y as useOnFirstRender } from "./useAnchoredPopupScrollLock-ciS_sEq3.js";
12
+ import { a as validateSpecsSearch, c as frictionViewDays, i as stringifyStudioSearch, n as oneOf, o as validateStudioSearch, r as parseStudioSearch, s as FRICTION_VIEW_DAYS, t as canonicalHref } from "./search-bltT7gwy.js";
13
+ import { t as create } from "./react-B2cLiz-i.js";
14
+ import { $n as triggerHover, A as useFloatingParentNodeId, An as gecko, At as clamp, B as FocusGuard, Bn as escapeKey, Bt as getOppositeAxisPlacements, C as useAnimationsFinished, Cr as isOverflowElement, Ct as getGridNavigatedIndex, D as FloatingNode, Dn as contains, Dr as isWebKit, En as closest, Er as isTopLayer, F as CLICK_TRIGGER_IDENTIFIER, Fr as useMergedRefs, Ft as getAlignmentAxis, G as useValueAsRef, Gn as inputPress, Gt as max, H as visuallyHiddenInput, Hn as imperativeAction, Ht as getPaddingObject, I as DISABLED_TRANSITIONS_STYLE, In as CompositeList, Ir as useRefWithInit, It as getAlignmentSides, J as Timeout, Jt as round, K as mergeCleanups, Kn as itemPress, Kt as min, Lr as useBaseUiId, Lt as getAxisLength, M as FloatingPortal, Mn as android, Mr as EMPTY_OBJECT, Mt as evaluate, N as useFloatingPortalNode, Nn as ios, Nr as NOOP, Nt as floor, O as FloatingTree, On as getTarget, Or as useRenderElement, Ot as isIndexOutOfListBounds, Pn as mac, Pt as getAlignment, Q as fastComponentRef, Qn as triggerFocus, Qt as stopEvent, R as POPUP_COLLISION_AVOIDANCE, Rn as closePress, Rt as getExpandedPlacements, S as useOpenChangeComplete, Sr as isLastTraversableNode, T as useDismiss, Tn as activeElement, Tr as isTableElement, Un as inputChange, Ut as getSide, V as visuallyHidden, Vn as focusOut, Vt as getOppositePlacement, Wn as inputClear, Wt as getSideAxis, X as useOnMount, Y as useTimeout, Yn as none, Yt as isMouseLikePointerType, Z as fastComponent, Zn as pointer, _ as usePopupInteractionProps, _r as getParentNode, a as ReactStore, an as isTypeableElement, ar as useButton, at as PageHeader, b as useTriggerDataForwarding, br as isElement, bt as isOutsideEvent, c as PopupTriggerMap, cn as popupStateMapping, cr as useIsoLayoutEffect, d as applyPopupOpenChange, dn as triggerOpenStateMapping, dr as getContainingBlock, dt as ToggleGroup, en as getNodeChildren, er as triggerPress, f as attachPreventUnmountOnClose, fr as getDocumentElement, ft as ToggleGroupItem, g as useOpenStateTransitions, gr as getOverflowAncestors, h as useImplicitActiveTrigger, hr as getNodeScroll, ht as COMPOSITE_KEYS, ir as useCompositeListItem, j as useFloatingTree, jn as webkit, jr as EMPTY_ARRAY, jt as createCoords, k as useFloatingNodeId, kr as mergeProps, l as FOCUSABLE_POPUP_PROPS, ln as popupTransitionStateMapping, lr as useStableCallback, lt as StatusWord, m as createPopupOpenState, mr as getNodeName, mt as useDirection, nn as isInteractiveElement, nr as createChangeEventDetails, on as matchesFocusVisible, or as ownerDocument, p as createDefaultInitialFocus, pr as getFrameElement, pt as useToolbarRootContext, q as addEventListener, qn as keyboard, qt as rectToClientRect, r as Icon, rn as isTargetInsideEnabledTrigger, rr as createGenericEventDetails, rt as ListCard, sn as triggerDisabled, sr as formatErrorMessage, t as Button, tt as Count, u as PopupHandleAttachment, un as pressableTriggerOpenStateMapping, ur as getComputedStyle$1, v as usePopupRootStore, vr as getWindow, x as useUnmountAfterClose, xr as isHTMLElement, y as usePopupRootSync, yr as isContainingBlock, yt as getTabbableNearElement, z as createAttribute, zn as disabled, zr as useControlled, zt as getOppositeAxis } from "./button-BqA1urbl.js";
15
+ import { _ as fieldValidityMapping, c as useValueChanged, d as useFormContext, f as useRegisterFieldControl, g as DEFAULT_FIELD_STATE_ATTRIBUTES, h as useFieldRootContext, l as useLabelableId, m as FieldRootContext, n as Kbd, o as InternalBackdrop, p as DEFAULT_FIELD_ROOT_CONTEXT, r as Separator, s as useSetFieldFocused, t as Input, u as useLabelableContext, v as inertValue, y as FloatingFocusManager } from "./fields-BMap2_Ju.js";
16
+ import { n as Mutation, t as useMutation } from "./useMutation-NjlA8oFY.js";
17
+ import "./__23tanstack-start-server-fn-resolver-Bli9bpSB.js";
18
+ import { t as getGuide } from "./guides-CA_EMG7E.js";
19
+ import { n as popupStoreSelectors, t as createInitialPopupStoreState } from "./store-X7yLPp7v.js";
20
+ import { t as usePopupHandleStore } from "./usePopupHandleStore-DEEXJYv0.js";
21
+ import { _ as useOnFirstRender, c as stringifyAsValue, d as findItemIndex, f as findSelectionIndex, g as selectedValueIncludes, h as resolveSelectedIndex, i as isGroupedItems, l as compareItemEquality, m as removeItem, n as flattenLeafItems, p as isSelectedValueDirty, r as hasNullItemLabel, s as stringifyAsLabel, t as useAnchoredPopupScrollLock, u as defaultItemEquality, v as useListNavigation, y as useFloatingRootContext } from "./useAnchoredPopupScrollLock-DLDmv6kM.js";
22
+ import { n as useOpenMethodTriggerProps, r as useClick, t as useOpenInteractionType } from "./useOpenInteractionType-CZYscfOb.js";
23
+ import { a as DialogClose$1, i as DialogPopup, n as DialogRoot, o as DialogBackdrop, r as DialogPortal, s as useDialogRootContext, t as DialogTitle$1 } from "./DialogTitle-DnKSl2V0.js";
21
24
  // ../../node_modules/.bun/@tanstack+router-core@1.171.39/node_modules/@tanstack/router-core/dist/esm/ssr/bodyScripts.js
22
25
  function getSsrBodyScriptParts(matches, manifest, nonce, routeScriptAttrs) {
23
26
  const assetMatches = _getAssetMatches(matches);
@@ -1783,6 +1786,10 @@ var QueryClient = class {
1783
1786
  this.#mutationCache.clear();
1784
1787
  }
1785
1788
  };
1789
+ // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/useQuery.js
1790
+ function useQuery(options, queryClient) {
1791
+ return useBaseQuery(options, QueryObserver, queryClient);
1792
+ }
1786
1793
  // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js
1787
1794
  /**
1788
1795
  * The options for `useSuspenseQuery` are the same as for `useQuery`, except for `throwOnError`, `enabled`, and
@@ -2098,12 +2105,118 @@ function setupRouterSsrQueryIntegration(opts) {
2098
2105
  });
2099
2106
  };
2100
2107
  }
2108
+ // ../mate-core/src/lib/workset/projection.ts
2109
+ var WORK_BUCKETS = [
2110
+ "scratchpad",
2111
+ "local",
2112
+ "remote"
2113
+ ];
2114
+ function isShared(presence) {
2115
+ return presence === "shared" || presence === "partial";
2116
+ }
2101
2117
  // ../mate-core/src/brand/svg.generated.ts
2102
2118
  var BRAND_SVGS = {
2103
2119
  symbolColor: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" width=\"256\" height=\"256\" role=\"img\" aria-labelledby=\"title\"><title id=\"title\">mate logo</title><g id=\"symbol\"><path fill=\"#1F2421\" d=\"M36 16H144V240H36A20 20 0 0 1 16 220V36A20 20 0 0 1 36 16Z\"/><path fill=\"#2E7D5B\" d=\"M160 16H220A20 20 0 0 1 240 36V80H160Z M160 96H240V160H160Z M160 176H240V220A20 20 0 0 1 220 240H160Z\"/></g></svg>",
2104
2120
  symbolOnDark: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" width=\"256\" height=\"256\" role=\"img\" aria-labelledby=\"title\"><title id=\"title\">mate logo</title><g id=\"symbol\"><path fill=\"#F4F0E8\" d=\"M36 16H144V240H36A20 20 0 0 1 16 220V36A20 20 0 0 1 36 16Z\"/><path fill=\"#7FD0A6\" d=\"M160 16H220A20 20 0 0 1 240 36V80H160Z M160 96H240V160H160Z M160 176H240V220A20 20 0 0 1 220 240H160Z\"/></g></svg>",
2105
2121
  favicon: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" width=\"256\" height=\"256\" role=\"img\" aria-labelledby=\"title\"><title id=\"title\">mate logo</title><rect width=\"256\" height=\"256\" rx=\"48\" fill=\"#1F2421\"/><g id=\"symbol\" transform=\"translate(32 32) scale(0.75)\"><path fill=\"#F4F0E8\" d=\"M36 16H144V240H36A20 20 0 0 1 16 220V36A20 20 0 0 1 36 16Z\"/><path fill=\"#7FD0A6\" d=\"M160 16H220A20 20 0 0 1 240 36V80H160Z M160 96H240V160H160Z M160 176H240V220A20 20 0 0 1 220 240H160Z\"/></g></svg>"
2106
2122
  };
2123
+ // ../mate-core/src/lib/studio-chat/agent.ts
2124
+ var CHAT_NO_CREDENTIAL = "Studio Chat has no Claude credential";
2125
+ var CHAT_CREDENTIAL_REJECTED = "The chat credential was rejected";
2126
+ var CHAT_NO_LOGIN = "Claude Code has no local login on this machine";
2127
+ function isCredentialFailure(text) {
2128
+ return [
2129
+ CHAT_NO_CREDENTIAL,
2130
+ CHAT_CREDENTIAL_REJECTED,
2131
+ CHAT_NO_LOGIN
2132
+ ].some((start) => text.startsWith(start));
2133
+ }
2134
+ /** Each harness's models; the first is its default. */
2135
+ var CHAT_MODELS = {
2136
+ "claude-code": [
2137
+ {
2138
+ id: "sonnet",
2139
+ name: "Sonnet",
2140
+ description: "Careful answers at a good pace"
2141
+ },
2142
+ {
2143
+ id: "opus",
2144
+ name: "Opus",
2145
+ description: "Most capable, for hard questions; slower"
2146
+ },
2147
+ {
2148
+ id: "haiku",
2149
+ name: "Haiku",
2150
+ description: "Fastest, for quick lookups",
2151
+ effortless: true
2152
+ }
2153
+ ],
2154
+ opencode: [
2155
+ {
2156
+ id: "anthropic/claude-sonnet-5-5",
2157
+ name: "Claude Sonnet 5.5",
2158
+ description: "Anthropic, with ANTHROPIC_API_KEY"
2159
+ },
2160
+ {
2161
+ id: "anthropic/claude-opus-5-5",
2162
+ name: "Claude Opus 5.5",
2163
+ description: "Anthropic's most capable; slower"
2164
+ },
2165
+ {
2166
+ id: "openai/gpt-6.1-sol",
2167
+ name: "GPT-6.1 Sol",
2168
+ description: "OpenAI, with OPENAI_API_KEY or an OpenCode login"
2169
+ },
2170
+ {
2171
+ id: "google/gemini-3.8-flash",
2172
+ name: "Gemini 3.8 Flash",
2173
+ description: "Google, with GOOGLE_GENERATIVE_AI_API_KEY"
2174
+ }
2175
+ ]
2176
+ };
2177
+ function chatModel(harness, id) {
2178
+ return CHAT_MODELS[harness].find((model) => model.id === id);
2179
+ }
2180
+ /** Thinking effort a turn can ask for; the middle one is the default. */
2181
+ var CHAT_EFFORTS = [
2182
+ "low",
2183
+ "medium",
2184
+ "high"
2185
+ ];
2186
+ /** Characters of earlier turns replayed into a prompt; the newest are kept. */
2187
+ var CHAT_HISTORY_BUDGET = 4e4;
2188
+ var CUT_MARK = "[…] ";
2189
+ function messageText(message) {
2190
+ return message.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join("\n").trim();
2191
+ }
2192
+ /** Characters of `messages` the next question replays, out of `CHAT_HISTORY_BUDGET`. */
2193
+ function replayedChars(messages) {
2194
+ return keptHistory(messages, CHAT_HISTORY_BUDGET).reduce((sum, entry) => sum + entry.length, 0);
2195
+ }
2196
+ function keptHistory(history, budget) {
2197
+ const kept = [];
2198
+ let used = 0;
2199
+ for (const message of history.toReversed()) {
2200
+ if (message.role !== "user" && message.role !== "assistant") continue;
2201
+ const text = messageText(message);
2202
+ if (!text) continue;
2203
+ const label = `${message.role === "user" ? "User" : "Assistant"}: `;
2204
+ const entry = `${label}${text}`;
2205
+ if (used + entry.length > budget) {
2206
+ const room = budget - used - label.length - 4;
2207
+ if (room > 0) kept.push(`${label}${CUT_MARK}${text.slice(-room)}`);
2208
+ break;
2209
+ }
2210
+ kept.push(entry);
2211
+ used += entry.length;
2212
+ }
2213
+ return kept.toReversed();
2214
+ }
2215
+ // ../mate-core/src/lib/credential-kinds.ts
2216
+ var CREDENTIAL_KIND_LABELS = {
2217
+ subscription: "Claude subscription token",
2218
+ "api-key": "Anthropic API key"
2219
+ };
2107
2220
  // src/styles/palette.ts
2108
2221
  /** Each of these also gets a `--<name>-soft` tint: this share of the colour over the card surface. */
2109
2222
  var TINTED_TOKENS = [
@@ -2183,9 +2296,12 @@ ${declarations(STUDIO_LIGHT_PALETTE, " ")}
2183
2296
  /** The path each view is served at. */
2184
2297
  var VIEW_PATHS = {
2185
2298
  dashboard: "/",
2299
+ chat: "/chat",
2300
+ work: "/work",
2186
2301
  workflow: "/workflow",
2187
2302
  "getting-started": "/getting-started",
2188
2303
  skills: "/skills",
2304
+ mcp: "/mcp",
2189
2305
  vault: "/vault",
2190
2306
  specs: "/specs",
2191
2307
  reports: "/reports",
@@ -2196,9 +2312,12 @@ var VIEW_PATHS = {
2196
2312
  /** A view's page title is its navigation label. */
2197
2313
  var VIEW_TITLES = {
2198
2314
  dashboard: "Overview",
2315
+ chat: "Chat",
2316
+ work: "Work",
2199
2317
  workflow: "Workflow",
2200
2318
  "getting-started": "Getting Started",
2201
2319
  skills: "Skills",
2320
+ mcp: "MCP",
2202
2321
  vault: "Vault",
2203
2322
  specs: "Specs",
2204
2323
  reports: "Reports",
@@ -2219,9 +2338,12 @@ function viewAt(pathname) {
2219
2338
  var VIEW_DESCRIPTIONS = {
2220
2339
  engineering: {
2221
2340
  dashboard: "Changes in flight, grouped by what they need next.",
2341
+ chat: "Ask about this companion; answers come from its files.",
2342
+ work: "Your ideas and changes, and the team's shared work to pick up.",
2222
2343
  workflow: "The Delivery Path: every stage, its skill and where your changes are.",
2223
2344
  "getting-started": "Take your first change from an idea to delivery in your existing checkout.",
2224
2345
  skills: "The skills each agent can run in this companion.",
2346
+ mcp: "The MCP servers this companion gives its agents, per audience.",
2225
2347
  vault: "Every file in the Companion Repository.",
2226
2348
  specs: "Capabilities by Area, with their requirements.",
2227
2349
  reports: "Reports agents published for this companion.",
@@ -2231,9 +2353,12 @@ var VIEW_DESCRIPTIONS = {
2231
2353
  },
2232
2354
  analysis: {
2233
2355
  dashboard: "What shipped lately, and the specs it changed.",
2356
+ chat: "Ask about this companion; answers come from its files.",
2357
+ work: "Ideas, changes and shared work.",
2234
2358
  workflow: "The Delivery Path.",
2235
2359
  "getting-started": "Developer setup and isolated work.",
2236
2360
  skills: "Skills in this companion.",
2361
+ mcp: "MCP servers in this companion.",
2237
2362
  vault: "Every file in the Companion Repository.",
2238
2363
  specs: "Capabilities by Area, with their requirements.",
2239
2364
  reports: "Reports agents published for this companion.",
@@ -2243,7 +2368,7 @@ var VIEW_DESCRIPTIONS = {
2243
2368
  }
2244
2369
  };
2245
2370
  // src/styles/app.css?url
2246
- var app_default = "/assets/app-ggXJ_QVh.css";
2371
+ var app_default = "/assets/app-CG3vCgyA.css";
2247
2372
  // src/terminal/keys.ts
2248
2373
  /** Browser storage keys and sizes of the agent terminal, shared by the page and its scripts. */
2249
2374
  var TERMINAL_TAB_KEY = "mate-studio-terminal-tab";
@@ -2652,28 +2777,6 @@ function useClientPoint(store, props = {}) {
2652
2777
  trigger: reference
2653
2778
  } : {}, [enabled, reference]);
2654
2779
  }
2655
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs
2656
- var import_shim = require_shim();
2657
- /**
2658
- * Reads the store currently exposed by a popup handle and subscribes to store-pointer changes.
2659
- * Detached triggers use this to follow a handle as a root attaches or detaches: while no root is
2660
- * attached, the handle exposes its fallback store; once a root attaches, subscribers re-render and
2661
- * read from the live root store.
2662
- *
2663
- * Returns `undefined` when no handle is provided so callers can fall back to their root context.
2664
- *
2665
- * @param handle The popup handle to read from, or `undefined` when the trigger is not handle-bound.
2666
- */
2667
- function usePopupHandleStore(handle) {
2668
- const subscribe = import_react.useCallback((listener) => {
2669
- if (handle === void 0) return NOOP;
2670
- return handle.subscribeStore(listener);
2671
- }, [handle]);
2672
- const getSnapshot = import_react.useCallback(() => {
2673
- return handle === void 0 ? void 0 : handle.store;
2674
- }, [handle]);
2675
- return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore);
2676
- }
2677
2780
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
2678
2781
  var isMacSafari = mac && webkit;
2679
2782
  /**
@@ -4622,7 +4725,7 @@ var size = (options, deps) => {
4622
4725
  };
4623
4726
  };
4624
4727
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
4625
- var selectors$3 = {
4728
+ var selectors$2 = {
4626
4729
  ...popupStoreSelectors,
4627
4730
  disabled: (state) => state.disabled,
4628
4731
  instantType: (state) => state.instantType,
@@ -4646,7 +4749,7 @@ var selectors$3 = {
4646
4749
  var TooltipStore = class extends ReactStore {
4647
4750
  constructor(initialState, floatingId, nested) {
4648
4751
  const triggerElements = new PopupTriggerMap();
4649
- super(createInitialState$2(initialState, triggerElements, floatingId, nested), createInitialContext$2(triggerElements), selectors$3);
4752
+ super(createInitialState$1(initialState, triggerElements, floatingId, nested), createInitialContext$1(triggerElements), selectors$2);
4650
4753
  }
4651
4754
  setOpen = (nextOpen, eventDetails) => {
4652
4755
  applyPopupOpenChange(this, nextOpen, eventDetails, { extraState: { openChangeReason: eventDetails.reason } });
@@ -4655,7 +4758,7 @@ var TooltipStore = class extends ReactStore {
4655
4758
  this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(triggerPress, event));
4656
4759
  }
4657
4760
  };
4658
- function createInitialState$2(initialState, triggerElements, floatingId, nested = false) {
4761
+ function createInitialState$1(initialState, triggerElements, floatingId, nested = false) {
4659
4762
  return {
4660
4763
  ...createInitialPopupStoreState(triggerElements, floatingId, nested),
4661
4764
  disabled: false,
@@ -4670,7 +4773,7 @@ function createInitialState$2(initialState, triggerElements, floatingId, nested
4670
4773
  ...initialState
4671
4774
  };
4672
4775
  }
4673
- function createInitialContext$2(triggerElements) {
4776
+ function createInitialContext$1(triggerElements) {
4674
4777
  return {
4675
4778
  popupRef: /*#__PURE__*/ import_react.createRef(),
4676
4779
  onOpenChange: void 0,
@@ -5978,11 +6081,12 @@ var whenIdle = (run) => {
5978
6081
  * mode's companion views, the Vault's root listing and the Reports list, then each other
5979
6082
  * enabled mode's Overview, so no first visit waits.
5980
6083
  */
5981
- function usePrefetchViews(search, studioMode, enabledModes = []) {
6084
+ function usePrefetchViews(search, studioMode, offers, enabledModes = []) {
5982
6085
  const queryClient = useQueryClient();
5983
6086
  const router = useRouter();
5984
6087
  const { companion } = search;
5985
6088
  const requestedMode = search.studioMode;
6089
+ const chat = offers.chat === true;
5986
6090
  const otherModes = enabledModes.filter((mode) => mode !== studioMode).join(",");
5987
6091
  (0, import_react.useEffect)(() => {
5988
6092
  if (!companion) return;
@@ -5991,7 +6095,7 @@ function usePrefetchViews(search, studioMode, enabledModes = []) {
5991
6095
  companion,
5992
6096
  studioMode: requestedMode
5993
6097
  };
5994
- const offered = viewsFor(studioMode);
6098
+ const offered = viewsFor(studioMode, { chat });
5995
6099
  const load = async (options) => {
5996
6100
  if (stopped || queryClient.getQueryData(options.queryKey) !== void 0) return;
5997
6101
  await queryClient.query(options).catch(() => {});
@@ -6023,6 +6127,7 @@ function usePrefetchViews(search, studioMode, enabledModes = []) {
6023
6127
  companion,
6024
6128
  requestedMode,
6025
6129
  studioMode,
6130
+ chat,
6026
6131
  otherModes,
6027
6132
  queryClient,
6028
6133
  router
@@ -6145,7 +6250,7 @@ function useComboboxHasItemsContext() {
6145
6250
  * Non-reactive values shared with the combobox parts. Nothing here is observable through
6146
6251
  * `selectors`, so writing to a ref never notifies subscribers.
6147
6252
  */
6148
- var selectors$2 = {
6253
+ var selectors$1 = {
6149
6254
  id: (state) => state.id,
6150
6255
  labelId: (state) => state.labelId,
6151
6256
  items: (state) => state.items,
@@ -6565,7 +6670,7 @@ function AriaCombobox(props) {
6565
6670
  valuesRef,
6566
6671
  pointerDownItemRef,
6567
6672
  selectionEventRef
6568
- }, selectors$2);
6673
+ }, selectors$1);
6569
6674
  }).current;
6570
6675
  const fieldRawValue = selectionMode === "none" ? inputValue : selectedValue;
6571
6676
  const fieldStringValue = import_react.useMemo(() => {
@@ -8003,74 +8108,6 @@ var ComboboxEmpty = /*#__PURE__*/ import_react.forwardRef(function ComboboxEmpty
8003
8108
  }, elementProps]
8004
8109
  });
8005
8110
  });
8006
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/root/DialogRootContext.mjs
8007
- var DialogRootContext = /*#__PURE__*/ import_react.createContext(void 0);
8008
- function useDialogRootContext(optional) {
8009
- const store = import_react.useContext(DialogRootContext);
8010
- if (!optional && store === void 0) throw new Error(formatErrorMessage(27));
8011
- return store;
8012
- }
8013
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/backdrop/DialogBackdrop.mjs
8014
- /**
8015
- * An overlay displayed beneath the popup.
8016
- * Renders a `<div>` element.
8017
- *
8018
- * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
8019
- */
8020
- var DialogBackdrop = /*#__PURE__*/ import_react.forwardRef(function DialogBackdrop(componentProps, forwardedRef) {
8021
- const { render, className, style, forceRender = false, ...elementProps } = componentProps;
8022
- const store = useDialogRootContext();
8023
- const open = store.useState("open");
8024
- const nested = store.useState("nested");
8025
- const mounted = store.useState("mounted");
8026
- const state = {
8027
- open,
8028
- transitionStatus: store.useState("transitionStatus")
8029
- };
8030
- return useRenderElement("div", componentProps, {
8031
- state,
8032
- ref: [store.context.backdropRef, forwardedRef],
8033
- stateAttributesMapping: popupTransitionStateMapping,
8034
- props: [{
8035
- role: "presentation",
8036
- hidden: !mounted,
8037
- style: {
8038
- userSelect: "none",
8039
- WebkitUserSelect: "none"
8040
- }
8041
- }, elementProps],
8042
- enabled: forceRender || !nested
8043
- });
8044
- });
8045
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/close/DialogClose.mjs
8046
- /**
8047
- * A button that closes the dialog.
8048
- * Renders a `<button>` element.
8049
- *
8050
- * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
8051
- */
8052
- var DialogClose$1 = /*#__PURE__*/ import_react.forwardRef(function DialogClose(componentProps, forwardedRef) {
8053
- const { render, className, style, disabled = false, nativeButton = true, ...elementProps } = componentProps;
8054
- const store = useDialogRootContext();
8055
- const open = store.useState("open");
8056
- const { getButtonProps, buttonRef } = useButton({
8057
- disabled,
8058
- native: nativeButton
8059
- });
8060
- const state = { disabled };
8061
- function handleClick(event) {
8062
- if (open) store.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent));
8063
- }
8064
- return useRenderElement("button", componentProps, {
8065
- state,
8066
- ref: [forwardedRef, buttonRef],
8067
- props: [
8068
- { onClick: handleClick },
8069
- elementProps,
8070
- getButtonProps
8071
- ]
8072
- });
8073
- });
8074
8111
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/description/DialogDescription.mjs
8075
8112
  /**
8076
8113
  * A paragraph with additional information about the dialog.
@@ -8088,358 +8125,6 @@ var DialogDescription$1 = /*#__PURE__*/ import_react.forwardRef(function DialogD
8088
8125
  props: [{ id }, elementProps]
8089
8126
  });
8090
8127
  });
8091
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/portal/DialogPortalContext.mjs
8092
- var DialogPortalContext = /*#__PURE__*/ import_react.createContext(void 0);
8093
- function useDialogPortalContext() {
8094
- const value = import_react.useContext(DialogPortalContext);
8095
- if (value === void 0) throw new Error(formatErrorMessage(26));
8096
- return value;
8097
- }
8098
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/popup/DialogPopupCssVars.mjs
8099
- /**
8100
- * Indicates how many dialogs are nested within.
8101
- * @type {number}
8102
- */
8103
- var nestedDialogs = "--nested-dialogs";
8104
- /**
8105
- * Present when the dialog has other open dialogs nested within it.
8106
- */
8107
- var nestedDialogOpen = "data-nested-dialog-open";
8108
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/utils/stateAttributesMapping.mjs
8109
- /**
8110
- * Shared by `Dialog.Popup` and `Dialog.Viewport`, whose states have the same shape.
8111
- * `nested` is not mapped: unmapped `true` booleans already render as `data-nested`.
8112
- */
8113
- var dialogStateAttributesMapping = {
8114
- ...popupStateMapping,
8115
- ...transitionStatusMapping,
8116
- nestedDialogOpen(value) {
8117
- return value ? { [nestedDialogOpen]: "" } : null;
8118
- }
8119
- };
8120
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/popup/DialogPopup.mjs
8121
- /**
8122
- * A container for the dialog contents.
8123
- * Renders a `<div>` element.
8124
- *
8125
- * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
8126
- */
8127
- var DialogPopup = /*#__PURE__*/ import_react.forwardRef(function DialogPopup(componentProps, forwardedRef) {
8128
- const { render, className, style, finalFocus, initialFocus, ...elementProps } = componentProps;
8129
- const store = useDialogRootContext();
8130
- const descriptionElementId = store.useState("descriptionElementId");
8131
- const disablePointerDismissal = store.useState("disablePointerDismissal");
8132
- const floatingRootContext = store.useState("floatingRootContext");
8133
- const rootPopupProps = store.useState("popupProps");
8134
- const modal = store.useState("modal");
8135
- const mounted = store.useState("mounted");
8136
- const nested = store.useState("nested");
8137
- const nestedOpenDialogCount = store.useState("nestedOpenDialogCount");
8138
- const open = store.useState("open");
8139
- const openMethod = store.useState("openMethod");
8140
- const titleElementId = store.useState("titleElementId");
8141
- const transitionStatus = store.useState("transitionStatus");
8142
- const role = store.useState("role");
8143
- const floatingId = floatingRootContext.useState("floatingId");
8144
- useDialogPortalContext();
8145
- useOpenChangeComplete({
8146
- open,
8147
- ref: store.context.popupRef,
8148
- onComplete() {
8149
- if (open) store.context.onOpenChangeComplete?.(true);
8150
- }
8151
- });
8152
- const resolvedInitialFocus = initialFocus === void 0 ? createDefaultInitialFocus(store.context.popupRef) : initialFocus;
8153
- const nestedDialogOpen = nestedOpenDialogCount > 0;
8154
- const setPopupElement = store.useStateSetter("popupElement");
8155
- const element = useRenderElement("div", componentProps, {
8156
- state: {
8157
- open,
8158
- nested,
8159
- transitionStatus,
8160
- nestedDialogOpen
8161
- },
8162
- props: [
8163
- rootPopupProps,
8164
- {
8165
- id: floatingId,
8166
- "aria-labelledby": titleElementId,
8167
- "aria-describedby": descriptionElementId,
8168
- role,
8169
- ...FOCUSABLE_POPUP_PROPS,
8170
- hidden: !mounted,
8171
- onKeyDown(event) {
8172
- if (COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
8173
- },
8174
- style: { [nestedDialogs]: nestedOpenDialogCount }
8175
- },
8176
- elementProps
8177
- ],
8178
- ref: [
8179
- forwardedRef,
8180
- store.context.popupRef,
8181
- setPopupElement
8182
- ],
8183
- stateAttributesMapping: dialogStateAttributesMapping
8184
- });
8185
- return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FloatingFocusManager, {
8186
- context: floatingRootContext,
8187
- openInteractionType: openMethod,
8188
- disabled: !mounted,
8189
- closeOnFocusOut: !disablePointerDismissal,
8190
- initialFocus: resolvedInitialFocus,
8191
- returnFocus: finalFocus,
8192
- modal: modal !== false,
8193
- restoreFocus: "popup",
8194
- children: element
8195
- });
8196
- });
8197
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/portal/DialogPortal.mjs
8198
- /**
8199
- * A portal element that moves the popup to a different part of the DOM.
8200
- * By default, the portal element is appended to `<body>`.
8201
- * Renders a `<div>` element.
8202
- *
8203
- * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
8204
- */
8205
- var DialogPortal = /*#__PURE__*/ import_react.forwardRef(function DialogPortal(props, forwardedRef) {
8206
- const { keepMounted = false, ...portalProps } = props;
8207
- const store = useDialogRootContext();
8208
- const mounted = store.useState("mounted");
8209
- const modal = store.useState("modal");
8210
- const open = store.useState("open");
8211
- if (!(mounted || keepMounted)) return null;
8212
- return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(DialogPortalContext.Provider, {
8213
- value: keepMounted,
8214
- children: /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(FloatingPortal, {
8215
- ref: forwardedRef,
8216
- ...portalProps,
8217
- children: [mounted && modal === true && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(InternalBackdrop, {
8218
- ref: store.context.internalBackdropRef,
8219
- inert: inertValue(!open)
8220
- }), props.children]
8221
- })
8222
- });
8223
- });
8224
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/root/useDialogRoot.mjs
8225
- function DialogInteractions({ store, parentContext, isDrawer }) {
8226
- const open = store.useState("open");
8227
- const mounted = store.useState("mounted");
8228
- const disablePointerDismissal = store.useState("disablePointerDismissal");
8229
- const modal = store.useState("modal");
8230
- const popupElement = store.useState("popupElement");
8231
- const floatingRootContext = store.useState("floatingRootContext");
8232
- const [ownNestedOpenDialogs, setOwnNestedOpenDialogs] = import_react.useState(0);
8233
- const [ownNestedOpenDrawers, setOwnNestedOpenDrawers] = import_react.useState(0);
8234
- const isTopmost = ownNestedOpenDialogs === 0;
8235
- const dismiss = useDismiss(floatingRootContext, {
8236
- outsidePressEvent() {
8237
- if (store.context.internalBackdropRef.current || store.context.backdropRef.current) return "intentional";
8238
- return {
8239
- mouse: modal === "trap-focus" ? "sloppy" : "intentional",
8240
- touch: "sloppy"
8241
- };
8242
- },
8243
- outsidePress(event) {
8244
- if (!store.context.outsidePressEnabledRef.current) return false;
8245
- if ("button" in event && event.button !== 0) return false;
8246
- if ("touches" in event) {
8247
- if (event.type === "touchend") {
8248
- if (event.changedTouches.length !== 1 || event.touches.length !== 0) return false;
8249
- } else if (event.touches.length !== 1) return false;
8250
- }
8251
- const target = getTarget(event);
8252
- if (isTopmost && !disablePointerDismissal) {
8253
- if (modal) {
8254
- const internalBackdrop = store.context.internalBackdropRef.current;
8255
- const backdrop = store.context.backdropRef.current;
8256
- return internalBackdrop || backdrop ? internalBackdrop === target || backdrop === target || contains(target, popupElement) && !target?.hasAttribute("data-base-ui-portal") : true;
8257
- }
8258
- return true;
8259
- }
8260
- return false;
8261
- },
8262
- escapeKey: isTopmost
8263
- });
8264
- useScrollLock(open && modal === true, popupElement);
8265
- store.useContextCallback("onNestedDialogOpen", (dialogCount, drawerCount) => {
8266
- if (!store.select("open") && !store.select("mounted")) return;
8267
- setOwnNestedOpenDialogs(dialogCount);
8268
- setOwnNestedOpenDrawers(drawerCount);
8269
- });
8270
- useIsoLayoutEffect(() => {
8271
- if (!open && !mounted) {
8272
- setOwnNestedOpenDialogs(0);
8273
- setOwnNestedOpenDrawers(0);
8274
- }
8275
- }, [open, mounted]);
8276
- useIsoLayoutEffect(() => {
8277
- if (parentContext?.onNestedDialogOpen) {
8278
- if (open) parentContext.onNestedDialogOpen(ownNestedOpenDialogs + 1, ownNestedOpenDrawers + (isDrawer ? 1 : 0));
8279
- }
8280
- return () => {
8281
- if (parentContext?.onNestedDialogOpen && open) parentContext.onNestedDialogOpen(0, 0);
8282
- };
8283
- }, [
8284
- isDrawer,
8285
- open,
8286
- ownNestedOpenDialogs,
8287
- ownNestedOpenDrawers,
8288
- parentContext
8289
- ]);
8290
- usePopupInteractionProps(store, {
8291
- activeTriggerProps: dismiss.reference,
8292
- inactiveTriggerProps: dismiss.trigger,
8293
- popupProps: dismiss.floating,
8294
- nestedOpenDialogCount: ownNestedOpenDialogs,
8295
- nestedOpenDrawerCount: ownNestedOpenDrawers
8296
- });
8297
- return null;
8298
- }
8299
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/store/DialogStore.mjs
8300
- var selectors$1 = {
8301
- ...popupStoreSelectors,
8302
- modal: (state) => state.modal,
8303
- nested: (state) => state.nested,
8304
- nestedOpenDialogCount: (state) => state.nestedOpenDialogCount,
8305
- nestedOpenDrawerCount: (state) => state.nestedOpenDrawerCount,
8306
- disablePointerDismissal: (state) => state.disablePointerDismissal,
8307
- openMethod: (state) => state.openMethod,
8308
- descriptionElementId: (state) => state.descriptionElementId,
8309
- titleElementId: (state) => state.titleElementId,
8310
- viewportElement: (state) => state.viewportElement,
8311
- role: (state) => state.role
8312
- };
8313
- /**
8314
- * The subset of `DialogStore` that detached handle-backed triggers rely on. Both the real
8315
- * `DialogStore` and the inert fallback store satisfy it, so a trigger can read from whichever
8316
- * store the handle currently exposes.
8317
- */
8318
- var DialogStore = class extends ReactStore {
8319
- constructor(initialState, floatingId, nested) {
8320
- const triggerElements = new PopupTriggerMap();
8321
- const state = createInitialState$1(initialState, triggerElements, floatingId, nested);
8322
- super(state, createInitialContext$1(triggerElements), selectors$1);
8323
- }
8324
- setOpen = (nextOpen, eventDetails) => {
8325
- eventDetails.preventUnmountOnClose = () => {
8326
- this.set("preventUnmountingOnClose", true);
8327
- };
8328
- if (!nextOpen && eventDetails.trigger == null && this.state.activeTriggerId != null) eventDetails.trigger = this.state.activeTriggerElement ?? void 0;
8329
- this.context.onOpenChange?.(nextOpen, eventDetails);
8330
- if (eventDetails.isCanceled) return;
8331
- this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
8332
- this.update(createPopupOpenState(this.state, nextOpen, eventDetails.trigger));
8333
- };
8334
- };
8335
- function createInitialState$1(initialState, triggerElements, floatingId, nested = false) {
8336
- return {
8337
- ...createInitialPopupStoreState(triggerElements, floatingId, nested),
8338
- modal: true,
8339
- disablePointerDismissal: false,
8340
- viewportElement: null,
8341
- descriptionElementId: void 0,
8342
- titleElementId: void 0,
8343
- openMethod: null,
8344
- nested: false,
8345
- nestedOpenDialogCount: 0,
8346
- nestedOpenDrawerCount: 0,
8347
- role: "dialog",
8348
- ...initialState
8349
- };
8350
- }
8351
- function createInitialContext$1(triggerElements) {
8352
- return {
8353
- popupRef: /*#__PURE__*/ import_react.createRef(),
8354
- backdropRef: /*#__PURE__*/ import_react.createRef(),
8355
- internalBackdropRef: /*#__PURE__*/ import_react.createRef(),
8356
- outsidePressEnabledRef: { current: true },
8357
- triggerElements,
8358
- onOpenChange: void 0,
8359
- onOpenChangeComplete: void 0
8360
- };
8361
- }
8362
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/root/useRenderDialogRoot.mjs
8363
- function useRenderDialogRoot(mode, props) {
8364
- const { children, open: openProp, defaultOpen = false, onOpenChange, onOpenChangeComplete, disablePointerDismissal: disablePointerDismissalProp = false, modal: modalProp = true, actionsRef, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null } = props;
8365
- const isDrawer = mode === "drawer";
8366
- const isAlertDialog = mode === "alert-dialog";
8367
- const modal = isAlertDialog ? true : modalProp;
8368
- const disablePointerDismissal = isAlertDialog || disablePointerDismissalProp;
8369
- const role = isAlertDialog ? "alertdialog" : "dialog";
8370
- const parentStore = useDialogRootContext(true);
8371
- const rootState = {
8372
- modal,
8373
- disablePointerDismissal,
8374
- nested: parentStore != null,
8375
- role
8376
- };
8377
- const store = usePopupRootStore((floatingId, floatingNested) => new DialogStore({
8378
- open: defaultOpen,
8379
- openProp,
8380
- activeTriggerId: defaultTriggerIdProp,
8381
- triggerIdProp,
8382
- ...rootState
8383
- }, floatingId, floatingNested), true);
8384
- store.useControlledProp("openProp", openProp);
8385
- store.useControlledProp("triggerIdProp", triggerIdProp);
8386
- store.useSyncedValues(rootState);
8387
- store.useContextCallback("onOpenChange", onOpenChange);
8388
- store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
8389
- const open = store.useState("open");
8390
- const mounted = store.useState("mounted");
8391
- const payload = store.useState("payload");
8392
- usePopupRootSync(store, open);
8393
- useImplicitActiveTrigger(store);
8394
- const { forceUnmount } = useOpenStateTransitions(open, store);
8395
- import_react.useImperativeHandle(actionsRef, () => ({
8396
- unmount: forceUnmount,
8397
- close: () => store.setOpen(false, createChangeEventDetails(imperativeAction))
8398
- }), [forceUnmount, store]);
8399
- const shouldRenderInteractions = open || mounted || handle != null;
8400
- return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(DialogRootContext.Provider, {
8401
- value: store,
8402
- children: [
8403
- handle && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(PopupHandleAttachment, {
8404
- handle,
8405
- store
8406
- }),
8407
- shouldRenderInteractions && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(DialogInteractions, {
8408
- store,
8409
- parentContext: parentStore?.context,
8410
- isDrawer
8411
- }),
8412
- typeof children === "function" ? children({ payload }) : children
8413
- ]
8414
- });
8415
- }
8416
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/root/DialogRoot.mjs
8417
- /**
8418
- * Groups all parts of the dialog.
8419
- * Doesn't render its own HTML element.
8420
- *
8421
- * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
8422
- */
8423
- var DialogRoot = fastComponent(function DialogRoot(props) {
8424
- return useRenderDialogRoot("dialog", props);
8425
- });
8426
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/dialog/title/DialogTitle.mjs
8427
- /**
8428
- * A heading that labels the dialog.
8429
- * Renders an `<h2>` element.
8430
- *
8431
- * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
8432
- */
8433
- var DialogTitle$1 = /*#__PURE__*/ import_react.forwardRef(function DialogTitle(componentProps, forwardedRef) {
8434
- const { render, className, style, id: idProp, ...elementProps } = componentProps;
8435
- const store = useDialogRootContext();
8436
- const id = useBaseUiId(idProp);
8437
- store.useSyncedValueWithCleanup("titleElementId", id);
8438
- return useRenderElement("h2", componentProps, {
8439
- ref: forwardedRef,
8440
- props: [{ id }, elementProps]
8441
- });
8442
- });
8443
8128
  fastComponentRef(function DialogTrigger(componentProps, forwardedRef) {
8444
8129
  const { render, className, style, disabled = false, nativeButton = true, id: idProp, payload, handle, ...elementProps } = componentProps;
8445
8130
  const dialogRootStore = useDialogRootContext(true);
@@ -8669,8 +8354,11 @@ function useMediaQuery(query) {
8669
8354
  /** Navigation order; core decides which views a mode offers. */
8670
8355
  var MODE_ORDER = [
8671
8356
  "dashboard",
8357
+ "chat",
8358
+ "work",
8672
8359
  "workflow",
8673
8360
  "skills",
8361
+ "mcp",
8674
8362
  "getting-started"
8675
8363
  ];
8676
8364
  var LIBRARY_ORDER = [
@@ -8685,9 +8373,12 @@ var INSIGHTS_ORDER = [
8685
8373
  ];
8686
8374
  var VIEW_ICONS = {
8687
8375
  dashboard: "home",
8376
+ chat: "chat",
8377
+ work: "tray",
8688
8378
  workflow: "flow",
8689
8379
  "getting-started": "doc",
8690
8380
  skills: "spark",
8381
+ mcp: "plug",
8691
8382
  specs: "doc",
8692
8383
  vault: "folder",
8693
8384
  reports: "chart",
@@ -8701,8 +8392,8 @@ function inOrder(views, order) {
8701
8392
  return views.toSorted((a, b) => rank(a) - rank(b));
8702
8393
  }
8703
8394
  /** The views a mode lists, in navigation order. */
8704
- function modeViews(mode) {
8705
- return inOrder(MODE_VIEWS[mode], MODE_ORDER);
8395
+ function modeViews(mode, chat = false) {
8396
+ return inOrder(viewsFor(mode, { chat }).filter((view) => !SHARED_VIEWS.includes(view)), MODE_ORDER);
8706
8397
  }
8707
8398
  function libraryViews() {
8708
8399
  return inOrder(SHARED_VIEWS.filter((view) => !INSIGHTS_ORDER.includes(view)), LIBRARY_ORDER);
@@ -8785,7 +8476,7 @@ function useCommands(shell, search, open) {
8785
8476
  }
8786
8477
  });
8787
8478
  const views = [
8788
- ...modeViews(shell.studioMode),
8479
+ ...modeViews(shell.studioMode, shell.chat),
8789
8480
  ...libraryViews(),
8790
8481
  ...insightViews()
8791
8482
  ].map((view) => ({
@@ -9770,22 +9461,6 @@ function RecordingReach() {
9770
9461
  children: "Applies to all companions on the machine that runs Studio."
9771
9462
  });
9772
9463
  }
9773
- /** A successful Retry removes itself; focus then goes to the recording button. */
9774
- function useRetryFocus(isSuccess) {
9775
- const button = (0, import_react.useRef)(null);
9776
- const retried = (0, import_react.useRef)(false);
9777
- (0, import_react.useEffect)(() => {
9778
- if (!isSuccess || !retried.current) return;
9779
- retried.current = false;
9780
- button.current?.focus();
9781
- }, [isSuccess]);
9782
- return {
9783
- button,
9784
- retried: () => {
9785
- retried.current = true;
9786
- }
9787
- };
9788
- }
9789
9464
  /** With `recording` unknown, the button is disabled and claims neither state. */
9790
9465
  function RecordingButton({ recording, toggle, ref }) {
9791
9466
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
@@ -9833,14 +9508,14 @@ function validateMarkInput(input) {
9833
9508
  }
9834
9509
  var markFriction = createServerFn({ method: "POST" }).validator(validateMarkInput).handler(createSsrRpc("e257827a07a72fbb27ff303a6d721f51ae699f21ddaaa8fb7b1f33203d573c56"));
9835
9510
  // src/lib/friction-query.ts
9836
- var SCOPE = "friction";
9511
+ var SCOPE$1 = "friction";
9837
9512
  var MACHINE_WIDE = "machine";
9838
9513
  var frictionKey = (owner, ...rest) => [
9839
9514
  owner,
9840
- SCOPE,
9515
+ SCOPE$1,
9841
9516
  ...rest
9842
9517
  ];
9843
- var isFrictionQuery = ({ queryKey: [, scope] }) => scope === SCOPE;
9518
+ var isFrictionQuery = ({ queryKey: [, scope] }) => scope === SCOPE$1;
9844
9519
  var frictionQuery = (companion, days) => queryOptions({
9845
9520
  queryKey: frictionKey(companion, days),
9846
9521
  queryFn: () => getFriction({ data: {
@@ -9856,7 +9531,7 @@ var frictionRecordingQuery = queryOptions({
9856
9531
  retry: false,
9857
9532
  refetchOnWindowFocus: false
9858
9533
  });
9859
- var RECORDING_CHANGE = [SCOPE, "set-recording"];
9534
+ var RECORDING_CHANGE = [SCOPE$1, "set-recording"];
9860
9535
  function useSetFrictionRecording() {
9861
9536
  const client = useQueryClient();
9862
9537
  const pending = useIsMutating({ mutationKey: RECORDING_CHANGE }) > 0;
@@ -9881,7 +9556,7 @@ function useSetFrictionRecording() {
9881
9556
  function useMarkFriction() {
9882
9557
  const client = useQueryClient();
9883
9558
  return useMutation({
9884
- mutationKey: [SCOPE, "mark"],
9559
+ mutationKey: [SCOPE$1, "mark"],
9885
9560
  mutationFn: (mark) => markFriction({ data: mark }),
9886
9561
  onSuccess: async (result) => {
9887
9562
  if (!result.ok) return;
@@ -9890,6 +9565,26 @@ function useMarkFriction() {
9890
9565
  }
9891
9566
  }).mutateAsync;
9892
9567
  }
9568
+ // src/lib/use-retry-focus.ts
9569
+ /**
9570
+ * A successful Retry removes itself; focus then goes to `target`, or without one to the control
9571
+ * `button` points at.
9572
+ */
9573
+ function useRetryFocus(isSuccess, target) {
9574
+ const button = (0, import_react.useRef)(null);
9575
+ const retried = (0, import_react.useRef)(false);
9576
+ (0, import_react.useEffect)(() => {
9577
+ if (!isSuccess || !retried.current) return;
9578
+ retried.current = false;
9579
+ (target ?? button).current?.focus();
9580
+ }, [isSuccess, target]);
9581
+ return {
9582
+ button,
9583
+ retried: () => {
9584
+ retried.current = true;
9585
+ }
9586
+ };
9587
+ }
9893
9588
  // src/lib/use-browser.ts
9894
9589
  var subscribe$1 = () => () => {};
9895
9590
  /**
@@ -10446,6 +10141,467 @@ function ViewPlaceholder() {
10446
10141
  ]
10447
10142
  });
10448
10143
  }
10144
+ // src/components/ui/sheet.tsx
10145
+ function Sheet(props) {
10146
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogRoot, {
10147
+ "data-slot": "sheet",
10148
+ ...props
10149
+ });
10150
+ }
10151
+ var SheetClose = DialogClose$1;
10152
+ /** A panel floating over the page from the right edge; it alone casts the floating shadow. */
10153
+ function SheetContent({ className, wide = false, ...props }) {
10154
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogBackdrop, {
10155
+ "data-slot": "sheet-overlay",
10156
+ className: "fixed inset-0 z-30 bg-[color-mix(in_srgb,var(--bg)_45%,transparent)] transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0"
10157
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPopup, {
10158
+ "data-slot": "sheet-content",
10159
+ "data-wide": wide ? "" : void 0,
10160
+ className: cn("fixed top-2 right-2 bottom-2 z-30 flex w-[min(560px,calc(100vw-16px))] flex-col overflow-hidden rounded-panel border border-rule bg-surface text-text shadow-float outline-none transition-[transform,width] duration-250 ease-[cubic-bezier(.16,1,.3,1)] data-ending-style:translate-x-[calc(100%+16px)] data-starting-style:translate-x-[calc(100%+16px)] data-wide:w-[min(760px,calc(100vw-16px))]", className),
10161
+ ...props
10162
+ })] });
10163
+ }
10164
+ function SheetTitle({ className, ...props }) {
10165
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle$1, {
10166
+ "data-slot": "sheet-title",
10167
+ className: cn("m-0 text-lg font-semibold break-words", className),
10168
+ ...props
10169
+ });
10170
+ }
10171
+ // src/components/credential-sheet.tsx
10172
+ var SETUP_TOKEN_STEPS = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ol", {
10173
+ className: "note agents-steps",
10174
+ children: [
10175
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
10176
+ "In a terminal on your own machine, run ",
10177
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: "claude setup-token" }),
10178
+ "."
10179
+ ] }),
10180
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "Sign in with your Claude account in the browser it opens." }),
10181
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { children: [
10182
+ "Paste the token it prints below. It starts with ",
10183
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: "sk-ant-oat" }),
10184
+ " and is valid for a year."
10185
+ ] })
10186
+ ]
10187
+ });
10188
+ function takeField(event, name) {
10189
+ event.preventDefault();
10190
+ const form = event.currentTarget;
10191
+ const value = new FormData(form).get(name);
10192
+ form.reset();
10193
+ return typeof value === "string" ? value : "";
10194
+ }
10195
+ function SecretForm({ tab: { kind, label, hint }, set, onSaved }) {
10196
+ const save = useMutation({
10197
+ mutationFn: (value) => set(kind, value),
10198
+ onSuccess: onSaved
10199
+ });
10200
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
10201
+ className: "factory-sheet",
10202
+ "data-agents-form": kind,
10203
+ onSubmit: (event) => save.mutate(takeField(event, "value")),
10204
+ children: [
10205
+ hint,
10206
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
10207
+ className: "agents-field",
10208
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
10209
+ type: "password",
10210
+ name: "value",
10211
+ autoComplete: "off",
10212
+ spellCheck: false,
10213
+ required: true
10214
+ })]
10215
+ }),
10216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
10217
+ className: "factory-sheet-actions",
10218
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
10219
+ type: "submit",
10220
+ disabled: save.isPending,
10221
+ children: "Save"
10222
+ })
10223
+ }),
10224
+ save.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
10225
+ className: "factory-problems",
10226
+ role: "alert",
10227
+ children: save.error.message
10228
+ }) : null
10229
+ ]
10230
+ });
10231
+ }
10232
+ function CredentialSheet({ title, query, set, clear: clearCredential, tabs, statusText, savedText, onClose }) {
10233
+ const queryClient = useQueryClient();
10234
+ const status = useQuery(query);
10235
+ const [tab, setTab] = (0, import_react.useState)(tabs[0].kind);
10236
+ const [saved, setSaved] = (0, import_react.useState)(false);
10237
+ const form = tabs.find((entry) => entry.kind === tab);
10238
+ const onSaved = (next) => {
10239
+ queryClient.setQueryData(query.queryKey, next);
10240
+ setSaved(true);
10241
+ };
10242
+ const clear = useMutation({
10243
+ mutationFn: clearCredential,
10244
+ onSuccess: (next) => {
10245
+ queryClient.setQueryData(query.queryKey, next);
10246
+ setSaved(false);
10247
+ document.querySelector(".agents-dialog input[name='value']")?.focus();
10248
+ }
10249
+ });
10250
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sheet, {
10251
+ open: true,
10252
+ onOpenChange: (open) => {
10253
+ if (!open) onClose();
10254
+ },
10255
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContent, {
10256
+ className: "agents-dialog",
10257
+ "aria-labelledby": "agents-title",
10258
+ initialFocus: () => document.querySelector(".agents-dialog .outcome-dialog-close"),
10259
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
10260
+ className: "outcome-dialog-head",
10261
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10262
+ className: "outcome-dialog-heading",
10263
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, {
10264
+ id: "agents-title",
10265
+ children: title
10266
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
10267
+ className: "outcome-dialog-state",
10268
+ "data-agents-status": "",
10269
+ children: status.error ? status.error.message : statusText(status.data)
10270
+ })]
10271
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetClose, {
10272
+ className: "outcome-dialog-close",
10273
+ "aria-keyshortcuts": "Escape",
10274
+ children: ["Close ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "Esc" })]
10275
+ })]
10276
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10277
+ className: "agents-dialog-body",
10278
+ children: [
10279
+ tabs.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
10280
+ role: "tablist",
10281
+ "aria-label": "How to sign in",
10282
+ className: "agents-tabs",
10283
+ children: tabs.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
10284
+ type: "button",
10285
+ role: "tab",
10286
+ id: `agents-tab-${entry.kind}`,
10287
+ "aria-controls": "agents-panel",
10288
+ "aria-selected": tab === entry.kind,
10289
+ onClick: () => {
10290
+ setTab(entry.kind);
10291
+ setSaved(false);
10292
+ },
10293
+ children: entry.tab
10294
+ }, entry.kind))
10295
+ }) : null,
10296
+ tabs.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
10297
+ role: "tabpanel",
10298
+ id: "agents-panel",
10299
+ "aria-labelledby": `agents-tab-${tab}`,
10300
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SecretForm, {
10301
+ tab: form,
10302
+ set,
10303
+ onSaved
10304
+ }, form.kind)
10305
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SecretForm, {
10306
+ tab: form,
10307
+ set,
10308
+ onSaved
10309
+ }, form.kind),
10310
+ saved ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
10311
+ className: "note",
10312
+ role: "status",
10313
+ children: savedText
10314
+ }) : null,
10315
+ status.data?.source === "studio" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10316
+ className: "factory-sheet-actions agents-clear",
10317
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
10318
+ type: "button",
10319
+ onClick: () => clear.mutate(),
10320
+ disabled: clear.isPending,
10321
+ children: "Remove the credential set in Studio"
10322
+ }), clear.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
10323
+ className: "factory-problems",
10324
+ role: "alert",
10325
+ children: clear.error.message
10326
+ }) : null]
10327
+ }) : null
10328
+ ]
10329
+ })]
10330
+ })
10331
+ });
10332
+ }
10333
+ // ../../node_modules/.bun/zustand@5.0.16+f73d66fb2ea5e116/node_modules/zustand/esm/middleware.mjs
10334
+ function createJSONStorage(getStorage, options) {
10335
+ let storage;
10336
+ try {
10337
+ storage = getStorage();
10338
+ } catch (e) {
10339
+ return;
10340
+ }
10341
+ return {
10342
+ getItem: (name) => {
10343
+ var _a;
10344
+ const parse = (str2) => {
10345
+ if (str2 === null) return null;
10346
+ return JSON.parse(str2, options == null ? void 0 : options.reviver);
10347
+ };
10348
+ const str = (_a = storage.getItem(name)) != null ? _a : null;
10349
+ if (str instanceof Promise) return str.then(parse);
10350
+ return parse(str);
10351
+ },
10352
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),
10353
+ removeItem: (name) => storage.removeItem(name)
10354
+ };
10355
+ }
10356
+ var toThenable = (fn) => (input) => {
10357
+ try {
10358
+ const result = fn(input);
10359
+ if (result instanceof Promise) return result;
10360
+ return {
10361
+ then(onFulfilled) {
10362
+ return toThenable(onFulfilled)(result);
10363
+ },
10364
+ catch(_onRejected) {
10365
+ return this;
10366
+ }
10367
+ };
10368
+ } catch (e) {
10369
+ return {
10370
+ then(_onFulfilled) {
10371
+ return this;
10372
+ },
10373
+ catch(onRejected) {
10374
+ return toThenable(onRejected)(e);
10375
+ }
10376
+ };
10377
+ }
10378
+ };
10379
+ var persistImpl = (config, baseOptions) => (set, get, api) => {
10380
+ let options = {
10381
+ storage: createJSONStorage(() => window.localStorage),
10382
+ partialize: (state) => state,
10383
+ version: 0,
10384
+ merge: (persistedState, currentState) => ({
10385
+ ...currentState,
10386
+ ...persistedState
10387
+ }),
10388
+ ...baseOptions
10389
+ };
10390
+ let hasHydrated = false;
10391
+ let hydrationVersion = 0;
10392
+ const hydrationListeners = /* @__PURE__ */ new Set();
10393
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
10394
+ let storage = options.storage;
10395
+ if (!storage) return config((...args) => {
10396
+ console.warn(`[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`);
10397
+ set(...args);
10398
+ }, get, api);
10399
+ const setItem = () => {
10400
+ const state = options.partialize({ ...get() });
10401
+ return storage.setItem(options.name, {
10402
+ state,
10403
+ version: options.version
10404
+ });
10405
+ };
10406
+ const savedSetState = api.setState;
10407
+ api.setState = (...args) => {
10408
+ savedSetState(...args);
10409
+ return setItem();
10410
+ };
10411
+ const configResult = config((...args) => {
10412
+ set(...args);
10413
+ return setItem();
10414
+ }, get, api);
10415
+ api.getInitialState = () => configResult;
10416
+ let stateFromStorage;
10417
+ const hydrate = () => {
10418
+ var _a, _b;
10419
+ if (!storage) return;
10420
+ const currentVersion = ++hydrationVersion;
10421
+ hasHydrated = false;
10422
+ hydrationListeners.forEach((cb) => {
10423
+ var _a2;
10424
+ return cb((_a2 = get()) != null ? _a2 : configResult);
10425
+ });
10426
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
10427
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
10428
+ if (deserializedStorageValue) {
10429
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
10430
+ if (options.migrate) {
10431
+ const migration = options.migrate(deserializedStorageValue.state, deserializedStorageValue.version);
10432
+ if (migration instanceof Promise) return migration.then((result) => [true, result]);
10433
+ return [true, migration];
10434
+ }
10435
+ console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`);
10436
+ } else return [false, deserializedStorageValue.state];
10437
+ }
10438
+ return [false, void 0];
10439
+ }).then((migrationResult) => {
10440
+ var _a2;
10441
+ if (currentVersion !== hydrationVersion) return;
10442
+ const [migrated, migratedState] = migrationResult;
10443
+ stateFromStorage = options.merge(migratedState, (_a2 = get()) != null ? _a2 : configResult);
10444
+ set(stateFromStorage, true);
10445
+ if (migrated) return setItem();
10446
+ }).then(() => {
10447
+ if (currentVersion !== hydrationVersion) return;
10448
+ postRehydrationCallback?.(get(), void 0);
10449
+ stateFromStorage = get();
10450
+ hasHydrated = true;
10451
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
10452
+ }).catch((e) => {
10453
+ if (currentVersion !== hydrationVersion) return;
10454
+ postRehydrationCallback?.(void 0, e);
10455
+ });
10456
+ };
10457
+ api.persist = {
10458
+ setOptions: (newOptions) => {
10459
+ options = {
10460
+ ...options,
10461
+ ...newOptions
10462
+ };
10463
+ if (newOptions.storage) storage = newOptions.storage;
10464
+ },
10465
+ clearStorage: () => {
10466
+ ++hydrationVersion;
10467
+ storage?.removeItem(options.name);
10468
+ },
10469
+ getOptions: () => options,
10470
+ rehydrate: () => hydrate(),
10471
+ hasHydrated: () => hasHydrated,
10472
+ onHydrate: (cb) => {
10473
+ hydrationListeners.add(cb);
10474
+ return () => {
10475
+ hydrationListeners.delete(cb);
10476
+ };
10477
+ },
10478
+ onFinishHydration: (cb) => {
10479
+ finishHydrationListeners.add(cb);
10480
+ return () => {
10481
+ finishHydrationListeners.delete(cb);
10482
+ };
10483
+ }
10484
+ };
10485
+ if (!options.skipHydration) hydrate();
10486
+ return stateFromStorage || configResult;
10487
+ };
10488
+ var persist = persistImpl;
10489
+ // src/stores/chat-ui.ts
10490
+ var useChatUi = create()(persist((set) => ({
10491
+ model: CHAT_MODELS["claude-code"][0].id,
10492
+ effort: CHAT_EFFORTS[1],
10493
+ panelOpen: true,
10494
+ credentialOpen: false,
10495
+ setModel: (model) => set({ model }),
10496
+ setEffort: (effort) => set({ effort }),
10497
+ setPanelOpen: (panelOpen) => set({ panelOpen }),
10498
+ setCredentialOpen: (credentialOpen) => set({ credentialOpen })
10499
+ }), {
10500
+ name: "mate.chat.model",
10501
+ storage: createJSONStorage(() => localStorage),
10502
+ partialize: ({ model, effort, panelOpen }) => ({
10503
+ model,
10504
+ effort,
10505
+ panelOpen
10506
+ }),
10507
+ merge: (stored, current) => {
10508
+ const { model, effort, panelOpen } = stored ?? {};
10509
+ return {
10510
+ ...current,
10511
+ ...model && chatModel("claude-code", model) ? { model } : {},
10512
+ ...effort && CHAT_EFFORTS.includes(effort) ? { effort } : {},
10513
+ ...typeof panelOpen === "boolean" ? { panelOpen } : {}
10514
+ };
10515
+ }
10516
+ }));
10517
+ // src/lib/studio-call.ts
10518
+ async function call(method, route, body) {
10519
+ const response = await studioFetch(route, {
10520
+ method,
10521
+ headers: {
10522
+ accept: "application/json",
10523
+ "content-type": "application/json"
10524
+ },
10525
+ ...body ? { body: JSON.stringify(body) } : {}
10526
+ });
10527
+ if (!response.ok) {
10528
+ const refusal = await response.json().catch(() => null);
10529
+ throw new Error(refusal?.reason ?? `status ${response.status}`);
10530
+ }
10531
+ return await response.json();
10532
+ }
10533
+ // src/lib/credential-text.ts
10534
+ function setCredentialText(status) {
10535
+ if (!status.kind) return null;
10536
+ const source = status.source === "studio" ? `set in Studio${status.setAt ? ` on ${new Date(status.setAt).toLocaleString()}` : ""}` : "supplied at startup";
10537
+ return `${CREDENTIAL_KIND_LABELS[status.kind]}, ${source}.`;
10538
+ }
10539
+ // src/lib/chat-credential.ts
10540
+ var chatCredentialKey = ["chat-credential"];
10541
+ var chatCredentialQuery = () => ({
10542
+ queryKey: chatCredentialKey,
10543
+ queryFn: () => call("GET", CHAT_CREDENTIAL_ROUTE)
10544
+ });
10545
+ var setChatCredential = (kind, value) => call("PUT", CHAT_CREDENTIAL_ROUTE, {
10546
+ kind,
10547
+ value
10548
+ });
10549
+ var clearChatCredential = () => call("DELETE", CHAT_CREDENTIAL_ROUTE);
10550
+ function chatCredentialText(status) {
10551
+ if (!status) return "Checking…";
10552
+ if (status.source === "login") return "Answers use your local Claude login.";
10553
+ return setCredentialText(status) ?? "No credential. Questions cannot be answered until one is set.";
10554
+ }
10555
+ // src/views/chat/chat-credential.tsx
10556
+ var TABS = [{
10557
+ kind: "api-key",
10558
+ tab: "API key",
10559
+ label: "Anthropic API key",
10560
+ hint: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
10561
+ className: "note",
10562
+ children: "Answers bill this key. It starts with sk-ant-api or sk-ant-usr."
10563
+ })
10564
+ }, {
10565
+ kind: "subscription",
10566
+ tab: "Claude subscription",
10567
+ label: "Subscription token",
10568
+ hint: SETUP_TOKEN_STEPS
10569
+ }];
10570
+ function ChatCredentialSheet({ apiKeyOnly = false, onClose }) {
10571
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CredentialSheet, {
10572
+ title: "Chat credential",
10573
+ query: chatCredentialQuery(),
10574
+ set: setChatCredential,
10575
+ clear: clearChatCredential,
10576
+ tabs: apiKeyOnly ? TABS.slice(0, 1) : TABS,
10577
+ statusText: chatCredentialText,
10578
+ savedText: "Saved. The next question uses it.",
10579
+ onClose
10580
+ });
10581
+ }
10582
+ function ChatCredentialHost({ apiKeyOnly = false }) {
10583
+ const open = useChatUi((state) => state.credentialOpen);
10584
+ const setOpen = useChatUi((state) => state.setCredentialOpen);
10585
+ return open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChatCredentialSheet, {
10586
+ apiKeyOnly,
10587
+ onClose: () => setOpen(false)
10588
+ }) : null;
10589
+ }
10590
+ // src/views/chat/conversation-handle.ts
10591
+ var held = null;
10592
+ function holdConversation(companion, stop) {
10593
+ held = {
10594
+ companion,
10595
+ stop
10596
+ };
10597
+ }
10598
+ function forgetConversation() {
10599
+ held?.stop();
10600
+ held = null;
10601
+ }
10602
+ function keepOnlyConversationOf(companion) {
10603
+ if (held?.companion !== companion) forgetConversation();
10604
+ }
10449
10605
  // src/shell/sidebar.tsx
10450
10606
  var MODE_ICONS = {
10451
10607
  engineering: "code",
@@ -10475,7 +10631,7 @@ function Sidebar({ shell, search, view }) {
10475
10631
  children: [shell.selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
10476
10632
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavGroup, {
10477
10633
  label: MODE_TITLES[mode],
10478
- views: modeViews(mode),
10634
+ views: modeViews(mode, shell.chat),
10479
10635
  search,
10480
10636
  current: view,
10481
10637
  counts,
@@ -10682,7 +10838,7 @@ function ModeSwitch({ shell, search, view, collapsed }) {
10682
10838
  if (!mode || mode === shell.studioMode || !shell.enabledModes.includes(mode)) return;
10683
10839
  holdShellForMode(queryClient, search, shell, mode);
10684
10840
  navigate({
10685
- to: viewsFor(mode).includes(view) ? VIEW_PATHS[view] : "/",
10841
+ to: viewsFor(mode, { chat: shell.chat }).includes(view) ? VIEW_PATHS[view] : "/",
10686
10842
  search: (previous) => ({
10687
10843
  ...previous,
10688
10844
  studioMode: mode
@@ -11522,12 +11678,13 @@ function StudioLayout({ search }) {
11522
11678
  useStudioEvents(digest);
11523
11679
  useStudioClicks();
11524
11680
  useRailKey();
11525
- usePrefetchViews(shell.selected ? search : {}, shell.studioMode, shell.enabledModes);
11681
+ usePrefetchViews(shell.selected ? search : {}, shell.studioMode, { chat: shell.chat }, shell.enabledModes);
11526
11682
  (0, import_react.useEffect)(() => {
11527
11683
  useTerminalUi.getState().setWorkspace(workspace ? workspaceKey : null);
11528
11684
  }, [workspace, workspaceKey]);
11529
11685
  (0, import_react.useEffect)(() => {
11530
11686
  if (!digest) return;
11687
+ keepOnlyConversationOf(digest);
11531
11688
  try {
11532
11689
  localStorage.setItem(COMPANION_STORAGE_KEY, digest);
11533
11690
  } catch {}
@@ -11575,6 +11732,7 @@ function StudioLayout({ search }) {
11575
11732
  shell,
11576
11733
  search
11577
11734
  }),
11735
+ shell.chat ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChatCredentialHost, { apiKeyOnly: shell.profile === "appliance" }) : null,
11578
11736
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toasts, { search })
11579
11737
  ] });
11580
11738
  }
@@ -11608,13 +11766,13 @@ function Toasts({ search }) {
11608
11766
  }
11609
11767
  // src/routes/__root.tsx
11610
11768
  var FAVICON_URI = `data:image/svg+xml;base64,${btoa(BRAND_SVGS.favicon)}`;
11611
- var Route$13 = createRootRouteWithContext()({
11769
+ var Route$16 = createRootRouteWithContext()({
11612
11770
  validateSearch: validateStudioSearch,
11613
11771
  loaderDeps: ({ search }) => search,
11614
11772
  ssr: true,
11615
11773
  beforeLoad: async ({ context, search, location }) => {
11616
11774
  const shell = await loadHeld(context.queryClient, shellQuery(search));
11617
- const href = canonicalHref(location.pathname, location.searchStr, viewAt(location.pathname), shell.studioMode);
11775
+ const href = canonicalHref(location.pathname, location.searchStr, viewAt(location.pathname), shell.studioMode, { chat: shell.chat });
11618
11776
  if (href) {
11619
11777
  const hash = viewAt(location.pathname) === "getting-started" && location.hash ? `#${location.hash.replace(/^#/, "")}` : "";
11620
11778
  throw redirect({
@@ -11649,7 +11807,7 @@ var Route$13 = createRootRouteWithContext()({
11649
11807
  component: RootLayout
11650
11808
  });
11651
11809
  function RootLayout() {
11652
- const { companion, studioMode } = Route$13.useSearch();
11810
+ const { companion, studioMode } = Route$16.useSearch();
11653
11811
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StudioLayout, { search: {
11654
11812
  companion,
11655
11813
  studioMode
@@ -11662,8 +11820,8 @@ function RootDocument({ children }) {
11662
11820
  });
11663
11821
  }
11664
11822
  // src/routes/index.tsx
11665
- var $$splitComponentImporter$12 = () => import("./routes-B4sNiE0X.js");
11666
- var Route$12 = createFileRoute("/")({
11823
+ var $$splitComponentImporter$15 = () => import("./routes-BEXxl0py.js");
11824
+ var Route$15 = createFileRoute("/")({
11667
11825
  staticData: { view: "dashboard" },
11668
11826
  validateSearch: (raw) => typeof raw.change === "string" && raw.change !== "" ? { change: raw.change } : {},
11669
11827
  loaderDeps: ({ search }) => ({
@@ -11672,39 +11830,121 @@ var Route$12 = createFileRoute("/")({
11672
11830
  }),
11673
11831
  ssr: true,
11674
11832
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("dashboard", deps)) : null,
11675
- component: lazyRouteComponent($$splitComponentImporter$12, "component")
11833
+ component: lazyRouteComponent($$splitComponentImporter$15, "component")
11676
11834
  });
11677
11835
  /** Each mode reads its own Overview; the server's effective mode picks it, not the address. */
11836
+ // src/routes/chat.tsx
11837
+ var $$splitComponentImporter$14 = () => import("./chat-zl332Tvu.js").then((n) => n.t);
11838
+ var Route$14 = createFileRoute("/chat")({
11839
+ staticData: { view: "chat" },
11840
+ loaderDeps: ({ search }) => ({
11841
+ companion: search.companion,
11842
+ studioMode: search.studioMode
11843
+ }),
11844
+ ssr: false,
11845
+ loader: ({ context, deps }) => registeredCompanion(context.queryClient, deps),
11846
+ component: lazyRouteComponent($$splitComponentImporter$14, "component")
11847
+ });
11678
11848
  // src/routes/friction.tsx
11679
- var $$splitComponentImporter$11 = () => import("./friction-B6osqFSm.js");
11680
- var Route$11 = createFileRoute("/friction")({
11849
+ var $$splitComponentImporter$13 = () => import("./friction-BPs9KWdq.js");
11850
+ var Route$13 = createFileRoute("/friction")({
11681
11851
  staticData: { view: "friction" },
11682
11852
  loaderDeps: ({ search }) => ({
11683
11853
  companion: search.companion,
11684
11854
  studioMode: search.studioMode
11685
11855
  }),
11686
11856
  loader: ({ context, deps }) => registeredCompanion(context.queryClient, deps),
11687
- component: lazyRouteComponent($$splitComponentImporter$11, "component")
11857
+ component: lazyRouteComponent($$splitComponentImporter$13, "component")
11688
11858
  });
11689
11859
  // src/routes/getting-started.tsx
11690
- var $$splitComponentImporter$10 = () => import("./getting-started-B136TP57.js");
11691
- var Route$10 = createFileRoute("/getting-started")({
11860
+ var $$splitComponentImporter$12 = () => import("./getting-started-B136TP57.js");
11861
+ var Route$12 = createFileRoute("/getting-started")({
11692
11862
  ssr: true,
11693
11863
  staticData: { view: "getting-started" },
11694
- component: lazyRouteComponent($$splitComponentImporter$10, "component")
11864
+ component: lazyRouteComponent($$splitComponentImporter$12, "component")
11695
11865
  });
11696
11866
  // src/routes/graph.tsx
11697
- var $$splitComponentImporter$9 = () => import("./graph-BJVZBevL.js").then((n) => n.t);
11867
+ var $$splitComponentImporter$11 = () => import("./graph-Cgzlrv3P.js").then((n) => n.t);
11698
11868
  var text$1 = (value) => typeof value === "string" && value.length > 0 && value.length <= 1024 ? value : void 0;
11699
- var Route$9 = createFileRoute("/graph")({
11869
+ var Route$11 = createFileRoute("/graph")({
11700
11870
  validateSearch: (raw) => text$1(raw.node) ? { node: text$1(raw.node) } : {},
11701
11871
  staticData: { view: "graph" },
11702
11872
  ssr: false,
11703
- component: lazyRouteComponent($$splitComponentImporter$9, "component")
11873
+ component: lazyRouteComponent($$splitComponentImporter$11, "component")
11874
+ });
11875
+ // src/server/mcp-manager.ts
11876
+ /** Far above any real section; core validates what is inside. */
11877
+ var MAX_STATE = 262144;
11878
+ function companionOf(input) {
11879
+ if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("no registered companion was selected");
11880
+ return input.companion;
11881
+ }
11882
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
11883
+ /** The outer shape and size only. */
11884
+ function stateOf(input) {
11885
+ const next = input?.next;
11886
+ if (!isRecord(next) || !(next.catalog === null || isRecord(next.catalog)) || !isRecord(next.audiences) || !Object.values(next.audiences).every(isRecord)) throw new Error("the request holds no mcpManager state");
11887
+ if (JSON.stringify(next).length > MAX_STATE) throw new Error("the mcpManager state exceeds the size limit");
11888
+ return {
11889
+ catalog: next.catalog,
11890
+ audiences: next.audiences
11891
+ };
11892
+ }
11893
+ var getMcpManager = createServerFn({ method: "GET" }).validator((input) => ({ companion: companionOf(input) })).handler(createSsrRpc("1d009b232dd1b78890b3c1f2be3a5df2d35a25793e0ad67870cb866677faad41"));
11894
+ /** Effective sets and variable states for unsaved state, or core's validation error. */
11895
+ var previewMcpManager = createServerFn({ method: "POST" }).validator((input) => ({
11896
+ companion: companionOf(input),
11897
+ next: stateOf(input)
11898
+ })).handler(createSsrRpc("e6f927edb301210a568a297901febc6dddf894875a991839f0582883c5599ba9"));
11899
+ /** A save; a stale token comes back as a conflict carrying the current view. */
11900
+ var saveMcpManager = createServerFn({ method: "POST" }).validator((input) => {
11901
+ if (typeof input?.token !== "string" || !/^[0-9a-f]{64}$/.test(input.token)) throw new Error("save requires the token of the last read");
11902
+ return {
11903
+ companion: companionOf(input),
11904
+ next: stateOf(input),
11905
+ token: input.token
11906
+ };
11907
+ }).handler(createSsrRpc("ba52b9a6beea7d337a5d2c387d967cfc6ba4ef7fe19a80a904306f29079f5d27"));
11908
+ // src/lib/mcp-query.ts
11909
+ var SCOPE = "mcp";
11910
+ var mcpManagerQuery = (companion) => queryOptions({
11911
+ queryKey: [companion, SCOPE],
11912
+ queryFn: () => getMcpManager({ data: { companion } }),
11913
+ retry: false
11914
+ });
11915
+ /** What core derives from unsaved state, or its validation error; held briefly per state. */
11916
+ var mcpPreviewQuery = (companion, next) => queryOptions({
11917
+ queryKey: [
11918
+ companion,
11919
+ SCOPE,
11920
+ "preview",
11921
+ next
11922
+ ],
11923
+ queryFn: () => previewMcpManager({ data: {
11924
+ companion,
11925
+ next
11926
+ } }),
11927
+ gcTime: 6e4
11928
+ });
11929
+ // src/routes/mcp.tsx
11930
+ var $$splitComponentImporter$10 = () => import("./mcp-BU0fLYyJ.js");
11931
+ var Route$10 = createFileRoute("/mcp")({
11932
+ staticData: { view: "mcp" },
11933
+ loaderDeps: ({ search }) => ({
11934
+ companion: search.companion,
11935
+ studioMode: search.studioMode
11936
+ }),
11937
+ ssr: true,
11938
+ loader: async ({ context, deps }) => {
11939
+ const companion = await registeredCompanion(context.queryClient, deps);
11940
+ if (!companion) return null;
11941
+ return loadView(context.queryClient, mcpManagerQuery(companion)).catch(() => null);
11942
+ },
11943
+ component: lazyRouteComponent($$splitComponentImporter$10, "component")
11704
11944
  });
11705
11945
  // src/routes/reports.tsx
11706
- var $$splitComponentImporter$8 = () => import("./reports-Dn92pLap.js");
11707
- var Route$8 = createFileRoute("/reports")({
11946
+ var $$splitComponentImporter$9 = () => import("./reports-9Pr7Bz6o.js");
11947
+ var Route$9 = createFileRoute("/reports")({
11708
11948
  staticData: { view: "reports" },
11709
11949
  loaderDeps: ({ search }) => ({
11710
11950
  companion: search.companion,
@@ -11714,11 +11954,11 @@ var Route$8 = createFileRoute("/reports")({
11714
11954
  const companion = await registeredCompanion(context.queryClient, deps);
11715
11955
  return companion ? loadView(context.queryClient, reportsQuery(companion)) : null;
11716
11956
  },
11717
- component: lazyRouteComponent($$splitComponentImporter$8, "component")
11957
+ component: lazyRouteComponent($$splitComponentImporter$9, "component")
11718
11958
  });
11719
11959
  // src/routes/skills.tsx
11720
- var $$splitComponentImporter$7 = () => import("./skills-B4-0qpqN.js");
11721
- var Route$7 = createFileRoute("/skills")({
11960
+ var $$splitComponentImporter$8 = () => import("./skills-BpGGUl6L.js");
11961
+ var Route$8 = createFileRoute("/skills")({
11722
11962
  staticData: { view: "skills" },
11723
11963
  loaderDeps: ({ search }) => ({
11724
11964
  companion: search.companion,
@@ -11726,11 +11966,11 @@ var Route$7 = createFileRoute("/skills")({
11726
11966
  }),
11727
11967
  ssr: true,
11728
11968
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("skills", deps)) : null,
11729
- component: lazyRouteComponent($$splitComponentImporter$7, "component")
11969
+ component: lazyRouteComponent($$splitComponentImporter$8, "component")
11730
11970
  });
11731
11971
  // src/routes/specs.tsx
11732
- var $$splitComponentImporter$6 = () => import("./specs-rfMug6qW.js");
11733
- var Route$6 = createFileRoute("/specs")({
11972
+ var $$splitComponentImporter$7 = () => import("./specs-CCGgXE-V.js");
11973
+ var Route$7 = createFileRoute("/specs")({
11734
11974
  staticData: { view: "specs" },
11735
11975
  validateSearch: validateSpecsSearch,
11736
11976
  loaderDeps: ({ search }) => ({
@@ -11739,23 +11979,23 @@ var Route$6 = createFileRoute("/specs")({
11739
11979
  }),
11740
11980
  ssr: true,
11741
11981
  loader: async ({ context, deps }) => await registeredCompanion(context.queryClient, deps) ? loadView(context.queryClient, companionViewQuery("specs", deps)) : null,
11742
- component: lazyRouteComponent($$splitComponentImporter$6, "component")
11982
+ component: lazyRouteComponent($$splitComponentImporter$7, "component")
11743
11983
  });
11744
11984
  // src/routes/usage.tsx
11745
- var $$splitComponentImporter$5 = () => import("./usage-BJgYWRCX.js");
11746
- var Route$5 = createFileRoute("/usage")({
11985
+ var $$splitComponentImporter$6 = () => import("./usage-DWbSPrPD.js");
11986
+ var Route$6 = createFileRoute("/usage")({
11747
11987
  staticData: { view: "usage" },
11748
11988
  loaderDeps: ({ search }) => ({
11749
11989
  companion: search.companion,
11750
11990
  studioMode: search.studioMode
11751
11991
  }),
11752
11992
  loader: ({ context, deps }) => registeredCompanion(context.queryClient, deps),
11753
- component: lazyRouteComponent($$splitComponentImporter$5, "component")
11993
+ component: lazyRouteComponent($$splitComponentImporter$6, "component")
11754
11994
  });
11755
11995
  // src/routes/vault.tsx
11756
- var $$splitComponentImporter$4 = () => import("./vault-CvlrLd2H.js");
11996
+ var $$splitComponentImporter$5 = () => import("./vault-dL79JlKH.js");
11757
11997
  var text = (value) => typeof value === "string" && value ? value : void 0;
11758
- var Route$4 = createFileRoute("/vault")({
11998
+ var Route$5 = createFileRoute("/vault")({
11759
11999
  staticData: { view: "vault" },
11760
12000
  validateSearch: (raw) => ({
11761
12001
  ...text(raw.path) ? { path: text(raw.path) } : {},
@@ -11772,10 +12012,29 @@ var Route$4 = createFileRoute("/vault")({
11772
12012
  const companion = await registeredCompanion(context.queryClient, deps);
11773
12013
  return companion ? loadView(context.queryClient, vaultQuery(companion, deps)) : null;
11774
12014
  },
12015
+ component: lazyRouteComponent($$splitComponentImporter$5, "component")
12016
+ });
12017
+ // src/views/work/work-search.ts
12018
+ function validateWorkSearch(raw) {
12019
+ return WORK_BUCKETS.includes(raw.bucket) ? { bucket: raw.bucket } : {};
12020
+ }
12021
+ // src/routes/work.tsx
12022
+ var $$splitComponentImporter$4 = () => import("./work-DsCEfhmK.js");
12023
+ var Route$4 = createFileRoute("/work")({
12024
+ staticData: { view: "work" },
12025
+ validateSearch: (raw) => validateWorkSearch(raw),
12026
+ loaderDeps: ({ search }) => ({
12027
+ companion: search.companion,
12028
+ studioMode: search.studioMode
12029
+ }),
12030
+ loader: async ({ context, deps }) => {
12031
+ const companion = await registeredCompanion(context.queryClient, deps);
12032
+ return companion ? loadView(context.queryClient, workQuery(companion)) : null;
12033
+ },
11775
12034
  component: lazyRouteComponent($$splitComponentImporter$4, "component")
11776
12035
  });
11777
12036
  // src/routes/workflow.tsx
11778
- var $$splitComponentImporter$3 = () => import("./workflow-BdrzcCt8.js");
12037
+ var $$splitComponentImporter$3 = () => import("./workflow-BOZ2sRYg.js");
11779
12038
  var Route$3 = createFileRoute("/workflow")({
11780
12039
  staticData: { view: "workflow" },
11781
12040
  loaderDeps: ({ search }) => ({
@@ -11787,7 +12046,7 @@ var Route$3 = createFileRoute("/workflow")({
11787
12046
  component: lazyRouteComponent($$splitComponentImporter$3, "component")
11788
12047
  });
11789
12048
  // src/routes/getting-started.index.tsx
11790
- var $$splitComponentImporter$2 = () => import("./getting-started.index-DZLuXnNO.js");
12049
+ var $$splitComponentImporter$2 = () => import("./getting-started.index-BaFfQ9Mn.js");
11791
12050
  var Route$2 = createFileRoute("/getting-started/")({
11792
12051
  loaderDeps: ({ search }) => search,
11793
12052
  ssr: true,
@@ -11795,7 +12054,7 @@ var Route$2 = createFileRoute("/getting-started/")({
11795
12054
  component: lazyRouteComponent($$splitComponentImporter$2, "component")
11796
12055
  });
11797
12056
  // src/routes/getting-started.$topic.tsx
11798
- var $$splitComponentImporter$1 = () => import("./getting-started._topic-BK2eU6AS.js");
12057
+ var $$splitComponentImporter$1 = () => import("./getting-started._topic-BgrBA4Vj.js");
11799
12058
  var Route$1 = createFileRoute("/getting-started/$topic")({
11800
12059
  loaderDeps: ({ search }) => search,
11801
12060
  ssr: true,
@@ -11803,62 +12062,77 @@ var Route$1 = createFileRoute("/getting-started/$topic")({
11803
12062
  component: lazyRouteComponent($$splitComponentImporter$1, "component")
11804
12063
  });
11805
12064
  // src/routes/plugins.$service.$view.tsx
11806
- var $$splitComponentImporter = () => import("./plugins._service._view-B32LzraG.js");
12065
+ var $$splitComponentImporter = () => import("./plugins._service._view-DdO1nELF.js");
11807
12066
  /** A view a plugin service ships as its own module; Studio mounts it in the layout. */
11808
12067
  var Route = createFileRoute("/plugins/$service/$view")({
11809
12068
  staticData: { pluginView: true },
11810
12069
  component: lazyRouteComponent($$splitComponentImporter, "component")
11811
12070
  });
11812
12071
  // src/route-tree.gen.ts
11813
- var IndexRoute = Route$12.update({
12072
+ var IndexRoute = Route$15.update({
11814
12073
  id: "/",
11815
12074
  path: "/",
11816
- getParentRoute: () => Route$13
12075
+ getParentRoute: () => Route$16
11817
12076
  });
11818
- var FrictionRoute = Route$11.update({
12077
+ var ChatRoute = Route$14.update({
12078
+ id: "/chat",
12079
+ path: "/chat",
12080
+ getParentRoute: () => Route$16
12081
+ });
12082
+ var FrictionRoute = Route$13.update({
11819
12083
  id: "/friction",
11820
12084
  path: "/friction",
11821
- getParentRoute: () => Route$13
12085
+ getParentRoute: () => Route$16
11822
12086
  });
11823
- var GettingStartedRoute = Route$10.update({
12087
+ var GettingStartedRoute = Route$12.update({
11824
12088
  id: "/getting-started",
11825
12089
  path: "/getting-started",
11826
- getParentRoute: () => Route$13
12090
+ getParentRoute: () => Route$16
11827
12091
  });
11828
- var GraphRoute = Route$9.update({
12092
+ var GraphRoute = Route$11.update({
11829
12093
  id: "/graph",
11830
12094
  path: "/graph",
11831
- getParentRoute: () => Route$13
12095
+ getParentRoute: () => Route$16
12096
+ });
12097
+ var McpRoute = Route$10.update({
12098
+ id: "/mcp",
12099
+ path: "/mcp",
12100
+ getParentRoute: () => Route$16
11832
12101
  });
11833
- var ReportsRoute = Route$8.update({
12102
+ var ReportsRoute = Route$9.update({
11834
12103
  id: "/reports",
11835
12104
  path: "/reports",
11836
- getParentRoute: () => Route$13
12105
+ getParentRoute: () => Route$16
11837
12106
  });
11838
- var SkillsRoute = Route$7.update({
12107
+ var SkillsRoute = Route$8.update({
11839
12108
  id: "/skills",
11840
12109
  path: "/skills",
11841
- getParentRoute: () => Route$13
12110
+ getParentRoute: () => Route$16
11842
12111
  });
11843
- var SpecsRoute = Route$6.update({
12112
+ var SpecsRoute = Route$7.update({
11844
12113
  id: "/specs",
11845
12114
  path: "/specs",
11846
- getParentRoute: () => Route$13
12115
+ getParentRoute: () => Route$16
11847
12116
  });
11848
- var UsageRoute = Route$5.update({
12117
+ var UsageRoute = Route$6.update({
11849
12118
  id: "/usage",
11850
12119
  path: "/usage",
11851
- getParentRoute: () => Route$13
12120
+ getParentRoute: () => Route$16
11852
12121
  });
11853
- var VaultRoute = Route$4.update({
12122
+ var VaultRoute = Route$5.update({
11854
12123
  id: "/vault",
11855
12124
  path: "/vault",
11856
- getParentRoute: () => Route$13
12125
+ getParentRoute: () => Route$16
12126
+ });
12127
+ var WorkRoute = Route$4.update({
12128
+ id: "/work",
12129
+ path: "/work",
12130
+ getParentRoute: () => Route$16
11857
12131
  });
11858
12132
  var WorkflowRoute = Route$3.update({
11859
12133
  id: "/workflow",
11860
12134
  path: "/workflow",
11861
- getParentRoute: () => Route$13
12135
+ getParentRoute: () => Route$16
11862
12136
  });
11863
12137
  var GettingStartedIndexRoute = Route$2.update({
11864
12138
  id: "/",
@@ -11873,7 +12147,7 @@ var GettingStartedTopicRoute = Route$1.update({
11873
12147
  var PluginsServiceViewRoute = Route.update({
11874
12148
  id: "/plugins/$service/$view",
11875
12149
  path: "/plugins/$service/$view",
11876
- getParentRoute: () => Route$13
12150
+ getParentRoute: () => Route$16
11877
12151
  });
11878
12152
  var GettingStartedRouteChildren = {
11879
12153
  GettingStartedTopicRoute,
@@ -11881,18 +12155,21 @@ var GettingStartedRouteChildren = {
11881
12155
  };
11882
12156
  var rootRouteChildren = {
11883
12157
  IndexRoute,
12158
+ ChatRoute,
11884
12159
  FrictionRoute,
11885
12160
  GettingStartedRoute: GettingStartedRoute._addFileChildren(GettingStartedRouteChildren),
11886
12161
  GraphRoute,
12162
+ McpRoute,
11887
12163
  ReportsRoute,
11888
12164
  SkillsRoute,
11889
12165
  SpecsRoute,
11890
12166
  UsageRoute,
11891
12167
  VaultRoute,
12168
+ WorkRoute,
11892
12169
  WorkflowRoute,
11893
12170
  PluginsServiceViewRoute
11894
12171
  };
11895
- var routeTree = Route$13._addFileChildren(rootRouteChildren)._addFileTypes();
12172
+ var routeTree = Route$16._addFileChildren(rootRouteChildren)._addFileTypes();
11896
12173
  // src/lib/query-client.ts
11897
12174
  /**
11898
12175
  * The page's query client. In the browser every failed query or mutation makes the page's
@@ -11922,7 +12199,9 @@ function getRouter() {
11922
12199
  context: { queryClient },
11923
12200
  scrollRestoration: true,
11924
12201
  defaultPreload: "intent",
11925
- defaultPendingComponent: ViewPlaceholder
12202
+ defaultPendingComponent: ViewPlaceholder,
12203
+ parseSearch: parseStudioSearch,
12204
+ stringifySearch: stringifyStudioSearch
11926
12205
  });
11927
12206
  setupRouterSsrQueryIntegration({
11928
12207
  router,
@@ -11930,4 +12209,4 @@ function getRouter() {
11930
12209
  });
11931
12210
  return router;
11932
12211
  }
11933
- export { useComboboxInputValueContext as $, changeStep as A, ComboboxItem as B, useMediaQuery as C, changeGroup as D, activeChanges as E, DialogPortal as F, ComboboxPositionerContext as G, ComboboxList as H, DialogPopup as I, usePopupSide as J, useComboboxPositionerContext as K, DialogClose$1 as L, inField as M, DialogTitle$1 as N, changePath as O, DialogRoot as P, useComboboxFloatingContext as Q, DialogBackdrop as R, useRetryFocus as S, GROUP_TITLES as T, ComboboxInput as U, useComboboxItemContext as V, ComboboxInternalDismissButton as W, AriaCombobox as X, triggerStateAttributesMapping as Y, getComboboxPopupId as Z, useMarkFriction as _, Route$3 as a, Tooltip as at, RecordingReach as b, Route$6 as c, useAnchorPositioning as ct, Route$9 as d, useComboboxRootContext as et, Route$11 as f, frictionQuery as g, getRouter, useBrowser as h, Route$2 as i, studioConnection as it, groupChanges as j, changeProgress as k, Route$7 as l, platform as lt, ViewPlaceholder as m, Route as n, useVaultUi as nt, Route$4 as o, usePositioner as ot, Route$12 as p, useListEmpty as q, Route$1 as r, usePageUi as rt, Route$5 as s, getDisabledMountTransitionStyles as st, router_exports as t, useAppearance as tt, Route$8 as u, useSuspenseQuery as ut, useSetFrictionRecording as v, CHANGE_GROUPS as w, RecordingState as x, RecordingButton as y, ComboboxEmpty as z };
12212
+ export { DialogContent as $, SheetContent as A, CHAT_MODELS as At, RecordingState as B, chatCredentialText as C, Tooltip as Ct, persist as D, platform as Dt, createJSONStorage as E, useAnchorPositioning as Et, frictionQuery as F, WORK_BUCKETS as Ft, changeGroup as G, CHANGE_GROUPS as H, useMarkFriction as I, isShared as It, changeStep as J, changePath as K, useSetFrictionRecording as L, useSuspenseQuery as Lt, ViewPlaceholder as M, isCredentialFailure as Mt, useBrowser as N, messageText as Nt, Sheet as O, CHAT_EFFORTS as Ot, useRetryFocus as P, replayedChars as Pt, DialogClose as Q, RecordingButton as R, useQuery as Rt, chatCredentialQuery as S, studioConnection as St, useChatUi as T, getDisabledMountTransitionStyles as Tt, GROUP_TITLES as U, useMediaQuery as V, activeChanges as W, inField as X, groupChanges as Y, Dialog as Z, Route$13 as _, useComboboxRootContext as _t, Route$3 as a, ComboboxList as at, forgetConversation as b, copyText as bt, Route$6 as c, ComboboxPositionerContext as ct, Route$9 as d, usePopupSide as dt, DialogDescription as et, Route$10 as f, triggerStateAttributesMapping as ft, Route$11 as g, getRouter, useComboboxInputValueContext as gt, saveMcpManager as h, useComboboxFloatingContext as ht, Route$2 as i, useComboboxItemContext as it, SheetTitle as j, chatModel as jt, SheetClose as k, CHAT_HISTORY_BUDGET as kt, Route$7 as l, useComboboxPositionerContext as lt, mcpPreviewQuery as m, getComboboxPopupId as mt, Route as n, ComboboxEmpty as nt, Route$4 as o, ComboboxInput as ot, mcpManagerQuery as p, AriaCombobox as pt, changeProgress as q, Route$1 as r, ComboboxItem as rt, Route$5 as s, ComboboxInternalDismissButton as st, router_exports as t, DialogTitle as tt, Route$8 as u, useListEmpty as ut, Route$14 as v, useAppearance as vt, call as w, usePositioner as wt, holdConversation as x, usePageUi as xt, Route$15 as y, useVaultUi as yt, RecordingReach as z };