bazilion 0.26.1 → 0.50.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 (203) hide show
  1. package/dist/cli.js +405 -244
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +1572 -749
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/ConfigPage-_FY--9PB.js +1 -0
  6. package/dist/web/client/assets/ConfirmDialog-BblXqMVb.js +1 -0
  7. package/dist/web/client/assets/ConnectionsView-BZHJysCa.js +1 -0
  8. package/dist/web/client/assets/FieldRow-k05wfDy9.js +1 -0
  9. package/dist/web/client/assets/SectionTabs-DlfXtepS.js +1 -0
  10. package/dist/web/client/assets/{SkillFindings-8LX6bYf_.js → SkillFindings-CHf5ZGY0.js} +1 -1
  11. package/dist/web/client/assets/SpawnDialog-C-Ujb4bC.js +1 -0
  12. package/dist/web/client/assets/TeamForm-D6EAAF7m.js +1 -0
  13. package/dist/web/client/assets/TeamThread-DpUOwMoi.js +1 -0
  14. package/dist/web/client/assets/UnsavedChangesGuard-DTUP7hwu.js +1 -0
  15. package/dist/web/client/assets/_id-C94dgBDe.js +1 -0
  16. package/dist/web/client/assets/_id-CxmEfoEp.js +1 -0
  17. package/dist/web/client/assets/agents-C-bJ5R_0.js +1 -0
  18. package/dist/web/client/assets/agents-odqBNx-A.js +1 -0
  19. package/dist/web/client/assets/api-CPzQ_z9m.js +1 -0
  20. package/dist/web/client/assets/arrow-right-Dyta3p06.js +1 -0
  21. package/dist/web/client/assets/attention-D0e7o7fh.js +1 -0
  22. package/dist/web/client/assets/chevron-right-B2YEg9rw.js +1 -0
  23. package/dist/web/client/assets/config-B7Y5MtpM.js +3 -0
  24. package/dist/web/client/assets/createLucideIcon-Cgab8gqu.js +1 -0
  25. package/dist/web/client/assets/index-CNVw44IE.js +54 -0
  26. package/dist/web/client/assets/link-ClwtaO_E.js +1 -0
  27. package/dist/web/client/assets/login-Br1F4rQx.js +1 -0
  28. package/dist/web/client/assets/mcp-B8bIAY6k.js +1 -0
  29. package/dist/web/client/assets/routes-BZdlkRdC.js +76 -0
  30. package/dist/web/client/assets/save-ZqeB_I-c.js +1 -0
  31. package/dist/web/client/assets/{services-B2f7e5jV.js → services-CPJxDrVG.js} +1 -1
  32. package/dist/web/client/assets/skills-DE_kQQGj.js +1 -0
  33. package/dist/web/client/assets/style-BWShXY3e.js +7 -0
  34. package/dist/web/client/assets/styles-Tney8jZq.css +2 -0
  35. package/dist/web/client/assets/teams-AcuSLc3I.js +1 -0
  36. package/dist/web/client/assets/teams-tRamPg7O.js +1 -0
  37. package/dist/web/client/assets/telegram-Ku69-GAv.js +1 -0
  38. package/dist/web/client/assets/tokens-DuLNZMgi.js +1 -0
  39. package/dist/web/client/assets/welcome-CrQk6n6I.js +1 -0
  40. package/dist/web/server/assets/{ConfigPage-CGld_wCK.js → ConfigPage-DSLM5CLw.js} +2 -2
  41. package/dist/web/server/assets/{ConfirmDialog-LdVlEanK.js → ConfirmDialog-CvLZgbfY.js} +1 -1
  42. package/dist/web/server/assets/ConnectionsView-DVLNH81Y.js +708 -0
  43. package/dist/web/server/assets/{FieldRow-Dah2KKqo.js → FieldRow-DQBzMtcR.js} +4 -4
  44. package/dist/web/server/assets/{Page-CMSYKXWJ.js → Page-KIL1CsME.js} +1 -1
  45. package/dist/web/server/assets/Rail-D8LhjS38.js +756 -0
  46. package/dist/web/server/assets/{SectionTabs-CqFg9Vwx.js → SectionTabs-CNcvxbR8.js} +1 -16
  47. package/dist/web/server/assets/{SkillFindings-Bd6e81Wu.js → SkillFindings-DX8lCMG7.js} +1 -1
  48. package/dist/web/server/assets/{SpawnDialog-BGNaMfFb.js → SpawnDialog-Brmkl_ll.js} +24 -6
  49. package/dist/web/server/assets/{TeamForm-C93tpn9r.js → TeamForm-CvQAs2FA.js} +1 -1
  50. package/dist/web/server/assets/TeamThread-BNJi6gPM.js +205 -0
  51. package/dist/web/server/assets/{UnsavedChangesGuard-Dm4a27_5.js → UnsavedChangesGuard-B3Lpl08z.js} +8 -4
  52. package/dist/web/server/assets/{TeamPolicyEditor-BHS3J0R9.js → _id-BH1631a8.js} +114 -263
  53. package/dist/web/server/assets/{_id-sW6zXrTP.js → _id-CA3QO7J5.js} +1 -1
  54. package/dist/web/server/assets/{_id-lOVnT5sS.js → _id-CO1PgvyG.js} +5 -5
  55. package/dist/web/server/assets/{_id-B0x1ffz3.js → _id-DIXUiIaB.js} +1 -1
  56. package/dist/web/server/assets/{_id-ByiXeIPS.js → _id-E2N4gZ4O.js} +2 -2
  57. package/dist/web/server/assets/{_id-Bdf_Rg62.js → _id-TVruGcOd.js} +1 -1
  58. package/dist/web/server/assets/_tanstack-start-manifest_v-BVfrV7LQ.js +191 -0
  59. package/dist/web/server/assets/{agents-BNPkidbH.js → agents-BnWgFo6o.js} +1 -1
  60. package/dist/web/server/assets/{agents-BK8OmB8g.js → agents-C63VycUw.js} +2 -2
  61. package/dist/web/server/assets/{agents-D4tqK1kH.js → agents-CalSKogx.js} +14 -15
  62. package/dist/web/server/assets/{agents-Cn9GkXFX.js → agents-CdZvooeQ.js} +1 -1
  63. package/dist/web/server/assets/{agents-lOqc6VGd.js → agents-DPZVni4Q.js} +1 -1
  64. package/dist/web/server/assets/{agents-DycxHDt8.js → agents-DrkEwIpR.js} +8 -8
  65. package/dist/web/server/assets/{attention-DULVjdmF.js → attention-BbE4yc-V.js} +1 -1
  66. package/dist/web/server/assets/{attention-YWnLKA2E.js → attention-Cr7puThv.js} +1 -1
  67. package/dist/web/server/assets/{attention-BIm455bC.js → attention-DIyX3VMB.js} +6 -6
  68. package/dist/web/server/assets/{auth-DiN92ydD.js → auth-dJnrFW6y.js} +1 -1
  69. package/dist/web/server/assets/{config-C1VB28se.js → config-3tPtOmPE.js} +1 -1
  70. package/dist/web/server/assets/{config-BNEgu7WG.js → config-DJGZiPBJ.js} +13 -13
  71. package/dist/web/server/assets/{config-TdVqnqNL.js → config-rUqhMjIs.js} +1 -1
  72. package/dist/web/server/assets/{daemon-client-DL2ik2Em.js → daemon-client-B_ZRIIrT.js} +2 -1
  73. package/dist/web/server/assets/{mcp-BwmpNQPN.js → mcp-C97uAZe1.js} +1 -1
  74. package/dist/web/server/assets/{mcp-B09_O05r.js → mcp-Cf7KzOJ9.js} +9 -9
  75. package/dist/web/server/assets/{mcp-CqdTfXcn.js → mcp-DE14q5c0.js} +1 -1
  76. package/dist/web/server/assets/{router-BI9gmY3S.js → router-w2yPgmC1.js} +412 -259
  77. package/dist/web/server/assets/routes-1FEodTRm.js +16 -0
  78. package/dist/web/server/assets/routes-B6AO0LjK.js +57 -0
  79. package/dist/web/server/assets/routes-D1NHwz6f.js +7644 -0
  80. package/dist/web/server/assets/{services-tCfB1B83.js → services-BjroGXgC.js} +4 -4
  81. package/dist/web/server/assets/{services-Q9HYQXXB.js → services-Cdk40QHq.js} +1 -1
  82. package/dist/web/server/assets/{services-BLvAvb8g.js → services-DsHRLL8q.js} +1 -1
  83. package/dist/web/server/assets/{skills-BZg_txbf.js → skills-CA17GjuZ.js} +1 -1
  84. package/dist/web/server/assets/{skills-C7fqRPna.js → skills-DC1OTc8n.js} +11 -11
  85. package/dist/web/server/assets/{skills-C_g8IKag.js → skills-h5aHa7Q8.js} +1 -1
  86. package/dist/web/server/assets/style-GYDODk2F.js +178 -0
  87. package/dist/web/server/assets/{teams-D4CaU76n.js → teams-Bm63mbTt.js} +1 -1
  88. package/dist/web/server/assets/{teams-DX2HmKqi.js → teams-BxnvFTyn.js} +1 -1
  89. package/dist/web/server/assets/{teams-BS-oweRl.js → teams-Cg-QQWpH.js} +23 -15
  90. package/dist/web/server/assets/{teams-BHkhnt6b.js → teams-D6Tx-Jyn.js} +1 -1
  91. package/dist/web/server/assets/{teams-BSflKBP8.js → teams-OzHTyVi9.js} +6 -6
  92. package/dist/web/server/assets/{teams-CNyB5nM9.js → teams-YrmyutM4.js} +1 -1
  93. package/dist/web/server/assets/{telegram-CrJiygCX.js → telegram-BJ4l_TA_.js} +6 -6
  94. package/dist/web/server/assets/{telegram-C4v1HhyJ.js → telegram-Gy7_9yih.js} +1 -1
  95. package/dist/web/server/assets/{telegram-BUdnc8oF.js → telegram-xU-vXgef.js} +1 -1
  96. package/dist/web/server/assets/{tokens-DqldzPUq.js → tokens-ByPTGFBQ.js} +1 -1
  97. package/dist/web/server/assets/{tokens-B1twAJdd.js → tokens-CEdl8puR.js} +1 -1
  98. package/dist/web/server/assets/{tokens-DdjEyALj.js → tokens-CsqoRt5T.js} +10 -10
  99. package/dist/web/server/assets/{welcome-D0d38Pzx.js → welcome-O6Rjd7yO.js} +1 -1
  100. package/dist/web/server/assets/workspace-DeEYMPDX.js +658 -0
  101. package/dist/web/server/server.js +20 -72
  102. package/dist/worker.js +51 -7
  103. package/dist/worker.js.map +1 -1
  104. package/package.json +1 -2
  105. package/dist/web/client/assets/AgentAvatar-DWx-bM6n.js +0 -1
  106. package/dist/web/client/assets/ChatPane-DOV_HJg-.js +0 -72
  107. package/dist/web/client/assets/ConfigPage-Dfu9DzFX.js +0 -1
  108. package/dist/web/client/assets/ConfirmDialog-536ziJ5P.js +0 -1
  109. package/dist/web/client/assets/FieldRow-z1JqCdqn.js +0 -1
  110. package/dist/web/client/assets/ResultCard-X4nTbjYY.js +0 -1
  111. package/dist/web/client/assets/SectionTabs-DXHzXmmb.js +0 -1
  112. package/dist/web/client/assets/SpawnDialog-DoZl-yes.js +0 -1
  113. package/dist/web/client/assets/SpawnTeamModal-C638hEoN.js +0 -1
  114. package/dist/web/client/assets/TeamForm-C-WzvOl4.js +0 -1
  115. package/dist/web/client/assets/TeamPolicyEditor-CSKBx0oK.js +0 -7
  116. package/dist/web/client/assets/UnsavedChangesGuard-GC-vzw7h.js +0 -1
  117. package/dist/web/client/assets/_id-BKLynswT.js +0 -1
  118. package/dist/web/client/assets/_id-BYM_NORr.js +0 -1
  119. package/dist/web/client/assets/_id-Cxa98a9m.js +0 -1
  120. package/dist/web/client/assets/_id-D4hV1U1t.js +0 -1
  121. package/dist/web/client/assets/agent-actions-CXQCoxKO.js +0 -1
  122. package/dist/web/client/assets/agents-BxPS1_Bp.js +0 -1
  123. package/dist/web/client/assets/agents-GozAWW-l.js +0 -1
  124. package/dist/web/client/assets/attention-Cz9rZcrr.js +0 -1
  125. package/dist/web/client/assets/chevron-right-CPAb1zac.js +0 -1
  126. package/dist/web/client/assets/config-9vv9Lipb.js +0 -3
  127. package/dist/web/client/assets/inbox-DHLArXxl.js +0 -1
  128. package/dist/web/client/assets/index-1YXquAq8.js +0 -52
  129. package/dist/web/client/assets/learning-PvtXm8Ne.js +0 -1
  130. package/dist/web/client/assets/login-DIJpNQFo.js +0 -1
  131. package/dist/web/client/assets/mcp-pKBL0xIf.js +0 -1
  132. package/dist/web/client/assets/members-DHWsgsEs.js +0 -1
  133. package/dist/web/client/assets/memory-CEVppPyU.js +0 -1
  134. package/dist/web/client/assets/plus-BaIRdB10.js +0 -1
  135. package/dist/web/client/assets/policy-DEh4BLSw.js +0 -1
  136. package/dist/web/client/assets/preload-helper-eUUcpe2S.js +0 -1
  137. package/dist/web/client/assets/results-DgJPjEZF.js +0 -1
  138. package/dist/web/client/assets/review-BbshafTQ.js +0 -1
  139. package/dist/web/client/assets/route-Ccb8v41z.js +0 -1
  140. package/dist/web/client/assets/route-D1d6kCEV.js +0 -1
  141. package/dist/web/client/assets/routes-g7V4ru7T.js +0 -1
  142. package/dist/web/client/assets/settings-B6elpcYm.js +0 -1
  143. package/dist/web/client/assets/skills-CngE7TF8.js +0 -1
  144. package/dist/web/client/assets/styles-xUnZ-ep_.css +0 -2
  145. package/dist/web/client/assets/teams-BdJZXOan.js +0 -1
  146. package/dist/web/client/assets/teams-c496ISsT.js +0 -1
  147. package/dist/web/client/assets/telegram-B_-hK6EC.js +0 -1
  148. package/dist/web/client/assets/tokens-CKz8gx4-.js +0 -1
  149. package/dist/web/client/assets/triggers-DCEPciGW.js +0 -1
  150. package/dist/web/client/assets/welcome-D-zVOLGA.js +0 -1
  151. package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +0 -37
  152. package/dist/web/server/assets/ChatPane-De_FPEoD.js +0 -1887
  153. package/dist/web/server/assets/ResultCard-CZn1w4KA.js +0 -97
  154. package/dist/web/server/assets/Sidebar-puq47KyR.js +0 -430
  155. package/dist/web/server/assets/SpawnTeamModal-C6GbfScI.js +0 -97
  156. package/dist/web/server/assets/_id-BR6tnR6I.js +0 -23
  157. package/dist/web/server/assets/_id-Bm611NQz.js +0 -13
  158. package/dist/web/server/assets/_id-D5UCoyES.js +0 -359
  159. package/dist/web/server/assets/_id-DHx5UmmL.js +0 -12
  160. package/dist/web/server/assets/_id-DLpGmOVm.js +0 -19
  161. package/dist/web/server/assets/_id-Y5ctILG2.js +0 -13
  162. package/dist/web/server/assets/_id-dDA0pdVo.js +0 -54
  163. package/dist/web/server/assets/_tanstack-start-manifest_v-B8u80HjK.js +0 -292
  164. package/dist/web/server/assets/agent-actions-BBdFVdoa.js +0 -20
  165. package/dist/web/server/assets/api-WWxPqx67.js +0 -85
  166. package/dist/web/server/assets/inbox-4Vj5jTT8.js +0 -245
  167. package/dist/web/server/assets/inbox-D4IqUv3l.js +0 -38
  168. package/dist/web/server/assets/inbox-Dle24AfV.js +0 -23
  169. package/dist/web/server/assets/learning-BScq7VbO.js +0 -12
  170. package/dist/web/server/assets/learning-CBWFEnhg.js +0 -263
  171. package/dist/web/server/assets/learning-DWAKevhF.js +0 -25
  172. package/dist/web/server/assets/members-B8QBF6TF.js +0 -12
  173. package/dist/web/server/assets/members-DsF02Wp7.js +0 -12
  174. package/dist/web/server/assets/members-tWZA9b15.js +0 -36
  175. package/dist/web/server/assets/memory-BNN0b-0x.js +0 -12
  176. package/dist/web/server/assets/memory-CTl1E1Rm.js +0 -267
  177. package/dist/web/server/assets/memory-CV5uCBb2.js +0 -12
  178. package/dist/web/server/assets/policy-C9M6zV6w.js +0 -79
  179. package/dist/web/server/assets/policy-h-6NpU3m.js +0 -19
  180. package/dist/web/server/assets/policy-xEw9X0DK.js +0 -12
  181. package/dist/web/server/assets/results-D3A3UA4d.js +0 -182
  182. package/dist/web/server/assets/results-D6Ui5S8D.js +0 -12
  183. package/dist/web/server/assets/results-DWmxvfyn.js +0 -15
  184. package/dist/web/server/assets/review-CyQky-WQ.js +0 -40
  185. package/dist/web/server/assets/review-Sq0GGcPV.js +0 -322
  186. package/dist/web/server/assets/review-XWbSF8cF.js +0 -12
  187. package/dist/web/server/assets/route-BErtkz6t.js +0 -19
  188. package/dist/web/server/assets/route-CLoV-An_.js +0 -48
  189. package/dist/web/server/assets/route-WQ19JkBa.js +0 -19
  190. package/dist/web/server/assets/route-dEK_2GLj.js +0 -203
  191. package/dist/web/server/assets/route-iHTkhO81.js +0 -16
  192. package/dist/web/server/assets/route-zs8uUQtB.js +0 -16
  193. package/dist/web/server/assets/routes-081s4n24.js +0 -45
  194. package/dist/web/server/assets/routes-CWo5WPsr.js +0 -15
  195. package/dist/web/server/assets/routes-Cqp1ufHm.js +0 -56
  196. package/dist/web/server/assets/settings-CVaGv-xF.js +0 -12
  197. package/dist/web/server/assets/settings-D9viV-86.js +0 -561
  198. package/dist/web/server/assets/settings-DaZNZ_CC.js +0 -27
  199. package/dist/web/server/assets/triggers-B7LW784F.js +0 -214
  200. package/dist/web/server/assets/triggers-C5sMCZXv2.js +0 -12
  201. package/dist/web/server/assets/triggers-DMfVdImD.js +0 -12
  202. package/dist/web/client/assets/{TeamPolicyEditor-DLioOiRN.css → style-DLioOiRN.css} +0 -0
  203. package/dist/web/server/assets/{start-DTX6aKCi.js → start-DhW7sy23.js} +1 -1
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{at as t,ot as n}from"./index-CNVw44IE.js";import{n as r,t as i}from"./SectionTabs-DlfXtepS.js";var a=e();function o({title:e,description:o,children:s,actions:c,size:l=`default`}){return(0,a.jsxs)(n,{size:l,children:[(0,a.jsx)(t,{eyebrow:`Configuration`,title:e,description:o,actions:c}),(0,a.jsx)(r,{label:`Configuration sections`,base:`/config`,tabs:i}),(0,a.jsx)(`div`,{className:`space-y-6`,children:s})]})}export{o as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,i}from"./api-CPzQ_z9m.js";import{t as a}from"./createLucideIcon-Cgab8gqu.js";import{G as o,H as s,K as c,U as l,V as u,W as d,q as f,ut as p}from"./index-CNVw44IE.js";var m=a(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),h=e(t(),1),g=n(),_=typeof document>`u`?h.useEffect:h.useLayoutEffect;function v(e){let t=e.activeElement;return!t||t===e.body||t===e.documentElement||!(`focus`in t)||typeof t.focus!=`function`?null:t}function y(e,t){!e?.isConnected||e.ownerDocument!==t||e.focus({preventScroll:!0})}function b({open:e=!0,onClose:t,busy:n=!1,title:r,description:i,className:a,children:b}){let x=(0,h.useRef)(null),S=(0,h.useRef)(!1);return _(()=>{e&&!S.current&&(x.current=v(document)),S.current=e},[e]),(0,g.jsx)(u,{open:e,onOpenChange:e=>{!e&&!n&&t()},children:(0,g.jsxs)(c,{children:[(0,g.jsx)(o,{className:`fixed inset-0 z-50 bg-chocolate/35 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=open]:fade-in-0`}),(0,g.jsxs)(l,{className:p(`fixed left-1/2 top-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-[16px] border border-frost bg-snow p-5 text-chocolate shadow-baziu-lg outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:p-6`,a),onCloseAutoFocus:e=>{e.preventDefault(),y(x.current,document),x.current=null},onEscapeKeyDown:e=>{n&&e.preventDefault()},onPointerDownOutside:e=>{n&&e.preventDefault()},children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-2 pr-6`,children:[(0,g.jsx)(f,{className:`font-serif text-xl text-chocolate`,children:r}),i?(0,g.jsx)(d,{asChild:!0,children:(0,g.jsx)(`div`,{className:`text-sm leading-6 text-mocha`,children:i})}):(0,g.jsx)(d,{className:`sr-only`,children:r})]}),b,!n&&(0,g.jsx)(s,{"aria-label":`Close`,className:`absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-lg text-mocha hover:bg-ivory hover:text-sapphire`,children:(0,g.jsx)(m,{className:`size-4`,"aria-hidden":`true`})})]})]})})}function x({children:e}){return(0,g.jsx)(`div`,{className:`flex flex-col-reverse gap-2 border-t border-frost pt-4 sm:flex-row sm:justify-end`,children:e})}function S({open:e,title:t,description:n,confirmLabel:a,confirmVariant:o=`danger`,onConfirm:s,onOpenChange:c}){let[l,u]=(0,h.useState)(!1),[d,f]=(0,h.useState)(null);(0,h.useEffect)(()=>{e||(u(!1),f(null))},[e]);async function p(){u(!0),f(null);try{await s(),c(!1)}catch(e){f(i(e)),u(!1)}}return(0,g.jsxs)(b,{open:e,busy:l,onClose:()=>c(!1),title:t,description:n,className:`max-w-md`,children:[d&&(0,g.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger/10 px-3 py-2 text-sm text-danger`,children:d}),(0,g.jsxs)(x,{children:[(0,g.jsx)(r,{variant:`ghost`,disabled:l,onClick:()=>c(!1),children:`Cancel`}),(0,g.jsx)(r,{variant:o,disabled:l,onClick:()=>void p(),children:l?`Working…`:a})]})]})}export{m as i,b as n,x as r,S as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,t as i}from"./link-ClwtaO_E.js";import{t as a}from"./UnsavedChangesGuard-DTUP7hwu.js";import{a as o,i as s,n as c}from"./api-CPzQ_z9m.js";import{C as l,c as u,d,h as f,i as p,n as m,p as h,t as g,v as _}from"./TeamThread-DpUOwMoi.js";import{t as v}from"./arrow-right-Dyta3p06.js";import{t as ee}from"./save-ZqeB_I-c.js";import{C as y,_ as b,b as te,c as x,d as ne,f as S,g as C,h as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j,u as M,v as re,y as ie}from"./style-BWShXY3e.js";import{t as ae}from"./ConfirmDialog-BblXqMVb.js";import{O as N,v as P}from"./index-CNVw44IE.js";var F=e(t(),1),I=n(),L=`!size-2.5 !border-2 !border-snow !bg-sapphire`,R=[{id:`t`,position:M.Top},{id:`r`,position:M.Right},{id:`b`,position:M.Bottom},{id:`l`,position:M.Left}];function z(){return(0,I.jsx)(I.Fragment,{children:R.map(e=>(0,I.jsx)(T,{id:e.id,type:`source`,position:e.position,className:L},e.id))})}function oe({data:e,selected:t}){let{member:n}=e;return(0,I.jsxs)(`div`,{className:`w-[210px] rounded-2xl border bg-snow px-3 py-2.5 shadow-baziu-sm transition-shadow ${t?`border-sapphire shadow-baziu-md`:`border-frost`}`,children:[(0,I.jsx)(z,{}),(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,I.jsx)(P,{identity:n.identity,size:34}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-sm font-semibold text-chocolate`,children:n.name}),(0,I.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-1.5 text-[0.7rem] ${n.isolated?`font-semibold text-warning`:`text-mocha`}`,children:[(0,I.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${u[n.state.kind]}`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:n.isolated?`No connections`:n.state.text})]})]})]})]})}function B({selected:e}){return(0,I.jsxs)(`div`,{className:`w-[160px] rounded-2xl border border-dashed bg-ivory px-3 py-2.5 ${e?`border-sapphire`:`border-fawn`}`,children:[(0,I.jsx)(z,{}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(y,{className:`size-4 shrink-0 text-rose-baziu`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`block text-sm font-semibold text-chocolate`,children:`Other teams`})]})]})}var V={member:oe,outside:B},H=(e,t)=>`pair:${p(e,t)}`;function se(e){if(!e?.startsWith(`pair:`))return null;let[t,n]=e.slice(5).split(`|`);return t&&n?[t,n]:null}var U={member:{w:210,h:62},outside:{w:160,h:46}};function W(e,t){let n=e=>U[e.type===`outside`?`outside`:`member`],r=t.position.x+n(t).w/2-(e.position.x+n(e).w/2),i=t.position.y+n(t).h/2-(e.position.y+n(e).h/2);return Math.abs(r)>=Math.abs(i)*1.4?r>0?{from:`r`,to:`l`}:{from:`l`,to:`r`}:i>0?{from:`b`,to:`t`}:{from:`t`,to:`b`}}function ce({document:e,members:t,traffic:n,selectedId:r,onSelect:i,onConnect:a,onMove:o,onOpenMember:s}){let c=(0,F.useMemo)(()=>{let e=Math.max(520,...t.map(e=>e.position.x+270)),n=t.length===0?120:t.reduce((e,t)=>e+t.position.y,0)/t.length;return[...t.map(e=>({id:e.id,type:`member`,position:e.position,data:{member:e},ariaLabel:`${e.name}: ${e.isolated?`no connections`:e.state.text}`,selected:r===e.id,deletable:!1})),{id:S,type:`outside`,position:{x:e,y:n},data:{},ariaLabel:`Agents in other teams`,selected:r===S,draggable:!1,deletable:!1}]},[t,r]),[l,u,d]=A(c);(0,F.useEffect)(()=>{u(e=>{let t=new Map(e.map(e=>[e.id,e]));return c.map(e=>{let n=t.get(e.id);return n?.dragging?{...e,position:n.position}:e})})},[c,u]);let f=(0,F.useMemo)(()=>{let t=[],i=new Map(l.map(e=>[e.id,e])),a=[...i.keys()];for(let o=0;o<a.length;o++)for(let s=o+1;s<a.length;s++){let[c,l]=[a[o],a[s]].sort(),u=C(e,c,l),d=C(e,l,c),f=H(c,l),p=n.get(f)??0;if(!u&&!d&&p===0)continue;let m=W(i.get(c),i.get(l)),h=u||d,g=r===f,_=g?`var(--color-sapphire-deep)`:h?`var(--color-sapphire)`:`var(--color-fawn)`,v={type:E.ArrowClosed,width:16,height:16,color:_};t.push({id:f,source:c,target:l,sourceHandle:m.from,targetHandle:m.to,selected:g,...u?{markerEnd:v}:{},...d?{markerStart:v}:{},style:{stroke:_,strokeWidth:g?2.6:1.8,...h?{}:{strokeDasharray:`5 5`}},...p>0?{label:`${p} message${p===1?``:`s`}`,labelStyle:{fontSize:11,fontWeight:600,fill:`var(--color-mocha)`},labelBgStyle:{fill:`var(--color-snow)`,stroke:`var(--color-frost)`},labelBgPadding:[6,3],labelBgBorderRadius:8}:{},interactionWidth:24})}return t},[l,e,n,r]);return(0,I.jsx)(`div`,{className:`h-full min-h-[420px] w-full bg-ivory`,children:(0,I.jsxs)(O,{nodes:l,edges:f,nodeTypes:V,connectionMode:x.Loose,onConnect:e=>{e.source&&e.target&&e.source!==e.target&&a(e.source,e.target)},onNodesChange:d,onNodeClick:(e,t)=>i(t.id),onNodeDoubleClick:(e,t)=>{t.type===`member`&&s(t.id)},onEdgeClick:(e,t)=>i(t.id),onPaneClick:()=>i(null),onNodeDragStop:(e,t)=>{t.type===`member`&&o(t.id,t.position)},deleteKeyCode:null,minZoom:.35,maxZoom:1.6,edgesReconnectable:!1,fitView:!0,fitViewOptions:{padding:.2,maxZoom:1},proOptions:{hideAttribution:!0},className:`policy-flow`,children:[(0,I.jsx)(j,{variant:D.Dots,gap:20,size:1.2,color:`var(--color-fawn)`}),(0,I.jsx)(k,{position:`bottom-left`,showInteractive:!1,className:`!overflow-hidden !rounded-md !border !border-frost !bg-snow !shadow-baziu-sm [&_button]:!border-frost [&_button]:!bg-snow [&_button]:!fill-chocolate`})]})})}var le={open:`Members message each other freely. A connection only matters for reaching other Teams.`,restricted:`A member can message a teammate only along a connection.`};function ue(e,t){if(t===1)return{x:220,y:140};let n=Math.max(135,t*38),r=e/t*2*Math.PI-Math.PI/2;return{x:Math.round(40+n*1.3*(1+Math.cos(r))),y:Math.round(40+n*(1+Math.sin(r)))}}var G=(e,t)=>e.has(t)?t:S,K=e=>`bz_map_${e}`;function de(e){try{let t=JSON.parse(window.localStorage.getItem(K(e))??`{}`);return t&&typeof t==`object`?t:{}}catch{return{}}}function q({team:e}){let t=_(t=>c(`/api/teams/${encodeURIComponent(e.id)}/policy`,{signal:t}),[e.id]);return t.error?(0,I.jsx)(d,{view:`connections`,children:(0,I.jsx)(`p`,{role:`alert`,className:`err m-4`,children:t.error})}):t.data?(0,I.jsx)(J,{team:e,policy:t.data},e.id):(0,I.jsx)(d,{view:`connections`,children:(0,I.jsx)(`p`,{role:`status`,className:`m-4 text-sm text-muted-foreground`,children:`Loading the connections…`})})}function J({team:e,policy:t}){let{agentById:n,search:i}=h(),l=N(),u=r(),p=m(e.id,300),[_,v]=(0,F.useState)(()=>b(t)),[y,x]=(0,F.useState)(_),[C,T]=(0,F.useState)(`map`),[E,D]=(0,F.useState)(null),[O,k]=(0,F.useState)({}),[A,j]=(0,F.useState)(!1),[M,P]=(0,F.useState)(null),[L,R]=(0,F.useState)(!1),z=!ie(_,y);(0,F.useEffect)(()=>k(de(e.id)),[e.id]);let oe=(t,n)=>{k(r=>{let i={...r,[t]:n};try{window.localStorage.setItem(K(e.id),JSON.stringify(i))}catch{}return i})},B=(0,F.useMemo)(()=>y.members.filter(e=>e.status!==`archived`),[y.members]),V=(0,F.useMemo)(()=>new Set(B.map(e=>e.key)),[B]),U=B.map((e,t)=>({id:e.key,name:e.name,identity:n(e.key)?.identity,state:l.stateOf(e.key),isolated:y.mode===`restricted`&&!y.edges.some(t=>t.from===e.key||t.to===e.key),position:O[e.key]??ue(t,B.length)})),W=e=>G(V,e),q=p.data,J=(0,F.useMemo)(()=>{let e=new Map;for(let t of q??[]){let n=G(V,t.fromAgentId),r=G(V,t.toAgentId);if(n===r)continue;let i=H(n,r);e.set(i,(e.get(i)??0)+1)}return e},[q,V]),Y=(e,t,n)=>{P(null),x(r=>te(r,e,t,n))};async function me(){j(!0),P(null);try{let t=b(await c(`/api/teams/${encodeURIComponent(e.id)}/policy`,{method:`PATCH`,body:{mode:y.mode,edges:re(y)}}));v(t),x(t),P({error:!1,text:`Saved. It applies to the next message an Agent sends.`}),await u.invalidate()}catch(e){P({error:!0,text:s(e)})}finally{j(!1)}}let X=se(E),Z=E&&(V.has(E)||E===S)?E:null,Q=(e,t)=>W(e.fromAgentId)===t||W(e.toAgentId)===t,$=q??[],he=X?$.filter(e=>Q(e,X[0])&&Q(e,X[1])):Z?$.filter(e=>Q(e,Z)):$;return(0,I.jsxs)(d,{view:`connections`,actions:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(f,{label:`How members reach each other`,value:y.mode,options:[{id:`open`,label:`Open`},{id:`restricted`,label:`Restricted`}],onChange:e=>{P(null),x(t=>({...t,mode:e}))}}),(0,I.jsx)(f,{label:`Show as`,value:C,options:[{id:`map`,label:`Map`},{id:`matrix`,label:`Table`}],onChange:T}),(0,I.jsx)(o,{variant:`ghost`,className:`min-h-8 px-3 py-1 text-xs`,disabled:!z||A,onClick:()=>R(!0),children:`Discard`}),(0,I.jsxs)(o,{variant:`primary`,className:`min-h-8 px-3 py-1 text-xs`,disabled:!z||A,onClick:()=>void me(),children:[(0,I.jsx)(ee,{className:`size-3.5`,"aria-hidden":`true`}),A?`Saving…`:`Save`]})]}),children:[(0,I.jsx)(a,{when:z,subject:`connection changes`}),(0,I.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_23rem]`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col max-lg:h-[52vh]`,children:[(0,I.jsx)(`p`,{className:`m-0 border-b border-border px-3 py-1.5 text-xs ${M?.error?`text-danger`:z?`text-warning`:`text-mocha`}`,role:M?.error?`alert`:`status`,children:M?.text??(z?`Unsaved changes. `:``)+le[y.mode]+(C===`map`?` Drag from one Agent to another to connect them.`:``)}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1`,children:B.length===0?(0,I.jsx)(`p`,{className:`m-0 p-6 text-center text-sm text-muted-foreground`,children:`This Team has no members to connect yet.`}):C===`map`?(0,I.jsx)(ce,{document:y,members:U,traffic:J,selectedId:E,onSelect:D,onConnect:(e,t)=>{Y(e,t,!0),D(H(e,t))},onMove:oe,onOpenMember:e=>void u.navigate({to:`/`,search:{agent:e,panel:`connections`}})}):(0,I.jsx)(ne,{document:{...y,members:B},selectedId:E,onSelect:D,onToggle:Y})})]}),(0,I.jsxs)(`aside`,{"aria-label":`About the selection`,className:`min-h-0 overflow-y-auto border-border p-3.5 max-lg:border-t lg:border-l`,children:[X?(0,I.jsx)(fe,{document:y,pair:X,onToggle:Y,onClear:()=>D(null)}):Z?(0,I.jsx)(pe,{document:y,actor:Z,others:[...B.map(e=>e.key),S].filter(e=>e!==Z),panel:i.panel,onToggle:Y,onSelectPair:e=>D(H(Z,e))}):(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`h2`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:[B.length,` member`,B.length===1?``:`s`,` ·`,` `,y.mode===`open`?`open Team`:`restricted Team`]}),(0,I.jsx)(`p`,{className:`m-0 mt-1 text-xs leading-relaxed text-mocha`,children:`Select an Agent to choose who it can message, or a line to see what two Agents said to each other. You can always talk to every Agent, and every Agent can always reach you.`})]}),(0,I.jsx)(`h2`,{className:`m-0 mb-1.5 mt-5 font-body text-[0.72rem] font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:X?`Messages between them`:Z?`Messages of ${w(y,Z)}`:`Recent messages`}),p.error?(0,I.jsx)(`p`,{role:`alert`,className:`m-0 text-xs text-danger`,children:p.error}):(0,I.jsx)(g,{messages:he,limit:30,empty:X||Z?`None among the Team’s recent messages.`:`No messages between Agents yet.`})]})]}),(0,I.jsx)(ae,{open:L,title:`Discard the connection changes?`,description:(0,I.jsx)(`p`,{children:`Every unsaved change is dropped. The saved connections stay as they are.`}),confirmLabel:`Discard changes`,onConfirm:()=>{x(_),D(null),P(null)},onOpenChange:R})]})}function Y({document:e,from:t,to:n,onToggle:r}){let i=C(e,t,n),a=e.mode===`open`&&t!==S&&n!==S;return(0,I.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":i,onClick:()=>r(t,n,!i),className:`unstyled flex min-h-10 w-full items-center gap-2 rounded-[10px] border px-2.5 py-1.5 text-left text-sm ${i?`border-primary/30 bg-accent/60`:`border-border bg-card hover:bg-muted`}`,children:[(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:w(e,t)}),(0,I.jsx)(v,{className:`size-3.5 shrink-0 text-mocha`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:w(e,n)})]}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs font-semibold ${i?`text-accent-foreground`:`text-muted-foreground`}`,children:i?`Connected`:a?`Open anyway`:`Not connected`})]})}function fe({document:e,pair:[t,n],onToggle:r,onClear:i}){let a=C(e,t,n)||C(e,n,t);return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`h2`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:[w(e,t),` and `,w(e,n)]}),(0,I.jsxs)(`p`,{className:`m-0 mt-1 text-xs leading-relaxed text-mocha`,children:[`Each direction is its own connection.`,t===S||n===S?` Reaching another Team also needs that Team to connect its Agent to “Other teams”.`:``]}),(0,I.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,I.jsx)(Y,{document:e,from:t,to:n,onToggle:r}),(0,I.jsx)(Y,{document:e,from:n,to:t,onToggle:r})]}),a&&(0,I.jsx)(`div`,{className:`mt-2.5`,children:(0,I.jsx)(o,{variant:`danger`,className:`min-h-8 px-3 py-1 text-xs`,onClick:()=>{r(t,n,!1),r(n,t,!1),i()},children:`Disconnect both ways`})})]})}function pe({document:e,actor:t,others:n,panel:r,onToggle:a,onSelectPair:o}){let{agentById:s}=h(),c=N(),d=t===S?void 0:s(t),f=d?c.stateOf(d.id):null;return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[t!==S&&(0,I.jsx)(P,{identity:d?.identity,size:34}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h2`,{className:`m-0 truncate font-body text-sm font-semibold text-foreground`,children:w(e,t)}),f?(0,I.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-1.5 text-xs text-mocha`,children:[(0,I.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${u[f.kind]}`,"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:f.text})]}):(0,I.jsx)(`p`,{className:`m-0 text-xs text-mocha`,children:`Every Agent that is not in this Team.`})]}),d&&(0,I.jsxs)(i,{to:`/`,search:{agent:d.id,...r?{panel:r}:{panel:`connections`}},className:`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-[10px] border border-border bg-card px-2.5 text-xs font-semibold text-foreground hover:border-sapphire-light hover:text-sapphire`,children:[(0,I.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`}),`Open`]})]}),(0,I.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.map(n=>(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>o(n),className:`unstyled mb-1 text-xs font-semibold text-mocha hover:text-sapphire`,children:[`With `,w(e,n)]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(Y,{document:e,from:t,to:n,onToggle:a}),(0,I.jsx)(Y,{document:e,from:n,to:t,onToggle:a})]})]},n))})]})}export{q as ConnectionsView};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r}from"./link-ClwtaO_E.js";import{a as i,i as a,n as o}from"./api-CPzQ_z9m.js";import{t as s}from"./ConfirmDialog-BblXqMVb.js";var c=e(t(),1),l=n();function u({field:e}){let t=r(),n=`/api/config/fields/${encodeURIComponent(e.envVar)}`,u=(0,c.useId)(),d=`${u}-description`,[f,p]=(0,c.useState)(e.kind===`config`?e.value??``:``),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(!1),S=e.kind===`secret`&&f.trim().length===0;async function C(r){if(r.preventDefault(),S){_(e.set?`Paste a replacement value, or use remove credential to explicitly clear the stored secret.`:`A secret value is required.`);return}h(!0),_(null);try{await o(n,{method:`PUT`,body:{value:f}}),y(Date.now()),e.kind===`secret`&&p(``),await t.invalidate()}catch(e){_(a(e))}finally{h(!1)}}async function w(){await o(n,{method:`DELETE`}),p(``),_(null),y(Date.now()),await t.invalidate()}return(0,l.jsxs)(`form`,{onSubmit:C,className:`grid grid-cols-1 gap-2 border-b py-3 last:border-0 md:grid-cols-[12rem_minmax(0,1fr)_auto_auto] md:items-center`,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsx)(`label`,{htmlFor:u,className:`text-sm font-medium text-foreground`,children:e.label}),e.description&&(0,l.jsx)(`div`,{id:d,className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),(0,l.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer`,children:`Advanced identifier`}),(0,l.jsx)(`code`,{className:`mt-1 inline-block break-all font-mono`,children:e.envVar})]})]}),(0,l.jsx)(`div`,{className:`min-w-0`,children:e.kind===`config`&&e.options?(0,l.jsxs)(`select`,{id:u,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`,children:[(0,l.jsx)(`option`,{value:``,children:`Not set (default)`}),f&&!e.options.includes(f)&&(0,l.jsxs)(`option`,{value:f,children:[`Unsupported: `,f]}),e.options.map(t=>(0,l.jsx)(`option`,{value:t,children:e.optionLabels?.[t]??t},t))]}):e.kind===`config`?(0,l.jsx)(`input`,{id:u,type:`text`,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),placeholder:e.placeholder??``,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`input`,{id:u,type:`password`,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),placeholder:e.set?`(paste to replace stored value)`:e.placeholder??`paste key…`,autoComplete:`off`,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}),e.set&&(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank keeps the current credential. Removal is a separate explicit action.`})]})}),(0,l.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,l.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),v&&Date.now()-v<2e3&&(0,l.jsx)(`span`,{role:`status`,className:`text-success ml-2`,children:`saved ✓`})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-self-end`,children:[(0,l.jsx)(i,{variant:`ghost`,type:`submit`,disabled:m||S,className:`text-xs`,children:`save`}),e.kind===`secret`&&e.set&&(0,l.jsx)(i,{variant:`danger`,className:`text-xs`,onClick:()=>x(!0),children:`remove`})]}),g&&(0,l.jsx)(`p`,{role:`alert`,className:`text-xs text-danger md:col-span-4`,children:g}),(0,l.jsx)(s,{open:b,title:`Remove ${e.label}?`,description:(0,l.jsxs)(`p`,{children:[`This permanently deletes the stored `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.envVar}),` `,`credential. Features that use it will fail until you save a replacement.`]}),confirmLabel:`remove stored credential`,onConfirm:w,onOpenChange:x})]})}export{u as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{t}from"./link-ClwtaO_E.js";var n=e();function r({label:e,base:r,tabs:i,children:a}){return(0,n.jsxs)(`nav`,{"aria-label":e,className:`mb-6 flex max-w-full gap-1 overflow-x-auto rounded-xl border border-border bg-muted/50 p-1`,children:[i.map(([e,i])=>{let a=`${r}${e}`;return(0,n.jsx)(t,{to:a,activeOptions:{exact:!e,includeSearch:!1},className:`inline-flex items-center whitespace-nowrap rounded-lg border px-2 py-1.5 text-xs font-semibold transition-colors sm:px-3 sm:text-sm`,activeProps:{className:`border-border bg-card text-foreground shadow-baziu-sm`},inactiveProps:{className:`border-transparent text-muted-foreground hover:bg-card/70 hover:text-foreground`},children:i},a)}),a]})}var i=[[`/agents`,`Agent templates`],[`/teams`,`Team templates`]],a=[[``,`Providers`],[`/services`,`Services`],[`/mcp`,`MCP`],[`/integrations/telegram`,`Integrations`],[`/tokens`,`Tokens`]];export{r as n,i as r,a as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{ht as t}from"./index-1YXquAq8.js";var n=e();function r({findings:e}){return e.length===0?(0,n.jsx)(t,{variant:`success`,children:`Clean`}):(0,n.jsxs)(`details`,{className:`text-xs`,children:[(0,n.jsx)(`summary`,{className:`cursor-pointer list-none`,children:(0,n.jsxs)(t,{variant:e.some(e=>e.severity===`danger`)?`danger`:`warning`,children:[e.length,` finding`,e.length===1?``:`s`]})}),(0,n.jsx)(`div`,{className:`mt-2 min-w-64`,children:(0,n.jsx)(i,{findings:e})})]})}function i({findings:e}){return(0,n.jsx)(`ul`,{className:`m-0 space-y-1.5 pl-0`,children:e.map((e,r)=>(0,n.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,n.jsx)(t,{variant:e.severity===`danger`?`danger`:`warning`,children:e.severity===`danger`?`Danger`:`Warning`}),(0,n.jsxs)(`span`,{children:[(0,n.jsx)(`code`,{children:e.code}),e.line?`, line ${e.line}`:``,` — `,e.message]})]},r))})}export{r as n,i as t};
1
+ import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{lt as t}from"./index-CNVw44IE.js";var n=e();function r({findings:e}){return e.length===0?(0,n.jsx)(t,{variant:`success`,children:`Clean`}):(0,n.jsxs)(`details`,{className:`text-xs`,children:[(0,n.jsx)(`summary`,{className:`cursor-pointer list-none`,children:(0,n.jsxs)(t,{variant:e.some(e=>e.severity===`danger`)?`danger`:`warning`,children:[e.length,` finding`,e.length===1?``:`s`]})}),(0,n.jsx)(`div`,{className:`mt-2 min-w-64`,children:(0,n.jsx)(i,{findings:e})})]})}function i({findings:e}){return(0,n.jsx)(`ul`,{className:`m-0 space-y-1.5 pl-0`,children:e.map((e,r)=>(0,n.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,n.jsx)(t,{variant:e.severity===`danger`?`danger`:`warning`,children:e.severity===`danger`?`Danger`:`Warning`}),(0,n.jsxs)(`span`,{children:[(0,n.jsx)(`code`,{children:e.code}),e.line?`, line ${e.line}`:``,` — `,e.message]})]},r))})}export{r as n,i as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./link-ClwtaO_E.js";import{a as i,i as a,n as o}from"./api-CPzQ_z9m.js";import{n as s,r as c}from"./ConfirmDialog-BblXqMVb.js";import"./entities-xVoB-p2j.js";import{n as l,t as u}from"./ModelSelect-CvOHjUyB.js";var d=e=>`/api/agents/${encodeURIComponent(e)}`;function f(e){return o(`${d(e)}/archive`,{method:`POST`})}function p(e){return o(`${d(e)}/unarchive`,{method:`POST`})}function m(e){return o(d(e),{method:`DELETE`})}function h(e,t){return o(d(e),{method:`PATCH`,body:{name:t}})}var g=e(t(),1),_=n();function v({profiles:e,teams:t,profileId:n,teamId:d,onClose:f}){let p=r(),[m,h]=(0,g.useState)(n??e.find(e=>e.id==="default")?.id??e[0]?.id??``),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)([]),[w,T]=(0,g.useState)(t.find(e=>e.id===d)?.id??t.find(e=>e.id==="default")?.id??t[0]?.id??``),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(null),A=t.find(e=>e.id===w)?.policyMode===`restricted`;(0,g.useEffect)(()=>{let e=new AbortController;return o(u,{signal:e.signal}).then(e=>C(e.teams)).catch(()=>{}),()=>e.abort()},[]);async function j(e){e.preventDefault(),k(null),D(!0);try{let e={profileId:m,teamId:w};v.trim()&&(e.name=v.trim()),b&&(e.model=b);let{agent:t}=await o(`/api/agents`,{body:e});f(),await p({to:`/`,search:{agent:t.id}})}catch(e){k(a(e)),D(!1)}}return(0,_.jsx)(s,{title:`Spawn an agent`,busy:E,onClose:f,children:(0,_.jsxs)(`form`,{onSubmit:e=>void j(e),children:[(0,_.jsxs)(`label`,{children:[`Agent template`,(0,_.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),required:!0,children:e.map(e=>(0,_.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))})]}),(0,_.jsxs)(`label`,{children:[`Name (optional; defaults to the template's)`,(0,_.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),autoComplete:`off`})]}),(0,_.jsx)(l,{label:`Model`,value:b,onChange:x,groups:S,emptyOption:`Use the template default`}),(0,_.jsxs)(`label`,{children:[`Team`,(0,_.jsx)(`select`,{value:w,onChange:e=>T(e.target.value),children:t.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.name,e.id==="default"?` (default)`:``]},e.id))})]}),A&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This Team is restricted: the new Agent starts with no connections. Add them under Connections.`}),O&&(0,_.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:O}),(0,_.jsx)(`div`,{className:`mt-4`,children:(0,_.jsxs)(c,{children:[(0,_.jsx)(i,{variant:`ghost`,disabled:E,onClick:f,children:`Cancel`}),(0,_.jsx)(i,{variant:`primary`,type:`submit`,disabled:E||!m,children:E?`Spawning…`:`Spawn agent`})]})})]})})}export{p as a,h as i,f as n,m as r,v as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,i,n as a}from"./api-CPzQ_z9m.js";var o=e(t(),1),s=n();function c({onCreated:e,onBusyChange:t,extraActions:n}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(null);function v(e){h(e),t?.(e)}async function y(t){t.preventDefault(),_(null),v(!0);try{let t=await a(`/api/teams`,{body:{id:c.trim(),name:u.trim()||void 0,link:f.trim()||void 0}});l(``),d(``),p(``),await e(t)}catch(e){_(i(e))}finally{v(!1)}}return(0,s.jsxs)(`form`,{onSubmit:e=>void y(e),children:[(0,s.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,s.jsxs)(`label`,{children:[`ID (slug)`,(0,s.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),required:!0,pattern:`[a-z0-9][a-z0-9\\-]*`,placeholder:`my-project`})]}),(0,s.jsxs)(`label`,{children:[`Name (optional)`,(0,s.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`My project`})]}),(0,s.jsxs)(`label`,{className:`sm:col-span-2`,children:[`Link target (optional, absolute path)`,(0,s.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`/home/you/projects/my-project`}),(0,s.jsxs)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:[`Leave blank for a fresh directory under `,(0,s.jsx)(`code`,{children:`~/.bazilion/teams/<slug>/`}),`. Give a path to link the Team to an existing project tree.`]})]})]}),g&&(0,s.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:g}),(0,s.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-2`,children:[n?.(m),(0,s.jsx)(r,{variant:`primary`,type:`submit`,disabled:m||!c.trim(),children:m?`Creating…`:`Create team`})]})]})}export{c as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,t as i}from"./link-ClwtaO_E.js";import{a,i as o,n as s}from"./api-CPzQ_z9m.js";import{t as c}from"./createLucideIcon-Cgab8gqu.js";import{t as l}from"./arrow-right-Dyta3p06.js";import{n as u}from"./save-ZqeB_I-c.js";import{t as d}from"./chevron-right-B2YEg9rw.js";import{n as f,r as p,t as m}from"./ConfirmDialog-BblXqMVb.js";import{$ as h,B as g,D as _,E as v,F as y,I as b,J as x,L as S,O as C,P as ee,Q as te,R as ne,X as w,v as T,y as E,z as D}from"./index-CNVw44IE.js";import{n as O,t as re}from"./entities-xVoB-p2j.js";import{i as ie,n as ae,t as oe}from"./SpawnDialog-C-Ujb4bC.js";import{t as se}from"./TeamForm-D6EAAF7m.js";var k=c(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),A=c(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),j=c(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),M=c(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),N=c(`images`,[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]),P=c(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),F=c(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),I=c(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),L=c(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),R=c(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),z=c(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),B=n(),V=e(t(),1);function H(e,t){let[n,r]=(0,V.useState)(void 0),[i,a]=(0,V.useState)(null),[s,c]=(0,V.useState)(!0),l=(0,V.useRef)(e);l.current=e;let u=(0,V.useRef)(null),d=(0,V.useCallback)(async e=>{u.current?.abort();let t=new AbortController;u.current=t,e&&r(void 0),c(!0);try{let e=await l.current(t.signal);if(t.signal.aborted)return;r(e),a(null)}catch(e){if(t.signal.aborted)return;a(o(e))}finally{t.signal.aborted||c(!1)}},[]);return(0,V.useEffect)(()=>(d(!0),()=>u.current?.abort()),t),{data:n,error:i,loading:s,reload:(0,V.useCallback)(()=>d(!1),[d])}}function U(){let[e,t]=(0,V.useState)(!1);return(0,V.useEffect)(()=>t(!0),[]),e}function W(e,t=!0){let[n,r]=(0,V.useState)(t);return(0,V.useEffect)(()=>{let t=window.matchMedia(e),n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}function G({label:e,value:t,options:n,onChange:r}){return(0,B.jsx)(`fieldset`,{"aria-label":e,className:`m-0 flex min-w-0 rounded-[12px] border border-border bg-card p-0.5`,children:n.map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t===e.id,onClick:()=>r(e.id),className:`unstyled h-7 whitespace-nowrap rounded-[9px] px-2.5 text-xs font-semibold ${t===e.id?`bg-accent text-accent-foreground`:`text-mocha hover:text-foreground`}`,children:e.label},e.id))})}var K=(0,V.createContext)(null);function q({value:e,children:t}){let n=(0,V.useMemo)(()=>{let t=new Map(e.agents.map(e=>[e.id,e]));return{...e,agentById:e=>t.get(e),to:t=>({...e.search,...t})}},[e]);return(0,B.jsx)(K.Provider,{value:n,children:t})}function J(){let e=(0,V.useContext)(K);if(!e)throw Error(`useWorkspace needs a WorkspaceProvider`);return e}function Y(){return(0,V.useContext)(K)}var X={connections:{label:`Connections`,icon:F},changes:{label:`Changes`,icon:j},files:{label:`Files`,icon:N}};function ce({view:e,actions:t,children:n}){let{team:r,agent:a,to:o}=J();return(0,B.jsxs)(`section`,{"aria-label":`${X[e].label} of ${r?.name??`the Team`}`,className:`flex h-full min-w-0 flex-col overflow-hidden rounded-[16px] border border-border bg-card shadow-baziu-sm`,children:[(0,B.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border bg-muted/60 px-3 py-2`,children:[(0,B.jsxs)(i,{to:`/`,search:o({view:void 0,result:void 0,panel:e}),className:`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-[10px] border border-border bg-card px-2.5 text-[0.82rem] font-semibold text-foreground hover:border-sapphire-light hover:text-sapphire`,children:[(0,B.jsx)(A,{className:`size-3.5`,"aria-hidden":`true`}),a?a.agent.name:`Back`]}),(0,B.jsx)(`h1`,{className:`m-0 min-w-0 truncate font-display text-[1.2rem] leading-tight text-charcoal`,children:r?.name}),(0,B.jsx)(`nav`,{"aria-label":`Team views`,className:`flex rounded-[12px] border border-border bg-card p-0.5`,children:E.map(t=>{let n=X[t].icon,r=t===e;return(0,B.jsxs)(i,{to:`/`,search:o({view:t}),"aria-current":r?`page`:void 0,className:`inline-flex h-7 items-center gap-1.5 rounded-[9px] px-2.5 text-[0.8rem] font-semibold ${r?`bg-accent text-accent-foreground`:`text-mocha hover:bg-muted hover:text-foreground`}`,children:[(0,B.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:r?``:`hidden sm:inline`,children:X[t].label})]},t)})}),t&&(0,B.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:t})]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:n})]})}function le({template:e,teams:t,initialTeamId:n=``,onClose:r,onSpawned:i}){let[c,l]=(0,V.useState)(n),[u,d]=(0,V.useState)(``),[m,h]=(0,V.useState)(null),[g,_]=(0,V.useState)(!1),v=c.trim(),y=t.some(e=>e.id===v);async function b(t){t.preventDefault(),_(!0),h(null);try{await s(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{body:{teamId:v,...u&&!y?{userMd:u}:{}}}),i(v)}catch(e){h(o(e))}finally{_(!1)}}return(0,B.jsx)(f,{title:`Spawn team: ${e.name}`,description:(0,B.jsxs)(B.Fragment,{children:[`Creates `,e.slots.length,` Agent`,e.slots.length===1?``:`s`,` and`,` `,e.edges.length,` allow edge`,e.edges.length===1?``:`s`,`. An unknown slug creates a new `,e.policyMode,` Team; an existing Team keeps its mode.`]}),busy:g,onClose:r,children:(0,B.jsxs)(`form`,{onSubmit:e=>void b(e),children:[(0,B.jsxs)(`label`,{children:[`Target Team slug`,(0,B.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),list:`spawn-team-targets`,required:!0}),(0,B.jsx)(`datalist`,{id:`spawn-team-targets`,children:t.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),!y&&(0,B.jsxs)(`label`,{children:[`Starter USER.md (new Team only; defaults to the template's)`,(0,B.jsx)(`textarea`,{rows:3,value:u,onChange:e=>d(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]}),m&&(0,B.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:m}),(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsxs)(p,{children:[(0,B.jsx)(a,{variant:`ghost`,disabled:g,onClick:r,children:`Cancel`}),(0,B.jsx)(a,{variant:`primary`,type:`submit`,disabled:g||!v||e.slots.length===0,children:g?`Spawning…`:`Spawn team`})]})})]})})}var ue=`bz_sidebar_open_groups`;function de(e){document.cookie=`${ue}=${encodeURIComponent(JSON.stringify(e))}; Path=/; Max-Age=31536000; SameSite=Lax`}var Z=`flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,fe=`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,pe={needs:`text-warning`,working:`text-success`,paused:`text-warning`,fresh:`text-accent-foreground`,idle:`text-muted-foreground`},Q={needs:`bg-warning`,working:`bg-success animate-pulse`,paused:`bg-fawn`,fresh:`bg-primary`,idle:`bg-fawn`};function me(e){return[...e].sort((e,t)=>Number(t.id===O)-Number(e.id===O))}function he({initialOpenGroups:e}){let{agents:t,teams:n,profiles:o,teamTemplates:s,agent:c,team:l,search:p}=J(),v=C(),w=r(),[T,E]=(0,V.useState)(null),[O,ie]=(0,V.useState)(void 0),[k,A]=(0,V.useState)(null),[j,M]=(0,V.useState)(!1),[N,P]=(0,V.useState)(!1),[F,I]=(0,V.useState)(null),[R,z]=(0,V.useState)(null),[H,U]=(0,V.useState)(e),W=(0,V.useRef)(null),G=()=>window.requestAnimationFrame(()=>W.current?.focus()),K=[...o].sort((e,t)=>Number(t.id===re)-Number(e.id===re)),q=me(n),Y=s.find(e=>e.id===k),X=c?.agent.id??null;return(0,B.jsxs)(`aside`,{className:`flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,B.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border bg-muted/60 px-3 py-2.5`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-[10px] bg-accent text-accent-foreground`,children:(0,B.jsx)(x,{className:`size-4`,"aria-hidden":`true`})}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-sm font-semibold leading-tight text-foreground`,children:`Teams`}),(0,B.jsxs)(`p`,{className:`m-0 truncate text-xs leading-snug text-muted-foreground`,children:[t.length,` agent`,t.length===1?``:`s`,` in `,n.length,` team`,n.length===1?``:`s`]})]})]}),(0,B.jsxs)(ne,{modal:!1,children:[(0,B.jsx)(g,{asChild:!0,children:(0,B.jsxs)(`button`,{ref:W,type:`button`,"aria-label":`Create a new Agent or Team`,className:`unstyled group inline-flex h-8 items-center gap-1 rounded-lg border border-border bg-card px-2.5 text-xs font-semibold text-foreground shadow-baziu-sm transition-colors hover:border-primary/30 hover:bg-accent hover:text-accent-foreground`,children:[(0,B.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),`New`,(0,B.jsx)(te,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":`true`})]})}),(0,B.jsx)(S,{children:(0,B.jsxs)(ee,{align:`end`,sideOffset:6,className:`z-50 w-60 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none`,children:[(0,B.jsxs)(b,{className:fe,children:[(0,B.jsx)(h,{className:`size-3`,"aria-hidden":`true`}),`Agent templates`]}),K.length===0?(0,B.jsx)(y,{asChild:!0,className:Z,children:(0,B.jsx)(`a`,{href:`/templates/agents`,children:`Create an Agent template`})}):K.map(e=>(0,B.jsxs)(y,{className:Z,onSelect:()=>{ie(l?.id),E(e.id)},children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),e.id==="default"&&(0,B.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground`,children:`Default`})]},e.id)),(0,B.jsx)(D,{className:`my-1.5 h-px bg-border`}),(0,B.jsxs)(b,{className:fe,children:[(0,B.jsx)(x,{className:`size-3`,"aria-hidden":`true`}),`Team templates`]}),s.length===0?(0,B.jsx)(y,{asChild:!0,className:Z,children:(0,B.jsx)(`a`,{href:`/templates/teams`,children:`Create a Team template`})}):s.map(e=>(0,B.jsxs)(y,{className:Z,disabled:e.slots.length===0,title:e.slots.length===0?`Add at least one member before spawning`:void 0,onSelect:()=>A(e.id),children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),(0,B.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-xs text-muted-foreground`,children:e.slots.length})]},e.id)),(0,B.jsx)(D,{className:`my-1.5 h-px bg-border`}),(0,B.jsxs)(y,{className:Z,onSelect:()=>M(!0),children:[(0,B.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`}),`Create a team`]})]})})]})]}),(0,B.jsxs)(`nav`,{className:`flex-1 overflow-y-auto p-1.5`,"aria-label":`Teams and agents`,children:[t.length===0&&(0,B.jsxs)(`div`,{className:`m-1 mb-2 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center`,children:[(0,B.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:`No agents yet`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Your default Team is ready. Spawn the first agent to start a conversation.`}),K[0]?(0,B.jsx)(a,{variant:`primary`,className:`mt-3`,onClick:()=>E(K[0]?.id??`default`),children:`Spawn first agent`}):(0,B.jsx)(`a`,{href:`/templates/agents`,className:`mt-3 text-xs font-semibold`,children:`Create an Agent template`})]}),q.map(e=>{let n=t.filter(t=>t.teamId===e.id),r=l?.id===e.id,a=H[e.id]??(r||e.id==="default"),o=_(n.map(e=>v.stateOf(e.id)));return(0,B.jsxs)(`details`,{open:a,onToggle:t=>{let n=t.currentTarget.open;if(n===a)return;let r={...H,[e.id]:n};de(r),U(r)},className:`group/details mb-1 last:mb-0`,children:[(0,B.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg py-1 pl-2 pr-1 text-sm transition-colors hover:bg-accent/60 [&::-webkit-details-marker]:hidden ${r?`bg-muted text-foreground`:`text-mocha`}`,children:[(0,B.jsx)(d,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-open/details:rotate-90`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-semibold`,children:e.name}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:o||n.length}),(0,B.jsx)(i,{to:`/`,search:{...c?.team.id===e.id?{agent:c.agent.id}:{},team:e.id,panel:`team`},"aria-label":`Open ${e.name}: members, USER.md, memory`,title:`Open the Team`,className:`flex size-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-card hover:text-primary`,children:(0,B.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`})})]}),n.length===0?(0,B.jsx)(`div`,{className:`py-2 pl-7 pr-2 text-xs text-muted-foreground`,children:`No agents in this team`}):(0,B.jsx)(`div`,{className:`space-y-0.5 py-1 pl-1.5`,children:n.map(e=>(0,B.jsx)(ge,{agent:e,selected:e.id===X,state:v.stateOf(e.id),lastActivityAt:v.byAgent.get(e.id)?.lastActivityAt??null,panel:p.panel,onRename:()=>I(e),onArchive:()=>z(e)},e.id))})]},e.id)})]}),T&&(0,B.jsx)(oe,{profiles:K,teams:q,profileId:T,teamId:O,onClose:()=>{E(null),G()}}),Y&&(0,B.jsx)(le,{template:Y,teams:q,onClose:()=>{A(null),G()},onSpawned:e=>{A(null),w.navigate({to:`/`,search:{team:e,panel:`team`}})}}),j&&(0,B.jsx)(f,{title:`Create a team`,description:`A Team is one workspace with its own USER.md, members and shared memory.`,busy:N,onClose:()=>{M(!1),G()},children:(0,B.jsx)(se,{onBusyChange:P,onCreated:async e=>{M(!1),await w.navigate({to:`/`,search:{team:e.id,panel:`team`}})},extraActions:e=>(0,B.jsx)(a,{variant:`ghost`,disabled:e,onClick:()=>M(!1),children:`Cancel`})})}),F&&(0,B.jsx)(ve,{agent:F,onClose:()=>I(null),onRenamed:()=>w.invalidate()}),(0,B.jsx)(m,{open:R!==null,onOpenChange:e=>{e||z(null)},title:`Archive ${R?.name??`agent`}?`,description:(0,B.jsx)(`p`,{children:`The Agent leaves this list and receives no work. Restore it later under Manage, Agents, with “Show archived”.`}),confirmLabel:`Archive agent`,confirmVariant:`primary`,onConfirm:async()=>{R&&(await ae(R.id),R.id===X?await w.navigate({to:`/`,search:{}}):await w.invalidate())}})]})}function ge({agent:e,selected:t,state:n,lastActivityAt:r,panel:a,onRename:o,onArchive:s}){let c=U();return(0,B.jsxs)(`div`,{className:`group/row relative rounded-2xl`,children:[(0,B.jsxs)(i,{to:`/`,search:{agent:e.id,...a?{panel:a}:{}},"aria-current":t?`page`:void 0,className:`flex min-h-[3.1rem] items-center gap-2.5 rounded-2xl border py-1.5 pl-2 pr-9 transition-colors hover:bg-accent/60 ${t?`border-primary/20 bg-accent shadow-baziu-sm`:`border-transparent`}`,children:[(0,B.jsx)(T,{identity:e.identity,size:30}),(0,B.jsxs)(`span`,{className:`block min-w-0 flex-1`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-sm font-semibold leading-tight ${t?`text-accent-foreground`:`text-foreground`}`,children:e.name}),e.telegramTopicId!==null&&(0,B.jsx)(`span`,{className:`shrink-0 text-primary`,title:`Telegram topic #${e.telegramTopicId}`,role:`img`,"aria-label":`Bound to Telegram topic ${e.telegramTopicId}`,children:(0,B.jsx)(z,{className:`size-3`,"aria-hidden":`true`})}),c&&r!==null&&(0,B.jsx)(`time`,{dateTime:new Date(r).toISOString(),className:`ml-auto shrink-0 text-[0.7rem] font-normal text-muted-foreground`,children:v(r)})]}),(0,B.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 text-xs leading-snug ${pe[n.kind]}`,children:[(0,B.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${Q[n.kind]}`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:n.text})]})]})]}),(0,B.jsxs)(ne,{modal:!1,children:[(0,B.jsx)(g,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,"aria-label":`More for ${e.name}`,className:`unstyled absolute right-1 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-lg text-muted-foreground opacity-0 transition-opacity hover:bg-card hover:text-primary focus-visible:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100`,children:(0,B.jsx)(M,{className:`size-4`,"aria-hidden":`true`})})}),(0,B.jsx)(S,{children:(0,B.jsxs)(ee,{align:`start`,sideOffset:4,className:`z-50 w-48 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none`,children:[(0,B.jsx)(y,{asChild:!0,className:Z,children:(0,B.jsxs)(i,{to:`/`,search:{agent:e.id,panel:`agent`},children:[(0,B.jsx)(w,{className:`size-3.5`,"aria-hidden":`true`}),`Agent settings`]})}),(0,B.jsxs)(y,{className:Z,onSelect:o,children:[(0,B.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`}),`Rename`]}),(0,B.jsxs)(y,{className:Z,onSelect:s,children:[(0,B.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),`Archive`]})]})})]})]})}function _e(){let{agents:e,teams:t,agent:n,team:r,search:a}=J(),o=C(),s=me(t).filter(t=>e.some(e=>e.teamId===t.id));return s.sort((e,t)=>Number(t.id===r?.id)-Number(e.id===r?.id)),(0,B.jsxs)(`nav`,{"aria-label":`Agents`,className:`flex h-full w-16 flex-col items-center gap-2 overflow-y-auto rounded-xl border border-border bg-card py-2.5 shadow-baziu-sm`,children:[(0,B.jsx)(i,{to:`/`,search:{...a,view:void 0,file:void 0,result:void 0},"aria-label":`Back to the conversation and the full list`,title:`Back to the conversation`,className:`flex size-10 shrink-0 items-center justify-center rounded-xl text-mocha hover:bg-accent hover:text-accent-foreground`,children:(0,B.jsx)(I,{className:`size-[18px]`,"aria-hidden":`true`})}),s.map(t=>(0,B.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`h-px w-8 bg-border`}),(0,B.jsx)(`span`,{className:`max-w-14 truncate text-[0.65rem] font-bold uppercase tracking-[0.06em] ${t.id===r?.id?`text-accent-foreground`:`text-muted-foreground`}`,title:t.name,children:t.name}),e.filter(e=>e.teamId===t.id).map(e=>{let t=o.stateOf(e.id);return(0,B.jsxs)(i,{to:`/`,search:{agent:e.id,...a.panel?{panel:a.panel}:{}},"aria-label":`${e.name}: ${t.text}`,title:`${e.name}: ${t.text}`,className:`relative flex size-10 shrink-0 items-center justify-center rounded-full ${e.id===n?.agent.id?`ring-2 ring-primary ring-offset-2 ring-offset-card`:``}`,children:[(0,B.jsx)(T,{identity:e.identity,size:40}),(0,B.jsx)(`span`,{className:`absolute -bottom-px -right-px size-3 rounded-full border-2 border-card ${Q[t.kind]}`,"aria-hidden":`true`})]},e.id)})]},t.id))]})}function ve({agent:e,onClose:t,onRenamed:n}){let[r,i]=(0,V.useState)(e.name),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),d=!r.trim()||r.trim()===e.name;async function m(i){if(i.preventDefault(),!d){c(!0),u(null);try{await ie(e.id,r.trim()),await n(),t()}catch(e){u(o(e)),c(!1)}}}return(0,B.jsx)(f,{title:`Rename ${e.name}`,description:`This changes the display name only; the Agent ID and history stay the same.`,busy:s,onClose:t,className:`max-w-md`,children:(0,B.jsxs)(`form`,{onSubmit:e=>void m(e),children:[(0,B.jsxs)(`label`,{children:[`Agent name`,(0,B.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),maxLength:120})]}),l&&(0,B.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:l}),(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsxs)(p,{children:[(0,B.jsx)(a,{variant:`ghost`,disabled:s,onClick:t,children:`Cancel`}),(0,B.jsx)(a,{variant:`primary`,type:`submit`,disabled:s||d,children:s?`Renaming…`:`Rename agent`})]})})]})})}function ye(e){try{let t=JSON.parse(e);if(typeof t.text==`string`)return t.text}catch{}return e}var $=(e,t)=>e<t?`${e}|${t}`:`${t}|${e}`;function be(e){let t=new Map;for(let n of e){let e=$(n.fromAgentId,n.toAgentId),r=t.get(e)??{forward:0,back:0,lastAt:0};n.fromAgentId<n.toAgentId?r.forward++:r.back++,r.lastAt=Math.max(r.lastAt,n.createdAt),t.set(e,r)}return t}function xe(e,t=100){let{turnsEnded:n}=C();return H(n=>s(`/api/teams/${encodeURIComponent(e)}/messages?limit=${t}`,{signal:n}).then(e=>e.messages),[e,t,n])}function Se({messages:e,limit:t=20,empty:n=`No messages between Agents yet.`}){let{agentById:r}=J(),i=U();if(e.length===0)return(0,B.jsx)(`p`,{className:`m-0 py-3 text-sm text-muted-foreground`,children:n});let a=e=>r(e)?.name??e.slice(0,8);return(0,B.jsxs)(`ol`,{className:`m-0 list-none space-y-1.5 p-0`,children:[e.slice(0,t).map(e=>{let t=ye(e.payload);return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`details`,{className:`group rounded-[10px] border border-border bg-card`,children:[(0,B.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-col gap-0.5 px-2.5 py-2 [&::-webkit-details-marker]:hidden`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,B.jsx)(T,{identity:r(e.fromAgentId)?.identity,size:18}),(0,B.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:a(e.fromAgentId)}),(0,B.jsx)(l,{className:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,B.jsx)(T,{identity:r(e.toAgentId)?.identity,size:18}),(0,B.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:a(e.toAgentId)}),e.readAt===null&&(0,B.jsx)(`span`,{className:`shrink-0 rounded-full bg-warning/15 px-1.5 text-[0.68rem] font-semibold text-warning`,children:`unread`}),i&&(0,B.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),className:`ml-auto shrink-0 text-muted-foreground`,children:v(e.createdAt)})]}),(0,B.jsx)(`span`,{className:`line-clamp-2 break-words text-[0.82rem] leading-snug text-mocha group-open:hidden`,children:t})]}),(0,B.jsx)(`p`,{className:`m-0 whitespace-pre-wrap break-words border-t border-frost/70 px-2.5 py-2 text-[0.82rem] leading-snug text-chocolate`,children:t})]})},e.id)}),e.length>t&&(0,B.jsxs)(`li`,{className:`px-1 text-xs text-muted-foreground`,children:[`The newest `,t,` of `,e.length,` loaded.`]})]})}export{P as C,A as E,F as S,j as T,W as _,be as a,R as b,Q as c,ce as d,q as f,U as g,G as h,$ as i,_e as l,Y as m,xe as n,he as o,J as p,ye as r,ve as s,Se as t,le as u,H as v,N as w,L as x,z as y};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r}from"./link-ClwtaO_E.js";import{t as i}from"./ConfirmDialog-BblXqMVb.js";var a=e(t(),1);function o(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function s(e,t){let{shouldBlockFn:n,enableBeforeUnload:i=!0,disabled:s=!1,withResolver:c=!1}=o(e,t),l=r(),{history:u}=l,[d,f]=a.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return a.useEffect(()=>s?void 0:u.block({blockerFn:async e=>{function t(e){let t=l.parseLocation(e),n=l.getMatchedRoutes(t.pathname);return n.foundRoute===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n.routeParams,search:l.options.parseSearch(e.search)}:{routeId:n.foundRoute.id,fullPath:n.foundRoute.fullPath,pathname:t.pathname,params:n.routeParams,search:l.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let a=await n({action:e.action,current:r,next:i});if(!c)return a;if(!a)return!1;let o=await new Promise(t=>{f({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return f({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),o},enableBeforeUnload:i}),[n,i,s,c,u,l]),d}var c=n();function l({when:e,subject:t=`changes`}){let n=(0,a.useRef)(!1),r=s({shouldBlockFn:(0,a.useCallback)(()=>e,[e]),enableBeforeUnload:e,disabled:!e,withResolver:!0}),o=r.status===`blocked`&&r.next.pathname!==r.current.pathname?r.next.pathname:``;return(0,c.jsx)(i,{open:r.status===`blocked`,title:`Discard unsaved ${t}?`,description:o?(0,c.jsxs)(`p`,{children:[`Leaving this page for `,(0,c.jsx)(`code`,{className:`font-mono`,children:o}),` will permanently discard the unsaved `,t,` on this page.`]}):(0,c.jsxs)(`p`,{children:[`Going on will permanently discard the unsaved `,t,`.`]}),confirmLabel:o?`Discard and leave`:`Discard`,onConfirm:()=>{n.current=!0,r.proceed?.()},onOpenChange:e=>{!e&&!n.current&&r.reset?.(),e||(n.current=!1)}})}export{l as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r}from"./link-ClwtaO_E.js";import{t as i}from"./UnsavedChangesGuard-DTUP7hwu.js";import{a,i as o,n as s}from"./api-CPzQ_z9m.js";import{ot as c,t as l}from"./index-CNVw44IE.js";import{n as u}from"./ModelSelect-CvOHjUyB.js";import{n as d,r as f}from"./SectionTabs-DlfXtepS.js";import{t as p}from"./Tabs-D0LgBNIk.js";import{t as m}from"./SkillsPicker-Cr87y_W-.js";var h=e(t()),g=n();function _(){let{loaded:e,modelGroups:t,skills:n}=l.useLoaderData(),{profile:r,files:a}=e,[o,s]=(0,h.useState)(`basics`),[u,m]=(0,h.useState)({}),_=(0,h.useCallback)((e,t)=>{m(n=>n[e]===t?n:{...n,[e]:t})},[]),v=Object.values(u).filter(Boolean).length;return(0,g.jsxs)(c,{children:[(0,g.jsx)(i,{when:v>0,subject:`Agent template changes`}),(0,g.jsx)(d,{label:`Template kinds`,base:`/templates`,tabs:f}),(0,g.jsxs)(`header`,{children:[(0,g.jsx)(`a`,{href:`/templates/agents`,className:`mb-1 inline-block text-[0.85em] text-mocha-light hover:text-sapphire`,children:`← Agent templates`}),(0,g.jsx)(`h1`,{children:r.name}),(0,g.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[0.9em] text-mocha-light`,children:[(0,g.jsx)(`code`,{children:r.id}),(0,g.jsx)(`span`,{children:`·`}),(0,g.jsxs)(`span`,{children:[`model: `,(0,g.jsx)(`code`,{children:r.defaultModel})]})]}),(0,g.jsx)(`p`,{className:`muted mt-4`,children:`These settings and files seed every agent spawned from this template from now on. Existing agents keep their own copies.`})]}),(0,g.jsx)(p,{items:[{id:`basics`,label:`Basics`},{id:`skills`,label:`Skills`}],active:o,onChange:s}),v>0&&(0,g.jsxs)(`p`,{role:`status`,className:`text-sm text-warning`,children:[v,` unsaved `,v===1?`section`:`sections`,`: switching tabs keeps them; leaving the page asks first.`]}),(0,g.jsxs)(`div`,{hidden:o!==`basics`,className:`space-y-5`,children:[(0,g.jsx)(E,{profileId:r.id,initialName:r.name,currentModel:r.defaultModel,modelGroups:t,onDirtyChange:_}),(0,g.jsx)(w,{profileId:r.id,file:`SOUL.md`,initial:a.soul,rows:14,onDirtyChange:_}),(0,g.jsx)(w,{profileId:r.id,file:`IDENTITY.md`,initial:a.identity,rows:10,onDirtyChange:_}),a.bootstrap===null?(0,g.jsx)(x,{title:`BOOTSTRAP.md`,children:(0,g.jsx)(`p`,{className:`muted`,children:`This template has no first-run ritual, so spawned agents get no intro message.`})}):(0,g.jsx)(w,{profileId:r.id,file:`BOOTSTRAP.md`,initial:a.bootstrap,rows:10,onDirtyChange:_}),(0,g.jsx)(T,{profileId:r.id,file:`AGENTS.md`,initial:a.agents,hint:`Peers and routing notes: who this agent can hand off to.`,onDirtyChange:_}),(0,g.jsx)(T,{profileId:r.id,file:`TOOLS.md`,initial:a.tools,hint:`Agent-specific tool notes beyond the generic tool descriptions.`,onDirtyChange:_})]}),(0,g.jsx)(`div`,{hidden:o!==`skills`,children:(0,g.jsx)(D,{profileId:r.id,initialMode:r.skillsMode,initialPicked:e.defaultSkills,skills:n,onDirtyChange:_})})]})}var v={kind:`idle`,message:``};function y(e,t){return e&&t.kind!==`saving`&&t.kind!==`error`?{kind:`idle`,message:`unsaved changes`,dirty:!0}:t}function b(e,t,n){(0,h.useEffect)(()=>n(e,t),[t,n,e])}function x({title:e,status:t,children:n}){let r=t?.kind===`saved`?`text-sapphire`:t?.kind===`error`?`text-danger`:t?.dirty?`text-mocha`:`text-mocha-light`;return(0,g.jsxs)(`section`,{className:`rounded-[16px] border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,g.jsx)(`h3`,{className:`m-0 font-mono text-[0.95em] font-semibold normal-case tracking-normal text-chocolate`,children:e}),t?.message&&(0,g.jsx)(`span`,{role:t.kind===`error`?`alert`:`status`,className:`text-[0.82em] ${r}`,children:t.message})]}),n]})}async function S(e,t){e({kind:`saving`,message:`saving…`});try{await t(),e({kind:`saved`,message:`saved`})}catch(t){e({kind:`error`,message:`error: ${o(t)}`})}}function C(e,t){return`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`}function w({profileId:e,file:t,initial:n,rows:r,onDirtyChange:i}){let[o,c]=(0,h.useState)(n),[l,u]=(0,h.useState)(n),[d,f]=(0,h.useState)(v),p=l!==o;return b(`file:${t}`,p,i),(0,g.jsxs)(x,{title:t,status:y(p,d),children:[(0,g.jsx)(`textarea`,{"aria-label":`${t} contents`,rows:r,value:l,onChange:e=>u(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`}),(0,g.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,g.jsx)(a,{variant:`primary`,disabled:d.kind===`saving`,onClick:()=>void S(f,async()=>{await s(C(e,t),{method:`PUT`,body:{content:l}}),c(l)}),children:`Save`}),(0,g.jsx)(a,{variant:`ghost`,onClick:()=>{u(o),f(v)},children:`Revert`})]})]})}function T({profileId:e,file:t,initial:n,hint:i,onDirtyChange:o}){let c=r(),[l,u]=(0,h.useState)(v);return n===null?(0,g.jsxs)(x,{title:t,status:l,children:[(0,g.jsx)(`p`,{className:`muted my-1`,children:i}),(0,g.jsx)(a,{variant:`primary`,className:`mt-3`,disabled:l.kind===`saving`,onClick:()=>void S(u,async()=>{await s(C(e,t),{method:`PUT`,body:{content:``}}),await c.invalidate()}),children:l.kind===`saving`?`Creating…`:`Create empty`})]}):(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`muted mb-2 ml-1 text-[0.85em]`,children:i}),(0,g.jsx)(w,{profileId:e,file:t,initial:n,rows:10,onDirtyChange:o})]})}function E({profileId:e,initialName:t,currentModel:n,modelGroups:i,onDirtyChange:o}){let c=r(),[l,d]=(0,h.useState)({name:t,model:n}),[f,p]=(0,h.useState)(t),[m,_]=(0,h.useState)(n),[C,w]=(0,h.useState)(v),T=f!==l.name||m!==l.model;return b(`settings`,T,o),(0,g.jsx)(x,{title:`settings`,status:y(T,C),children:(0,g.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),S(w,async()=>{let t={name:f.trim(),model:m};await s(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,body:{name:t.name,defaultModel:t.model}}),await c.invalidate(),p(t.name),d(t)})},children:[(0,g.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`label`,{children:[`Name`,(0,g.jsx)(`input`,{value:f,onChange:e=>p(e.target.value)})]}),(0,g.jsx)(u,{label:`Default model`,value:m,onChange:_,groups:i,required:!0})]}),(0,g.jsx)(a,{variant:`primary`,type:`submit`,className:`mt-3`,disabled:!T||C.kind===`saving`,children:`Save settings`})]})})}function D({profileId:e,initialMode:t,initialPicked:n,skills:i,onDirtyChange:o}){let c=r(),[l,u]=(0,h.useState)({mode:t,picked:new Set(n)}),[d,f]=(0,h.useState)(t),[p,_]=(0,h.useState)(()=>new Set(n)),[C,w]=(0,h.useState)(v),T=d!==l.mode||p.size!==l.picked.size||[...p].some(e=>!l.picked.has(e));return b(`skills`,T,o),(0,g.jsxs)(x,{title:`skills`,status:y(T,C),children:[(0,g.jsx)(`p`,{className:`muted my-2`,children:`What agents spawned from this template start with. Existing agents keep their skills.`}),(0,g.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),S(w,async()=>{let t=d===`selected`?new Set(p):new Set;await s(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,body:{skillsMode:d,defaultSkills:[...t]}}),await c.invalidate(),_(t),u({mode:d,picked:t})})},children:[(0,g.jsx)(m,{mode:d,onModeChange:f,picked:p,onPickedChange:_,skills:i}),(0,g.jsx)(a,{variant:`primary`,type:`submit`,className:`mt-3`,disabled:!T||C.kind===`saving`,children:`Save skills`})]})]})}export{_ as component};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{t as r}from"./UnsavedChangesGuard-DTUP7hwu.js";import{a as i,i as a,n as o}from"./api-CPzQ_z9m.js";import{t as s}from"./createLucideIcon-Cgab8gqu.js";import{n as c,t as l}from"./save-ZqeB_I-c.js";import{C as u,S as d,a as f,b as p,d as m,f as h,g,h as _,i as v,l as y,m as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D,x as O,y as k}from"./style-BWShXY3e.js";import{i as A,t as j}from"./ConfirmDialog-BblXqMVb.js";import{$ as M,n as N,ot as P}from"./index-CNVw44IE.js";import{n as F,r as I}from"./SectionTabs-DlfXtepS.js";var L=s(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),R=s(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),z=s(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),B=s(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),V=e(t(),1),H=n();function U({data:e,selected:t}){return(0,H.jsxs)(`div`,{className:`relative w-[190px] rounded-md border bg-snow px-3 py-2.5 shadow-baziu-sm transition-shadow ${t?`border-sapphire shadow-baziu-md`:`border-frost`}`,children:[(0,H.jsx)(v,{type:`target`,position:D.Left,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,H.jsx)(`span`,{className:`flex h-8 w-8 flex-none items-center justify-center rounded-md bg-sapphire-glow text-sapphire`,children:(0,H.jsx)(M,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-semibold text-chocolate`,children:e.member.name}),(0,H.jsx)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate text-[0.68rem] text-mocha-light`,children:`slot`})]}),e.isolated&&(0,H.jsx)(z,{className:`h-4 w-4 flex-none text-[#a56568]`,"aria-label":`No allow edges`}),e.incomplete&&(0,H.jsx)(L,{className:`h-4 w-4 flex-none text-warning`,"aria-label":`Incomplete slot`})]}),(0,H.jsx)(v,{type:`source`,position:D.Right,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`})]})}function W({data:e,selected:t}){return(0,H.jsxs)(`div`,{className:`w-[150px] rounded-md border bg-ivory px-3 py-2.5 shadow-baziu-sm ${t?`border-sapphire`:`border-fawn`}`,children:[(0,H.jsx)(v,{type:`target`,position:D.Left,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(u,{className:`h-4 w-4 flex-none text-rose-baziu`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`block text-sm font-semibold text-chocolate`,children:e.label})]}),(0,H.jsx)(v,{type:`source`,position:D.Right,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`})]})}var G={agent:U,outside:W};function K({document:e,selectedId:t,incompleteKeys:n,onSelect:r,onConnect:i,onRemoveEdge:a,onMoveMember:o,onOpenMember:s}){let c=(0,V.useMemo)(()=>[{id:h,type:`outside`,position:{x:Math.max(800,...e.members.map(e=>e.position.x+280)),y:110},data:{label:`Other teams`},ariaLabel:`Agents in other teams`,selected:t===h,draggable:!1,deletable:!1},...e.members.map(r=>{let i=e.mode===`restricted`&&!e.edges.some(e=>e.from===r.key||e.to===r.key),a=n.has(r.key);return{id:r.key,type:`agent`,position:r.position,data:{member:r,isolated:i,incomplete:a},ariaLabel:`${r.name}${i?`, no allow edges`:``}${a?`, incomplete`:``}`,selected:t===r.key,deletable:!1}})],[e,n,t]),[l,u,d]=T(c);(0,V.useEffect)(()=>{u(e=>{let t=new Map(e.map(e=>[e.id,e]));return c.map(e=>({...t.get(e.id),...e}))})},[c,u]);let p=(0,V.useMemo)(()=>e.edges.map(e=>{let n=b(e.from,e.to);return{id:n,source:e.from,target:e.to,selected:t===n,markerEnd:{type:y.ArrowClosed,width:16,height:16},style:{stroke:`var(--color-sapphire)`,strokeWidth:1.7}}}),[e.edges,t]),m=e=>{e.source&&e.target&&i(e.source,e.target)},g=t=>e.members.find(e=>e.key===t);return(0,H.jsx)(`div`,{className:`h-full min-h-[420px] w-full bg-ivory`,children:(0,H.jsxs)(S,{nodes:l,edges:p,nodeTypes:G,onConnect:m,onNodesChange:d,onNodeClick:(e,t)=>r(t.id),onNodeDoubleClick:(e,t)=>{let n=g(t.id);n&&s(n)},onEdgeClick:(e,t)=>r(t.id),onPaneClick:()=>r(null),onEdgesDelete:e=>{for(let t of e)a(t.source,t.target)},onNodeDragStop:(e,t)=>{g(t.id)&&o(t.id,t.position)},minZoom:.35,maxZoom:1.8,edgesReconnectable:!1,fitView:!0,fitViewOptions:{padding:.22,maxZoom:1},proOptions:{hideAttribution:!0},className:`policy-flow`,children:[(0,H.jsx)(E,{variant:x.Dots,gap:20,size:1.2,color:`var(--color-fawn)`}),(0,H.jsx)(w,{position:`bottom-left`,showInteractive:!1,className:`!overflow-hidden !rounded-md !border !border-frost !bg-snow !shadow-baziu-sm [&_button]:!border-frost [&_button]:!bg-snow [&_button]:!fill-chocolate`}),(0,H.jsx)(f,{pannable:!0,zoomable:!0,position:`bottom-right`,className:`!hidden !rounded-md !border !border-frost !bg-snow sm:!block`,nodeColor:e=>e.type===`outside`?`var(--color-rose-baziu)`:`var(--color-sapphire)`,maskColor:`color-mix(in srgb, var(--color-cream) 70%, transparent)`})]})})}var q={open:`Members message each other freely; edges only matter for messages to and from other teams.`,restricted:`Members message each other only along allow edges.`};function J({template:e,profiles:t}){let[n,s]=(0,V.useState)(()=>O(e)),[c,u]=(0,V.useState)(n),[f,h]=(0,V.useState)(`flow`),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(!1),w=!k(n,c),T=(0,V.useMemo)(()=>new Set(c.members.filter(e=>!t.some(t=>t.id===e.profileId)).map(e=>e.key)),[c.members,t]),E=(e,t,n)=>u(r=>p(r,e,t,n));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(r,{when:w,subject:`Team template draft`}),(0,H.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-frost bg-snow`,"aria-label":`Team policy editor`,children:[(0,H.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-frost bg-cream p-3`,children:[(0,H.jsxs)(`div`,{className:`mr-auto min-w-0`,children:[(0,H.jsxs)(`label`,{className:`m-0 text-xs`,children:[`Template name`,(0,H.jsx)(`input`,{value:c.name,onChange:e=>{let t=e.target.value;u(e=>({...e,name:t}))}})]}),(0,H.jsx)(`p`,{className:`muted m-0 text-xs`,children:q[c.mode]})]}),(0,H.jsx)(`fieldset`,{className:`m-0 flex min-w-0 rounded-md border border-frost bg-ivory p-0.5`,"aria-label":`Policy mode`,children:[`open`,`restricted`].map(e=>(0,H.jsx)(Y,{active:c.mode===e,label:e===`open`?`Open`:`Restricted`,onClick:()=>u(t=>({...t,mode:e}))},e))}),(0,H.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 rounded-md border border-frost bg-ivory p-0.5`,"aria-label":`Editor view`,children:[(0,H.jsx)(Y,{active:f===`flow`,label:`Flow`,icon:(0,H.jsx)(R,{className:`h-4 w-4`}),onClick:()=>h(`flow`)}),(0,H.jsx)(Y,{active:f===`matrix`,label:`Matrix`,icon:(0,H.jsx)(B,{className:`h-4 w-4`}),onClick:()=>h(`matrix`)})]}),(0,H.jsx)(i,{variant:`ghost`,disabled:!w||v,onClick:()=>C(!0),children:`Discard`}),(0,H.jsxs)(i,{variant:`primary`,disabled:!w||v,onClick:async()=>{y(!0),x(null);try{let n=O(await o(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`PUT`,body:d(c,t)}));s(n),u(n),_(null),x(`Saved.`)}catch(e){x(a(e))}finally{y(!1)}},children:[(0,H.jsx)(l,{className:`h-4 w-4`}),` `,v?`Saving…`:`Save`]})]}),b&&(0,H.jsx)(`div`,{role:`status`,className:`border-b border-frost bg-ivory px-4 py-2 text-sm`,children:b}),(0,H.jsxs)(`div`,{className:`grid min-h-[620px] grid-cols-1 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,H.jsx)(`div`,{className:`min-h-[480px] overflow-hidden`,children:f===`flow`?(0,H.jsx)(K,{document:c,selectedId:g,incompleteKeys:T,onSelect:_,onConnect:(e,t)=>E(e,t,!0),onRemoveEdge:(e,t)=>E(e,t,!1),onMoveMember:(e,t)=>u(n=>({...n,members:n.members.map(n=>n.key===e?{...n,position:t}:n)})),onOpenMember:e=>_(e.key)}):(0,H.jsx)(m,{document:c,selectedId:g,onSelect:_,onToggle:E})}),(0,H.jsx)(`aside`,{className:`border-t border-frost p-4 lg:border-l lg:border-t-0`,children:(0,H.jsx)(X,{document:c,selectedId:g,profiles:t,onDraft:u,onSelect:_,onToggle:E})})]})]}),(0,H.jsx)(j,{open:S,title:`Discard this Team template draft?`,description:(0,H.jsx)(`p`,{children:`This discards every unsaved change. The saved template stays as it is.`}),confirmLabel:`discard draft`,onConfirm:()=>{u(n),_(null),x(null)},onOpenChange:C})]})}function Y({active:e,label:t,icon:n,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:r,className:`flex items-center gap-1 rounded px-2 py-1 text-xs ${e?`bg-snow text-sapphire shadow-sm`:`text-mocha`}`,children:[n,t]})}function X({document:e,selectedId:t,profiles:n,onDraft:r,onSelect:a,onToggle:o}){let s=[...e.members.map(e=>e.key),h],l=e.edges.find(e=>b(e.from,e.to)===t),u=t&&s.includes(t)?t:null,d=e.members.find(e=>e.key===u),f=e=>r(t=>({...t,members:t.members.map(t=>t.key===d?.key?{...t,...e}:t)}));return l?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Allow edge`}),(0,H.jsxs)(`p`,{className:`text-sm`,children:[_(e,l.from),` → `,_(e,l.to)]}),(0,H.jsxs)(i,{variant:`danger`,onClick:()=>{o(l.from,l.to,!1),a(null)},children:[(0,H.jsx)(A,{className:`h-4 w-4`}),` Remove edge`]})]}):u?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:d?`Slot`:`Boundary`}),(0,H.jsx)(`h3`,{className:`mt-1 text-base`,children:_(e,u)})]}),d&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`text-xs`,children:[`Agent name`,(0,H.jsx)(`input`,{value:d.name,onChange:e=>f({name:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`text-xs`,children:[`Agent template`,(0,H.jsxs)(`select`,{value:d.profileId,onChange:e=>f({profileId:e.target.value}),children:[!n.some(e=>e.id===d.profileId)&&(0,H.jsx)(`option`,{value:d.profileId,children:d.profileId||`Select a template`}),n.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold`,children:`May send to`}),s.filter(e=>e!==u).map(t=>{let n=g(e,u,t);return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:()=>o(u,t,!n),className:`flex w-full items-center justify-between rounded border border-frost p-2 text-xs`,children:[(0,H.jsx)(`span`,{children:_(e,t)}),n?`Allowed`:`Not allowed`]},t)})]}),d&&(0,H.jsxs)(i,{variant:`danger`,onClick:()=>{r(e=>({...e,members:e.members.filter(e=>e.key!==d.key),edges:e.edges.filter(e=>e.from!==d.key&&e.to!==d.key)})),a(null)},children:[(0,H.jsx)(A,{className:`h-4 w-4`}),` Remove slot and its edges`]})]}):(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Summary`}),(0,H.jsxs)(`p`,{className:`muted text-xs`,children:[e.members.length,` slots · `,e.edges.length,` allow edges`]}),(0,H.jsx)(`p`,{className:`muted mt-2 text-xs`,children:`Select a node to edit who it may message. Drag from one node's handle to another to add an edge. Other teams need an edge to Other teams in the sender's Team and one from Other teams in the recipient's Team.`})]}),(0,H.jsxs)(`label`,{className:`text-xs`,children:[`USER.md for spawned Teams`,(0,H.jsx)(`textarea`,{rows:6,value:e.userMd??``,onChange:e=>{let t=e.target.value;r(e=>({...e,userMd:t||null}))},className:`font-mono text-[0.85em]`})]}),(0,H.jsxs)(i,{variant:`ghost`,onClick:()=>r(e=>({...e,members:[...e.members,{key:`draft:${crypto.randomUUID()}`,profileId:n[0]?.id??``,name:`Agent ${e.members.length+1}`,position:C(e.members.length)}]})),children:[(0,H.jsx)(c,{className:`h-4 w-4`}),` Add slot`]})]})}function Z(){let{template:e,profiles:t}=N.useLoaderData(),[n,r]=(0,V.useState)(!1);return(0,H.jsxs)(P,{size:`wide`,children:[(0,H.jsx)(F,{label:`Template kinds`,base:`/templates`,tabs:I}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`a`,{href:`/templates/teams`,children:`← Team templates`}),(0,H.jsx)(i,{variant:`danger`,onClick:()=>r(!0),children:`Delete template`})]}),(0,H.jsx)(J,{template:e,profiles:t}),(0,H.jsx)(j,{open:n,title:`Delete Team template ${e.name}?`,description:(0,H.jsx)(`p`,{children:`Teams already spawned from it keep their Agents and edges.`}),confirmLabel:`Delete template`,onConfirm:async()=>{await o(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`DELETE`}),window.location.assign(`/templates/teams`)},onOpenChange:r})]})}export{Z as component};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,t as i}from"./link-ClwtaO_E.js";import{a,i as o}from"./api-CPzQ_z9m.js";import{t as s}from"./ConfirmDialog-BblXqMVb.js";import{at as c,it as l,l as u,lt as d,nt as f,ot as p,rt as m,st as h,v as g}from"./index-CNVw44IE.js";import{a as _,n as v,r as y,t as b}from"./SpawnDialog-C-Ujb4bC.js";var x=e(t()),S=n();function C(){let{agents:e,profiles:t,teams:n}=u.useLoaderData(),C=u.useSearch().all===1,w=r(),[T,E]=(0,x.useState)(!1),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(null);async function j(e){A(null);try{await _(e.id),await w.invalidate()}catch(e){A(o(e))}}return(0,S.jsxs)(p,{size:`wide`,children:[(0,S.jsx)(c,{eyebrow:`Workspace`,title:`Agents`,description:`Every Agent across your teams: spawn, archive, restore and delete. Open one to talk to it; its model, skills and schedules are in its side panel.`,actions:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`a`,{className:`ghost-btn`,href:C?`/agents`:`/agents?all=1`,children:C?`Hide archived`:`Show archived`}),(0,S.jsx)(a,{variant:`primary`,disabled:t.length===0,onClick:()=>E(!0),children:`Spawn agent`})]})}),k&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:k}),(0,S.jsx)(h,{title:C?`All agents`:`Current agents`,description:C?`Active and archived agents are shown together.`:`Archived agents stay hidden until you choose to show them.`,children:e.length===0?(0,S.jsx)(f,{title:C?`No agents yet`:`No current agents`,description:`Spawn an agent to give a team its first working member.`}):(0,S.jsx)(m,{children:e.map(e=>(0,S.jsx)(l,{title:(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(g,{identity:e.identity,size:26}),(0,S.jsx)(i,{to:`/`,search:{agent:e.id},className:`truncate`,children:e.name}),(0,S.jsx)(d,{variant:e.status===`archived`?`warning`:`success`,children:e.status})]}),meta:(0,S.jsxs)(S.Fragment,{children:[(e.identity?.creature||e.identity?.vibe)&&(0,S.jsx)(`span`,{children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)}),(0,S.jsxs)(`span`,{children:[`template `,(0,S.jsx)(`code`,{children:e.profileId})]}),(0,S.jsxs)(`span`,{children:[`team `,(0,S.jsx)(`code`,{children:e.teamId})]}),(0,S.jsx)(`code`,{title:e.id,children:e.id.slice(0,8)})]}),actions:(0,S.jsxs)(S.Fragment,{children:[e.status===`archived`?(0,S.jsx)(a,{variant:`ghost`,onClick:()=>void j(e),children:`Restore`}):(0,S.jsx)(a,{variant:`ghost`,onClick:()=>O({kind:`archive`,agent:e}),children:`Archive`}),(0,S.jsx)(a,{variant:`danger`,onClick:()=>O({kind:`delete`,agent:e}),children:`Delete`})]})},e.id))})}),T&&(0,S.jsx)(b,{profiles:t,teams:n,onClose:()=>E(!1)}),(0,S.jsx)(s,{open:D!==null,onOpenChange:e=>{e||O(null)},title:D?.kind===`delete`?`Delete ${D.agent.name} permanently?`:`Archive ${D?.agent.name??`agent`}?`,description:D?.kind===`delete`?(0,S.jsx)(`p`,{children:`This permanently removes the Agent, its messages, triggers, skill attachments, sessions, and private on-disk directory. This cannot be undone.`}):(0,S.jsx)(`p`,{children:`The Agent will stop appearing in current lists and cannot receive normal work. You can restore it later from “Show archived”.`}),confirmLabel:D?.kind===`delete`?`Delete permanently`:`Archive agent`,confirmVariant:D?.kind===`delete`?`danger`:`primary`,onConfirm:async()=>{D&&(D.kind===`delete`?await y(D.agent.id):await v(D.agent.id),await w.invalidate())}})]})}export{C as component};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r}from"./link-ClwtaO_E.js";import{t as i}from"./UnsavedChangesGuard-DTUP7hwu.js";import{a,i as o,n as s}from"./api-CPzQ_z9m.js";import{t as c}from"./ConfirmDialog-BblXqMVb.js";import{at as l,i as u,it as d,lt as f,ot as p,rt as m,st as h}from"./index-CNVw44IE.js";import{n as g}from"./ModelSelect-CvOHjUyB.js";import{n as _,r as v}from"./SectionTabs-DlfXtepS.js";import{t as y}from"./Tabs-D0LgBNIk.js";import{t as b}from"./SkillsPicker-Cr87y_W-.js";var x=e(t()),S=n();function C(){let{profiles:e,modelGroups:t,skills:n,templates:i}=u.useLoaderData(),o=r(),[g,y]=(0,x.useState)(null);return(0,S.jsxs)(p,{size:`wide`,children:[(0,S.jsx)(l,{eyebrow:`Templates`,title:`Agent templates`,description:`Reusable identity, model and skills for newly spawned agents.`}),(0,S.jsx)(_,{label:`Template kinds`,base:`/templates`,tabs:v}),(0,S.jsx)(T,{modelGroups:t,skills:n,templates:i,onCreated:()=>o.invalidate()}),(0,S.jsx)(h,{title:`Templates`,children:e.length===0?(0,S.jsx)(`p`,{className:`muted`,children:`No Agent templates yet.`}):(0,S.jsx)(m,{children:e.map(e=>(0,S.jsx)(d,{title:(0,S.jsx)(`a`,{href:`/templates/agents/${encodeURIComponent(e.id)}`,children:e.name}),meta:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{children:e.id}),(0,S.jsx)(`code`,{children:e.defaultModel}),(0,S.jsxs)(`span`,{children:[e.agentCount,` agent`,e.agentCount===1?``:`s`]}),(0,S.jsxs)(`span`,{children:[`skills:`,` `,e.skillsMode===`all`?`all`:e.defaultSkills.join(`, `)||`none`]})]}),actions:e.agentCount===0?(0,S.jsx)(a,{variant:`danger`,onClick:()=>y(e),children:`Delete`}):(0,S.jsx)(f,{title:`${e.agentCount} agent(s) use this template`,children:`In use`})},e.id))})}),(0,S.jsx)(c,{open:g!==null,title:`Delete Agent template ${g?.name??``}?`,description:(0,S.jsxs)(`p`,{children:[`This permanently deletes `,(0,S.jsx)(`code`,{className:`font-mono`,children:g?.id}),` and its files. Existing Agents keep their own copies.`]}),confirmLabel:`Delete Agent template`,onConfirm:async()=>{g&&(await s(`/api/profiles/${encodeURIComponent(g.id)}`,{method:`DELETE`}),await o.invalidate())},onOpenChange:e=>{e||y(null)}})]})}var w=[{key:`soul`,label:`SOUL.md`,hint:`Persona, values and operating principles. Part of every session.`,rows:16,optional:!1},{key:`identity`,label:`IDENTITY.md`,hint:`Name, creature, vibe, emoji, avatar: filled in during the first-run ritual.`,rows:12,optional:!1},{key:`bootstrap`,label:`BOOTSTRAP.md`,hint:`The first-run ritual; the agent retires it once introductions are done.`,rows:16,optional:!0},{key:`agents`,label:`AGENTS.md`,hint:`The workspace operating manual: memory discipline, red lines, channel etiquette.`,rows:16,optional:!0},{key:`tools`,label:`TOOLS.md`,hint:`Agent-specific tool notes and environment facts beyond the tool descriptions.`,rows:14,optional:!0}];function T({modelGroups:e,skills:t,templates:n,onCreated:r}){let c=()=>({soul:n.soul,identity:n.identity,bootstrap:n.bootstrap,agents:n.agents,tools:n.tools}),[l,u]=(0,x.useState)(`basics`),[d,f]=(0,x.useState)(``),[p,m]=(0,x.useState)(``),[_,v]=(0,x.useState)(``),[C,T]=(0,x.useState)(c),[E,D]=(0,x.useState)({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),[O,k]=(0,x.useState)(`all`),[A,j]=(0,x.useState)(new Set),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1),I=c(),L=d.length>0||p.length>0||_.length>0||w.some(e=>C[e.key]!==I[e.key]||!E[e.key])||O!==`all`||A.size>0;function R(e,t){D(n=>({...n,[e]:t})),!t&&l===e&&u(`basics`)}async function z(e){e.preventDefault(),N(null),F(!0);try{await s(`/api/profiles`,{body:{id:d.trim(),name:p.trim()||void 0,defaultModel:_,skillsMode:O,defaultSkills:O===`selected`?Array.from(A):[],soul:C.soul,identity:C.identity,bootstrap:E.bootstrap?C.bootstrap:null,agents:E.agents?C.agents:null,tools:E.tools?C.tools:null}}),f(``),m(``),v(``),T(c()),D({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),j(new Set),k(`all`),u(`basics`),await r()}catch(e){N(o(e))}finally{F(!1)}}let B=w.find(e=>e.key===l);return(0,S.jsx)(h,{title:`Create an Agent template`,children:(0,S.jsxs)(`form`,{onSubmit:e=>void z(e),children:[(0,S.jsx)(i,{when:L&&!P,subject:`Agent template draft`}),M&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:M}),(0,S.jsx)(y,{items:[{id:`basics`,label:`Basics`},...w.map(e=>({id:e.key,label:e.label.replace(`.md`,``),disabled:!E[e.key]})),{id:`skills`,label:`Skills`}],active:l,onChange:u}),(0,S.jsxs)(`fieldset`,{className:`mb-5 rounded-md border border-frost p-3`,children:[(0,S.jsx)(`legend`,{className:`px-1 text-[0.85em] font-medium text-mocha`,children:`Files to include`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2 text-[0.9em]`,children:w.map(e=>(0,S.jsxs)(`label`,{className:`m-0 inline-flex items-center gap-1.5 ${e.optional?`cursor-pointer`:`opacity-60`}`,title:e.optional?void 0:`always included`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:E[e.key],disabled:!e.optional,onChange:t=>R(e.key,t.target.checked)}),e.label]},e.key))}),(0,S.jsx)(`p`,{className:`muted mt-2 text-[0.8em]`,children:`Each spawned agent gets its own copy of the included files.`})]}),l===`basics`&&(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`label`,{children:[`ID (slug)`,(0,S.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,S.jsxs)(`label`,{children:[`Name`,(0,S.jsx)(`input`,{value:p,onChange:e=>m(e.target.value)})]})]}),(0,S.jsx)(g,{label:`Default model`,value:_,onChange:v,groups:e,required:!0}),e.length===0&&(0,S.jsxs)(`p`,{className:`muted text-[0.85em]`,children:[`Enable a provider and curate its models under `,(0,S.jsx)(`a`,{href:`/config`,children:`Setup`}),` first.`]})]}),B&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:B.hint}),(0,S.jsxs)(`label`,{children:[B.label,(0,S.jsx)(`textarea`,{rows:B.rows,value:C[B.key],onChange:e=>T(t=>({...t,[B.key]:e.target.value})),className:`font-mono text-[0.88em] leading-[1.55]`})]})]}),l===`skills`&&(0,S.jsx)(b,{mode:O,onModeChange:k,picked:A,onPickedChange:j,skills:t}),(0,S.jsx)(`div`,{className:`mt-5`,children:(0,S.jsx)(a,{variant:`primary`,type:`submit`,disabled:P||!d.trim()||!_,children:P?`Creating…`:`Create`})})]})})}export{C as component};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";var t=e(),n={primary:`btn-primary`,ghost:`ghost-btn`,danger:`danger-btn`};function r({variant:e,type:r,className:i,...a}){let o=i?`${n[e]} ${i}`:n[e];return(0,t.jsx)(`button`,{type:r??`button`,className:o,...a})}var i=[`__Host-bz_csrf`,`bz_csrf_dev`];function a(e,t){let n=[];for(let r of e?.split(`;`)??[]){let e=r.indexOf(`=`);e>0&&r.slice(0,e).trim()===t&&n.push(r.slice(e+1).trim())}return n}function o(e,t){return a(e,t)[0]}var s=class extends Error{status;code;body;constructor(e,t,n,r){super(e),this.status=t,this.code=n,this.body=r}};function c(){for(let e of i){let t=o(document.cookie,e);if(t)return{"x-bazilion-csrf":t}}return{}}async function l(e){let t=await e.text().catch(()=>``),n={};try{let e=JSON.parse(t);e&&typeof e==`object`&&(n=e)}catch{}let r=typeof n.error==`string`?n.error:t.slice(0,300)||`HTTP ${e.status}`,i=typeof n.code==`string`?n.code:void 0;return new s(r,e.status,i,n)}async function u(e,t={}){let n=t.method??(t.body===void 0?`GET`:`POST`),r=n===`GET`?{}:c(),i;t.body instanceof FormData?i=t.body:t.body!==void 0&&(r[`content-type`]=`application/json`,i=JSON.stringify(t.body));let a=await fetch(e,{method:n,headers:r,body:i,signal:t.signal});if(!a.ok)throw await l(a);return a}async function d(e,t={}){let n=await(await u(e,t)).text();return n?JSON.parse(n):void 0}function f(e){return e instanceof Error?e.message:String(e)}export{r as a,f as i,d as n,u as r,s as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-Cgab8gqu.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{t as r}from"./link-ClwtaO_E.js";import{a as i,i as a,n as o}from"./api-CPzQ_z9m.js";import{at as s,ct as c,it as l,lt as u,nt as d,ot as f,rt as p,st as m,u as h}from"./index-CNVw44IE.js";var g=e(t()),_=n(),v=`/api/attention?state=all&limit=200`,y=`/api/attention/summary`,b={action_required:`warning`,error:`danger`,warning:`info`};function x(){let e=h.useLoaderData(),[t,n]=(0,g.useState)(e.list),[x,S]=(0,g.useState)(e.summary),[C,w]=(0,g.useState)(`open`),[T,E]=(0,g.useState)(`all`),[D,O]=(0,g.useState)(`all`),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=t.items.filter(e=>(C===`all`||(C===`open`?e.acknowledgedAt===null:e.acknowledgedAt!==null))&&(T===`all`||e.kind===T)&&(D===`all`||e.severity===D)),P=[...new Set([...t.degraded,...x.degraded].map(e=>e.kind))];async function F(){let[e,t]=await Promise.all([o(v),o(y)]);n(e),S(t)}async function I(e,t){A(e),M(null);try{M(await t())}catch(e){M(a(e))}finally{await F().catch(()=>{}),A(null)}}let L=(e,t)=>I(e.key,async()=>{let n=`/api/attention/${encodeURIComponent(e.key)}`;return await o(t?`${n}/acknowledge`:`${n}/acknowledgement`,{method:t?`POST`:`DELETE`}),null}),R=()=>I(`all`,async()=>{let{acknowledged:e}=await o(`/api/attention/acknowledge-all`,{method:`POST`});return`Acknowledged ${e} informational item(s). Lesson proposals and paused queues stay open.`});return(0,_.jsxs)(f,{size:`wide`,children:[(0,_.jsx)(s,{eyebrow:`Operations`,title:`Attention`,description:`Decisions waiting for you and failures worth a look. Act on an item at its source; acknowledge informational ones here.`,actions:(0,_.jsx)(i,{variant:`ghost`,disabled:k!==null,onClick:()=>void R(),children:`Acknowledge all informational items`})}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,_.jsx)(c,{label:`Open`,value:x.openTotal}),(0,_.jsx)(c,{label:`Action required`,value:x.bySeverity.action_required}),(0,_.jsx)(c,{label:`Errors and warnings`,value:x.bySeverity.error+x.bySeverity.warning})]}),P.length>0&&(0,_.jsxs)(`div`,{role:`alert`,className:`rounded-lg border border-danger/40 bg-danger/10 p-4 text-sm`,children:[(0,_.jsx)(`strong`,{children:`Partial results.`}),` `,P.join(`, `),` could not be loaded.`]}),j&&(0,_.jsx)(`p`,{role:`status`,className:`rounded-lg bg-muted px-4 py-3 text-sm`,children:j}),(0,_.jsx)(m,{title:`Queue`,description:`${N.length} matching item${N.length===1?``:`s`}`,actions:(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,_.jsxs)(`select`,{"aria-label":`Queue state`,value:C,onChange:e=>w(e.target.value),children:[(0,_.jsx)(`option`,{value:`open`,children:`Open`}),(0,_.jsx)(`option`,{value:`acknowledged`,children:`History`}),(0,_.jsx)(`option`,{value:`all`,children:`All`})]}),(0,_.jsxs)(`select`,{"aria-label":`Severity`,value:D,onChange:e=>O(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All severities`}),(0,_.jsx)(`option`,{value:`action_required`,children:`Action required`}),(0,_.jsx)(`option`,{value:`error`,children:`Errors`}),(0,_.jsx)(`option`,{value:`warning`,children:`Warnings`})]}),(0,_.jsxs)(`select`,{"aria-label":`Kind`,value:T,onChange:e=>E(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All kinds`}),(0,_.jsx)(`option`,{value:`lesson_proposal`,children:`Lessons`}),(0,_.jsx)(`option`,{value:`review_failure`,children:`Review failures`}),(0,_.jsx)(`option`,{value:`trigger_failure`,children:`Trigger failures`}),(0,_.jsx)(`option`,{value:`agent_loop_break`,children:`Loop breaks`}),(0,_.jsx)(`option`,{value:`queue_interrupted`,children:`Paused queues`})]})]}),children:N.length===0?(0,_.jsx)(d,{title:C===`open`?`Nothing needs attention`:`No matching history`,description:`Items come from learning reviews, triggers, follow-up queues and loop breaks.`}):(0,_.jsx)(p,{children:N.map(e=>(0,_.jsx)(l,{title:e.title,meta:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{variant:b[e.severity],children:e.severity.replace(`_`,` `)}),(0,_.jsx)(`span`,{children:e.kind.replaceAll(`_`,` `)}),(0,_.jsx)(`span`,{children:[e.agentName,e.teamName].filter(Boolean).join(` · `)||`System`}),(0,_.jsx)(`time`,{dateTime:new Date(e.occurredAt).toISOString(),children:new Date(e.occurredAt).toLocaleString()})]}),actions:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(r,{to:e.href,className:`btn-primary`,children:e.kind===`lesson_proposal`?`Review lesson`:`Inspect source`}),e.acknowledgeable&&(0,_.jsx)(i,{variant:`ghost`,disabled:k===e.key,onClick:()=>void L(e,e.acknowledgedAt===null),children:e.acknowledgedAt===null?`Acknowledge`:`Restore to open`})]}),children:(0,_.jsx)(`p`,{className:`mb-0 mt-1 text-sm text-muted-foreground`,children:e.diagnostic})},e.key))})})]})}export{x as component};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-Cgab8gqu.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
@@ -0,0 +1,3 @@
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r}from"./link-ClwtaO_E.js";import{a as i,i as a,n as o}from"./api-CPzQ_z9m.js";import{t as s}from"./createLucideIcon-Cgab8gqu.js";import{t as c}from"./chevron-right-B2YEg9rw.js";import{t as l}from"./ConfirmDialog-BblXqMVb.js";import{Q as u,Z as d,ct as f,d as p,lt as m,nt as h}from"./index-CNVw44IE.js";import{t as g}from"./ConfigPage-_FY--9PB.js";import{t as _}from"./FieldRow-k05wfDy9.js";var v=s(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),y=s(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),b=e(t()),x=n();function S(){return(0,x.jsxs)(`section`,{"aria-label":`Backup`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsx)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Backup`})}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 p-4 text-sm sm:px-5`,children:[(0,x.jsxs)(`p`,{className:`m-0 max-w-prose text-muted-foreground`,children:[`A tar.gz of the Bazilion home. It is not encrypted and holds every stored credential; for an encrypted copy run `,(0,x.jsx)(`code`,{children:`bazilion backup create --recipient <age1…>`}),`. Restore with `,(0,x.jsx)(`code`,{children:`bazilion backup restore`}),` while the daemon is stopped.`]}),(0,x.jsx)(`a`,{href:`/api/backup`,download:!0,className:`btn-primary no-underline`,children:`Download backup`})]})]})}function C({report:e}){return(0,x.jsxs)(`section`,{"aria-label":`Installation health`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsx)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Installation health`})}),(0,x.jsxs)(`dl`,{className:`p-4 sm:px-5`,children:[(0,x.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Installation health`}),(0,x.jsx)(`dd`,{className:`mt-1 font-semibold ${e.ok?`text-success`:`text-warning`}`,children:e.ok?`Healthy`:`Issues found`}),(0,x.jsx)(`dd`,{className:`mt-1 text-xs text-muted-foreground`,children:`Run bazilion doctor for the details.`})]})]})}function w({shell:e}){return(0,x.jsxs)(`section`,{"aria-label":`Agent runtime`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsxs)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:[(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Agent runtime`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Applies to every turn: chat, Telegram, schedules and inbox. Unattended turns auto-deny dangerous commands.`})]}),e.ok?(0,x.jsxs)(`dl`,{className:`divide-y divide-border px-4 text-sm sm:px-5`,children:[(0,x.jsx)(T,{label:`Sandbox`,value:e.sandboxMode===`docker`?`Docker (${e.sandboxImage}) — bash in a network-disabled container`:`Off — bash and file tools run on the host, unisolated`}),e.docker&&(0,x.jsx)(T,{label:`Docker`,value:e.docker.ready?`Ready`:`Unavailable — ${e.docker.reason}`,ok:e.docker.ready}),e.docker?.remediation&&(0,x.jsx)(T,{label:`Remediation`,value:e.docker.remediation}),(0,x.jsx)(T,{label:`Dangerous-command approval`,value:e.approvalMode===`dangerous`?`On — chat can allow once; unattended turns auto-deny`:`Off`})]}):(0,x.jsxs)(`p`,{role:`alert`,className:`px-4 py-3 text-sm text-warning sm:px-5`,children:[`Invalid shell-security configuration: `,e.error]})]})}function T({label:e,value:t,ok:n}){return(0,x.jsxs)(`div`,{className:`grid gap-1 py-3 sm:grid-cols-[14rem_1fr] sm:gap-4`,children:[(0,x.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,x.jsx)(`dd`,{className:n===void 0?`font-medium`:n?`text-success`:`text-warning`,children:t})]})}var E=new Set([`openai-codex`,`openai`,`anthropic`,`google`]),D=new Set([`ollama`,`lmstudio`,`llamacpp`]);function O(e){return e.enabled||e.curated.length>0||e.fields.some(e=>e.set)}function k(e,t){let n=t.trim().toLocaleLowerCase();return n?[e.id,e.displayName,e.hint??``,...e.fields.flatMap(e=>[e.label,e.envVar]),...e.curated,...e.catalog].some(e=>e.toLocaleLowerCase().includes(n)):!0}function A(e,t=``){let n=e.filter(e=>k(e,t)),r=n.filter(O),i=new Set(r.map(e=>e.id)),a=n.filter(e=>!i.has(e.id));return[{key:`configured`,title:`Configured`,description:`Providers you enabled, added models to, or saved credentials for.`,providers:r},{key:`recommended`,title:`Recommended starting points`,description:`The simplest hosted options for a first Bazilion conversation.`,providers:a.filter(e=>E.has(e.id))},{key:`local`,title:`Local models`,description:`Use a model server on the same machine without exposing the daemon.`,providers:a.filter(e=>D.has(e.id))},{key:`more`,title:`More providers`,description:`Specialist, regional, enterprise, and subscription endpoints.`,providers:a.filter(e=>!E.has(e.id)&&!D.has(e.id))}].filter(e=>e.providers.length>0)}function j(e){return e.enabled?e.curated.length===0?{label:`Needs a model`,tone:`warning`}:{label:`Enabled`,tone:`neutral`}:O(e)?{label:`Saved, disabled`,tone:`neutral`}:{label:`Not configured`,tone:`neutral`}}function M(){let{providers:e,openaiCodex:t,runtime:n,readiness:r}=p.useLoaderData(),a=e.some(e=>e.enabled&&e.curated.length>0),o=(0,b.useRef)(a),[s,l]=(0,b.useState)(!1),[m,_]=(0,b.useState)(``),T=(0,b.useMemo)(()=>A(e,m),[e,m]),E=e.filter(O).length,D=e.filter(e=>e.enabled).length;return(0,b.useEffect)(()=>{!o.current&&a&&l(!0)},[a]),(0,x.jsxs)(g,{title:`Providers`,description:(0,x.jsx)(x.Fragment,{children:`Connect the model services your agents may use. Credentials stay encrypted; advanced endpoint and environment names remain available inside each provider.`}),children:[(0,x.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,x.jsx)(f,{label:`Configured`,value:E,detail:`credentials, models, or toggle`}),(0,x.jsx)(f,{label:`Enabled`,value:D,detail:`available to agents`}),(0,x.jsx)(f,{label:`Selected models`,value:e.reduce((e,t)=>e+(t.enabled?t.curated.length:0),0),detail:`across enabled providers`})]}),(0,x.jsx)(C,{report:r}),(0,x.jsx)(S,{}),(0,x.jsx)(w,{shell:n}),!a&&(0,x.jsx)(N,{providers:e,openaiCodex:t}),s&&(0,x.jsx)(`section`,{role:`status`,className:`rounded-2xl border border-success/30 bg-success/10 p-5 text-sm`,children:(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(v,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`h2`,{className:`m-0 font-body text-base font-semibold text-foreground`,children:`Your default workspace is ready`}),(0,x.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Bazilion created the default Agent template and Team. Test the selected model below before relying on it, or continue to spawn your first agent.`}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,x.jsxs)(`a`,{href:`/agents`,className:`btn-primary no-underline`,children:[`Spawn your first agent`,(0,x.jsx)(c,{className:`size-4`,"aria-hidden":`true`})]}),(0,x.jsx)(i,{variant:`ghost`,onClick:()=>l(!1),children:`Keep configuring`})]})]})]})}),(0,x.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-4 shadow-baziu-sm sm:p-5`,children:[(0,x.jsx)(`label`,{htmlFor:`provider-search`,className:`m-0 text-sm font-semibold text-foreground`,children:`Find a provider`}),(0,x.jsxs)(`div`,{className:`relative mt-2`,children:[(0,x.jsx)(d,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,x.jsx)(`input`,{id:`provider-search`,type:`search`,value:m,onChange:e=>_(e.target.value),placeholder:`Search by service, model, or advanced key`,className:`pl-9`})]}),(0,x.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:`Start with one provider. Everything else stays collapsed until you need it.`})]}),T.length===0?(0,x.jsx)(h,{icon:(0,x.jsx)(d,{className:`size-4`,"aria-hidden":`true`}),title:`No providers match`,description:`Try another search instead of “${m}”.`,actions:(0,x.jsx)(i,{variant:`ghost`,onClick:()=>_(``),children:`Clear search`})}):(0,x.jsx)(`div`,{className:`space-y-4`,children:T.map(e=>(0,x.jsxs)(`details`,{open:!!m||e.key===`configured`||!a&&e.key===`recommended`,className:`group/providers overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-4 marker:hidden sm:px-5`,children:[(0,x.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent text-accent-foreground`,children:(0,x.jsx)(y,{className:`size-4`,"aria-hidden":`true`})}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block text-sm font-semibold text-foreground`,children:e.title}),(0,x.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:e.description})]}),(0,x.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground`,children:e.providers.length}),(0,x.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/providers:rotate-180`,"aria-hidden":`true`})]}),(0,x.jsx)(`div`,{className:`space-y-2 border-t border-border bg-muted/20 p-2 sm:p-3`,children:e.providers.map(e=>(0,x.jsx)(P,{p:e,initiallyOpen:e.enabled||!!m||!a&&e.id===`openai-codex`,openaiCodexStatus:e.id===`openai-codex`?t:void 0},e.id))})]},`${e.key}:${m}`))})]})}function N({providers:e,openaiCodex:t}){let n=[];for(let r of e)r.enabled&&(r.id===`openai-codex`&&!t.connected&&n.push(`${r.id}: enabled but ChatGPT is not connected — click "Connect ChatGPT" below`),r.curated.length===0&&n.push(`${r.id}: enabled but no curated models — add at least one name in the "curated models" box below and save`));let r=e.filter(e=>e.enabled).length;return(0,x.jsxs)(`div`,{role:`status`,className:`rounded-2xl border border-warning/30 bg-warning/10 p-5 text-sm`,children:[(0,x.jsx)(`div`,{className:`font-semibold text-foreground mb-1`,children:`Finish your first provider`}),(0,x.jsx)(`p`,{className:`text-muted-foreground mb-2`,children:`Enable one provider, save at least one exact model id, then send the small test request. Saving the model creates your default resources; a successful test confirms that the credential and model actually work.`}),n.length>0?(0,x.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-warning`,children:n.map(e=>(0,x.jsx)(`li`,{children:e},e))}):r===0?(0,x.jsx)(`p`,{className:`text-warning`,children:`No provider is enabled. Open a recommended option below and follow its steps.`}):null]})}function P({p:e,openaiCodexStatus:t,initiallyOpen:n}){let s=r(),[l,u]=(0,b.useState)(e.enabled),[d,f]=(0,b.useState)(n),[p,h]=(0,b.useState)(e.curated.join(`
2
+ `)),[g,v]=(0,b.useState)(!1),[y,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(null),[T,E]=(0,b.useState)(e.curated[0]??``),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(null),M=j({...e,enabled:l}),N=`/api/config/providers/${encodeURIComponent(e.id)}`;async function P(e){u(e),w(null);try{await o(`${N}/enabled`,{method:`PUT`,body:{enabled:e}}),e&&f(!0),await s.invalidate()}catch(t){u(!e),w(a(t))}}async function L(e){e.preventDefault(),v(!0),S(null);try{let e=p.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);S({kind:`success`,message:[`Models saved.`,...(await o(`${N}/models`,{method:`PUT`,body:{models:e}})).movedTemplates.map(e=>`Template ${e.name} now uses ${e.model}.`)].join(` `)}),E(e[0]??``),A(null),await s.invalidate()}catch(e){S({kind:`error`,message:a(e)})}finally{v(!1)}}async function R(){if(T){O(!0),A(null);try{await o(`/api/providers/test`,{body:{model:`${e.id}:${T}`,message:`Reply with exactly: Bazilion connection verified.`}}),A({kind:`success`,message:`Verified ${e.displayName} with ${T}.`}),await s.invalidate()}catch(e){A({kind:`error`,message:a(e)})}finally{O(!1)}}}return(0,x.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,x.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`unstyled flex min-w-0 flex-1 items-center gap-2 rounded-lg text-left`,"aria-expanded":d,"aria-controls":`provider-${e.id}`,onClick:()=>f(e=>!e),children:[(0,x.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground transition-transform ${d?`rotate-90`:``}`,"aria-hidden":`true`}),(0,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.displayName}),(0,x.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.id})]})]}),(0,x.jsx)(m,{variant:M.tone,children:M.label}),(0,x.jsxs)(`label`,{className:`m-0 flex cursor-pointer items-center gap-1.5 rounded-lg px-1 text-xs font-semibold`,children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>P(e.target.checked),className:`size-4`,"aria-label":`${l?`Disable`:`Enable`} ${e.displayName}`}),(0,x.jsx)(`span`,{className:l?`text-success`:`text-muted-foreground`,children:l?`enabled`:`disabled`})]}),(0,x.jsxs)(`span`,{className:`w-full pl-6 text-xs text-muted-foreground sm:w-auto sm:pl-0`,children:[e.curated.length>0&&(0,x.jsxs)(`span`,{children:[e.curated.length,` curated`]}),e.catalog.length>0&&(0,x.jsxs)(`span`,{children:[` · `,e.catalog.length,` catalog`]}),e.live&&!e.live.error&&(0,x.jsxs)(`span`,{children:[` · `,e.live.models.length,` live`]})]})]}),C&&(0,x.jsx)(`p`,{role:`alert`,className:`mx-4 mb-3 text-sm text-danger`,children:C}),d&&(0,x.jsxs)(`div`,{id:`provider-${e.id}`,className:`border-t border-dashed px-3 py-4 sm:px-4`,children:[e.hint&&(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.id===`openai-codex`&&t&&(0,x.jsx)(I,{status:t}),e.fields.map(e=>(0,x.jsx)(_,{field:e},e.envVar)),(0,x.jsx)(`h4`,{id:`provider-${e.id}-models-label`,className:`mt-4 mb-1 font-body text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Models available to agents`}),e.curated.length===0&&(0,x.jsxs)(`p`,{className:`mb-2 text-xs font-medium text-warning`,children:[`First-run setup needs at least one model name here — type one (e.g.`,` `,(0,x.jsx)(`code`,{className:`font-mono`,children:e.catalog[0]??e.live?.models[0]??`model-name`}),`) and click `,(0,x.jsx)(`em`,{children:`save models`}),`. Catalog chips below are the safest source when available.`]}),(0,x.jsxs)(`form`,{onSubmit:L,children:[(0,x.jsx)(`textarea`,{id:`provider-${e.id}-models`,"aria-labelledby":`provider-${e.id}-models-label`,value:p,onChange:e=>h(e.target.value),rows:Math.max(3,Math.min(8,p.split(`
3
+ `).length)),className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,placeholder:e.catalog.length===0&&!e.live?`Type model names one per line, e.g. qwen3-coder-30b`:`Click catalog chips below, or type names one per line`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mt-2`,children:[(0,x.jsx)(`button`,{type:`submit`,disabled:g,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:g?`Saving…`:`Save models`}),y&&(0,x.jsx)(`span`,{role:y.kind===`error`?`alert`:`status`,className:`text-xs ${y.kind===`error`?`text-danger`:`text-success`}`,children:y.message})]})]}),e.catalog.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`catalog`}),(0,x.jsx)(F,{items:e.catalog,onPick:e=>h(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live&&!e.live.error&&e.live.models.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`live`}),(0,x.jsx)(F,{items:e.live.models,onPick:e=>h(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live?.error&&(0,x.jsxs)(`p`,{role:`alert`,className:`text-xs text-danger mt-2`,children:[`Could not fetch live models: `,e.live.error]}),l&&e.curated.length>0&&(0,x.jsxs)(`div`,{className:`mt-4 rounded-xl border border-border bg-muted/30 p-3`,children:[(0,x.jsx)(`h4`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:`Test the connection`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Sends one short real request. Your provider may charge its normal token cost.`}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-end`,children:[(0,x.jsxs)(`label`,{className:`m-0 min-w-0 flex-1 text-xs font-semibold text-foreground`,children:[`Model`,(0,x.jsx)(`select`,{className:`mt-1`,value:T,onChange:e=>E(e.target.value),children:e.curated.map(e=>(0,x.jsx)(`option`,{value:e,children:e},e))})]}),(0,x.jsx)(i,{variant:`ghost`,disabled:D||!T,onClick:()=>void R(),children:D?`Testing…`:`Send test request`})]}),k&&(0,x.jsx)(`p`,{role:k.kind===`error`?`alert`:`status`,className:`mt-3 rounded-lg px-3 py-2 text-sm ${k.kind===`error`?`bg-danger/10 text-danger`:`bg-success/10 text-success`}`,children:k.message})]})]})]})}function F({items:e,onPick:t}){return(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1.5 max-h-40 overflow-y-auto rounded-md border bg-background p-1.5`,children:e.map(e=>(0,x.jsx)(`button`,{type:`button`,onClick:()=>t(e),"aria-label":`Add ${e} to selected models`,className:`rounded border bg-card px-2 py-0.5 font-mono text-xs hover:border-primary hover:bg-accent`,children:e},e))})}function I({status:e}){let t=r(),[n,s]=(0,b.useState)(!1),[c,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(!1),p=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>{p.current?.abort()},[]);async function m(){p.current?.abort();let e=new AbortController;p.current=e,s(!0),u(null);try{if(await o(`/api/auth/openai/login`,{method:`POST`,signal:e.signal}),e.signal.aborted)return;await t.invalidate()}catch(t){if(e.signal.aborted)return;u(a(t))}finally{p.current===e&&(p.current=null,e.signal.aborted||s(!1))}}async function h(){s(!0),u(null);try{await o(`/api/auth/openai`,{method:`DELETE`}),await t.invalidate()}catch(e){throw u(a(e)),e}finally{s(!1)}}return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 mb-3`,children:[e.connected?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2 items-center mb-2`,children:[(0,x.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-2 py-0.5 text-xs font-semibold uppercase`,children:`connected`}),e.accountId&&(0,x.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`account `,(0,x.jsx)(`code`,{className:`font-mono`,children:e.accountId})]}),e.expiresAt&&(0,x.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`token expires `,new Date(e.expiresAt).toISOString().replace(/\.\d+Z$/,`Z`)]})]}),(0,x.jsx)(i,{variant:`danger`,onClick:()=>f(!0),disabled:n,children:`Disconnect ChatGPT`})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:[`Sign in with your ChatGPT account — the OAuth flow opens a new browser tab. The loopback callback at `,(0,x.jsx)(`code`,{className:`font-mono`,children:`localhost:1455`}),` only works when you're using the web UI on the same machine as the daemon. For remote setups or callback trouble, run`,` `,(0,x.jsx)(`code`,{className:`font-mono`,children:`bazilion auth openai login --device-code`}),` on the client. From a source checkout, run`,` `,(0,x.jsx)(`code`,{className:`font-mono`,children:`pnpm tsx apps/cli/src/index.ts auth openai login --device-code`}),` `,`from the repository root.`]}),(0,x.jsx)(i,{variant:`primary`,onClick:m,disabled:n,children:n?`opening browser…`:`Connect ChatGPT →`})]}),c&&(0,x.jsx)(`p`,{role:`alert`,className:`text-sm text-danger mt-2`,children:c})]}),(0,x.jsx)(l,{open:d,onOpenChange:f,title:`Disconnect ChatGPT?`,description:(0,x.jsxs)(`p`,{children:[`This removes the saved OpenAI Codex OAuth credentials. Agents using an`,` `,(0,x.jsx)(`code`,{children:`openai-codex`}),` model will stop working until you connect again.`]}),confirmLabel:`Disconnect ChatGPT`,onConfirm:h})]})}export{M as component};
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./jsx-runtime-bzQ4Vb5N.js";var n=e(t(),1),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(0,n.createContext)({}),u=()=>(0,n.useContext)(l),d=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:a,className:o=``,children:l,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=u()??{},y=a??g?Number(i??h)*24/Number(t??m):i??h;return(0,n.createElement)(`svg`,{ref:p,...s,width:t??m??s.width,height:t??m??s.height,stroke:e??_,strokeWidth:y,className:r(`lucide`,v,o),...!l&&!c(f)&&{"aria-hidden":`true`},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])}),f=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(d,{ref:c,iconNode:t,className:r(`lucide-${i(o(e))}`,`lucide-${e}`,a),...s}));return a.displayName=o(e),a};export{f as t};