@uniqbit/mate-core 0.20.0 → 0.21.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 (286) hide show
  1. package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
  2. package/claude-capability-plugins/companion-mentions/hooks/register.ts +1 -1
  3. package/claude-plugin/hooks/hooks.json +10 -1
  4. package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
  5. package/opencode-plugin/src/server.ts +9 -2
  6. package/package.json +2 -1
  7. package/src/cli/commands/artifact/delivery/environment.ts +28 -8
  8. package/src/cli/commands/artifact/delivery/link.ts +28 -9
  9. package/src/cli/commands/artifact/delivery/output.ts +7 -0
  10. package/src/cli/commands/companion/update.ts +2 -19
  11. package/src/cli/commands/factory/factory.ts +11 -1
  12. package/src/cli/commands/install.ts +47 -36
  13. package/src/cli/commands/launch/claude.ts +2 -0
  14. package/src/cli/commands/launch/shared.ts +33 -6
  15. package/src/cli/commands/plugin/install.ts +27 -11
  16. package/src/cli/commands/report/index.ts +180 -184
  17. package/src/cli/commands/report/markdown.ts +67 -72
  18. package/src/cli/commands/shared/companion-selection.ts +3 -1
  19. package/src/cli/commands/studio/access.ts +6 -14
  20. package/src/cli/commands/studio/areas.ts +112 -33
  21. package/src/cli/commands/studio/companion-add.ts +87 -0
  22. package/src/cli/commands/studio/companion-removal.ts +15 -8
  23. package/src/cli/commands/studio/factory-credential.ts +1 -15
  24. package/src/cli/commands/studio/factory-git-tokens.ts +40 -0
  25. package/src/cli/commands/studio/factory-relay.ts +18 -0
  26. package/src/cli/commands/studio/graph-model.ts +61 -0
  27. package/src/cli/commands/studio/graph.ts +336 -0
  28. package/src/cli/commands/studio/index.ts +4 -4
  29. package/src/cli/commands/studio/payload.ts +42 -15
  30. package/src/cli/commands/studio/repository-add.ts +116 -0
  31. package/src/cli/commands/studio/routes.ts +6 -0
  32. package/src/cli/commands/studio/selection.ts +12 -3
  33. package/src/cli/commands/studio/server.ts +127 -5
  34. package/src/cli/commands/studio/services.ts +40 -0
  35. package/src/cli/commands/studio/terminal.ts +45 -3
  36. package/src/cli/commands/studio/views/vault/markdown-tree.ts +84 -3
  37. package/src/cli/commands/studio/workset-session.ts +47 -14
  38. package/src/cli/commands/unwrap.ts +3 -0
  39. package/src/cli/commands/update.ts +2 -0
  40. package/src/cli/commands/vscode/release-vsix.json +4 -0
  41. package/src/cli/commands/vscode/setup.ts +71 -13
  42. package/src/cli/commands/vscode/vsix.ts +48 -7
  43. package/src/cli/commands/working/cleanup.ts +40 -8
  44. package/src/cli/commands/working/worktree.ts +176 -35
  45. package/src/cli/main.ts +17 -2
  46. package/src/cli/usage.ts +1 -1
  47. package/src/hooks/rtk-worktree-git.ts +48 -0
  48. package/src/hooks/validate-artifact-path.ts +38 -7
  49. package/src/lib/delivery/branch-template.ts +122 -0
  50. package/src/lib/delivery/branches.ts +21 -16
  51. package/src/lib/delivery/checkout.ts +102 -0
  52. package/src/lib/delivery/environment.ts +2 -0
  53. package/src/lib/delivery/merge-git.ts +13 -1
  54. package/src/lib/delivery/record-delivery.ts +83 -29
  55. package/src/lib/delivery/record.ts +15 -3
  56. package/src/lib/delivery/resolve-branch.ts +157 -110
  57. package/src/lib/factory/attach-client.ts +11 -1
  58. package/src/lib/factory/broker.ts +37 -40
  59. package/src/lib/factory/client.ts +22 -1
  60. package/src/lib/factory/clone-url.ts +39 -0
  61. package/src/lib/factory/command.ts +21 -5
  62. package/src/lib/factory/git-auth.ts +61 -0
  63. package/src/lib/factory/git-credential-store.ts +181 -0
  64. package/src/lib/factory/ids.ts +12 -2
  65. package/src/lib/factory/outcomes/actions.ts +20 -4
  66. package/src/lib/factory/outcomes/index.ts +77 -11
  67. package/src/lib/factory/outcomes/lifecycle.ts +9 -2
  68. package/src/lib/factory/outcomes/sessions.ts +23 -1
  69. package/src/lib/factory/prepare.ts +9 -3
  70. package/src/lib/factory/runner/scheduler.ts +96 -14
  71. package/src/lib/factory/runner/workflow.ts +5 -1
  72. package/src/lib/factory/runtime.ts +143 -43
  73. package/src/lib/orchestrator/companion-hub.ts +6 -1
  74. package/src/lib/orchestrator/engine-floor.ts +48 -0
  75. package/src/lib/orchestrator/launcher.ts +34 -1
  76. package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
  77. package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
  78. package/src/lib/orchestrator/projection-claude-links.ts +32 -8
  79. package/src/lib/orchestrator/projection-claude-skills.ts +2 -2
  80. package/src/lib/orchestrator/projection-entries.ts +22 -18
  81. package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
  82. package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
  83. package/src/lib/orchestrator/projection-types.ts +28 -1
  84. package/src/lib/orchestrator/refresh-working-claude-links.ts +3 -1
  85. package/src/lib/orchestrator/session-prepare.ts +6 -1
  86. package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
  87. package/src/lib/orchestrator/types.ts +4 -0
  88. package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
  89. package/src/lib/orchestrator/working-repo-projection.ts +24 -4
  90. package/src/lib/orchestrator/wrap-pass.ts +1 -0
  91. package/src/lib/public-npm.ts +95 -50
  92. package/src/lib/session-state.ts +72 -2
  93. package/src/lib/update-checker.ts +7 -1
  94. package/src/lib/usage/aggregate.ts +202 -0
  95. package/src/lib/usage/cache.ts +87 -0
  96. package/src/lib/usage/claude-pricing.ts +71 -0
  97. package/src/lib/usage/claude.ts +189 -0
  98. package/src/lib/usage/collect.ts +56 -0
  99. package/src/lib/usage/opencode.ts +188 -0
  100. package/src/lib/usage/records.ts +80 -0
  101. package/src/lib/usage/rtk-database.ts +72 -0
  102. package/src/lib/usage/savings.ts +209 -0
  103. package/src/lib/usage/scope.ts +182 -0
  104. package/src/lib/usage/source.ts +102 -0
  105. package/src/lib/usage/types.ts +143 -0
  106. package/src/lib/usage/window.ts +37 -0
  107. package/src/lib/workset/factory-local.ts +157 -0
  108. package/src/lib/workset/record.ts +25 -11
  109. package/src/lib/workset/repositories.ts +118 -25
  110. package/src/lib/workset/worktree-include.ts +161 -0
  111. package/src/lib/workset/worktree-index.ts +6 -2
  112. package/src/lib/workset/worktree.ts +591 -101
  113. package/src/opencode/companion-hooks.ts +46 -8
  114. package/src/opencode/companion-policy.ts +18 -5
  115. package/src/opencode/enter-worktree.ts +254 -6
  116. package/src/opencode/session-register.ts +2 -2
  117. package/src/runtime/claude-bg-isolation.ts +138 -0
  118. package/src/runtime/companion-git.ts +10 -2
  119. package/src/runtime/companion-guidance.ts +17 -4
  120. package/src/runtime/current-branch.ts +16 -2
  121. package/src/runtime/entered-worktree.ts +24 -0
  122. package/src/runtime/git-tracked.ts +60 -0
  123. package/src/runtime/repo-destination.ts +72 -0
  124. package/src/runtime/repo-local.ts +25 -3
  125. package/src/runtime/rtk-git-guard.ts +66 -0
  126. package/src/runtime/runtime-document-manifest.ts +229 -19
  127. package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
  128. package/src/runtime/secret-guard.ts +9 -2
  129. package/src/runtime/secret-policy-weakening.ts +122 -0
  130. package/src/runtime/serving-claude-wrap.ts +15 -2
  131. package/src/runtime/umbrella-folder.ts +56 -0
  132. package/src/runtime/wrap-state.ts +5 -13
  133. package/src/studio.ts +37 -0
  134. package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +61 -6
  135. package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +8 -4
  136. package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +9 -5
  137. package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +5 -4
  138. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +10 -4
  139. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +5 -1
  140. package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +61 -6
  141. package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +8 -4
  142. package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +9 -5
  143. package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +5 -4
  144. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +10 -4
  145. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +5 -1
  146. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +305 -42
  147. package/src/tools/setup/capabilities/rtk.ts +93 -1
  148. package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
  149. package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
  150. package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -4
  151. package/src/tools/setup/dynamic-plugins/install.ts +24 -22
  152. package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
  153. package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
  154. package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
  155. package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
  156. package/src/tools/setup/mate.ts +3 -3
  157. package/src/tools/setup/plugins/gitignore.ts +15 -9
  158. package/src/tools/setup/providers/claude-plugin-hooks.ts +12 -0
  159. package/src/tools/setup/providers/claude.ts +25 -3
  160. package/src/tools/setup/utils.ts +4 -2
  161. package/src/tools/setup/working-repo-cleanup.ts +2 -2
  162. package/src/tools/setup.ts +25 -14
  163. package/studio-dist/client/assets/app-D9cw6szy.css +2 -0
  164. package/studio-dist/client/assets/artifacts-WD2ZXYrx.js +1 -0
  165. package/studio-dist/client/assets/button-Br0O1sXw.js +1 -0
  166. package/studio-dist/client/assets/combobox-DA7RAUUZ.js +1 -0
  167. package/studio-dist/client/assets/companion-view-CrabvxS8.js +1 -0
  168. package/studio-dist/client/assets/factory-DGS0E16C.js +6 -0
  169. package/studio-dist/client/assets/fields-6aXBpFhJ.js +1 -0
  170. package/studio-dist/client/assets/getting-started-Clde4w6P.js +1 -0
  171. package/studio-dist/client/assets/getting-started-D6kgWwWZ.js +1 -0
  172. package/studio-dist/client/assets/getting-started._topic-BiunccbT.js +1 -0
  173. package/studio-dist/client/assets/getting-started.index-DpiNoGw8.js +1 -0
  174. package/studio-dist/client/assets/graph-B_TCBVbu.js +2 -0
  175. package/studio-dist/client/assets/graph-canvas-Ba37Y5AE.js +3242 -0
  176. package/studio-dist/client/assets/guides-Du_RtJxP.js +1 -0
  177. package/studio-dist/client/assets/index-Df8L1LQa.js +40 -0
  178. package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
  179. package/studio-dist/client/assets/markdown-view-BOX6x0rL.js +1 -0
  180. package/studio-dist/client/assets/panel-dbmCx7Mx.js +1 -0
  181. package/studio-dist/client/assets/queries-RvHeXY12.js +1 -0
  182. package/studio-dist/client/assets/react-3QStrcDO.js +27 -0
  183. package/studio-dist/client/assets/report-url-XRL0x1SY.js +1 -0
  184. package/studio-dist/client/assets/reports-r3IK7Doz.js +1 -0
  185. package/studio-dist/client/assets/routes-C0A5LTFc.js +1 -0
  186. package/studio-dist/client/assets/select-CnaMd617.js +1 -0
  187. package/studio-dist/client/assets/skills-CzjzHpBT.js +1 -0
  188. package/studio-dist/client/assets/specs-B0ldF_6J.js +1 -0
  189. package/studio-dist/client/assets/specs-view-BnCLA0gW.js +1 -0
  190. package/studio-dist/client/assets/spinner-Dcm3fqK1.js +1 -0
  191. package/studio-dist/client/assets/steps-C0p2N1Pb.js +1 -0
  192. package/studio-dist/client/assets/store-Dw34catY.js +1 -0
  193. package/studio-dist/client/assets/studio-Cpz_HRHp.js +100 -0
  194. package/studio-dist/client/assets/studio-queries-ibmpFo6R.js +2 -0
  195. package/studio-dist/client/assets/usage-C2QJ_0IZ.js +55 -0
  196. package/studio-dist/client/assets/useAnchoredPopupScrollLock-Bj-FWb8z.js +1 -0
  197. package/studio-dist/client/assets/useMutation-aAr2uiay.js +1 -0
  198. package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
  199. package/studio-dist/client/assets/vault-BGcxkSIY.js +1 -0
  200. package/studio-dist/client/assets/warnings-R1cE1rLf.js +1 -0
  201. package/studio-dist/client/assets/workflow-C2qTrMDH.js +1 -0
  202. package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-Bn896ZYj.js +122 -0
  203. package/studio-dist/server/assets/_tanstack-start-manifest_v.js +102 -35
  204. package/studio-dist/server/assets/{actions-Bvgj9eb8.js → actions-DYSv-9VV.js} +10 -4
  205. package/studio-dist/server/assets/artifacts-DnF9L3dZ.js +216 -0
  206. package/studio-dist/server/assets/{button-CIJqAhni.js → button-CgOIVdmD.js} +13 -1702
  207. package/studio-dist/server/assets/combobox-DV_s9W0s.js +483 -0
  208. package/studio-dist/server/assets/{companion-view-DISASvdJ.js → companion-view-BKVXD3TO.js} +3 -3
  209. package/studio-dist/server/assets/companions-C7fctnU9.js +31 -0
  210. package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
  211. package/studio-dist/server/assets/{factory-DUTa0eDs.js → factory-C7Ybg0xG.js} +1256 -353
  212. package/studio-dist/server/assets/{factory-DGPmNGbo.js → factory-Df5uAHjb.js} +53 -6
  213. package/studio-dist/server/assets/fields-BbieQTD0.js +1190 -0
  214. package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
  215. package/studio-dist/server/assets/getting-started-CRxMWorQ.js +67 -0
  216. package/studio-dist/server/assets/getting-started._topic-DJKQAzYl.js +13 -0
  217. package/studio-dist/server/assets/getting-started.index-D84gec1t.js +13 -0
  218. package/studio-dist/server/assets/graph-CSje3029.js +801 -0
  219. package/studio-dist/server/assets/graph-DDZzXM1L.js +16 -0
  220. package/studio-dist/server/assets/graph-canvas-22bWB5-2.js +21066 -0
  221. package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
  222. package/studio-dist/server/assets/guides-D9dk1Frq.js +13 -0
  223. package/studio-dist/server/assets/guides-IE-19POz.js +5 -0
  224. package/studio-dist/server/assets/guides.server-vcYRY5wx.js +66 -0
  225. package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
  226. package/studio-dist/server/assets/{markdown-view-Bn7xPdks.js → markdown-view-BR8dJ7aR.js} +28 -9
  227. package/studio-dist/server/assets/{panel-3Jmn4awF.js → panel-BR_t9iMM.js} +4 -4
  228. package/studio-dist/server/assets/queries-DWoTin-q.js +32 -0
  229. package/studio-dist/server/assets/react-CdqSUhaL.js +89 -0
  230. package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
  231. package/studio-dist/server/assets/report-url-BUXPcE_8.js +9 -0
  232. package/studio-dist/server/assets/{reports-D6YMqhnO.js → reports-CQ9qQ1-n.js} +9 -10
  233. package/studio-dist/server/assets/{reports-C06RXVE2.js → reports-dYDEoBeq.js} +3 -3
  234. package/studio-dist/server/assets/{router-C8MGqlAY.js → router-DkRHNTpE.js} +787 -2862
  235. package/studio-dist/server/assets/{routes-BcFgvqf7.js → routes-B6GfOew4.js} +22 -171
  236. package/studio-dist/server/assets/{search-JAKurDNh.js → search-BJnWLfkG.js} +21 -2
  237. package/studio-dist/server/assets/select-Af7Wibii.js +1609 -0
  238. package/studio-dist/server/assets/{shell-DS3wUexh.js → shell-Hq-hXgnT.js} +6 -5
  239. package/studio-dist/server/assets/{skills-BEnOxiDl.js → skills-B7nEuVbx.js} +9 -8
  240. package/studio-dist/server/assets/{skills-CtrBAtX3.js → skills-B_YYL7q8.js} +3 -3
  241. package/studio-dist/server/assets/specs-BpLUFntA.js +51 -0
  242. package/studio-dist/server/assets/specs-view-0peMVd22.js +426 -0
  243. package/studio-dist/server/assets/spinner-CdwJW4VB.js +20 -0
  244. package/studio-dist/server/assets/{steps-Dq_CwY_s.js → steps-D56DApvK.js} +1 -1
  245. package/studio-dist/server/assets/store-Cs17okNG.js +280 -0
  246. package/studio-dist/server/assets/studio-CAcKp3bM.js +10340 -0
  247. package/studio-dist/server/assets/studio-queries-BtRGzDdh.js +1451 -0
  248. package/studio-dist/server/assets/usage-COdjd1gD.js +25570 -0
  249. package/studio-dist/server/assets/usage-f6pqE1tm.js +24 -0
  250. package/studio-dist/server/assets/useAnchoredPopupScrollLock-DlBKHRw7.js +756 -0
  251. package/studio-dist/server/assets/useMutation-DzTZGenE.js +690 -0
  252. package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-M2GBs8s3.js → useSelector-DUmCUXAs.js} +4 -668
  253. package/studio-dist/server/assets/{vault-Fvxt2Tzl.js → vault-BDuIUq0F.js} +8 -5
  254. package/studio-dist/server/assets/{vault-BmWnryh3.js → vault-BVLp6zu3.js} +3 -3
  255. package/studio-dist/server/assets/{views-BgYa-za2.js → views-flRUr21z.js} +4 -4
  256. package/studio-dist/server/assets/{warnings-DzR6fyZh.js → warnings-CDy9pdgL.js} +3 -2
  257. package/studio-dist/server/assets/{delivery-path-C29fBynY.js → workflow-D9GKI2EV.js} +132 -106
  258. package/studio-dist/server/server.js +582 -8
  259. package/src/cli/commands/report/collector.ts +0 -288
  260. package/studio-dist/client/assets/app-CdPiFv59.css +0 -2
  261. package/studio-dist/client/assets/button-BIIHE0EQ.js +0 -3
  262. package/studio-dist/client/assets/companion-view-DM6YyXaR.js +0 -1
  263. package/studio-dist/client/assets/delivery-path-DELxj0Av.js +0 -1
  264. package/studio-dist/client/assets/factory-BZy0E8ty.js +0 -4
  265. package/studio-dist/client/assets/index-B3wkMzjA.js +0 -40
  266. package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +0 -1
  267. package/studio-dist/client/assets/panel-CbajlC3p.js +0 -1
  268. package/studio-dist/client/assets/prepaint-CwSrpdFA.js +0 -27
  269. package/studio-dist/client/assets/react-CN2GSx7x.js +0 -1
  270. package/studio-dist/client/assets/reports-DllhYQ5_.js +0 -1
  271. package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
  272. package/studio-dist/client/assets/routes-COm-G3mK.js +0 -1
  273. package/studio-dist/client/assets/skills-DmWAy-jZ.js +0 -1
  274. package/studio-dist/client/assets/specs-BG3Wi3ln.js +0 -1
  275. package/studio-dist/client/assets/steps-DFsH3Neu.js +0 -1
  276. package/studio-dist/client/assets/vault-B2q1nBY5.js +0 -1
  277. package/studio-dist/client/assets/warnings-BSXIyuSQ.js +0 -1
  278. package/studio-dist/client/assets/workflow-DlsQD6Hc.js +0 -1
  279. package/studio-dist/server/assets/companions-BYbHWKOZ.js +0 -15
  280. package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
  281. package/studio-dist/server/assets/prepaint-DJfTQ_VH.js +0 -45
  282. package/studio-dist/server/assets/react-Ce6dj15C.js +0 -46
  283. package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
  284. package/studio-dist/server/assets/specs-C8rv34-5.js +0 -211
  285. package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
  286. package/studio-dist/server/assets/workflow-liRYecHk.js +0 -73
@@ -1,547 +1,9 @@
1
- import { i as __toESM, t as __commonJSMin } from "./rolldown-runtime-DYf_mQCB.js";
2
- import { C as invariant, D as trimPathLeft, E as removeTrailingSlash, O as trimPathRight, T as cleanPath, c as useRouter, d as reactUse, j as require_react, k as rootRouteId, n as require_react_dom, r as useMatch, t as getServerFnById, u as require_jsx_runtime } from "./__23tanstack-start-server-fn-resolver-M2GBs8s3.js";
3
- import { f as TSS_SERVER_FUNCTION, t as createServerFn, y as redirect } from "./createServerFn-F5sAOF8V.js";
4
- import { a as deepEqual, c as functionalUpdate$1, f as isDangerousProtocol, l as getUrlScheme, p as isModuleNotFoundError } from "./utils-C9CX1kcy.js";
5
- import { l as COMPANION_DIGEST_PATTERN } from "./studio-BeltxxKt.js";
6
- import { t as OUTCOME_ACTIONS } from "./actions-Bvgj9eb8.js";
7
- import { n as validateStudioSearch } from "./search-JAKurDNh.js";
8
- // ../../node_modules/.bun/@tanstack+router-core@1.171.39/node_modules/@tanstack/router-core/dist/esm/route.js
9
- var BaseRoute = class {
10
- get to() {
11
- return this._to;
12
- }
13
- get id() {
14
- return this._id;
15
- }
16
- get path() {
17
- return this._path;
18
- }
19
- get fullPath() {
20
- return this._fullPath;
21
- }
22
- constructor(options) {
23
- this.init = (originalIndex) => {
24
- this.originalIndex = originalIndex;
25
- this._branch = void 0;
26
- const options = this.options;
27
- const isRoot = !options?.path && !options?.id;
28
- this.parentRoute = this.options.getParentRoute?.();
29
- if (isRoot) this._path = rootRouteId;
30
- else if (!this.parentRoute) invariant();
31
- let path = isRoot ? rootRouteId : options?.path;
32
- if (path && path !== "/") path = trimPathLeft(path);
33
- const customId = options?.id || path;
34
- const id = isRoot ? rootRouteId : cleanPath((this.parentRoute.id === "__root__" ? "" : this.parentRoute.id) + "/" + (customId ?? ""));
35
- if (path === "__root__") path = "/";
36
- const fullPath = id === "__root__" ? "/" : path === void 0 ? this.parentRoute.fullPath : cleanPath(this.parentRoute.fullPath + "/" + path);
37
- this._path = path;
38
- this._id = id;
39
- this._fullPath = fullPath;
40
- this._to = trimPathRight(fullPath);
41
- };
42
- this.addChildren = (children) => {
43
- return this._addFileChildren(children);
44
- };
45
- this._addFileChildren = (children) => {
46
- if (Array.isArray(children)) this.children = children;
47
- if (typeof children === "object" && children !== null) this.children = Object.values(children);
48
- return this;
49
- };
50
- this._addFileTypes = () => {
51
- return this;
52
- };
53
- this.updateLoader = (options) => {
54
- Object.assign(this.options, options);
55
- return this;
56
- };
57
- this.update = (options) => {
58
- Object.assign(this.options, options);
59
- return this;
60
- };
61
- this.lazy = (lazyFn) => {
62
- this.lazyFn = lazyFn;
63
- return this;
64
- };
65
- this.redirect = (opts) => redirect({
66
- from: this.fullPath,
67
- ...opts
68
- });
69
- this.options = options || {};
70
- this.isRoot = !options?.getParentRoute;
71
- if (options?.id && options?.path) throw new Error(`Route cannot have both an 'id' and a 'path' option.`);
72
- }
73
- };
74
- var BaseRootRoute = class extends BaseRoute {
75
- constructor(options) {
76
- super(options);
77
- }
78
- };
79
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useLoaderData.js
80
- /**
81
- * Read and select the current route's loader data with type‑safety.
82
- *
83
- * Options:
84
- * - `from`/`strict`: Choose which route's data to read and strictness
85
- * - `select`: Map the loader data to a derived value
86
- * - `structuralSharing`: Enable structural sharing for stable references
87
- *
88
- * @returns The loader data (or selected value) for the matched route.
89
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook
90
- */
91
- function useLoaderData(opts) {
92
- return useMatch({
93
- from: opts.from,
94
- strict: opts.strict,
95
- structuralSharing: opts.structuralSharing,
96
- select: (match) => {
97
- return opts.select ? opts.select(match.loaderData) : match.loaderData;
98
- }
99
- });
100
- }
101
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useLoaderDeps.js
102
- /**
103
- * Read and select the current route's loader dependencies object.
104
- *
105
- * Options:
106
- * - `from`: Choose which route's loader deps to read
107
- * - `select`: Map the deps to a derived value
108
- * - `structuralSharing`: Enable structural sharing for stable references
109
- *
110
- * @returns The loader deps (or selected value) for the matched route.
111
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook
112
- */
113
- function useLoaderDeps(opts) {
114
- const { select, ...rest } = opts;
115
- return useMatch({
116
- ...rest,
117
- select: (match) => {
118
- return select ? select(match.loaderDeps) : match.loaderDeps;
119
- }
120
- });
121
- }
122
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useParams.js
123
- /**
124
- * Access the current route's path parameters with type-safety.
125
- *
126
- * Options:
127
- * - `from`/`strict`: Specify the matched route and whether to enforce strict typing
128
- * - `select`: Project the params object to a derived value for memoized renders
129
- * - `structuralSharing`: Enable structural sharing for stable references
130
- * - `shouldThrow`: Throw if the route is not found in strict contexts
131
- *
132
- * @returns The params object (or selected value) for the matched route.
133
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useParamsHook
134
- */
135
- function useParams(opts) {
136
- return useMatch({
137
- from: opts.from,
138
- shouldThrow: opts.shouldThrow,
139
- structuralSharing: opts.structuralSharing,
140
- strict: opts.strict,
141
- select: (match) => {
142
- const params = opts.strict === false ? match.params : match._strictParams;
143
- return opts.select ? opts.select(params) : params;
144
- }
145
- });
146
- }
147
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useSearch.js
148
- /**
149
- * Read and select the current route's search parameters with type-safety.
150
- *
151
- * Options:
152
- * - `from`/`strict`: Control which route's search is read and how strictly it's typed
153
- * - `select`: Map the search object to a derived value for render optimization
154
- * - `structuralSharing`: Enable structural sharing for stable references
155
- * - `shouldThrow`: Throw when the route is not found (strict contexts)
156
- *
157
- * @returns The search object (or selected value) for the matched route.
158
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useSearchHook
159
- */
160
- function useSearch(opts) {
161
- return useMatch({
162
- from: opts.from,
163
- strict: opts.strict,
164
- shouldThrow: opts.shouldThrow,
165
- structuralSharing: opts.structuralSharing,
166
- select: (match) => {
167
- return opts.select ? opts.select(match.search) : match.search;
168
- }
169
- });
170
- }
171
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useNavigate.js
1
+ import { n as require_react, o as __toESM, r as __commonJSMin, t as require_jsx_runtime } from "./jsx-runtime-Bt0s0YKS.js";
2
+ import { B as addToEnd, H as ensureQueryFn, J as isValidTimeout, Q as noop$1, U as fetchSignal, V as addToStart, at as sleep, ct as timeoutManager, et as replaceData, it as skipToken, nt as shallowEqualObjects, ot as timeUntilStale, q as isServer$1, rt as shouldThrowError, st as systemSetTimeoutZero, tt as resolveQueryValue, z as addConsumeAwareSignal } from "./studio-queries-BtRGzDdh.js";
3
+ import { i as require_react_dom } from "../server.js";
4
+ // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
172
5
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
173
- /**
174
- * Imperative navigation hook.
175
- *
176
- * Returns a stable `navigate(options)` function to change the current location
177
- * programmatically. Prefer the `Link` component for user-initiated navigation,
178
- * and use this hook from effects, callbacks, or handlers where imperative
179
- * navigation is required.
180
- *
181
- * Options:
182
- * - `from`: Optional route base used to resolve relative `to` paths.
183
- *
184
- * @returns A function that accepts `NavigateOptions`.
185
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useNavigateHook
186
- */
187
- function useNavigate(_defaultOpts) {
188
- const router = useRouter();
189
- return import_react.useCallback((options) => {
190
- return router.navigate({
191
- ...options,
192
- from: options.from ?? _defaultOpts?.from
193
- });
194
- }, [_defaultOpts?.from, router]);
195
- }
196
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/useRouteContext.js
197
- function useRouteContext(opts) {
198
- return useMatch({
199
- ...opts,
200
- select: (match) => opts.select ? opts.select(match.context) : match.context
201
- });
202
- }
203
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/link.js
204
6
  var import_jsx_runtime = require_jsx_runtime();
205
- function resolveExternalLink(to, protocolAllowlist) {
206
- const scheme = typeof to === "string" && getUrlScheme(to);
207
- if (!scheme) return;
208
- if (!protocolAllowlist.has(scheme)) return null;
209
- return to;
210
- }
211
- function resolveIsActive(location, next, activeOptions, basepath) {
212
- const currentPath = removeTrailingSlash(location.pathname, basepath);
213
- const nextPath = removeTrailingSlash(next.pathname, basepath);
214
- if (activeOptions?.exact ? currentPath !== nextPath : !(currentPath.startsWith(nextPath) && (currentPath.length === nextPath.length || currentPath[nextPath.length] === "/"))) return false;
215
- if (activeOptions?.includeSearch ?? true) {
216
- if (!deepEqual(location.search, next.search, !activeOptions?.exact, activeOptions?.explicitUndefined)) return false;
217
- }
218
- return !activeOptions?.includeHash || location.hash === next.hash;
219
- }
220
- function useLinkProps(options, forwardedRef, host) {
221
- return getServerLinkProps(useRouter(), options, forwardedRef, host);
222
- }
223
- var STATIC_EMPTY_OBJECT = {};
224
- var STATIC_ACTIVE_OBJECT = { className: "active" };
225
- var ROUTER_OPTION_KEYS = /* @__PURE__ */ new Set([
226
- "to",
227
- "params",
228
- "search",
229
- "hash",
230
- "state",
231
- "mask",
232
- "from",
233
- "unsafeRelative",
234
- "reloadDocument",
235
- "preload",
236
- "preloadDelay",
237
- "preloadIntentProximity",
238
- "hashScrollIntoView",
239
- "replace",
240
- "startTransition",
241
- "resetScroll",
242
- "viewTransition",
243
- "ignoreBlocker",
244
- "activeProps",
245
- "inactiveProps",
246
- "activeOptions",
247
- "_asChild"
248
- ]);
249
- function collectElementProps(options, host) {
250
- const props = {};
251
- for (const key in options) {
252
- if (ROUTER_OPTION_KEYS.has(key) || key === "type" && host !== void 0 || key === "disabled" && host === "a") continue;
253
- props[key] = options[key];
254
- }
255
- return props;
256
- }
257
- function applyLinkState(props, options, isActive, href, linkDisabled, host) {
258
- const { activeProps, inactiveProps, className, style, target } = options;
259
- const stateProps = functionalUpdate$1(isActive ? activeProps : inactiveProps, {}) ?? (isActive ? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT);
260
- Object.assign(props, stateProps);
261
- props.href = href;
262
- if (host !== "a") props.disabled = linkDisabled;
263
- props.target = target;
264
- const stateStyle = stateProps.style;
265
- if (style || stateStyle) props.style = style && stateStyle ? {
266
- ...style,
267
- ...stateStyle
268
- } : style || stateStyle;
269
- const stateClassName = stateProps.className;
270
- if (className || stateClassName) props.className = className ? stateClassName ? `${className} ${stateClassName}` : className : stateClassName;
271
- if (linkDisabled) {
272
- props.role = "link";
273
- props["aria-disabled"] = true;
274
- }
275
- if (isActive) {
276
- props["data-status"] = "active";
277
- props["aria-current"] = "page";
278
- }
279
- return props;
280
- }
281
- function getServerLinkProps(router, options, forwardedRef, host) {
282
- const { to, disabled, activeOptions } = options;
283
- const directExternalLink = resolveExternalLink(to, router.protocolAllowlist);
284
- const next = directExternalLink === void 0 ? router.buildLocation(options) : void 0;
285
- const hrefOption = next ? getHrefOption(next, router, disabled) : directExternalLink ?? void 0;
286
- const linkDisabled = disabled || !hrefOption;
287
- const externalLink = directExternalLink ?? (hrefOption && getUrlScheme(hrefOption) ? hrefOption : void 0);
288
- const props = collectElementProps(options, host);
289
- props.ref = forwardedRef;
290
- if (externalLink) {
291
- props.href = externalLink;
292
- return props;
293
- }
294
- return applyLinkState(props, options, !!next && !(!disabled && !hrefOption) && !activeOptions?.includeHash && resolveIsActive(router.stores.location.get(), next, activeOptions, router.basepath), hrefOption, linkDisabled, host);
295
- }
296
- function getHrefOption(next, router, disabled) {
297
- if (disabled) return;
298
- const location = next.maskedLocation ?? next;
299
- const href = location.external ? location.publicHref : router.history.createHref(location.publicHref) || "/";
300
- if ((location.external || href !== location.publicHref) && isDangerousProtocol(href, router.protocolAllowlist)) return;
301
- return href;
302
- }
303
- /**
304
- * A strongly-typed anchor component for declarative navigation.
305
- * Handles path, search, hash and state updates with optional route preloading
306
- * and active-state styling.
307
- *
308
- * Props:
309
- * - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
310
- * - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry
311
- * - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive
312
- * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation
313
- * - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation
314
- * - `ignoreBlocker`: Bypass registered blockers
315
- *
316
- * @returns An anchor-like element that navigates without full page reloads.
317
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent
318
- */
319
- var Link = import_react.memo(import_react.forwardRef((props, ref) => {
320
- const host = props._asChild || "a";
321
- const linkProps = useLinkProps(props, ref, host);
322
- const children = typeof props.children === "function" ? props.children({ isActive: linkProps["data-status"] === "active" }) : props.children;
323
- return import_react.createElement(host, linkProps, children);
324
- }), areLinkPropsEqual);
325
- function areLinkPropsEqual(prev, next) {
326
- let extraKeys = 0;
327
- for (const key in next) {
328
- extraKeys++;
329
- if (prev[key] === next[key]) continue;
330
- if (!ROUTER_OPTION_KEYS.has(key) || !deepEqual(prev[key], next[key], false, true)) return false;
331
- }
332
- for (const _key in prev) extraKeys--;
333
- return extraKeys === 0;
334
- }
335
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/route.js
336
- var Route = class extends BaseRoute {
337
- /**
338
- * @deprecated Use the `createRoute` function instead.
339
- */
340
- constructor(options) {
341
- super(options);
342
- this.useMatch = (opts) => {
343
- return useMatch({
344
- ...opts,
345
- from: this.id
346
- });
347
- };
348
- this.useRouteContext = (opts) => {
349
- return useRouteContext({
350
- ...opts,
351
- from: this.id
352
- });
353
- };
354
- this.useSearch = (opts) => {
355
- return useSearch({
356
- ...opts,
357
- from: this.id
358
- });
359
- };
360
- this.useParams = (opts) => {
361
- return useParams({
362
- ...opts,
363
- from: this.id
364
- });
365
- };
366
- this.useLoaderDeps = (opts) => {
367
- return useLoaderDeps({
368
- ...opts,
369
- from: this.id
370
- });
371
- };
372
- this.useLoaderData = (opts) => {
373
- return useLoaderData({
374
- ...opts,
375
- from: this.id
376
- });
377
- };
378
- this.useNavigate = () => {
379
- return useNavigate({ from: this.fullPath });
380
- };
381
- this.Link = import_react.forwardRef((props, ref) => {
382
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
383
- ref,
384
- from: this.fullPath,
385
- ...props
386
- });
387
- });
388
- }
389
- };
390
- /**
391
- * Creates a non-root Route instance for code-based routing.
392
- *
393
- * Use this to define a route that will be composed into a route tree
394
- * (typically via a parent route's `addChildren`). If you're using file-based
395
- * routing, prefer `createFileRoute`.
396
- *
397
- * @param options Route options (path, component, loader, context, etc.).
398
- * @returns A Route instance to be attached to the route tree.
399
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouteFunction
400
- */
401
- function createRoute(options) {
402
- return new Route(options);
403
- }
404
- /**
405
- * Creates a root route factory that requires a router context type.
406
- *
407
- * Use when your root route expects `context` to be provided to `createRouter`.
408
- * The returned function behaves like `createRootRoute` but enforces a context type.
409
- *
410
- * @returns A factory function to configure and return a root route.
411
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction
412
- */
413
- function createRootRouteWithContext() {
414
- return (options) => {
415
- return createRootRoute(options);
416
- };
417
- }
418
- var RootRoute = class extends BaseRootRoute {
419
- /**
420
- * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
421
- */
422
- constructor(options) {
423
- super(options);
424
- this.useMatch = (opts) => {
425
- return useMatch({
426
- ...opts,
427
- from: this.id
428
- });
429
- };
430
- this.useRouteContext = (opts) => {
431
- return useRouteContext({
432
- ...opts,
433
- from: this.id
434
- });
435
- };
436
- this.useSearch = (opts) => {
437
- return useSearch({
438
- ...opts,
439
- from: this.id
440
- });
441
- };
442
- this.useParams = (opts) => {
443
- return useParams({
444
- ...opts,
445
- from: this.id
446
- });
447
- };
448
- this.useLoaderDeps = (opts) => {
449
- return useLoaderDeps({
450
- ...opts,
451
- from: this.id
452
- });
453
- };
454
- this.useLoaderData = (opts) => {
455
- return useLoaderData({
456
- ...opts,
457
- from: this.id
458
- });
459
- };
460
- this.useNavigate = () => {
461
- return useNavigate({ from: this.fullPath });
462
- };
463
- this.Link = import_react.forwardRef((props, ref) => {
464
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
465
- ref,
466
- from: this.fullPath,
467
- ...props
468
- });
469
- });
470
- }
471
- };
472
- /**
473
- * Creates a root Route instance used to build your route tree.
474
- *
475
- * Typically paired with `createRouter({ routeTree })`. If you need to require
476
- * a typed router context, use `createRootRouteWithContext` instead.
477
- *
478
- * @param options Root route options (component, error, pending, etc.).
479
- * @returns A root route instance.
480
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteFunction
481
- */
482
- function createRootRoute(options) {
483
- return new RootRoute(options);
484
- }
485
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/fileRoute.js
486
- /**
487
- * Creates a file-based Route factory for a given path.
488
- *
489
- * Used by TanStack Router's file-based routing to associate a file with a
490
- * route. The returned function accepts standard route options. In normal usage
491
- * the `path` string is inserted and maintained by the `tsr` generator.
492
- *
493
- * @param path File path literal for the route (usually auto-generated).
494
- * @returns A function that accepts Route options and returns a Route instance.
495
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction
496
- */
497
- function createFileRoute(path) {
498
- return (options) => {
499
- const route = createRoute(options);
500
- route.isRoot = false;
501
- return route;
502
- };
503
- }
504
- // ../../node_modules/.bun/@tanstack+react-router@1.170.46+7492c01c6988791b/node_modules/@tanstack/react-router/dist/esm/lazyRouteComponent.js
505
- /**
506
- * Wrap a dynamic import to create a route component that supports
507
- * `.preload()` and friendly reload-on-module-missing behavior.
508
- *
509
- * @param importer Function returning a module promise
510
- * @param exportName Named export to use (default: `default`)
511
- * @returns A lazy route component compatible with TanStack Router
512
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/lazyRouteComponentFunction
513
- */
514
- function lazyRouteComponent(importer, exportName) {
515
- let loadPromise;
516
- let comp;
517
- let error;
518
- const load = () => {
519
- if (!loadPromise) {
520
- error = void 0;
521
- loadPromise = importer().then((res) => {
522
- comp = res[exportName ?? "default"];
523
- }).catch((err) => {
524
- loadPromise = void 0;
525
- error = err;
526
- });
527
- }
528
- return loadPromise;
529
- };
530
- const lazyComp = function Lazy(props) {
531
- if (error) {
532
- if (isModuleNotFoundError(error) && false);
533
- throw error;
534
- }
535
- if (!comp) {
536
- if (reactUse) reactUse(load());
537
- else throw load();
538
- }
539
- return import_react.createElement(comp, props);
540
- };
541
- lazyComp.preload = load;
542
- return lazyComp;
543
- }
544
- // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
545
7
  /**
546
8
  * The context that `useQueryClient` reads from. `QueryClientProvider` is the normal way to set it.
547
9
  */
@@ -590,523 +52,6 @@ var QueryClientProvider = ({ client, children }) => {
590
52
  children
591
53
  });
592
54
  };
593
- // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
594
- var defaultTimeoutProvider = {
595
- setTimeout: (callback, delay) => setTimeout(callback, delay),
596
- clearTimeout: (timeoutId) => clearTimeout(timeoutId),
597
- setInterval: (callback, delay) => setInterval(callback, delay),
598
- clearInterval: (intervalId) => clearInterval(intervalId)
599
- };
600
- /**
601
- * Allows customization of how timeouts are created.
602
- *
603
- * `@tanstack/query-core` makes liberal use of timeouts to implement `staleTime`
604
- * and `gcTime`. The default TimeoutManager provider uses the platform's global
605
- * `setTimeout` implementation, which is known to have scalability issues with
606
- * thousands of timeouts on the event loop.
607
- *
608
- * If you hit this limitation, consider providing a custom TimeoutProvider that
609
- * coalesces timeouts.
610
- */
611
- var TimeoutManager = class {
612
- #provider = defaultTimeoutProvider;
613
- #providerCalled = false;
614
- /**
615
- * `setTimeoutProvider` can be used to set a custom implementation of the
616
- * `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` functions,
617
- * called a `TimeoutProvider`.
618
- *
619
- * This may be useful if you notice event loop performance issues with
620
- * thousands of queries. A custom TimeoutProvider could also support timer
621
- * delays longer than the global `setTimeout` maximum delay value of about
622
- * 24 days.
623
- *
624
- * It is important to call `setTimeoutProvider` before creating a
625
- * QueryClient or queries, so that the same provider is used consistently
626
- * for all timers in the application, since different TimeoutProviders
627
- * cannot cancel each others' timers.
628
- * @param provider - The `TimeoutProvider` to use for all timers from now on.
629
- * @example
630
- * ```ts
631
- * import { timeoutManager, QueryClient } from '@tanstack/query-core'
632
- * import { CustomTimeoutProvider } from './CustomTimeoutProvider'
633
- *
634
- * timeoutManager.setTimeoutProvider(new CustomTimeoutProvider())
635
- *
636
- * export const queryClient = new QueryClient()
637
- * ```
638
- */
639
- setTimeoutProvider(provider) {
640
- this.#provider = provider;
641
- }
642
- /**
643
- * `setTimeout` schedules a callback to run after approximately `delay`
644
- * milliseconds, like the global `setTimeout` function. The callback can be
645
- * canceled with `clearTimeout`.
646
- *
647
- * It returns a timer ID, which may be a number or an object that can be
648
- * coerced to a number via `Symbol.toPrimitive`.
649
- * @param callback - The function to call when the timeout elapses.
650
- * @param delay - The time to wait before calling `callback`, in milliseconds.
651
- * @returns The timer ID, to pass to {@link TimeoutManager#clearTimeout}.
652
- * @example
653
- * ```ts
654
- * import { timeoutManager } from '@tanstack/query-core'
655
- *
656
- * const timeoutId = timeoutManager.setTimeout(
657
- * () => console.log('ran at:', new Date()),
658
- * 1000,
659
- * )
660
- *
661
- * const timeoutIdNumber: number = Number(timeoutId)
662
- * ```
663
- */
664
- setTimeout(callback, delay) {
665
- return this.#provider.setTimeout(callback, delay);
666
- }
667
- /**
668
- * `clearTimeout` cancels a timeout callback scheduled with `setTimeout`,
669
- * like the global `clearTimeout` function. It should be called with a
670
- * timer ID returned by `setTimeout`.
671
- * @param timeoutId - The timer ID returned by `setTimeout`, or `undefined`.
672
- * @example
673
- * ```ts
674
- * import { timeoutManager } from '@tanstack/query-core'
675
- *
676
- * const timeoutId = timeoutManager.setTimeout(
677
- * () => console.log('ran at:', new Date()),
678
- * 1000,
679
- * )
680
- *
681
- * timeoutManager.clearTimeout(timeoutId)
682
- * ```
683
- */
684
- clearTimeout(timeoutId) {
685
- this.#provider.clearTimeout(timeoutId);
686
- }
687
- /**
688
- * `setInterval` schedules a callback to be called approximately every
689
- * `delay` milliseconds, like the global `setInterval` function.
690
- *
691
- * Like `setTimeout`, it returns a timer ID, which may be a number or an
692
- * object that can be coerced to a number via `Symbol.toPrimitive`.
693
- * @param callback - The function to call on every interval.
694
- * @param delay - The time between calls, in milliseconds.
695
- * @returns The timer ID, to pass to {@link TimeoutManager#clearInterval}.
696
- * @example
697
- * ```ts
698
- * import { timeoutManager } from '@tanstack/query-core'
699
- *
700
- * const intervalId = timeoutManager.setInterval(
701
- * () => console.log('ran at:', new Date()),
702
- * 1000,
703
- * )
704
- * ```
705
- */
706
- setInterval(callback, delay) {
707
- return this.#provider.setInterval(callback, delay);
708
- }
709
- /**
710
- * `clearInterval` can be used to cancel an interval, like the global
711
- * `clearInterval` function. It should be called with an interval ID
712
- * returned by `setInterval`.
713
- * @param intervalId - The timer ID returned by `setInterval`, or `undefined`.
714
- * @example
715
- * ```ts
716
- * import { timeoutManager } from '@tanstack/query-core'
717
- *
718
- * const intervalId = timeoutManager.setInterval(
719
- * () => console.log('ran at:', new Date()),
720
- * 1000,
721
- * )
722
- *
723
- * timeoutManager.clearInterval(intervalId)
724
- * ```
725
- */
726
- clearInterval(intervalId) {
727
- this.#provider.clearInterval(intervalId);
728
- }
729
- };
730
- /**
731
- * Singleton instance of {@link TimeoutManager}, used throughout TanStack Query to schedule and cancel timers.
732
- */
733
- var timeoutManager = new TimeoutManager();
734
- /**
735
- * In many cases code wants to delay to the next event loop tick; this is not
736
- * mediated by {@link timeoutManager}.
737
- *
738
- * This function is provided to make auditing the `tanstack/query-core` for
739
- * incorrect use of system `setTimeout` easier.
740
- * @param callback - The function to call on the next event loop tick.
741
- */
742
- function systemSetTimeoutZero(callback) {
743
- setTimeout(callback, 0);
744
- }
745
- // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/utils.js
746
- /**
747
- * @deprecated use `environmentManager.isServer()` instead.
748
- */
749
- var isServer$1 = typeof window === "undefined" || "Deno" in globalThis;
750
- function noop$1() {}
751
- /**
752
- * Resolves an {@link Updater}: calls it with `input` if it is a function, otherwise returns it as
753
- * is.
754
- * @param updater - The new value, or a function that receives `input` and returns the new value.
755
- * @param input - The current value, passed to `updater` if it is a function.
756
- * @returns The new value.
757
- */
758
- function functionalUpdate(updater, input) {
759
- return typeof updater === "function" ? updater(input) : updater;
760
- }
761
- /**
762
- * Checks whether a value can be used as a timeout: a non-negative, finite number.
763
- * @param value - The value to check.
764
- * @returns `true` if `value` is a number that is `>= 0` and not `Infinity`.
765
- */
766
- function isValidTimeout(value) {
767
- return typeof value === "number" && value >= 0 && value !== Infinity;
768
- }
769
- /**
770
- * Calculates how long until data updated at `updatedAt` becomes stale.
771
- * @param updatedAt - The timestamp, in milliseconds, at which the data was last updated.
772
- * @param staleTime - The time, in milliseconds, after which data is considered stale. Defaults to
773
- * `0`.
774
- * @returns The remaining time in milliseconds, or `0` if the data is already stale.
775
- */
776
- function timeUntilStale(updatedAt, staleTime) {
777
- return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
778
- }
779
- /**
780
- * Resolves an option that can be given either as a value or as a function of the query, such as
781
- * `staleTime`.
782
- * @param value - The option value, or a function that receives `query` and returns the value.
783
- * @param query - The query passed to `value` if it is a function.
784
- * @returns The resolved value, or `undefined` if `value` is `undefined`.
785
- */
786
- function resolveQueryValue(value, query) {
787
- return typeof value === "function" ? value(query) : value;
788
- }
789
- /**
790
- * Checks whether a query matches the given {@link QueryFilters}.
791
- * Every filter that is specified must match; filters that are left unspecified are ignored.
792
- * @param filters - The filters to check the query against.
793
- * @param query - The query to check.
794
- * @returns `true` if the query matches every specified filter.
795
- * @example
796
- * ```ts
797
- * const queryCache = queryClient.getQueryCache()
798
- *
799
- * const matchingQueries = queryCache
800
- * .getAll()
801
- * .filter((query) => matchQuery({ queryKey: ['posts'] }, query))
802
- * ```
803
- */
804
- function matchQuery(filters, query) {
805
- const { type = "all", exact, fetchStatus, predicate, queryKey, stale } = filters;
806
- if (queryKey) {
807
- if (exact) {
808
- if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false;
809
- } else if (!partialMatchKey(query.queryKey, queryKey)) return false;
810
- }
811
- if (type !== "all") {
812
- const isActive = query.isActive();
813
- if (type === "active" && !isActive) return false;
814
- if (type === "inactive" && isActive) return false;
815
- }
816
- if (typeof stale === "boolean" && query.isStale() !== stale) return false;
817
- if (fetchStatus && fetchStatus !== query.state.fetchStatus) return false;
818
- if (predicate && !predicate(query)) return false;
819
- return true;
820
- }
821
- /**
822
- * Checks whether a mutation matches the given {@link MutationFilters}.
823
- * Every filter that is specified must match; filters that are left unspecified are ignored.
824
- * If a `mutationKey` filter is provided but the mutation has no `mutationKey` of its own, it does not match.
825
- * @param filters - The filters to check the mutation against.
826
- * @param mutation - The mutation to check.
827
- * @returns `true` if the mutation matches every specified filter.
828
- * @example
829
- * ```ts
830
- * const mutationCache = queryClient.getMutationCache()
831
- *
832
- * const matchingMutations = mutationCache
833
- * .getAll()
834
- * .filter((mutation) => matchMutation({ mutationKey: ['addPost'] }, mutation))
835
- * ```
836
- */
837
- function matchMutation(filters, mutation) {
838
- const { exact, status, predicate, mutationKey } = filters;
839
- if (mutationKey) {
840
- if (!mutation.options.mutationKey) return false;
841
- if (exact) {
842
- if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) return false;
843
- } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) return false;
844
- }
845
- if (status && mutation.state.status !== status) return false;
846
- if (predicate && !predicate(mutation)) return false;
847
- return true;
848
- }
849
- /**
850
- * Hashes a query key with the query's `queryKeyHashFn` option, falling back to {@link hashKey}.
851
- * @param queryKey - The query key to hash.
852
- * @param options - The query options that may provide a custom `queryKeyHashFn`.
853
- * @returns The query hash, a string that identifies the query in the cache.
854
- */
855
- function hashQueryKeyByOptions(queryKey, options) {
856
- return (options?.queryKeyHashFn || hashKey)(queryKey);
857
- }
858
- /**
859
- * Default query & mutation keys hash function.
860
- * Hashes the value into a stable hash.
861
- * @param queryKey - The query or mutation key to hash.
862
- * @returns The stable hash of the key, as a JSON string.
863
- * @example
864
- * ```ts
865
- * // Object keys are sorted, so key order doesn't affect the hash:
866
- * hashKey(['todos', { page: 1, filter: 'done' }]) // === '["todos",{"filter":"done","page":1}]'
867
- * ```
868
- */
869
- function hashKey(queryKey) {
870
- return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
871
- result[key] = val[key];
872
- return result;
873
- }, {}) : val);
874
- }
875
- function partialMatchKey(a, b) {
876
- if (a === b) return true;
877
- if (typeof a !== typeof b) return false;
878
- if (a && b && typeof a === "object" && typeof b === "object") {
879
- if (Array.isArray(a) && Array.isArray(b)) {
880
- if (b.length > a.length) return false;
881
- for (let i = 0; i < b.length; i++) if (!partialMatchKey(a[i], b[i])) return false;
882
- return true;
883
- }
884
- const bKeys = Object.keys(b);
885
- for (const key of bKeys) if (!partialMatchKey(a[key], b[key])) return false;
886
- return true;
887
- }
888
- return false;
889
- }
890
- var hasOwn = Object.prototype.hasOwnProperty;
891
- function replaceEqualDeep(a, b, depth = 0) {
892
- if (a === b) return a;
893
- if (depth > 500) return b;
894
- const array = isPlainArray(a) && isPlainArray(b);
895
- if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
896
- const aSize = (array ? a : Object.keys(a)).length;
897
- const bItems = array ? b : Object.keys(b);
898
- const bSize = bItems.length;
899
- const copy = array ? new Array(bSize) : {};
900
- let equalItems = 0;
901
- for (let i = 0; i < bSize; i++) {
902
- const key = array ? i : bItems[i];
903
- const aItem = a[key];
904
- const bItem = b[key];
905
- if (aItem === bItem) {
906
- copy[key] = aItem;
907
- if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
908
- continue;
909
- }
910
- if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
911
- copy[key] = bItem;
912
- continue;
913
- }
914
- const v = replaceEqualDeep(aItem, bItem, depth + 1);
915
- copy[key] = v;
916
- if (v === aItem) equalItems++;
917
- }
918
- return aSize === bSize && equalItems === aSize ? a : copy;
919
- }
920
- /**
921
- * Shallow compare objects.
922
- * @param a - The first object.
923
- * @param b - The second object, or `undefined`.
924
- * @returns `true` if both objects have the same keys, with strictly equal values for each key.
925
- */
926
- function shallowEqualObjects(a, b) {
927
- if (!b || Object.keys(a).length !== Object.keys(b).length) return false;
928
- for (const key of Object.keys(a)) if (!hasOwn.call(b, key) || a[key] !== b[key]) return false;
929
- return true;
930
- }
931
- /**
932
- * Checks whether a value is an array with no holes and no extra properties.
933
- * @param value - The value to check.
934
- * @returns `true` if `value` is an array whose number of own keys equals its `length`.
935
- */
936
- function isPlainArray(value) {
937
- return Array.isArray(value) && value.length === Object.keys(value).length;
938
- }
939
- /**
940
- * Checks whether a value is a plain object, e.g. created with an object literal or
941
- * `Object.create(null)`.
942
- * @param o - The value to check.
943
- * @returns `true` if `o` is a plain object.
944
- */
945
- function isPlainObject(o) {
946
- if (!hasObjectPrototype(o)) return false;
947
- const objectPrototype = Object.getPrototypeOf(o);
948
- const ctor = objectPrototype?.constructor;
949
- if (ctor === void 0) return true;
950
- if (typeof ctor !== "function") return false;
951
- const prot = ctor.prototype;
952
- if (!hasObjectPrototype(prot)) return false;
953
- if (!prot.hasOwnProperty("isPrototypeOf")) return false;
954
- if (objectPrototype !== Object.prototype) return false;
955
- return true;
956
- }
957
- /**
958
- * Checks whether a value's `Object.prototype.toString` tag is `[object Object]`.
959
- * @param o - The value to check.
960
- * @returns `true` if the tag is `[object Object]`.
961
- */
962
- function hasObjectPrototype(o) {
963
- return Object.prototype.toString.call(o) === "[object Object]";
964
- }
965
- /**
966
- * Waits for the given time, using the configured {@link timeoutManager}.
967
- * @param timeout - The time to wait, in milliseconds.
968
- * @returns A promise that resolves after `timeout` milliseconds.
969
- */
970
- function sleep(timeout) {
971
- return new Promise((resolve) => {
972
- timeoutManager.setTimeout(resolve, timeout);
973
- });
974
- }
975
- /**
976
- * Applies a query's `structuralSharing` option when writing new data.
977
- * @param prevData - The previously cached data.
978
- * @param data - The new data.
979
- * @param options - The query options, whose `structuralSharing` decides how the data is merged.
980
- * @returns The result of a custom `structuralSharing` function, `data` with its unchanged parts
981
- * replaced by those of `prevData` by default, or `data` as is if `structuralSharing` is `false`.
982
- * @throws {Error} The error from the default structural sharing, e.g. when the data is not JSON serializable.
983
- * Outside production, it is also logged to the console.
984
- */
985
- function replaceData(prevData, data, options) {
986
- if (typeof options.structuralSharing === "function") return options.structuralSharing(prevData, data);
987
- else if (options.structuralSharing !== false) return replaceEqualDeep(prevData, data);
988
- return data;
989
- }
990
- /**
991
- * Intended to be passed as a query's `placeholderData` option, for example
992
- * `placeholderData: keepPreviousData`. Instead of resetting the query's data to `undefined` while a new
993
- * query key is fetching, it keeps displaying the previously fetched data until the new data arrives.
994
- * @param previousData - The data of the previous query key, passed by the observer.
995
- * @returns The previous data, unchanged.
996
- * @example
997
- * ```ts
998
- * new QueryObserver(queryClient, {
999
- * queryKey: ['posts', page],
1000
- * queryFn: () => fetchPosts(page),
1001
- * placeholderData: keepPreviousData,
1002
- * })
1003
- * ```
1004
- */
1005
- function keepPreviousData(previousData) {
1006
- return previousData;
1007
- }
1008
- /**
1009
- * Returns a new array with `item` added at the end. If that makes the array longer than `max`,
1010
- * excess items are removed from the start.
1011
- * @param items - The current items.
1012
- * @param item - The value to append.
1013
- * @param max - The maximum number of items to keep. `0` (the default) means no limit.
1014
- * @returns A new array with `item` added.
1015
- */
1016
- function addToEnd(items, item, max = 0) {
1017
- const newItems = [...items, item];
1018
- return max && newItems.length > max ? newItems.slice(-max) : newItems;
1019
- }
1020
- /**
1021
- * Returns a new array with `item` added at the start. If that makes the array longer than `max`,
1022
- * excess items are removed from the end.
1023
- * @param items - The current items.
1024
- * @param item - The value to prepend.
1025
- * @param max - The maximum number of items to keep. `0` (the default) means no limit.
1026
- * @returns A new array with `item` added.
1027
- */
1028
- function addToStart(items, item, max = 0) {
1029
- const newItems = [item, ...items];
1030
- return max && newItems.length > max ? newItems.slice(0, max) : newItems;
1031
- }
1032
- /**
1033
- * Sentinel value that can be passed as a query's `queryFn` to conditionally disable the query (equivalent
1034
- * to `enabled: false`) while preserving full type inference for the query's data. Unlike `enabled: false`,
1035
- * a query disabled via `skipToken` cannot be triggered with `refetch`.
1036
- * @example
1037
- * ```ts
1038
- * new QueryObserver(queryClient, {
1039
- * queryKey: ['post', postId],
1040
- * queryFn: postId != null ? () => fetchPost(postId) : skipToken,
1041
- * })
1042
- * ```
1043
- */
1044
- var skipToken = Symbol();
1045
- /**
1046
- * Returns the function to call for a fetch. If there is no `queryFn` but the fetch was started from
1047
- * an `initialPromise`, that promise is returned instead. If there is no usable `queryFn` (missing or
1048
- * {@link skipToken}), the returned function rejects with a `Missing queryFn` error.
1049
- * @param options - The query options with the `queryFn`, and the `queryHash` used in error messages.
1050
- * @param fetchOptions - The fetch options, which may carry an `initialPromise`.
1051
- * @returns The function to call for the fetch.
1052
- */
1053
- function ensureQueryFn(options, fetchOptions) {
1054
- if (!options.queryFn && fetchOptions?.initialPromise) return () => fetchOptions.initialPromise;
1055
- if (!options.queryFn || options.queryFn === skipToken) return () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${options.queryHash}'`));
1056
- return options.queryFn;
1057
- }
1058
- /**
1059
- * Resolves a `throwOnError` option to a boolean.
1060
- * If `throwOnError` is a function, it is called with `params` (e.g. the error and, depending on the caller,
1061
- * additional context such as the query or mutation) and its result is returned, allowing the throwing
1062
- * behavior to be decided per error. Otherwise, `throwOnError` itself is coerced to a boolean (`undefined`
1063
- * resolves to `false`).
1064
- * @param throwOnError - The `throwOnError` option: a boolean, a function that decides per error, or
1065
- * `undefined`.
1066
- * @param params - The arguments passed to `throwOnError` if it is a function.
1067
- * @returns Whether the error should be thrown.
1068
- * @example
1069
- * ```ts
1070
- * const throwOnError =
1071
- * query.state.error && typeof options.throwOnError === 'function'
1072
- * ? shouldThrowError(options.throwOnError, [query.state.error, query])
1073
- * : options.throwOnError
1074
- * ```
1075
- */
1076
- function shouldThrowError(throwOnError, params) {
1077
- if (typeof throwOnError === "function") return throwOnError(...params);
1078
- return !!throwOnError;
1079
- }
1080
- var fetchSignal = Symbol();
1081
- /**
1082
- * Adds a lazy `signal` getter to an object, such as a query function context. The first time
1083
- * `signal` is read, `onCancelled` is registered for the signal's `abort` event (or called right
1084
- * away if it is already aborted), so cancellation is only tracked when the signal is actually used.
1085
- * @param object - The object to add the `signal` property to.
1086
- * @param getSignal - Returns the `AbortSignal`. Called once, when `signal` is first read.
1087
- * @param onCancelled - Called when the signal is aborted, if `signal` was read.
1088
- * @param internalSignal - The fetch signal to forward without consuming the getter.
1089
- * @returns The same object, with the `signal` property added.
1090
- */
1091
- function addConsumeAwareSignal(object, getSignal, onCancelled, internalSignal) {
1092
- let consumed = false;
1093
- let signal;
1094
- Object.defineProperties(object, {
1095
- [fetchSignal]: { value: internalSignal },
1096
- signal: {
1097
- enumerable: true,
1098
- get: () => {
1099
- signal ??= getSignal();
1100
- if (consumed) return signal;
1101
- consumed = true;
1102
- if (signal.aborted) onCancelled();
1103
- else signal.addEventListener("abort", onCancelled, { once: true });
1104
- return signal;
1105
- }
1106
- }
1107
- });
1108
- return object;
1109
- }
1110
55
  // ../../node_modules/.bun/@tanstack+query-core@5.105.3/node_modules/@tanstack/query-core/build/modern/environmentManager.js
1111
56
  var isServerFn = () => isServer$1;
1112
57
  /**
@@ -3108,374 +2053,6 @@ function useBaseQuery(options, Observer, queryClient) {
3108
2053
  function useQuery(options, queryClient) {
3109
2054
  return useBaseQuery(options, QueryObserver, queryClient);
3110
2055
  }
3111
- // ../../node_modules/.bun/@tanstack+react-query@5.105.3+cef22a3c7e8b4cef/node_modules/@tanstack/react-query/build/modern/queryOptions.js
3112
- function queryOptions(options) {
3113
- return options;
3114
- }
3115
- // ../mate-core/src/cli/commands/studio/routes.ts
3116
- /** A hosted report's HTML is served at this prefix plus its id. */
3117
- var REPORT_VIEW_PREFIX = "/studio/reports/";
3118
- /** Prefix of a Workset's run log routes. */
3119
- var FACTORY_WORKSETS_ROUTE = "/api/factory/worksets";
3120
- /**
3121
- * The Agents panel: `GET` the Workset agent credential's status, `PUT` `{kind, value}`
3122
- * to set it, `DELETE` to clear one set in Studio. Factory mode only.
3123
- */
3124
- var FACTORY_CREDENTIAL_ROUTE = "/api/factory/credential";
3125
- /** `GET` a Workset's bounded run log as text. */
3126
- function factoryLogRoute(id) {
3127
- return `${FACTORY_WORKSETS_ROUTE}/${encodeURIComponent(id)}/log`;
3128
- }
3129
- /** Server-sent events: a Workset's run log replayed, then followed live. */
3130
- function factoryLogStreamRoute(id) {
3131
- return `${factoryLogRoute(id)}/stream`;
3132
- }
3133
- /** One event stream per page: board, reports and markdown tree changes for a companion. */
3134
- var STUDIO_EVENTS_ROUTE = "/api/events";
3135
- /** The terminal's WASM core, loaded by Studio's bundled terminal from Studio itself. */
3136
- var TERMINAL_WASM = `/studio/terminal/wterm.wasm`;
3137
- /** The terminal's WebSocket, and its session list and end calls. */
3138
- var TERMINAL_SOCKET_ROUTE = "/api/terminal";
3139
- var TERMINAL_SESSIONS_ROUTE = "/api/terminal/sessions";
3140
- var TERMINAL_SESSIONS_END_ROUTE = "/api/terminal/sessions/end";
3141
- // src/lib/agent-credential.ts
3142
- /**
3143
- * The Agents panel's calls to the factory credential route. Only the status is cached;
3144
- * an entered value goes in one request body and is never kept, keyed or put in an address.
3145
- */
3146
- var agentCredentialKey = ["agent-credential"];
3147
- async function call(method, route, body) {
3148
- const response = await fetch(route, {
3149
- method,
3150
- credentials: "same-origin",
3151
- headers: {
3152
- accept: "application/json",
3153
- "content-type": "application/json"
3154
- },
3155
- ...body ? { body: JSON.stringify(body) } : {}
3156
- });
3157
- if (!response.ok) {
3158
- const refusal = await response.json().catch(() => null);
3159
- throw new Error(refusal?.reason ?? `status ${response.status}`);
3160
- }
3161
- return await response.json();
3162
- }
3163
- var agentCredentialQuery = () => ({
3164
- queryKey: agentCredentialKey,
3165
- queryFn: () => call("GET", FACTORY_CREDENTIAL_ROUTE)
3166
- });
3167
- var setAgentCredential = (kind, value) => call("PUT", FACTORY_CREDENTIAL_ROUTE, {
3168
- kind,
3169
- value
3170
- });
3171
- var clearAgentCredential = () => call("DELETE", FACTORY_CREDENTIAL_ROUTE);
3172
- // ../../node_modules/.bun/@tanstack+start-server-core@1.169.45/node_modules/@tanstack/start-server-core/dist/esm/createSsrRpc.js
3173
- var createSsrRpc = (functionId) => {
3174
- const url = "/_serverFn/" + functionId;
3175
- const serverFnMeta = { id: functionId };
3176
- const fn = async (...args) => {
3177
- return (await getServerFnById(functionId, { origin: "server" }))(...args);
3178
- };
3179
- return Object.assign(fn, {
3180
- url,
3181
- serverFnMeta,
3182
- [TSS_SERVER_FUNCTION]: true
3183
- });
3184
- };
3185
- // src/server/factory.ts
3186
- /** What the Factory reads from the companion payload; nothing else crosses to the browser. */
3187
- /** Board actions a person can take: core's Outcome actions, plus `create`, which needs no runner. */
3188
- var FACTORY_ACTIONS = ["create", ...OUTCOME_ACTIONS];
3189
- var MAX_FIELD = 65536;
3190
- function validate(input) {
3191
- if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("no registered companion was selected");
3192
- if (!FACTORY_ACTIONS.includes(input.action)) throw new Error(`unknown factory action ${JSON.stringify(input.action)}`);
3193
- if (input.action !== "create" && typeof input.id !== "string") throw new Error("the action names no Outcome");
3194
- const fields = {};
3195
- for (const [name, value] of Object.entries(input.fields ?? {})) if (typeof value === "string" && value.length <= MAX_FIELD) fields[name] = value;
3196
- return {
3197
- companion: input.companion,
3198
- action: input.action,
3199
- id: input.id,
3200
- fields
3201
- };
3202
- }
3203
- /** One Outcome action, checked by core's services exactly as the old form posts were. */
3204
- var runFactoryAction = createServerFn({ method: "POST" }).validator(validate).handler(createSsrRpc("b0ff357be654d7d833a4f9550953dda5e215e97cdc5b21639aef40d8a2401c4f"));
3205
- /** The Factory's view model: the companion payload, its runs and sessions, at one moment. */
3206
- var getFactory = createServerFn({ method: "GET" }).validator((input) => {
3207
- if (!COMPANION_DIGEST_PATTERN.test(input?.companion ?? "")) throw new Error("no registered companion was selected");
3208
- return { companion: input.companion };
3209
- }).handler(createSsrRpc("332ea72d0b70383661ce66a3228167cb05dc752e7269134a11855d1329c936aa"));
3210
- // src/server/reports.ts
3211
- /** A registered companion's hosted reports, newest first; titles and times only. */
3212
- var getReports = createServerFn({ method: "GET" }).validator((input) => {
3213
- if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("no registered companion was selected");
3214
- return { companion: input.companion };
3215
- }).handler(createSsrRpc("990d830ca9afc020639551c43ec50904b734051c52b1ad91dbf739065b343bb3"));
3216
- // src/server/shell.ts
3217
- /** `refresh` collects the companion again; every other call reads the held snapshot. */
3218
- var getShell = createServerFn({ method: "GET" }).validator((input) => ({
3219
- ...validateStudioSearch(input),
3220
- ...input.refresh === true ? { refresh: true } : {}
3221
- })).handler(createSsrRpc("b4cd58adfccec803b6c97478c78656e3acf554351ec97ef0ce550a10e235ebce"));
3222
- // src/server/skills.ts
3223
- var AGENTS = /* @__PURE__ */ new Set([
3224
- "claude",
3225
- "opencode",
3226
- "agents"
3227
- ]);
3228
- /** One installed skill's files and one of them rendered; core confines it to the skill's folder. */
3229
- var getSkillPreview = createServerFn({ method: "GET" }).validator((input) => {
3230
- if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("no registered companion was selected");
3231
- if (!AGENTS.has(input.agent)) throw new Error("unknown agent");
3232
- if (typeof input.name !== "string" || input.name === "" || input.name.length > 200) throw new Error("the request names no skill");
3233
- const file = typeof input.file === "string" && input.file !== "" && input.file.length <= 4096 ? input.file : void 0;
3234
- return {
3235
- companion: input.companion,
3236
- agent: input.agent,
3237
- name: input.name,
3238
- file
3239
- };
3240
- }).handler(createSsrRpc("8a3086c4bf87fd353e471c38fe6c5e531cb9aa6b29b234d7edb6de5d143cf689"));
3241
- // src/server/vault.ts
3242
- var MAX_CONTENT = 5242880;
3243
- function companionOf(input) {
3244
- if (typeof input?.companion !== "string" || !COMPANION_DIGEST_PATTERN.test(input.companion)) throw new Error("no registered companion was selected");
3245
- return input.companion;
3246
- }
3247
- var text = (value) => typeof value === "string" && value.length > 0 && value.length <= 4096 ? value : void 0;
3248
- /** The vault page; core resolves every path against the selected companion. */
3249
- var getVault = createServerFn({ method: "GET" }).validator((input) => ({
3250
- companion: companionOf(input),
3251
- path: text(input.path),
3252
- dir: text(input.dir),
3253
- refresh: input.refresh === true,
3254
- wait: input.wait === true
3255
- })).handler(createSsrRpc("cc0685774bfb5205a762c25bdd4b959c1f541584df4b67aac816fe529fa37c87"));
3256
- var getVaultChildren = createServerFn({ method: "GET" }).validator((input) => {
3257
- const dir = text(input.dir);
3258
- if (!dir) throw new Error("the request names no folder");
3259
- return {
3260
- companion: companionOf(input),
3261
- dir
3262
- };
3263
- }).handler(createSsrRpc("7564d662d1e0ede6133407d7dde8d613b3b11718bc4f95160680342deeaf9cfd"));
3264
- var getVaultMatches = createServerFn({ method: "GET" }).validator((input) => ({
3265
- companion: companionOf(input),
3266
- query: typeof input.query === "string" ? input.query.slice(0, 200) : ""
3267
- })).handler(createSsrRpc("99f4d57911b5959a331ed18424ab13369de22f8b2b142a146ea967742dfbc997"));
3268
- /** Unsaved editor text rendered as a saved file would be; nothing is read or written. */
3269
- var previewVaultFile = createServerFn({ method: "POST" }).validator((input) => {
3270
- const path = text(input.path);
3271
- if (!path) throw new Error("the preview names no file");
3272
- if (typeof input.content !== "string" || input.content.length > MAX_CONTENT) throw new Error("preview requires content within the size limit");
3273
- return {
3274
- companion: companionOf(input),
3275
- path,
3276
- content: input.content
3277
- };
3278
- }).handler(createSsrRpc("c9e07976b298f1d1353d3422b03638f260b66975d28a1c8b07919923be8c488d"));
3279
- /** A save; a stale token comes back as a conflict carrying the current content and token. */
3280
- var saveVaultFile = createServerFn({ method: "POST" }).validator((input) => {
3281
- const path = text(input.path);
3282
- if (!path) throw new Error("save requires a path");
3283
- if (typeof input.content !== "string" || input.content.length > MAX_CONTENT) throw new Error("save requires content within the size limit");
3284
- return {
3285
- companion: companionOf(input),
3286
- path,
3287
- content: input.content,
3288
- token: text(input.token)
3289
- };
3290
- }).handler(createSsrRpc("63d1e2171062e2d082e16522c162963c4da2a71c447f69f0937bd6e5e10b73ba"));
3291
- // src/server/views.ts
3292
- var VIEWS = /* @__PURE__ */ new Set([
3293
- "dashboard",
3294
- "workflow",
3295
- "skills",
3296
- "specs"
3297
- ]);
3298
- var getCompanionView = createServerFn({ method: "GET" }).validator((input) => {
3299
- if (!VIEWS.has(input?.view)) throw new Error("unknown view");
3300
- const search = validateStudioSearch(input);
3301
- if (!search.companion || !COMPANION_DIGEST_PATTERN.test(search.companion)) throw new Error("no registered companion was selected");
3302
- return {
3303
- ...search,
3304
- view: input.view
3305
- };
3306
- }).handler(createSsrRpc("a09876e9d912d4f3edfe004081679f011fcebe77cfe1b2b25cf6f3e6f1eafc6a"));
3307
- // src/lib/studio-queries.ts
3308
- /**
3309
- * Every companion-scoped Studio query, and which of them each trigger makes stale. Keys start
3310
- * with the companion digest (`null` when none is selected), so one prefix is one companion.
3311
- */
3312
- var keys = {
3313
- companion: (companion) => [companion],
3314
- shell: (companion) => [companion, "shell"],
3315
- views: (companion) => [companion, "view"],
3316
- skills: (companion) => [companion, "skills"],
3317
- factory: (companion) => [companion, "factory"],
3318
- vault: (companion) => [companion, "vault"],
3319
- vaultViews: (companion) => [
3320
- companion,
3321
- "vault",
3322
- "view"
3323
- ],
3324
- reports: (companion) => [companion, "reports"]
3325
- };
3326
- /** Per file and per filter, so unbounded; dropped a while after their last use. */
3327
- var VAULT_GC_MS = 3e5;
3328
- var shellQuery = (search) => queryOptions({
3329
- queryKey: [...keys.shell(search.companion ?? null), search.studioMode ?? null],
3330
- queryFn: () => getShell({ data: search })
3331
- });
3332
- /**
3333
- * Holds the shell another enabled mode would read, built from the one shown: only the mode
3334
- * differs, so switching waits for no request. Held as stale, so the server's copy follows.
3335
- */
3336
- function holdShellForMode(queryClient, search, shell, studioMode) {
3337
- const { queryKey } = shellQuery({
3338
- ...search,
3339
- studioMode
3340
- });
3341
- if (queryClient.getQueryData(queryKey) !== void 0) return;
3342
- queryClient.setQueryData(queryKey, {
3343
- ...shell,
3344
- studioMode
3345
- }, { updatedAt: 0 });
3346
- }
3347
- var companionViewQuery = (view, search) => queryOptions({
3348
- queryKey: [
3349
- ...keys.views(search.companion ?? null),
3350
- view,
3351
- search.studioMode ?? null
3352
- ],
3353
- queryFn: () => getCompanionView({ data: {
3354
- ...search,
3355
- view
3356
- } })
3357
- });
3358
- var skillPreviewQuery = (companion, agent, name, file) => queryOptions({
3359
- queryKey: [
3360
- ...keys.skills(companion),
3361
- agent,
3362
- name,
3363
- file ?? null
3364
- ],
3365
- queryFn: () => getSkillPreview({ data: {
3366
- companion,
3367
- agent,
3368
- name,
3369
- file
3370
- } })
3371
- });
3372
- var factoryQuery = (companion) => queryOptions({
3373
- queryKey: keys.factory(companion),
3374
- queryFn: () => getFactory({ data: { companion } }),
3375
- refetchInterval: 3e4
3376
- });
3377
- var vaultQuery = (companion, search, wait = false) => queryOptions({
3378
- queryKey: [
3379
- ...keys.vaultViews(companion),
3380
- search.path ?? null,
3381
- search.dir ?? null,
3382
- wait
3383
- ],
3384
- queryFn: () => getVault({ data: {
3385
- companion,
3386
- path: search.path,
3387
- dir: search.dir,
3388
- wait
3389
- } }),
3390
- gcTime: VAULT_GC_MS
3391
- });
3392
- var vaultChildrenQuery = (companion, dir) => queryOptions({
3393
- queryKey: [
3394
- ...keys.vault(companion),
3395
- "children",
3396
- dir
3397
- ],
3398
- queryFn: () => getVaultChildren({ data: {
3399
- companion,
3400
- dir
3401
- } })
3402
- });
3403
- var vaultMatchesQuery = (companion, query) => queryOptions({
3404
- queryKey: [
3405
- ...keys.vault(companion),
3406
- "matches",
3407
- query
3408
- ],
3409
- queryFn: () => getVaultMatches({ data: {
3410
- companion,
3411
- query
3412
- } }),
3413
- gcTime: VAULT_GC_MS
3414
- });
3415
- var reportsQuery = (companion) => queryOptions({
3416
- queryKey: keys.reports(companion),
3417
- queryFn: () => getReports({ data: { companion } })
3418
- });
3419
- async function stale(queryClient, ...queryKeys) {
3420
- await Promise.all(queryKeys.map((queryKey) => queryClient.invalidateQueries({ queryKey })));
3421
- }
3422
- /** After a server event for `companion`; views refetch in place (design D7). */
3423
- async function afterEvent(queryClient, companion, type) {
3424
- if (type === "board") {
3425
- if (queryClient.getQueryCache().find({ queryKey: keys.factory(companion) })?.isActive()) {
3426
- await stale(queryClient, keys.factory(companion));
3427
- await stale(queryClient, keys.shell(companion), keys.views(companion));
3428
- } else await stale(queryClient, keys.factory(companion), keys.shell(companion), keys.views(companion));
3429
- } else if (type === "reports") await stale(queryClient, keys.reports(companion));
3430
- }
3431
- var afterFactoryAction = (queryClient, companion) => stale(queryClient, keys.factory(companion));
3432
- /** The refresh answer is shown at once; the companion's other vault reads follow. */
3433
- function afterVaultRefresh(queryClient, companion, search, fresh) {
3434
- const shown = vaultQuery(companion, search).queryKey;
3435
- queryClient.setQueryData(shown, fresh);
3436
- const answered = hashKey(shown);
3437
- return queryClient.invalidateQueries({
3438
- queryKey: keys.vault(companion),
3439
- predicate: (query) => query.queryHash !== answered
3440
- });
3441
- }
3442
- /** After the open file changed on disk or was saved. */
3443
- var afterVaultFileChange = (queryClient, companion) => stale(queryClient, keys.vaultViews(companion));
3444
- /**
3445
- * After Refresh collected `companion` again; other companions keep what they hold. The agent
3446
- * credential is not companion data but may change out of band; terminal sessions are polled.
3447
- */
3448
- var afterRefresh = (queryClient, companion) => stale(queryClient, keys.companion(companion ?? null), agentCredentialKey);
3449
- // src/lib/queries.ts
3450
- /** Cached data as it is, however old, else fetched: what `ensureQueryData` returned. */
3451
- function loadHeld(queryClient, options) {
3452
- return queryClient.query({
3453
- ...options,
3454
- staleTime: "static"
3455
- });
3456
- }
3457
- /**
3458
- * The address's companion when it is registered, else `null`. The layout shows the picker then,
3459
- * so a view loader loads nothing rather than failing the page.
3460
- */
3461
- async function registeredCompanion(queryClient, search) {
3462
- if (!search.companion) return null;
3463
- return (await loadHeld(queryClient, shellQuery({
3464
- companion: search.companion,
3465
- studioMode: search.studioMode
3466
- }))).selected?.digest ?? null;
3467
- }
3468
- /**
3469
- * A view loader's data: awaited on the server, so the first response carries it; started but
3470
- * not awaited in the browser, so navigation switches at once and the view suspends meanwhile.
3471
- * Held data is left as it is, so a hover preload reads nothing; the view's own query refreshes
3472
- * it in the background when stale.
3473
- */
3474
- async function loadView(queryClient, options, onServer = Boolean(true)) {
3475
- if (onServer) return loadHeld(queryClient, options);
3476
- loadHeld(queryClient, options).catch(() => {});
3477
- return null;
3478
- }
3479
2056
  // ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
3480
2057
  function r(e) {
3481
2058
  var t, f, n = "";
@@ -7913,8 +6490,10 @@ var escapeKey = "escape-key";
7913
6490
  var listNavigation = "list-navigation";
7914
6491
  var keyboard = "keyboard";
7915
6492
  var pointer = "pointer";
6493
+ var cancelOpen = "cancel-open";
7916
6494
  var disabled = "disabled";
7917
6495
  var imperativeAction = "imperative-action";
6496
+ var windowResize = "window-resize";
7918
6497
  // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/toggle/Toggle.mjs
7919
6498
  /**
7920
6499
  * A two-state button that can be on or off.
@@ -9306,189 +7885,6 @@ function ToggleGroupItem({ className, look = "pill", ...props }) {
9306
7885
  ...props
9307
7886
  });
9308
7887
  }
9309
- // src/components/view-parts.tsx
9310
- /** A view's title and one plain line on what it shows; no eyebrow. */
9311
- function PageHeader({ title, description, actions }) {
9312
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
9313
- className: "page-header flex flex-wrap items-end gap-x-4 gap-y-2 px-6 pt-5 pb-1 max-sm:px-4",
9314
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9315
- className: "min-w-0",
9316
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
9317
- className: "m-0 text-xl font-semibold tracking-[-0.015em]",
9318
- children: title
9319
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9320
- className: "m-0 mt-0.5 text-sm text-muted",
9321
- children: description
9322
- })]
9323
- }), actions ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
9324
- className: "ml-auto flex items-center gap-1.5",
9325
- children: actions
9326
- }) : null]
9327
- });
9328
- }
9329
- /** The page's padding for content under the header. */
9330
- var PAGE_PAD = "px-6 max-sm:px-4";
9331
- var TONE_TEXT = {
9332
- warn: "text-warn",
9333
- bad: "text-bad",
9334
- accent: "text-accent",
9335
- why: "text-why",
9336
- muted: "text-muted"
9337
- };
9338
- /** A count beside its label: a small tabular chip, amber only when the items need the person. */
9339
- function Count({ value, tone, className, label }) {
9340
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
9341
- className: cn("count inline-grid h-[18px] min-w-[18px] flex-none place-items-center rounded-full px-1.5 font-mono text-2xs leading-none font-medium tabular-nums", tone === "warn" && value > 0 ? "bg-warn-soft text-warn" : "bg-[color-mix(in_srgb,var(--muted)_16%,transparent)] text-muted", className),
9342
- "aria-label": label,
9343
- children: value
9344
- });
9345
- }
9346
- /**
9347
- * A group of items: the title bar carries the name, count and an optional hint on the surface
9348
- * tint; the rows sit on the page. Never nested, never around a graph, document or form.
9349
- */
9350
- function ListCard({ title, count, hint, tone, children, className, label }) {
9351
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
9352
- className: cn("list-card overflow-hidden rounded-card border border-rule", className),
9353
- "aria-label": label ?? (typeof title === "string" ? title : void 0),
9354
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9355
- className: cn("list-card-head flex items-center gap-2.5 border-b border-rule bg-surface px-4 py-2 text-[0.9rem] font-semibold", tone ? TONE_TEXT[tone] : null),
9356
- children: [
9357
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
9358
- className: "m-0 text-[inherit] font-[inherit]",
9359
- children: title
9360
- }),
9361
- count !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Count, {
9362
- value: count,
9363
- tone: tone === "warn" ? "warn" : void 0
9364
- }) : null,
9365
- hint ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
9366
- className: "ml-auto text-xs font-normal text-muted",
9367
- children: hint
9368
- }) : null
9369
- ]
9370
- }), children]
9371
- });
9372
- }
9373
- /** A row in a list card: one line, soft rule above, the surface tint on hover and when current. */
9374
- var ROW = "list-row flex w-full min-w-0 items-center gap-4 border-0 border-t border-rule-soft bg-transparent px-4 py-2 text-left text-base text-text no-underline transition-colors first:border-t-0 hover:bg-surface aria-[current=true]:bg-surface aria-[current=true]:shadow-[inset_2px_0_0_var(--accent)]";
9375
- /** Narrows a list in place; one value is always chosen. */
9376
- function Pills({ label, options, value, onChange, className }) {
9377
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToggleGroup, {
9378
- "aria-label": label,
9379
- value: [value],
9380
- onValueChange: (next) => {
9381
- const chosen = next[0];
9382
- if (chosen) onChange(chosen);
9383
- },
9384
- className,
9385
- children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ToggleGroupItem, {
9386
- value: option.value,
9387
- children: [option.label, option.count !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Count, {
9388
- value: option.count,
9389
- tone: option.tone === "warn" ? "warn" : void 0
9390
- }) : null]
9391
- }, option.value))
9392
- });
9393
- }
9394
- var MARKERS = {
9395
- /** Diamond: waiting on a person. */
9396
- review: "rotate-45 rounded-[2px] size-[7px] bg-why",
9397
- /** Diamond: under way. */
9398
- build: "rotate-45 rounded-[2px] size-[7px] bg-accent",
9399
- /** Circle: done. */
9400
- done: "rounded-full size-2 bg-accent",
9401
- /** Square: something is wrong. */
9402
- issue: "rounded-[1px] size-2 bg-bad",
9403
- /** Ring: nothing happening. */
9404
- idle: "rounded-full size-2 ring-[1.5px] ring-muted ring-inset",
9405
- warn: "rounded-full size-2 bg-warn"
9406
- };
9407
- var MARKER_TEXT = {
9408
- review: "text-why",
9409
- build: "text-accent",
9410
- done: "text-accent",
9411
- issue: "text-bad",
9412
- idle: "text-muted",
9413
- warn: "text-warn"
9414
- };
9415
- /** A status word with its marker shape, so the state never rests on colour alone. */
9416
- function StatusWord({ marker, children }) {
9417
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
9418
- className: cn("status-word inline-flex items-center gap-2 text-xs whitespace-nowrap", MARKER_TEXT[marker]),
9419
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
9420
- className: cn("flex-none", MARKERS[marker]),
9421
- "aria-hidden": "true"
9422
- }), children]
9423
- });
9424
- }
9425
- /** "N of M tasks" with its bar. */
9426
- function Progress({ done, total }) {
9427
- if (total === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
9428
- className: "text-xs text-muted",
9429
- children: "No tasks"
9430
- });
9431
- const percent = Math.min(100, Math.round(done / total * 100));
9432
- const label = `${done} of ${total} tasks`;
9433
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
9434
- className: "grid min-w-[120px] gap-1.5 text-xs text-muted",
9435
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
9436
- className: "relative block h-1 w-full max-w-[140px] overflow-hidden rounded-full bg-rule",
9437
- role: "progressbar",
9438
- "aria-valuemin": 0,
9439
- "aria-valuemax": 100,
9440
- "aria-valuenow": percent,
9441
- "aria-label": label,
9442
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
9443
- className: "absolute inset-y-0 left-0 rounded-full bg-accent",
9444
- style: { width: `${percent}%` }
9445
- })
9446
- })]
9447
- });
9448
- }
9449
- var subscribe = () => () => {};
9450
- /** "22m ago" from the viewer's clock; filled in after hydration so server and browser agree. */
9451
- function Age({ at, className }) {
9452
- const text = (0, import_react.useSyncExternalStore)(subscribe, () => at === void 0 ? "" : ageText(at, Date.now()), () => "");
9453
- if (at === void 0) return null;
9454
- const date = new Date(at);
9455
- if (Number.isNaN(date.getTime())) return null;
9456
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", {
9457
- dateTime: date.toISOString(),
9458
- className: cn("font-mono text-xs whitespace-nowrap text-muted", className),
9459
- children: text
9460
- });
9461
- }
9462
- function ageText(at, now) {
9463
- const seconds = Math.max(0, Math.round((now - new Date(at).getTime()) / 1e3));
9464
- if (seconds < 60) return "just now";
9465
- if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
9466
- if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`;
9467
- return `${Math.floor(seconds / 86400)}d ago`;
9468
- }
9469
- /** A plain sentence for a list with nothing in it; no empty card. */
9470
- function EmptyNote({ children, className }) {
9471
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
9472
- className: cn("empty m-0 rounded-card border border-dashed border-rule px-5 py-5 text-base text-muted", className),
9473
- children
9474
- });
9475
- }
9476
- /** A command as the person would type it; `copy` is the text copied when it differs. */
9477
- function CommandLine({ text, copy = text, label = "prompt" }) {
9478
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9479
- className: "flex min-w-0 items-center gap-2 rounded-control border border-rule bg-page py-1.5 pr-1.5 pl-3 font-mono text-xs",
9480
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
9481
- className: "min-w-0 flex-1 truncate",
9482
- children: text
9483
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
9484
- type: "button",
9485
- className: "inline-flex h-7 flex-none items-center rounded-[6px] border border-rule bg-surface px-2.5 font-sans text-xs text-text hover:border-accent hover:bg-accent-soft",
9486
- "data-copy": copy,
9487
- "data-copy-label": label,
9488
- children: "Copy"
9489
- })]
9490
- });
9491
- }
9492
7888
  // ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/fastHooks.mjs
9493
7889
  var hooks = [];
9494
7890
  var currentInstance = void 0;
@@ -9802,6 +8198,11 @@ function createAttribute(name) {
9802
8198
  var DISABLED_TRANSITIONS_STYLE = { style: { transition: "none" } };
9803
8199
  var CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger";
9804
8200
  /**
8201
+ * Used for dropdowns that usually strictly prefer top/bottom placements and
8202
+ * use `var(--available-height)` to limit their height.
8203
+ */
8204
+ var DROPDOWN_COLLISION_AVOIDANCE = { fallbackAxisSide: "none" };
8205
+ /**
9805
8206
  * Used by regular popups that usually aren't scrollable and are allowed to
9806
8207
  * freely flip to any axis of placement.
9807
8208
  */
@@ -11689,97 +10090,6 @@ var FloatingRootStore = class extends ReactStore {
11689
10090
  this.context.onOpenChange?.(newOpen, eventDetails);
11690
10091
  };
11691
10092
  };
11692
- // ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/popups/store.mjs
11693
- /**
11694
- * State common to all popup stores.
11695
- */
11696
- function createInitialPopupStoreState(triggerElements, floatingId, nested = false) {
11697
- return {
11698
- open: false,
11699
- openProp: void 0,
11700
- mounted: false,
11701
- transitionStatus: void 0,
11702
- floatingRootContext: new FloatingRootStore({
11703
- open: false,
11704
- transitionStatus: void 0,
11705
- floatingElement: null,
11706
- referenceElement: null,
11707
- triggerElements,
11708
- floatingId,
11709
- syncOnly: true,
11710
- nested,
11711
- onOpenChange: void 0
11712
- }),
11713
- floatingId,
11714
- triggerCount: 0,
11715
- preventUnmountingOnClose: false,
11716
- payload: void 0,
11717
- activeTriggerId: null,
11718
- activeTriggerElement: null,
11719
- openedWithoutTrigger: false,
11720
- triggerIdProp: void 0,
11721
- popupElement: null,
11722
- positionerElement: null,
11723
- activeTriggerProps: EMPTY_OBJECT,
11724
- inactiveTriggerProps: EMPTY_OBJECT,
11725
- popupProps: EMPTY_OBJECT
11726
- };
11727
- }
11728
- var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId;
11729
- var openSelector = (state) => state.openProp ?? state.open;
11730
- var popupIdSelector = (state) => {
11731
- return (state.popupElement?.id ?? state.floatingId) || void 0;
11732
- };
11733
- function triggerOwnsOpenPopup(state, triggerId) {
11734
- return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
11735
- }
11736
- function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
11737
- if (triggerOwnsOpenPopup(state, triggerId)) return true;
11738
- return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && !state.openedWithoutTrigger && state.triggerCount === 1;
11739
- }
11740
- var popupStoreSelectors = {
11741
- open: openSelector,
11742
- mounted: (state) => state.mounted,
11743
- transitionStatus: (state) => openSelector(state) && !state.mounted ? "starting" : state.transitionStatus,
11744
- floatingRootContext: (state) => state.floatingRootContext,
11745
- triggerCount: (state) => state.triggerCount,
11746
- preventUnmountingOnClose: (state) => state.preventUnmountingOnClose,
11747
- payload: (state) => state.payload,
11748
- activeTriggerId: activeTriggerIdSelector,
11749
- activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null,
11750
- popupId: popupIdSelector,
11751
- /**
11752
- * Whether the trigger with the given ID was used to open the popup.
11753
- */
11754
- isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId,
11755
- /**
11756
- * Whether the popup is open and was activated by a trigger with the given ID.
11757
- */
11758
- isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),
11759
- /**
11760
- * Whether the popup is mounted and was activated by a trigger with the given ID.
11761
- */
11762
- isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted,
11763
- triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,
11764
- /**
11765
- * Popup id for the trigger that currently owns the open popup.
11766
- */
11767
- triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0,
11768
- popupProps: (state) => state.popupProps,
11769
- popupElement: (state) => state.popupElement,
11770
- positionerElement: (state) => state.positionerElement
11771
- };
11772
- /**
11773
- * Store members a detached handle-backed trigger reads or invokes for trigger registration and data
11774
- * forwarding. `set`/`update` are included only for trigger-count and trigger-data bookkeeping; on a
11775
- * detached (inert) store they are intentionally no-ops, so a write through them is not guaranteed to
11776
- * be durable. Component handle-store views Pick these from their concrete store (preserving its
11777
- * context and selectors) and add any component-specific trigger-invoked members such as `setOpen`.
11778
- */
11779
- /**
11780
- * The subset of a popup store that trigger registration and data forwarding rely on. Narrow enough
11781
- * that an inert store can be passed while detached.
11782
- */
11783
10093
  // src/components/icon.tsx
11784
10094
  /** Line icons on a 20px grid, drawn locally so the page loads nothing from another host. */
11785
10095
  var PATHS = {
@@ -11789,6 +10099,7 @@ var PATHS = {
11789
10099
  doc: "M6 3h5l4 4v10H6zM11 3v4h4M8.5 11h4M8.5 14h4",
11790
10100
  folder: "M3 6.5V15h14V8H9.5L8 6H3.5",
11791
10101
  chart: "M4 16V9m4 7V5m4 11v-5m4 5V8",
10102
+ graph: "M3 6a2 2 0 1 0 4 0 2 2 0 1 0-4 0m10-1a2 2 0 1 0 4 0 2 2 0 1 0-4 0m-5 10a2 2 0 1 0 4 0 2 2 0 1 0-4 0M7 5.8l6-.6M5.7 7.9l3.6 5.3m5-6.3-3.4 6.3",
11792
10103
  search: "M9 15a6 6 0 1 0 0-12 6 6 0 0 0 0 12Zm4.5-1.5L17 17",
11793
10104
  chevron: "m7 8 3 3 3-3",
11794
10105
  right: "m8 6 4 4-4 4",
@@ -11926,4 +10237,4 @@ function Button({ className, variant, size, type = "button", ...props }) {
11926
10237
  ...props
11927
10238
  });
11928
10239
  }
11929
- export { CommandLine as $, useIsoLayoutEffect as $n, createSsrRpc as $r, isInteractiveElement as $t, useFloatingParentNodeId as A, partialMatchKey as Ai, closePress as An, cn as Ar, floor as At, visuallyHidden as B, Link as Bi, listNavigation as Bn, factoryQuery as Br, getSide as Bt, useOpenChangeComplete as C, functionalUpdate as Ci, getTarget as Cn, NOOP as Cr, getMinListIndex as Ct, FloatingNode as D, matchMutation as Di, ios as Dn, useBaseUiId as Dr, clamp as Dt, resolveRef as E, keepPreviousData as Ei, android as En, useRefWithInit as Er, isIndexOutOfListBounds as Et, CLICK_TRIGGER_IDENTIFIER as F, QueryClientProvider as Fi, inputChange as Fn, afterFactoryAction as Fr, getExpandedPlacements as Ft, mergeCleanups as G, triggerHover as Gn, vaultChildrenQuery as Gr, round as Gt, AnimationFrame as H, outsidePress as Hn, reportsQuery as Hr, max as Ht, DISABLED_TRANSITIONS_STYLE as I, useQueryClient as Ii, inputClear as In, afterRefresh as Ir, getOppositeAxis as It, useTimeout as J, createGenericEventDetails as Jn, getVault as Jr, isVirtualPointerEvent as Jt, addEventListener as K, triggerPress as Kn, vaultMatchesQuery as Kr, isMouseLikePointerType as Kt, POPUP_COLLISION_AVOIDANCE as L, lazyRouteComponent as Li, inputPress as Ln, afterVaultFileChange as Lr, getOppositeAxisPlacements as Lt, FloatingPortal as M, shallowEqualObjects as Mi, escapeKey as Mn, loadView as Mr, getAlignmentAxis as Mt, useFloatingPortalNode as N, shouldThrowError as Ni, focusOut as Nn, registeredCompanion as Nr, getAlignmentSides as Nt, FloatingTree as O, matchQuery as Oi, mac as On, useId as Or, createCoords as Ot, usePortalContext as P, skipToken as Pi, imperativeAction as Pn, afterEvent as Pr, getAxisLength as Pt, Age as Q, formatErrorMessage as Qn, runFactoryAction as Qr, getFloatingFocusElement as Qt, createAttribute as R, createFileRoute as Ri, itemPress as Rn, afterVaultRefresh as Rr, getOppositePlacement as Rt, useUnmountAfterClose as S, Subscribable as Si, contains as Sn, EMPTY_OBJECT as Sr, getMaxListIndex as St, useDismiss as T, hashQueryKeyByOptions as Ti, webkit as Tn, useMergedRefs as Tr, isElementVisible as Tt, useAnimationFrame as U, pointer as Un, shellQuery as Ur, min as Ut, visuallyHiddenInput as V, useNavigate as Vi, none as Vn, holdShellForMode as Vr, getSideAxis as Vt, useValueAsRef as W, triggerFocus as Wn, skillPreviewQuery as Wr, rectToClientRect as Wt, fastComponent as X, useButton as Xn, saveVaultFile as Xr, getNodeAncestors as Xt, useOnMount as Y, useCompositeListItem as Yn, previewVaultFile as Yr, stopEvent as Yt, fastComponentRef as Z, ownerDocument as Zn, getShell as Zr, getNodeChildren as Zt, useOpenStateTransitions as _, Removable as _i, ARROW_LEFT$1 as _n, isTopLayer as _r, getTabbableNearElement as _t, popupStoreSelectors as a, STUDIO_EVENTS_ROUTE as ai, popupStateMapping as an, getNodeName as ar, Pills as at, usePopupRootSync as b, notifyManager as bi, activeElement as bn, mergeProps as br, tabbable as bt, require_shim as c, TERMINAL_SOCKET_ROUTE as ci, triggerOpenStateMapping as cn, getParentNode as cr, StatusWord as ct, PopupHandleAttachment as d, factoryLogStreamRoute as di, closed as dn, isElement as dr, useToolbarRootContext as dt, agentCredentialKey as ei, isTargetInsideEnabledTrigger as en, useStableCallback as er, Count as et, applyPopupOpenChange as f, useQuery as fi, endingStyle as fn, isHTMLElement as fr, useDirection as ft, useImplicitActiveTrigger as g, Query as gi, ARROW_DOWN$1 as gn, isTableElement as gr, getPreviousTabbable as gt, createPopupOpenState as h, QueryObserver as hi, transitionStatusMapping as hn, isShadowRoot as hr, getNextTabbable as ht, createInitialPopupStoreState as i, REPORT_VIEW_PREFIX as ii, triggerDisabled as in, getFrameElement as ir, PageHeader as it, useFloatingTree as j, resolveQueryValue as ji, disabled as jn, loadHeld as jr, getAlignment as jt, useFloatingNodeId as k, noop$1 as ki, CompositeList as kn, useControlled as kr, evaluate as kt, PopupTriggerMap as l, TERMINAL_WASM as li, popupOpen$1 as ln, getWindow as lr, ToggleGroup as lt, createDefaultInitialFocus as m, defaultThrowOnError as mi, startingStyle as mn, isOverflowElement as mr, focusable as mt, buttonVariants as n, clearAgentCredential as ni, isTypeableElement as nn, getContainingBlock as nr, ListCard as nt, FloatingRootStore as o, TERMINAL_SESSIONS_END_ROUTE as oi, popupTransitionStateMapping as on, getNodeScroll as or, Progress as ot, attachPreventUnmountOnClose as p, useBaseQuery as pi, open as pn, isLastTraversableNode as pr, COMPOSITE_KEYS as pt, Timeout as q, createChangeEventDetails as qn, vaultQuery as qr, isVirtualClick as qt, Icon as r, setAgentCredential as ri, matchesFocusVisible as rn, getDocumentElement as rr, PAGE_PAD as rt, ReactStore as s, TERMINAL_SESSIONS_ROUTE as si, pressableTriggerOpenStateMapping as sn, getOverflowAncestors as sr, ROW as st, Button as t, agentCredentialQuery as ti, isTypeableCombobox as tn, getComputedStyle$1 as tr, EmptyNote as tt, FOCUSABLE_POPUP_PROPS as u, factoryLogRoute as ui, pressed as un, isContainingBlock as ur, ToggleGroupItem as ut, usePopupInteractionProps as v, createRetryer as vi, ARROW_RIGHT$1 as vn, isWebKit as vr, isOutsideEvent as vt, useAnimationsFinished as w, hashKey as wi, gecko as wn, isReactVersionAtLeast as wr, getNextListIndex as wt, useTriggerDataForwarding as x, focusManager as xi, closest as xn, EMPTY_ARRAY as xr, getGridNavigatedIndex as xt, usePopupRootStore as y, onlineManager as yi, ARROW_UP$1 as yn, useRenderElement as yr, isTabbable as yt, FocusGuard as z, createRootRouteWithContext as zi, keyboard as zn, companionViewQuery as zr, getPaddingObject as zt };
10240
+ export { ToggleGroup as $, getFrameElement as $n, triggerOpenStateMapping as $t, useFloatingParentNodeId as A, inputClear as An, QueryObserver as Ar, getPaddingObject as At, FocusGuard as B, triggerPress as Bn, stopEvent as Bt, useAnimationsFinished as C, cancelOpen as Cn, useId as Cr, getAlignmentAxis as Ct, FloatingNode as D, focusOut as Dn, useQuery as Dr, getOppositeAxis as Dt, resolveRef as E, escapeKey as En, clsx as Er, getExpandedPlacements as Et, CLICK_TRIGGER_IDENTIFIER as F, none as Fn, notifyManager as Fr, rectToClientRect as Ft, useValueAsRef as G, useButton as Gn, isTargetInsideEnabledTrigger as Gt, visuallyHiddenInput as H, createChangeEventDetails as Hn, getNodeChildren as Ht, DISABLED_TRANSITIONS_STYLE as I, outsidePress as In, focusManager as Ir, round as It, Timeout as J, useIsoLayoutEffect as Jn, matchesFocusVisible as Jt, mergeCleanups as K, ownerDocument as Kn, isTypeableCombobox as Kt, DROPDOWN_COLLISION_AVOIDANCE as L, pointer as Ln, Subscribable as Lr, isMouseLikePointerType as Lt, FloatingPortal as M, itemPress as Mn, Removable as Mr, getSideAxis as Mt, useFloatingPortalNode as N, keyboard as Nn, createRetryer as Nr, max as Nt, FloatingTree as O, imperativeAction as On, useBaseQuery as Or, getOppositeAxisPlacements as Ot, usePortalContext as P, listNavigation as Pn, onlineManager as Pr, min as Pt, fastComponentRef as Q, getDocumentElement as Qn, pressableTriggerOpenStateMapping as Qt, POPUP_COLLISION_AVOIDANCE as R, triggerFocus as Rn, QueryClientProvider as Rr, isVirtualClick as Rt, useOpenChangeComplete as S, CompositeList as Sn, useBaseUiId as Sr, getAlignment as St, useDismiss as T, disabled as Tn, cn as Tr, getAxisLength as Tt, AnimationFrame as U, createGenericEventDetails as Un, getFloatingFocusElement as Ut, visuallyHidden as V, windowResize as Vn, getNodeAncestors as Vt, useAnimationFrame as W, useCompositeListItem as Wn, isInteractiveElement as Wt, useOnMount as X, getComputedStyle$1 as Xn, popupStateMapping as Xt, useTimeout as Y, useStableCallback as Yn, triggerDisabled as Yt, fastComponent as Z, getContainingBlock as Zn, popupTransitionStateMapping as Zt, usePopupInteractionProps as _, webkit as _n, EMPTY_OBJECT as _r, isListIndexDisabled as _t, ReactStore as a, startingStyle as an, isContainingBlock as ar, getNextTabbable as at, useTriggerDataForwarding as b, mac as bn, useMergedRefs as br, evaluate as bt, PopupTriggerMap as c, ARROW_LEFT$1 as cn, isLastTraversableNode as cr, isOutsideEvent as ct, applyPopupOpenChange as d, activeElement as dn, isTableElement as dr, getGridNavigatedIndex as dt, popupOpen$1 as en, getNodeName as er, ToggleGroupItem as et, attachPreventUnmountOnClose as f, closest as fn, isTopLayer as fr, getMaxListIndex as ft, useOpenStateTransitions as g, gecko as gn, EMPTY_ARRAY as gr, isIndexOutOfListBounds as gt, useImplicitActiveTrigger as h, jsdom as hn, mergeProps as hr, isElementVisible as ht, FloatingRootStore as i, open as in, getWindow as ir, focusable as it, useFloatingTree as j, inputPress as jn, Query as jr, getSide as jt, useFloatingNodeId as k, inputChange as kn, defaultThrowOnError as kr, getOppositePlacement as kt, FOCUSABLE_POPUP_PROPS as l, ARROW_RIGHT$1 as ln, isOverflowElement as lr, isTabbable as lt, createPopupOpenState as m, getTarget as mn, useRenderElement as mr, getNextListIndex as mt, buttonVariants as n, closed as nn, getOverflowAncestors as nr, useDirection as nt, require_with_selector as o, transitionStatusMapping as on, isElement as or, getPreviousTabbable as ot, createDefaultInitialFocus as p, contains as pn, isWebKit as pr, getMinListIndex as pt, addEventListener as q, formatErrorMessage as qn, isTypeableElement as qt, Icon as r, endingStyle as rn, getParentNode as rr, COMPOSITE_KEYS as rt, require_shim as s, ARROW_DOWN$1 as sn, isHTMLElement as sr, getTabbableNearElement as st, Button as t, pressed as tn, getNodeScroll as tr, useToolbarRootContext as tt, PopupHandleAttachment as u, ARROW_UP$1 as un, isShadowRoot as ur, tabbable as ut, usePopupRootStore as v, android as vn, NOOP as vr, clamp as vt, useTransitionStatus as w, closePress as wn, useControlled as wr, getAlignmentSides as wt, useUnmountAfterClose as x, isElementDisabled as xn, useRefWithInit as xr, floor as xt, usePopupRootSync as y, ios as yn, isReactVersionAtLeast as yr, createCoords as yt, createAttribute as z, triggerHover as zn, useQueryClient as zr, isVirtualPointerEvent as zt };