bazilion 0.12.2 → 0.14.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 (217) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.js +795 -240
  3. package/dist/cli.js.map +1 -1
  4. package/dist/daemon.js +4555 -1280
  5. package/dist/daemon.js.map +1 -1
  6. package/dist/migrations/0001_init.sql +21 -0
  7. package/dist/web/client/assets/AgentTabs-BcmmwYJc.js +1 -0
  8. package/dist/web/client/assets/ConfigPage-BCLp-FUC.js +1 -0
  9. package/dist/web/client/assets/ConfirmDialog-CyL9A20V.js +1 -0
  10. package/dist/web/client/assets/FieldRow-D6REbYUa.js +1 -0
  11. package/dist/web/client/assets/Page-NV96O47A.js +1 -0
  12. package/dist/web/client/assets/ProductionTeamPolicyEditor-DBKnOezm.js +7 -0
  13. package/dist/web/client/assets/{ProfileCommunicationEditor-C43HvUe-.js → ProfileCommunicationEditor-4RK2laqO.js} +1 -1
  14. package/dist/web/client/assets/SectionTabs-4kCQXuFY.js +1 -0
  15. package/dist/web/client/assets/TeamTabs-CdtNEqt4.js +1 -0
  16. package/dist/web/client/assets/{TemplatesTabs-6Jd_xQj7.js → TemplatesTabs-CZyss2Y0.js} +1 -1
  17. package/dist/web/client/assets/UnsavedChangesGuard-CEoK-ZcN.js +1 -0
  18. package/dist/web/client/assets/_id-4ZS-w_Aj.js +1 -0
  19. package/dist/web/client/assets/{_id-AOAT0H_5.js → _id-DIqtdQij.js} +1 -1
  20. package/dist/web/client/assets/_id-DbcC2E7F.js +1 -0
  21. package/dist/web/client/assets/_id-f_r5M0p3.js +1 -0
  22. package/dist/web/client/assets/activity-CB9Ufth-.js +1 -0
  23. package/dist/web/client/assets/agents-D-JGXVg9.js +1 -0
  24. package/dist/web/client/assets/agents-DS2XafoA.js +1 -0
  25. package/dist/web/client/assets/approvals-Cke_mrJv.js +1 -0
  26. package/dist/web/client/assets/attention-PYwRM2wC.js +1 -0
  27. package/dist/web/client/assets/chevron-right-BG4OeFRQ.js +1 -0
  28. package/dist/web/client/assets/config-DF9Gqmfa.js +3 -0
  29. package/dist/web/client/assets/dm-sans-latin-400-normal-BwCSEQnW.woff +0 -0
  30. package/dist/web/client/assets/dm-sans-latin-400-normal-CW0RaeGs.woff2 +0 -0
  31. package/dist/web/client/assets/dm-sans-latin-500-normal-B9HHJjqV.woff2 +0 -0
  32. package/dist/web/client/assets/dm-sans-latin-500-normal-Dr3UlScf.woff +0 -0
  33. package/dist/web/client/assets/dm-sans-latin-600-normal-Aqo67rzb.woff2 +0 -0
  34. package/dist/web/client/assets/dm-sans-latin-600-normal-BmdmIIQ2.woff +0 -0
  35. package/dist/web/client/assets/dm-sans-latin-700-normal-CUSSCpQX.woff +0 -0
  36. package/dist/web/client/assets/dm-sans-latin-700-normal-DvUfVpUG.woff2 +0 -0
  37. package/dist/web/client/assets/dm-serif-display-latin-400-normal-C5_t9oOD.woff2 +0 -0
  38. package/dist/web/client/assets/dm-serif-display-latin-400-normal-_kVFYEpx.woff +0 -0
  39. package/dist/web/client/assets/{inbox-Bn1GbUsJ.js → inbox-DC_HdOfI.js} +1 -1
  40. package/dist/web/client/assets/index-Cofc7zhl.css +1 -0
  41. package/dist/web/client/assets/index-Cp6UHWr2.js +52 -0
  42. package/dist/web/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  43. package/dist/web/client/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  44. package/dist/web/client/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  45. package/dist/web/client/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  46. package/dist/web/client/assets/learning-BfrQ4YZY.js +1 -0
  47. package/dist/web/client/assets/login-D4n3AcBR.js +1 -0
  48. package/dist/web/client/assets/mcp-CnjQc_JJ.js +1 -0
  49. package/dist/web/client/assets/members-wxsVTJdW.js +1 -0
  50. package/dist/web/client/assets/memory-Du60O3pE.js +1 -0
  51. package/dist/web/client/assets/{policy-DaijITy7.js → policy-BOfnkJsL.js} +1 -1
  52. package/dist/web/client/assets/{preload-helper-mNuBjNXU.js → preload-helper-bztXdkDj.js} +1 -1
  53. package/dist/web/client/assets/routes-B9CuhzUW.js +1 -0
  54. package/dist/web/client/assets/services-DyvqJqM2.js +1 -0
  55. package/dist/web/client/assets/skills-DQo7ioW7.js +1 -0
  56. package/dist/web/client/assets/styles-B5vcgXln.css +2 -0
  57. package/dist/web/client/assets/{teams-D92R9Pb7.js → teams-DPggy97H.js} +1 -1
  58. package/dist/web/client/assets/teams-DdawcfNR.js +1 -0
  59. package/dist/web/client/assets/telegram-DcTeDpP5.js +1 -0
  60. package/dist/web/client/assets/tokens-CIEKwZXc.js +1 -0
  61. package/dist/web/client/assets/triggers-Bc2RrUPm.js +1 -0
  62. package/dist/web/client/assets/utils-B6KiDbIe.js +1 -0
  63. package/dist/web/client/assets/welcome-DlhNXUIa.js +1 -0
  64. package/dist/web/client/assets/wire-constants-BzdHSc6A.js +74 -0
  65. package/dist/web/client/assets/x-DAXGIe_Q.js +1 -0
  66. package/dist/web/server/assets/{AgentTabs-aXdsiiMp.js → AgentTabs-Dq8hDM2Q.js} +9 -2
  67. package/dist/web/server/assets/{ChatPane-Ba5wTsVk.js → ChatPane-CgSe7tsy.js} +81 -43
  68. package/dist/web/server/assets/{ConfigPage-BKlh5vOU.js → ConfigPage-CiQ-gxmJ.js} +3 -2
  69. package/dist/web/server/assets/ConfirmDialog-C-MPYYSU.js +99 -0
  70. package/dist/web/server/assets/FieldRow-DCOF07kl.js +160 -0
  71. package/dist/web/server/assets/{Page-LENulSXY.js → Page-Bz-ydB8j.js} +4 -10
  72. package/dist/web/server/assets/{ProductionTeamPolicyEditor-Y4mzFFvR.js → ProductionTeamPolicyEditor-DQSdP7Yx.js} +140 -123
  73. package/dist/web/server/assets/{SectionTabs-BJTPr5nU.js → SectionTabs-B2Yw81XN.js} +2 -2
  74. package/dist/web/server/assets/{Sidebar-DsRVCszF.js → Sidebar-DKyk7oIo.js} +563 -283
  75. package/dist/web/server/assets/{TeamTabs-zZzbP1t_.js → TeamTabs-Co3n2exj.js} +2 -6
  76. package/dist/web/server/assets/{TemplatesTabs-CcRxZhJe.js → TemplatesTabs-B0fA361R.js} +1 -1
  77. package/dist/web/server/assets/UnsavedChangesGuard-CiStXyBI.js +40 -0
  78. package/dist/web/server/assets/{_id-Dj1yZ3zJ.js → _id-BAA9KJBU.js} +4 -4
  79. package/dist/web/server/assets/{_id-LrvXU4Nr.js → _id-BM5m2FLT.js} +4 -4
  80. package/dist/web/server/assets/{_id-CwyGjJeP.js → _id-BYKpT2Tu.js} +4 -5
  81. package/dist/web/server/assets/{_id-BHYLL8M-.js → _id-BeKhPKw3.js} +350 -185
  82. package/dist/web/server/assets/{_id-C3HY4lWg.js → _id-BqWTB8Wl.js} +188 -86
  83. package/dist/web/server/assets/{_id-DinTp_7X.js → _id-BwvCtzlD.js} +3 -3
  84. package/dist/web/server/assets/{_id-D27T85mU.js → _id-DYU6uIBx.js} +4 -5
  85. package/dist/web/server/assets/{_id-IzadFZV9.js → _id-DvlDkk04.js} +4 -4
  86. package/dist/web/server/assets/{_id-BhOB8Umi.js → _id-DxCnEFpm.js} +4 -4
  87. package/dist/web/server/assets/{_id-tB47Vsfp.js → _id-HMy7jM3P.js} +3 -3
  88. package/dist/web/server/assets/{_id-D3Ap7zZA.js → _id-ndxFHx0t.js} +75 -71
  89. package/dist/web/server/assets/{_id-FcHdSocl.js → _id-sNu5aXZt.js} +5 -4
  90. package/dist/web/server/assets/{_tanstack-start-manifest_v-BGDBdnUs.js → _tanstack-start-manifest_v-C-OiOZeM.js} +118 -94
  91. package/dist/web/server/assets/{activity-DohitgwW.js → activity-9VP6QDTH.js} +3 -3
  92. package/dist/web/server/assets/{activity-BCI4mfNS.js → activity-BWv1goK6.js} +3 -3
  93. package/dist/web/server/assets/{activity-D9SMqBhy.js → activity-LjpblbDL.js} +3 -3
  94. package/dist/web/server/assets/{agents-C9xlWK0Z.js → agents-BDFGrU3o.js} +4 -4
  95. package/dist/web/server/assets/{agents-BY74v7fM.js → agents-BJAv919x.js} +3 -3
  96. package/dist/web/server/assets/{agents-BvttypqB.js → agents-CJk4pxKu.js} +3 -3
  97. package/dist/web/server/assets/{agents-CgZMHj80.js → agents-CYw1xHoY.js} +138 -16
  98. package/dist/web/server/assets/{agents-DZuFEj0D.js → agents-DfNKc_Q7.js} +52 -8
  99. package/dist/web/server/assets/{agents-BPKOshR5.js → agents-DjyQk94u.js} +4 -4
  100. package/dist/web/server/assets/{approvals-CWcFHlor.js → approvals-7JOoBchn.js} +3 -3
  101. package/dist/web/server/assets/{approvals-BGU-XGIO.js → approvals-BYi84gwl.js} +3 -3
  102. package/dist/web/server/assets/{approvals-DCaVw1Mz.js → approvals-Bz123liE.js} +59 -21
  103. package/dist/web/server/assets/{attention-BxkTf337.js → attention-B35JvhOL.js} +3 -3
  104. package/dist/web/server/assets/{attention-w21GQIGH.js → attention-C1pPWSXw.js} +3 -3
  105. package/dist/web/server/assets/{attention-CM-Ks1N9.js → attention-UhqPK_Ro.js} +3 -3
  106. package/dist/web/server/assets/{auth-byfSx6Ja.js → auth-7BHTH-KS.js} +5 -5
  107. package/dist/web/server/assets/{config-BDCJdtj2.js → config-BMiajTZP.js} +10 -5
  108. package/dist/web/server/assets/{config-1w2GiJUn.js → config-BlMkHStx.js} +3 -3
  109. package/dist/web/server/assets/config-ExacOzHX.js +958 -0
  110. package/dist/web/server/assets/{createServerRpc-pU-IQV2Y.js → createServerRpc-B7Yr1K8i.js} +1 -1
  111. package/dist/web/server/assets/{createSsrRpc-DFsIAfFd.js → createSsrRpc-6LHNEsSK.js} +1 -1
  112. package/dist/web/server/assets/{daemon-client-2NRMzlTr.js → daemon-client-CI5NHwNC.js} +16 -4
  113. package/dist/web/server/assets/{inbox-CzlKT9Wg.js → inbox-Dv55rGYq.js} +4 -4
  114. package/dist/web/server/assets/{inbox-BLUzA5sQ.js → inbox-RweGCV3D.js} +3 -3
  115. package/dist/web/server/assets/{inbox-ZvDNAjaM.js → inbox-cu3jLzNP.js} +4 -4
  116. package/dist/web/server/assets/{learning-B7PBkvER.js → learning-BaKM6qaw.js} +4 -4
  117. package/dist/web/server/assets/{learning-8zav4pIT.js → learning-C2upa1CE.js} +4 -4
  118. package/dist/web/server/assets/{learning-Cq7K2heb.js → learning-CbtNlqYo.js} +76 -23
  119. package/dist/web/server/assets/{login-CmWvxfTK.js → login-BNj3U6ok.js} +22 -12
  120. package/dist/web/server/assets/{login-Bx5LEyGP.js → login-Be8eP4Jp.js} +2 -2
  121. package/dist/web/server/assets/{mcp-DIWTogHM.js → mcp-B0goWO8Q.js} +3 -3
  122. package/dist/web/server/assets/{mcp-2pwT9HU8.js → mcp-BvnvlVFd.js} +3 -3
  123. package/dist/web/server/assets/mcp-CiBs8unU.js +332 -0
  124. package/dist/web/server/assets/members-BP3UTqu1.js +12 -0
  125. package/dist/web/server/assets/members-DHYTVgwb.js +100 -0
  126. package/dist/web/server/assets/members-DiYtr-zm.js +12 -0
  127. package/dist/web/server/assets/{memory-Dngc13Nw.js → memory-BqV-Afy1.js} +4 -4
  128. package/dist/web/server/assets/{memory-a8Kz57Kh.js → memory-CkXUgf5s.js} +150 -48
  129. package/dist/web/server/assets/{memory-pZ4pZT7p.js → memory-DTFEmfF3.js} +4 -4
  130. package/dist/web/server/assets/{policy-Bb-vEgqg.js → policy-18fdTFO4.js} +3 -3
  131. package/dist/web/server/assets/{policy-C30AeFIb.js → policy-BddK4xom.js} +3 -3
  132. package/dist/web/server/assets/{policy-BcGELcc9.js → policy-Bvvav8fh.js} +4 -4
  133. package/dist/web/server/assets/public-origin-xV0lm0Ty.js +25 -0
  134. package/dist/web/server/assets/router-pjH2t8Rl.js +813 -0
  135. package/dist/web/server/assets/{routes-B6cMLIPk.js → routes-BgHisAxH.js} +22 -5
  136. package/dist/web/server/assets/{routes-BrA-U_Hm.js → routes-COtkyZG1.js} +5 -5
  137. package/dist/web/server/assets/{routes-C19CMLZt.js → routes-DAU2g7Uz.js} +4 -4
  138. package/dist/web/server/assets/services-ClyGBU7W.js +83 -0
  139. package/dist/web/server/assets/{services-C4szdhPx.js → services-DgoU1udp.js} +3 -3
  140. package/dist/web/server/assets/{services-wG8I06oS.js → services-DozuJtzX.js} +3 -3
  141. package/dist/web/server/assets/{skills-BZdqiDig.js → skills-CYih9TJw.js} +47 -6
  142. package/dist/web/server/assets/{skills-a9VSWHWq.js → skills-DfGSJTCB.js} +3 -3
  143. package/dist/web/server/assets/{skills-C-UgkuCW.js → skills-Dw3cI3si.js} +3 -3
  144. package/dist/web/server/assets/start-D4Wq9iTa.js +70 -0
  145. package/dist/web/server/assets/{teams-OIkHuxy1.js → teams-BJuoNOTB.js} +3 -3
  146. package/dist/web/server/assets/{teams-CpQ0YgWf.js → teams-DF3RViAg.js} +3 -3
  147. package/dist/web/server/assets/{teams-DEpQR2QA.js → teams-DFnuc660.js} +3 -3
  148. package/dist/web/server/assets/{teams-DqfrEoH6.js → teams-DPnAX4wD.js} +4 -4
  149. package/dist/web/server/assets/{teams-jBtvnk59.js → teams-TV6nbEN_.js} +101 -10
  150. package/dist/web/server/assets/{teams-MjqgsmC3.js → teams-be05ci17.js} +3 -3
  151. package/dist/web/server/assets/{telegram-DNgCWebD.js → telegram-1AWL6lFw.js} +3 -3
  152. package/dist/web/server/assets/{telegram-XwyKSEtj.js → telegram-DbOFpTFm.js} +3 -3
  153. package/dist/web/server/assets/{telegram-CBF8SJzB.js → telegram-Dj4Wwhd6.js} +262 -43
  154. package/dist/web/server/assets/tokens-DDwtO15P.js +359 -0
  155. package/dist/web/server/assets/tokens-DjM8GsgS.js +19 -0
  156. package/dist/web/server/assets/{tokens-BnwFbV7T.js → tokens-_2hptHP6.js} +4 -4
  157. package/dist/web/server/assets/{triggers-BZPl5CHs.js → triggers-BvjYNmmY.js} +4 -4
  158. package/dist/web/server/assets/triggers-CHk9O3rU.js +367 -0
  159. package/dist/web/server/assets/{triggers-D79NoSXk.js → triggers-Nezfw-Bd.js} +4 -4
  160. package/dist/web/server/assets/utils-C_uf36nf.js +8 -0
  161. package/dist/web/server/assets/{welcome-DDB11L5j.js → welcome-B8nchXdF.js} +9 -8
  162. package/dist/web/server/server.js +29 -33
  163. package/dist/web-server.js +4 -0
  164. package/dist/web-server.js.map +1 -1
  165. package/dist/worker.js +1744 -362
  166. package/dist/worker.js.map +1 -1
  167. package/package.json +7 -6
  168. package/dist/web/client/assets/AgentTabs-R6gSjIj3.js +0 -1
  169. package/dist/web/client/assets/ConfigPage-BCwfgyjD.js +0 -1
  170. package/dist/web/client/assets/FieldRow-avAFLgYW.js +0 -1
  171. package/dist/web/client/assets/Page-CwNuDhWz.js +0 -1
  172. package/dist/web/client/assets/ProductionTeamPolicyEditor-CsWpTsy6.js +0 -7
  173. package/dist/web/client/assets/SectionTabs-DZzy01az.js +0 -1
  174. package/dist/web/client/assets/TeamTabs-DvqWieCq.js +0 -1
  175. package/dist/web/client/assets/_id-BUuz7Drv.js +0 -1
  176. package/dist/web/client/assets/_id-BegmVRmT.js +0 -1
  177. package/dist/web/client/assets/_id-BrA4Crh_.js +0 -1
  178. package/dist/web/client/assets/activity-n0Fw9_w3.js +0 -1
  179. package/dist/web/client/assets/agents-B33VQtbl.js +0 -1
  180. package/dist/web/client/assets/agents-C50pdxp7.js +0 -1
  181. package/dist/web/client/assets/approvals-DVW0hX8h.js +0 -1
  182. package/dist/web/client/assets/attention-B2490jcN.js +0 -1
  183. package/dist/web/client/assets/chevron-down-B0aNNOyn.js +0 -1
  184. package/dist/web/client/assets/config-CMMxxeX2.js +0 -3
  185. package/dist/web/client/assets/context-DcFzsfZ3.js +0 -1
  186. package/dist/web/client/assets/index-3nrK5iFr.js +0 -12
  187. package/dist/web/client/assets/learning-BUX1MFu2.js +0 -1
  188. package/dist/web/client/assets/login-CMWpGDKv.js +0 -1
  189. package/dist/web/client/assets/mcp-lZV08dqc.js +0 -1
  190. package/dist/web/client/assets/members-DAeaY2Cy.js +0 -1
  191. package/dist/web/client/assets/memory-HmMWxxdF.js +0 -1
  192. package/dist/web/client/assets/plus-CPzRJg1V.js +0 -1
  193. package/dist/web/client/assets/routes-BNk270AM.js +0 -1
  194. package/dist/web/client/assets/services-DtrpJrdo.js +0 -1
  195. package/dist/web/client/assets/skills-Cv93A3P3.js +0 -1
  196. package/dist/web/client/assets/styles-DMltY3su.css +0 -2
  197. package/dist/web/client/assets/teams-CCFnSNKi.js +0 -1
  198. package/dist/web/client/assets/telegram-BF1vdgDB.js +0 -1
  199. package/dist/web/client/assets/tokens-BXj6hWW-.js +0 -1
  200. package/dist/web/client/assets/triggers-NT24i4hZ.js +0 -1
  201. package/dist/web/client/assets/welcome-D0cy68eZ.js +0 -1
  202. package/dist/web/client/assets/wire-constants-BhVKOCQa.js +0 -74
  203. package/dist/web/server/assets/FieldRow-B4eTegH9.js +0 -94
  204. package/dist/web/server/assets/config-BmixCpz-.js +0 -372
  205. package/dist/web/server/assets/context-B-XDf6Ym.js +0 -12
  206. package/dist/web/server/assets/context-BXGo5Vfi.js +0 -12
  207. package/dist/web/server/assets/context-DrkrIWun.js +0 -47
  208. package/dist/web/server/assets/mcp-BJjLIdP0.js +0 -261
  209. package/dist/web/server/assets/members-CCv17cjQ.js +0 -46
  210. package/dist/web/server/assets/members-CW5aBe81.js +0 -12
  211. package/dist/web/server/assets/members-VdPwD6CE.js +0 -12
  212. package/dist/web/server/assets/router-CIVjTgNp.js +0 -537
  213. package/dist/web/server/assets/services-B9yBWDX0.js +0 -79
  214. package/dist/web/server/assets/start-WH8WzTL_.js +0 -4
  215. package/dist/web/server/assets/tokens-DPDMSN5O.js +0 -12
  216. package/dist/web/server/assets/tokens-yyTSfBSN.js +0 -186
  217. package/dist/web/server/assets/triggers-CSNNzRIi.js +0 -216
@@ -0,0 +1,813 @@
1
+ import { a as getCookie, n as createServerFn } from "../server.js";
2
+ import { t as DAEMON_BASE_URL } from "./daemon-client-CI5NHwNC.js";
3
+ import { t as webOriginConfig } from "./public-origin-xV0lm0Ty.js";
4
+ import { i as BaziuLogo, n as ThemeToggle, r as PawIcon, t as Route$5 } from "./login-Be8eP4Jp.js";
5
+ import { t as createSsrRpc } from "./createSsrRpc-6LHNEsSK.js";
6
+ import { t as Route$6 } from "./routes-DAU2g7Uz.js";
7
+ import { t as Route$7 } from "./teams-DFnuc660.js";
8
+ import { t as Route$8 } from "./skills-Dw3cI3si.js";
9
+ import { t as Route$9 } from "./config-BlMkHStx.js";
10
+ import { t as Route$10 } from "./attention-B35JvhOL.js";
11
+ import { t as Route$11 } from "./approvals-7JOoBchn.js";
12
+ import { t as Route$12 } from "./agents-BDFGrU3o.js";
13
+ import { t as Route$13 } from "./tokens-_2hptHP6.js";
14
+ import { t as Route$14 } from "./services-DgoU1udp.js";
15
+ import { t as Route$15 } from "./mcp-B0goWO8Q.js";
16
+ import { t as Route$16 } from "./teams-BJuoNOTB.js";
17
+ import { t as Route$17 } from "./agents-CJk4pxKu.js";
18
+ import { t as Route$18 } from "./_id-BAA9KJBU.js";
19
+ import { t as Route$19 } from "./_id-sNu5aXZt.js";
20
+ import { t as Route$20 } from "./policy-BddK4xom.js";
21
+ import { t as Route$21 } from "./memory-DTFEmfF3.js";
22
+ import { t as Route$22 } from "./members-DiYtr-zm.js";
23
+ import { t as Route$23 } from "./activity-LjpblbDL.js";
24
+ import { t as Route$24 } from "./telegram-DbOFpTFm.js";
25
+ import { t as Route$25 } from "./triggers-BvjYNmmY.js";
26
+ import { t as Route$26 } from "./learning-BaKM6qaw.js";
27
+ import { t as Route$27 } from "./inbox-cu3jLzNP.js";
28
+ import { t as Route$28 } from "./_id-BwvCtzlD.js";
29
+ import { t as Route$29 } from "./_id-BYKpT2Tu.js";
30
+ import { useEffect, useState } from "react";
31
+ import { HeadContent, Link, Outlet, Scripts, createFileRoute, createRootRoute, createRouter, lazyRouteComponent, redirect, useRouterState } from "@tanstack/react-router";
32
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
33
+ import { BellRing, Bot, ChevronDown, LayoutTemplate, LogOut, MessageCircle, Settings2, ShieldCheck, Sparkles, UsersRound } from "lucide-react";
34
+ import { DropdownMenu } from "radix-ui";
35
+ //#region src/components/Footer.tsx
36
+ function Footer() {
37
+ return /* @__PURE__ */ jsxs("footer", {
38
+ className: "mx-auto mt-14 flex w-full max-w-[1500px] shrink-0 flex-col items-center justify-between gap-3 border-t border-frost py-5 text-xs text-mocha-light sm:flex-row",
39
+ children: [/* @__PURE__ */ jsxs(Link, {
40
+ to: "/",
41
+ className: "team inline-flex items-center gap-2 rounded-lg text-charcoal transition-opacity hover:text-charcoal hover:opacity-80",
42
+ children: [/* @__PURE__ */ jsx(BaziuLogo, { className: "h-6 w-6 transition-transform duration-300 team-hover:rotate-[-8deg]" }), /* @__PURE__ */ jsx("span", {
43
+ className: "font-display text-sm tracking-[-0.01em]",
44
+ children: "bazilion"
45
+ })]
46
+ }), /* @__PURE__ */ jsxs("span", {
47
+ className: "inline-flex items-center gap-1.5",
48
+ children: ["dedicated to Baziu", /* @__PURE__ */ jsx(PawIcon, {
49
+ className: "h-3 w-3 text-rose-baziu opacity-60",
50
+ "aria-hidden": "true"
51
+ })]
52
+ })]
53
+ });
54
+ }
55
+ //#endregion
56
+ //#region src/components/TopNav.tsx
57
+ var PRIMARY_LINKS = [
58
+ {
59
+ to: "/",
60
+ label: "Chat",
61
+ icon: MessageCircle
62
+ },
63
+ {
64
+ to: "/agents",
65
+ label: "Agents",
66
+ icon: Bot
67
+ },
68
+ {
69
+ to: "/teams",
70
+ label: "Teams",
71
+ icon: UsersRound
72
+ }
73
+ ];
74
+ var OPERATIONS_LINKS = [{
75
+ href: "/approvals",
76
+ label: "Approvals",
77
+ description: "Decide whether one captured action may proceed.",
78
+ icon: ShieldCheck
79
+ }, {
80
+ href: "/attention",
81
+ label: "Attention",
82
+ description: "Inspect failures, warnings, lessons, and open signals.",
83
+ icon: BellRing
84
+ }];
85
+ var MANAGE_LINKS = [
86
+ {
87
+ href: "/templates",
88
+ label: "Templates",
89
+ description: "Reusable Agent behavior and Team rosters.",
90
+ icon: LayoutTemplate
91
+ },
92
+ {
93
+ href: "/skills",
94
+ label: "Skills",
95
+ description: "Prompt skills available to your agents.",
96
+ icon: Sparkles
97
+ },
98
+ {
99
+ href: "/config",
100
+ label: "Setup",
101
+ description: "Providers, integrations, access, and services.",
102
+ icon: Settings2
103
+ }
104
+ ];
105
+ function TopNav() {
106
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
107
+ const [attention, setAttention] = useState(null);
108
+ const [logoutError, setLogoutError] = useState(null);
109
+ useEffect(() => {
110
+ if (pathname === "/login" || pathname === "/welcome") return;
111
+ const controller = new AbortController();
112
+ fetch("/api/attention/summary", { signal: controller.signal }).then((response) => response.ok ? response.json() : null).then((body) => setAttention(body)).catch((error) => {
113
+ if (error instanceof DOMException && error.name === "AbortError") return;
114
+ });
115
+ return () => controller.abort();
116
+ }, [pathname]);
117
+ async function logout() {
118
+ setLogoutError(null);
119
+ try {
120
+ const response = await fetch("/api/logout", { method: "POST" });
121
+ if (!response.ok) throw new Error(`Log out failed (${response.status})`);
122
+ window.location.assign("/login");
123
+ } catch (error) {
124
+ setLogoutError(error instanceof Error ? error.message : String(error));
125
+ }
126
+ }
127
+ return /* @__PURE__ */ jsxs("nav", {
128
+ "aria-label": "Primary navigation",
129
+ className: "relative mx-auto grid w-full max-w-[1500px] shrink-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 border-b border-frost py-3 md:flex md:gap-2 md:py-4",
130
+ children: [
131
+ /* @__PURE__ */ jsxs(Link, {
132
+ to: "/",
133
+ "aria-label": "Bazilion home",
134
+ className: "logo team flex min-w-0 items-center gap-2 rounded-lg text-charcoal transition-opacity hover:text-charcoal hover:opacity-80",
135
+ children: [/* @__PURE__ */ jsx(BaziuLogo, { className: "logo-paw h-8 w-8 shrink-0 transition-transform duration-300 team-hover:rotate-[-8deg] team-hover:scale-[1.08]" }), /* @__PURE__ */ jsx("span", {
136
+ className: "truncate font-display text-[1.35rem] tracking-[-0.02em]",
137
+ children: "bazilion"
138
+ })]
139
+ }),
140
+ /* @__PURE__ */ jsxs("div", {
141
+ className: "col-span-2 row-start-2 flex min-w-0 items-center gap-1 overflow-x-auto pb-0.5 md:col-auto md:row-auto md:ml-4 md:flex-1 md:overflow-visible md:pb-0",
142
+ children: [
143
+ PRIMARY_LINKS.map((link) => {
144
+ const active = link.to === "/" ? pathname === "/" : pathname === link.to || pathname.startsWith(`${link.to}/`);
145
+ const Icon = link.icon;
146
+ return /* @__PURE__ */ jsxs(Link, {
147
+ to: link.to,
148
+ "aria-current": active ? "page" : void 0,
149
+ className: navButtonClass(active),
150
+ children: [/* @__PURE__ */ jsx(Icon, {
151
+ className: "hidden size-4 shrink-0 sm:block",
152
+ "aria-hidden": "true"
153
+ }), /* @__PURE__ */ jsx("span", { children: link.label })]
154
+ }, link.to);
155
+ }),
156
+ /* @__PURE__ */ jsx(NavMenu, {
157
+ label: "Operations",
158
+ compactLabel: "Ops",
159
+ icon: BellRing,
160
+ links: OPERATIONS_LINKS,
161
+ pathname,
162
+ badge: attention?.openTotal ?? 0,
163
+ itemBadges: {
164
+ "/approvals": attention?.byKind.communication_approval ?? 0,
165
+ "/attention": attention?.openTotal ?? 0
166
+ }
167
+ }),
168
+ /* @__PURE__ */ jsx(NavMenu, {
169
+ label: "Manage",
170
+ icon: Settings2,
171
+ links: MANAGE_LINKS,
172
+ pathname,
173
+ align: "end"
174
+ })
175
+ ]
176
+ }),
177
+ /* @__PURE__ */ jsxs("div", {
178
+ className: "col-start-2 row-start-1 flex items-center gap-1 md:col-auto md:row-auto md:ml-auto",
179
+ children: [/* @__PURE__ */ jsx(ThemeToggle, {}), /* @__PURE__ */ jsx("button", {
180
+ type: "button",
181
+ onClick: () => void logout(),
182
+ "aria-label": "Log out",
183
+ title: "Log out",
184
+ className: "unstyled inline-flex h-9 w-9 items-center justify-center rounded-lg text-mocha hover:bg-ivory hover:text-sapphire",
185
+ children: /* @__PURE__ */ jsx(LogOut, {
186
+ className: "h-4 w-4",
187
+ "aria-hidden": "true"
188
+ })
189
+ })]
190
+ }),
191
+ logoutError && /* @__PURE__ */ jsx("p", {
192
+ role: "alert",
193
+ className: "col-span-2 m-0 rounded-lg bg-danger/10 px-3 py-2 text-sm text-danger md:absolute md:right-0 md:top-[calc(100%+0.35rem)] md:z-50 md:shadow-baziu-md",
194
+ children: logoutError
195
+ })
196
+ ]
197
+ });
198
+ }
199
+ function NavMenu({ label, compactLabel, icon: Icon, links, pathname, badge = 0, itemBadges = {}, align = "start" }) {
200
+ const active = links.some((link) => pathname === link.href || pathname.startsWith(`${link.href}/`));
201
+ return /* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
202
+ asChild: true,
203
+ children: /* @__PURE__ */ jsxs("button", {
204
+ type: "button",
205
+ className: navButtonClass(active),
206
+ "aria-label": `${label} menu`,
207
+ children: [
208
+ /* @__PURE__ */ jsx(Icon, {
209
+ className: "hidden size-4 shrink-0 sm:block",
210
+ "aria-hidden": "true"
211
+ }),
212
+ /* @__PURE__ */ jsx("span", {
213
+ className: compactLabel ? "sm:hidden" : void 0,
214
+ children: compactLabel ?? label
215
+ }),
216
+ compactLabel && /* @__PURE__ */ jsx("span", {
217
+ className: "hidden sm:inline",
218
+ children: label
219
+ }),
220
+ badge > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
221
+ className: "size-2 shrink-0 rounded-full bg-danger sm:hidden",
222
+ "aria-label": `${badge} open items`
223
+ }), /* @__PURE__ */ jsx("span", {
224
+ className: "hidden sm:inline-flex",
225
+ children: /* @__PURE__ */ jsx(CountBadge, {
226
+ value: badge,
227
+ label: `${badge} open items`
228
+ })
229
+ })] }),
230
+ /* @__PURE__ */ jsx(ChevronDown, {
231
+ className: "size-3 shrink-0 text-muted-foreground",
232
+ "aria-hidden": "true"
233
+ })
234
+ ]
235
+ })
236
+ }), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
237
+ align,
238
+ sideOffset: 8,
239
+ collisionPadding: 12,
240
+ className: "z-50 w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
241
+ children: [/* @__PURE__ */ jsx(DropdownMenu.Label, {
242
+ className: "px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",
243
+ children: label
244
+ }), links.map((link) => {
245
+ const ItemIcon = link.icon;
246
+ const itemActive = pathname === link.href || pathname.startsWith(`${link.href}/`);
247
+ return /* @__PURE__ */ jsx(DropdownMenu.Item, {
248
+ asChild: true,
249
+ children: /* @__PURE__ */ jsxs("a", {
250
+ href: link.href,
251
+ "aria-current": itemActive ? "page" : void 0,
252
+ className: `flex cursor-pointer items-start gap-3 rounded-lg px-2.5 py-2.5 outline-none transition-colors focus:bg-accent focus:text-accent-foreground ${itemActive ? "bg-accent/70 text-accent-foreground" : "text-foreground"}`,
253
+ children: [/* @__PURE__ */ jsx("span", {
254
+ className: "mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",
255
+ children: /* @__PURE__ */ jsx(ItemIcon, {
256
+ className: "size-3.5",
257
+ "aria-hidden": "true"
258
+ })
259
+ }), /* @__PURE__ */ jsxs("span", {
260
+ className: "min-w-0 flex-1",
261
+ children: [/* @__PURE__ */ jsxs("span", {
262
+ className: "flex items-center gap-2 text-sm font-semibold",
263
+ children: [link.label, (itemBadges[link.href] ?? 0) > 0 && /* @__PURE__ */ jsx(CountBadge, {
264
+ value: itemBadges[link.href] ?? 0,
265
+ label: `${itemBadges[link.href]} open ${link.label.toLowerCase()} items`
266
+ })]
267
+ }), /* @__PURE__ */ jsx("span", {
268
+ className: "mt-0.5 block text-xs leading-5 text-muted-foreground",
269
+ children: link.description
270
+ })]
271
+ })]
272
+ })
273
+ }, link.href);
274
+ })]
275
+ }) })] });
276
+ }
277
+ function CountBadge({ value, label }) {
278
+ return /* @__PURE__ */ jsx("span", {
279
+ className: "inline-flex min-w-5 items-center justify-center rounded-full bg-danger px-1.5 py-0.5 text-xs font-semibold leading-4 text-primary-foreground",
280
+ "aria-label": label,
281
+ children: value > 99 ? "99+" : value
282
+ });
283
+ }
284
+ function navButtonClass(active) {
285
+ return `unstyled inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg border px-2 text-sm font-semibold transition-colors sm:px-2.5 ${active ? "border-sapphire-light bg-sapphire-glow text-sapphire shadow-baziu-sm" : "border-transparent text-mocha hover:border-frost hover:bg-ivory hover:text-sapphire"}`;
286
+ }
287
+ //#endregion
288
+ //#region src/lib/auth.ts
289
+ var fetchAuthState = createServerFn({ method: "GET" }).handler(createSsrRpc("a5d3825fc69573bb55bab6df578c750ebb0240dd394c3acee3adea02918a5dc2"));
290
+ var PUBLIC_PATHS = new Set(["/login"]);
291
+ var SETUP_OPEN_PREFIXES = ["/welcome", "/config"];
292
+ function isSetupOpen(path) {
293
+ for (const prefix of SETUP_OPEN_PREFIXES) if (path === prefix || path.startsWith(`${prefix}/`)) return true;
294
+ return false;
295
+ }
296
+ //#endregion
297
+ //#region src/lib/csrf-fetch.ts
298
+ function cookie(name) {
299
+ const prefix = `${encodeURIComponent(name)}=`;
300
+ for (const part of document.cookie.split(";")) {
301
+ const value = part.trim();
302
+ if (value.startsWith(prefix)) return decodeURIComponent(value.slice(prefix.length));
303
+ }
304
+ return null;
305
+ }
306
+ function installCsrfFetch() {
307
+ if (typeof window === "undefined") return;
308
+ const marker = "__bazilionCsrfFetchInstalled";
309
+ const state = window;
310
+ if (state[marker]) return;
311
+ state[marker] = true;
312
+ const original = window.fetch.bind(window);
313
+ window.fetch = (input, init) => {
314
+ const request = input instanceof Request ? input : null;
315
+ const method = (init?.method ?? request?.method ?? "GET").toUpperCase();
316
+ if (new URL(request?.url ?? String(input), window.location.href).origin !== window.location.origin || [
317
+ "GET",
318
+ "HEAD",
319
+ "OPTIONS"
320
+ ].includes(method)) return original(input, init);
321
+ const csrf = cookie("__Host-bz_csrf") ?? cookie("bz_csrf_dev");
322
+ if (!csrf) return original(input, init);
323
+ const headers = new Headers(request?.headers ?? void 0);
324
+ for (const [key, value] of new Headers(init?.headers)) headers.set(key, value);
325
+ headers.set("x-bazilion-csrf", csrf);
326
+ return original(input, {
327
+ ...init,
328
+ headers
329
+ });
330
+ };
331
+ }
332
+ //#endregion
333
+ //#region src/styles.css?url
334
+ var styles_default = "/assets/styles-B5vcgXln.css";
335
+ //#endregion
336
+ //#region src/routes/__root.tsx
337
+ var THEME_INIT_SCRIPT = `(function(){try{var t=localStorage.getItem('baziu-theme');var sd=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches;var d=t==='dark'||((t===null||t==='system')&&sd);document.documentElement.classList.toggle('dark',d);}catch(e){}})();`;
338
+ installCsrfFetch();
339
+ var Route$4 = createRootRoute({
340
+ beforeLoad: async ({ location }) => {
341
+ const path = location.pathname;
342
+ if (PUBLIC_PATHS.has(path)) return;
343
+ if (path.startsWith("/api/")) return;
344
+ const auth = await fetchAuthState();
345
+ if (!auth.authed) throw redirect({
346
+ to: "/login",
347
+ search: {}
348
+ });
349
+ if (!isSetupOpen(path) && !auth.setupComplete) throw redirect({ to: "/welcome" });
350
+ },
351
+ head: () => ({
352
+ meta: [
353
+ { charSet: "utf-8" },
354
+ {
355
+ name: "viewport",
356
+ content: "width=device-width, initial-scale=1"
357
+ },
358
+ { title: "bazilion" }
359
+ ],
360
+ links: [{
361
+ rel: "icon",
362
+ type: "image/svg+xml",
363
+ href: "/baziu.svg"
364
+ }, {
365
+ rel: "stylesheet",
366
+ href: styles_default
367
+ }]
368
+ }),
369
+ component: RootComponent,
370
+ notFoundComponent: NotFound
371
+ });
372
+ function NotFound() {
373
+ const pathname = useRouterState({ select: (s) => s.location.pathname });
374
+ return /* @__PURE__ */ jsx("div", {
375
+ className: "mx-auto max-w-2xl",
376
+ children: /* @__PURE__ */ jsxs("div", {
377
+ className: "card",
378
+ children: [
379
+ /* @__PURE__ */ jsx("h1", { children: "Not found" }),
380
+ /* @__PURE__ */ jsxs("p", {
381
+ className: "muted my-3",
382
+ children: [
383
+ "Nothing lives at ",
384
+ /* @__PURE__ */ jsx("code", { children: pathname }),
385
+ "."
386
+ ]
387
+ }),
388
+ /* @__PURE__ */ jsx(Link, {
389
+ to: "/",
390
+ children: "Back to home"
391
+ })
392
+ ]
393
+ })
394
+ });
395
+ }
396
+ function RootComponent() {
397
+ const pathname = useRouterState({ select: (s) => s.location.pathname });
398
+ const isLogin = pathname === "/login";
399
+ const isWorkspace = pathname === "/";
400
+ return /* @__PURE__ */ jsxs("html", {
401
+ lang: "en",
402
+ "data-layout": isWorkspace ? "workspace" : "page",
403
+ suppressHydrationWarning: true,
404
+ children: [/* @__PURE__ */ jsxs("head", { children: [/* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: THEME_INIT_SCRIPT } }), /* @__PURE__ */ jsx(HeadContent, {})] }), /* @__PURE__ */ jsxs("body", {
405
+ "data-layout": isWorkspace ? "workspace" : "page",
406
+ children: [
407
+ !isLogin && /* @__PURE__ */ jsx("a", {
408
+ href: "#main-content",
409
+ className: "sr-only z-[100] rounded-lg bg-primary px-4 py-2 font-semibold text-primary-foreground focus:not-sr-only focus:fixed focus:left-3 focus:top-3",
410
+ children: "Skip to main content"
411
+ }),
412
+ isLogin ? /* @__PURE__ */ jsx(Outlet, {}) : isWorkspace ? /* @__PURE__ */ jsxs("div", {
413
+ className: "flex h-dvh flex-col",
414
+ children: [/* @__PURE__ */ jsx("div", {
415
+ className: "px-3 sm:px-5",
416
+ children: /* @__PURE__ */ jsx(TopNav, {})
417
+ }), /* @__PURE__ */ jsx("main", {
418
+ id: "main-content",
419
+ tabIndex: -1,
420
+ className: "mx-auto min-h-0 w-full max-w-[1600px] flex-1 overflow-hidden px-3 pb-3 sm:px-5 sm:pb-5",
421
+ children: /* @__PURE__ */ jsx(Outlet, {})
422
+ })]
423
+ }) : /* @__PURE__ */ jsxs("div", {
424
+ className: "flex min-h-dvh flex-col",
425
+ children: [
426
+ /* @__PURE__ */ jsx("div", {
427
+ className: "px-3 sm:px-5",
428
+ children: /* @__PURE__ */ jsx(TopNav, {})
429
+ }),
430
+ /* @__PURE__ */ jsx("main", {
431
+ id: "main-content",
432
+ tabIndex: -1,
433
+ className: "mx-auto w-full max-w-[1500px] flex-1 px-4 py-9 sm:px-6 sm:py-12",
434
+ children: /* @__PURE__ */ jsx(Outlet, {})
435
+ }),
436
+ /* @__PURE__ */ jsx("div", {
437
+ className: "px-4 sm:px-6",
438
+ children: /* @__PURE__ */ jsx(Footer, {})
439
+ })
440
+ ]
441
+ }),
442
+ /* @__PURE__ */ jsx(Scripts, {})
443
+ ]
444
+ })]
445
+ });
446
+ }
447
+ //#endregion
448
+ //#region src/routes/welcome.tsx
449
+ var $$splitComponentImporter = () => import("./welcome-B8nchXdF.js");
450
+ var Route$3 = createFileRoute("/welcome")({
451
+ beforeLoad: async () => {
452
+ if ((await fetchAuthState()).setupComplete) throw redirect({ to: "/" });
453
+ },
454
+ component: lazyRouteComponent($$splitComponentImporter, "component")
455
+ });
456
+ //#endregion
457
+ //#region src/routes/templates/index.tsx
458
+ var Route$2 = createFileRoute("/templates/")({ beforeLoad: () => {
459
+ throw redirect({ to: "/templates/agents" });
460
+ } });
461
+ //#endregion
462
+ //#region src/routes/api/$.ts
463
+ var STRIP_REQUEST_HEADERS = new Set([
464
+ "host",
465
+ "connection",
466
+ "keep-alive",
467
+ "proxy-authenticate",
468
+ "proxy-authorization",
469
+ "te",
470
+ "trailer",
471
+ "transfer-encoding",
472
+ "upgrade",
473
+ "cookie",
474
+ "forwarded",
475
+ "x-forwarded-for",
476
+ "x-forwarded-host",
477
+ "x-forwarded-proto",
478
+ "x-real-ip"
479
+ ]);
480
+ var MAX_JSON_BODY = 2 * 1024 * 1024;
481
+ var MAX_UPLOAD_BODY = 25 * 1024 * 1024;
482
+ function isLoopback(hostname) {
483
+ return [
484
+ "127.0.0.1",
485
+ "localhost",
486
+ "[::1]",
487
+ "::1"
488
+ ].includes(hostname);
489
+ }
490
+ function hasDuplicateCookie(header, name) {
491
+ if (!header) return false;
492
+ return header.split(";").map((part) => part.trim()).map((part) => part.slice(0, part.indexOf("="))).filter((cookieName) => cookieName === name).length > 1;
493
+ }
494
+ async function readBoundedBody(body, limit) {
495
+ let seen = 0;
496
+ const reader = body.getReader();
497
+ const chunks = [];
498
+ try {
499
+ while (true) {
500
+ const { done, value } = await reader.read();
501
+ if (done) break;
502
+ seen += value.byteLength;
503
+ if (seen > limit) {
504
+ await reader.cancel("request body exceeds gateway limit");
505
+ return null;
506
+ }
507
+ chunks.push(value);
508
+ }
509
+ } finally {
510
+ reader.releaseLock();
511
+ }
512
+ const result = new Uint8Array(new ArrayBuffer(seen));
513
+ let offset = 0;
514
+ for (const chunk of chunks) {
515
+ result.set(chunk, offset);
516
+ offset += chunk.byteLength;
517
+ }
518
+ return result.buffer;
519
+ }
520
+ function addSecurityHeaders(headers, production) {
521
+ headers.set("x-content-type-options", "nosniff");
522
+ headers.set("referrer-policy", "same-origin");
523
+ headers.set("permissions-policy", "camera=(), microphone=(), geolocation=()");
524
+ headers.set("x-frame-options", "DENY");
525
+ headers.set("content-security-policy", "default-src 'self'; base-uri 'self'; connect-src 'self'; font-src 'self'; frame-ancestors 'none'; img-src 'self' data:; object-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'");
526
+ if (production) headers.set("strict-transport-security", "max-age=31536000; includeSubDomains");
527
+ }
528
+ var STRIP_RESPONSE_HEADERS = new Set([
529
+ "connection",
530
+ "keep-alive",
531
+ "proxy-authenticate",
532
+ "proxy-authorization",
533
+ "te",
534
+ "trailer",
535
+ "transfer-encoding",
536
+ "upgrade"
537
+ ]);
538
+ async function proxy(request) {
539
+ const incoming = new URL(request.url);
540
+ const originConfig = webOriginConfig();
541
+ const expectedOrigin = originConfig.origin ?? incoming.origin;
542
+ const expected = new URL(expectedOrigin);
543
+ if (originConfig.production) {
544
+ if (request.headers.get("host") !== expected.host) return new Response("not found", { status: 404 });
545
+ const forwardedHost = request.headers.get("x-forwarded-host");
546
+ const forwardedProto = request.headers.get("x-forwarded-proto");
547
+ if (forwardedHost && forwardedHost !== expected.host || forwardedProto && forwardedProto !== "https") return new Response("invalid forwarding headers", { status: 400 });
548
+ } else if (!isLoopback(incoming.hostname)) return new Response("loopback development only", { status: 403 });
549
+ if (request.headers.has("forwarded")) return new Response("invalid forwarding headers", { status: 400 });
550
+ const unsafe = ![
551
+ "GET",
552
+ "HEAD",
553
+ "OPTIONS"
554
+ ].includes(request.method);
555
+ const incomingCookies = request.headers.get("cookie");
556
+ if (hasDuplicateCookie(incomingCookies, originConfig.sessionCookie) || hasDuplicateCookie(incomingCookies, originConfig.csrfCookie)) return new Response("ambiguous cookies", { status: 400 });
557
+ const session = getCookie(originConfig.sessionCookie);
558
+ const csrf = getCookie(originConfig.csrfCookie);
559
+ if (unsafe && (session || incoming.pathname === "/api/login")) {
560
+ if (request.headers.get("origin") !== expectedOrigin) {
561
+ const contentType = request.headers.get("content-type") ?? "";
562
+ const acceptsHtml = request.headers.get("accept")?.includes("text/html") ?? false;
563
+ if (incoming.pathname === "/api/login" && contentType.startsWith("application/x-www-form-urlencoded") && acceptsHtml) return new Response(null, {
564
+ status: 303,
565
+ headers: { location: "/login?error=origin" }
566
+ });
567
+ return new Response("origin validation failed", { status: 403 });
568
+ }
569
+ if (session && (!csrf || request.headers.get("x-bazilion-csrf") !== csrf)) return new Response("csrf validation failed", { status: 403 });
570
+ }
571
+ const target = `${DAEMON_BASE_URL}${incoming.pathname}${incoming.search}`;
572
+ const headers = new Headers();
573
+ for (const [k, v] of request.headers) if (!STRIP_REQUEST_HEADERS.has(k.toLowerCase())) headers.set(k, v);
574
+ if (session) {
575
+ const cookieParts = [`${originConfig.sessionCookie}=${session}`];
576
+ if (csrf) cookieParts.push(`${originConfig.csrfCookie}=${csrf}`);
577
+ headers.set("cookie", cookieParts.join("; "));
578
+ }
579
+ headers.set("origin", DAEMON_BASE_URL);
580
+ const init = {
581
+ method: request.method,
582
+ headers,
583
+ redirect: "manual"
584
+ };
585
+ if (request.method !== "GET" && request.method !== "HEAD") {
586
+ const limit = (request.headers.get("content-type") ?? "").startsWith("multipart/form-data") ? MAX_UPLOAD_BODY : MAX_JSON_BODY;
587
+ const contentLength = Number(request.headers.get("content-length") ?? 0);
588
+ if (Number.isFinite(contentLength) && contentLength > limit) return new Response("request body too large", { status: 413 });
589
+ if (request.body) {
590
+ const body = await readBoundedBody(request.body, limit);
591
+ if (!body) return new Response("request body too large", { status: 413 });
592
+ init.body = body;
593
+ }
594
+ }
595
+ const upstream = await fetch(target, init);
596
+ const respHeaders = new Headers();
597
+ for (const [k, v] of upstream.headers) {
598
+ const lower = k.toLowerCase();
599
+ if (lower !== "set-cookie" && !STRIP_RESPONSE_HEADERS.has(lower)) respHeaders.set(k, v);
600
+ }
601
+ const getSetCookie = upstream.headers.getSetCookie;
602
+ for (const value of getSetCookie?.call(upstream.headers) ?? []) respHeaders.append("set-cookie", value);
603
+ addSecurityHeaders(respHeaders, originConfig.production);
604
+ return new Response(upstream.body, {
605
+ status: upstream.status,
606
+ statusText: upstream.statusText,
607
+ headers: respHeaders
608
+ });
609
+ }
610
+ var Route$1 = createFileRoute("/api/$")({ server: { handlers: {
611
+ GET: ({ request }) => proxy(request),
612
+ POST: ({ request }) => proxy(request),
613
+ PUT: ({ request }) => proxy(request),
614
+ PATCH: ({ request }) => proxy(request),
615
+ DELETE: ({ request }) => proxy(request)
616
+ } } });
617
+ //#endregion
618
+ //#region src/routes/teams/$id/context.tsx
619
+ var Route = createFileRoute("/teams/$id/context")({ beforeLoad: ({ params }) => {
620
+ throw redirect({
621
+ to: "/teams/$id",
622
+ params: { id: params.id }
623
+ });
624
+ } });
625
+ //#endregion
626
+ //#region src/routeTree.gen.ts
627
+ var WelcomeRoute = Route$3.update({
628
+ id: "/welcome",
629
+ path: "/welcome",
630
+ getParentRoute: () => Route$4
631
+ });
632
+ var LoginRoute = Route$5.update({
633
+ id: "/login",
634
+ path: "/login",
635
+ getParentRoute: () => Route$4
636
+ });
637
+ var IndexRoute = Route$6.update({
638
+ id: "/",
639
+ path: "/",
640
+ getParentRoute: () => Route$4
641
+ });
642
+ var TemplatesIndexRoute = Route$2.update({
643
+ id: "/templates/",
644
+ path: "/templates/",
645
+ getParentRoute: () => Route$4
646
+ });
647
+ var TeamsIndexRoute = Route$7.update({
648
+ id: "/teams/",
649
+ path: "/teams/",
650
+ getParentRoute: () => Route$4
651
+ });
652
+ var SkillsIndexRoute = Route$8.update({
653
+ id: "/skills/",
654
+ path: "/skills/",
655
+ getParentRoute: () => Route$4
656
+ });
657
+ var ConfigIndexRoute = Route$9.update({
658
+ id: "/config/",
659
+ path: "/config/",
660
+ getParentRoute: () => Route$4
661
+ });
662
+ var AttentionIndexRoute = Route$10.update({
663
+ id: "/attention/",
664
+ path: "/attention/",
665
+ getParentRoute: () => Route$4
666
+ });
667
+ var ApprovalsIndexRoute = Route$11.update({
668
+ id: "/approvals/",
669
+ path: "/approvals/",
670
+ getParentRoute: () => Route$4
671
+ });
672
+ var AgentsIndexRoute = Route$12.update({
673
+ id: "/agents/",
674
+ path: "/agents/",
675
+ getParentRoute: () => Route$4
676
+ });
677
+ var ConfigTokensRoute = Route$13.update({
678
+ id: "/config/tokens",
679
+ path: "/config/tokens",
680
+ getParentRoute: () => Route$4
681
+ });
682
+ var ConfigServicesRoute = Route$14.update({
683
+ id: "/config/services",
684
+ path: "/config/services",
685
+ getParentRoute: () => Route$4
686
+ });
687
+ var ConfigMcpRoute = Route$15.update({
688
+ id: "/config/mcp",
689
+ path: "/config/mcp",
690
+ getParentRoute: () => Route$4
691
+ });
692
+ var ApiSplatRoute = Route$1.update({
693
+ id: "/api/$",
694
+ path: "/api/$",
695
+ getParentRoute: () => Route$4
696
+ });
697
+ var TemplatesTeamsIndexRoute = Route$16.update({
698
+ id: "/templates/teams/",
699
+ path: "/templates/teams/",
700
+ getParentRoute: () => Route$4
701
+ });
702
+ var TemplatesAgentsIndexRoute = Route$17.update({
703
+ id: "/templates/agents/",
704
+ path: "/templates/agents/",
705
+ getParentRoute: () => Route$4
706
+ });
707
+ var TeamsIdIndexRoute = Route$18.update({
708
+ id: "/teams/$id/",
709
+ path: "/teams/$id/",
710
+ getParentRoute: () => Route$4
711
+ });
712
+ var AgentsIdIndexRoute = Route$19.update({
713
+ id: "/agents/$id/",
714
+ path: "/agents/$id/",
715
+ getParentRoute: () => Route$4
716
+ });
717
+ var TeamsIdPolicyRoute = Route$20.update({
718
+ id: "/teams/$id/policy",
719
+ path: "/teams/$id/policy",
720
+ getParentRoute: () => Route$4
721
+ });
722
+ var TeamsIdMemoryRoute = Route$21.update({
723
+ id: "/teams/$id/memory",
724
+ path: "/teams/$id/memory",
725
+ getParentRoute: () => Route$4
726
+ });
727
+ var TeamsIdMembersRoute = Route$22.update({
728
+ id: "/teams/$id/members",
729
+ path: "/teams/$id/members",
730
+ getParentRoute: () => Route$4
731
+ });
732
+ var TeamsIdContextRoute = Route.update({
733
+ id: "/teams/$id/context",
734
+ path: "/teams/$id/context",
735
+ getParentRoute: () => Route$4
736
+ });
737
+ var TeamsIdActivityRoute = Route$23.update({
738
+ id: "/teams/$id/activity",
739
+ path: "/teams/$id/activity",
740
+ getParentRoute: () => Route$4
741
+ });
742
+ var ConfigIntegrationsTelegramRoute = Route$24.update({
743
+ id: "/config/integrations/telegram",
744
+ path: "/config/integrations/telegram",
745
+ getParentRoute: () => Route$4
746
+ });
747
+ var AgentsIdTriggersRoute = Route$25.update({
748
+ id: "/agents/$id/triggers",
749
+ path: "/agents/$id/triggers",
750
+ getParentRoute: () => Route$4
751
+ });
752
+ var AgentsIdLearningRoute = Route$26.update({
753
+ id: "/agents/$id/learning",
754
+ path: "/agents/$id/learning",
755
+ getParentRoute: () => Route$4
756
+ });
757
+ var AgentsIdInboxRoute = Route$27.update({
758
+ id: "/agents/$id/inbox",
759
+ path: "/agents/$id/inbox",
760
+ getParentRoute: () => Route$4
761
+ });
762
+ var TemplatesTeamsIdIndexRoute = Route$28.update({
763
+ id: "/templates/teams/$id/",
764
+ path: "/templates/teams/$id/",
765
+ getParentRoute: () => Route$4
766
+ });
767
+ var rootRouteChildren = {
768
+ IndexRoute,
769
+ LoginRoute,
770
+ WelcomeRoute,
771
+ ApiSplatRoute,
772
+ ConfigMcpRoute,
773
+ ConfigServicesRoute,
774
+ ConfigTokensRoute,
775
+ AgentsIndexRoute,
776
+ ApprovalsIndexRoute,
777
+ AttentionIndexRoute,
778
+ ConfigIndexRoute,
779
+ SkillsIndexRoute,
780
+ TeamsIndexRoute,
781
+ TemplatesIndexRoute,
782
+ AgentsIdInboxRoute,
783
+ AgentsIdLearningRoute,
784
+ AgentsIdTriggersRoute,
785
+ ConfigIntegrationsTelegramRoute,
786
+ TeamsIdActivityRoute,
787
+ TeamsIdContextRoute,
788
+ TeamsIdMembersRoute,
789
+ TeamsIdMemoryRoute,
790
+ TeamsIdPolicyRoute,
791
+ AgentsIdIndexRoute,
792
+ TeamsIdIndexRoute,
793
+ TemplatesAgentsIndexRoute,
794
+ TemplatesTeamsIndexRoute,
795
+ TemplatesAgentsIdIndexRoute: Route$29.update({
796
+ id: "/templates/agents/$id/",
797
+ path: "/templates/agents/$id/",
798
+ getParentRoute: () => Route$4
799
+ }),
800
+ TemplatesTeamsIdIndexRoute
801
+ };
802
+ var routeTree = Route$4._addFileChildren(rootRouteChildren)._addFileTypes();
803
+ //#endregion
804
+ //#region src/router.tsx
805
+ function getRouter() {
806
+ return createRouter({
807
+ routeTree,
808
+ scrollRestoration: true,
809
+ defaultPreload: "intent"
810
+ });
811
+ }
812
+ //#endregion
813
+ export { getRouter };