bazilion 0.52.0 → 0.54.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.
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +296 -232
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-CkwSq3C7.js +1 -0
- package/dist/web/client/assets/AgentTemplateParts-CEn_4qVs.js +1 -0
- package/dist/web/client/assets/Button-UiegBKOK.js +1 -0
- package/dist/web/client/assets/ConfigPage-CUbHBhzx.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-VqBOFZEp.js +1 -0
- package/dist/web/client/assets/ConnectionsView-ByARMcWP.js +1 -0
- package/dist/web/client/assets/ManagePage-BJWZd1ts.js +1 -0
- package/dist/web/client/assets/SectionTabs-ViZKm3-B.js +1 -0
- package/dist/web/client/assets/Segmented-MYKKTuZO.js +1 -0
- package/dist/web/client/assets/SkillsParts-UvNK5SYP.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-DG5UbJNK.js +1 -0
- package/dist/web/client/assets/TeamForm-DGlxWv4e.js +1 -0
- package/dist/web/client/assets/TeamThread-mkwODO0S.js +1 -0
- package/dist/web/client/assets/UnsavedChangesGuard-BmdwLH99.js +1 -0
- package/dist/web/client/assets/_id-CvcxNmBH.js +1 -0
- package/dist/web/client/assets/_id-UyBk7gRl.js +1 -0
- package/dist/web/client/assets/access-C8d8vaQ6.js +1 -0
- package/dist/web/client/assets/agent-actions-BgE9fKHH.js +1 -0
- package/dist/web/client/assets/agents-CgtzqBpD.js +1 -0
- package/dist/web/client/assets/agents-D7W4BT8r.js +1 -0
- package/dist/web/client/assets/arrow-right-D0HKRb7U.js +1 -0
- package/dist/web/client/assets/attention-D9mQWoKt.js +1 -0
- package/dist/web/client/assets/bot-Bb--PFVU.js +1 -0
- package/dist/web/client/assets/chevron-right-bs0TUSl2.js +1 -0
- package/dist/web/client/assets/config-Dw6GWf38.js +1 -0
- package/dist/web/client/assets/createLucideIcon-DkniuEtD.js +1 -0
- package/dist/web/client/assets/download-C4t9l5wR.js +1 -0
- package/dist/web/client/assets/file-text-DzbjpYrV.js +1 -0
- package/dist/web/client/assets/images-DSYgPKM7.js +1 -0
- package/dist/web/client/assets/index-YW0gXPfk.js +14 -0
- package/dist/web/client/assets/key-round-BpK4-E3T.js +1 -0
- package/dist/web/client/assets/list-checks-JNXcmws9.js +1 -0
- package/dist/web/client/assets/login-DcQJk5-U.js +1 -0
- package/dist/web/client/assets/manage-SRGSx8n2.js +1 -0
- package/dist/web/client/assets/mcp-BUWu4TvS.js +1 -0
- package/dist/web/client/assets/message-square-DM2MP9vF.js +1 -0
- package/dist/web/client/assets/network-BJ4iPjQO.js +1 -0
- package/dist/web/client/assets/parts-LZxl9Gvc.js +41 -0
- package/dist/web/client/assets/plus-CLGNN5QX.js +1 -0
- package/dist/web/client/assets/routes-BxIIyGho.js +85 -0
- package/dist/web/client/assets/skills-C7DzIwFJ.js +1 -0
- package/dist/web/client/assets/square-terminal-Dmm6cV-G.js +1 -0
- package/dist/web/client/assets/style-CA2GAk9b.js +7 -0
- package/dist/web/client/assets/styles-C3CDSGAr.css +2 -0
- package/dist/web/client/assets/system-zQ0NnQML.js +1 -0
- package/dist/web/client/assets/teams-BEIJHObN.js +1 -0
- package/dist/web/client/assets/teams-DlOc7Ods.js +1 -0
- package/dist/web/client/assets/telegram-DKHq5DpE.js +1 -0
- package/dist/web/client/assets/tools-BKIpLaiC.js +1 -0
- package/dist/web/client/assets/use-resource-CQaIZbpy.js +1 -0
- package/dist/web/client/assets/users-round-BJrym3FG.js +1 -0
- package/dist/web/client/assets/welcome-CyS4Hrd-.js +1 -0
- package/dist/web/client/assets/wrench-GbE1M1RJ.js +1 -0
- package/dist/web/server/assets/{AddProviderDialog-Tn4AskPm.js → AddProviderDialog-Nc5mc_P6.js} +106 -8
- package/dist/web/server/assets/AgentTemplateParts-DZK_r3nQ.js +266 -0
- package/dist/web/server/assets/{ConfigPage-DqDUujmt.js → ConfigPage-CxzL-gTm.js} +2 -2
- package/dist/web/server/assets/{ConfirmDialog-DfaJ--A6.js → ConfirmDialog-4xeCXKHe.js} +1 -2
- package/dist/web/server/assets/{ConnectionsView-DAG-zNBz.js → ConnectionsView-B02FjNsM.js} +9 -9
- package/dist/web/server/assets/ManagePage-BfCWE8Lj.js +29 -0
- package/dist/web/server/assets/ModelMenu-D-hTgYOO.js +278 -0
- package/dist/web/server/assets/{Rail-BIC_4ptO.js → Rail-3gbidhyv.js} +17 -110
- package/dist/web/server/assets/{SectionTabs-BGsrf-UQ.js → SectionTabs-CWQ5orUW.js} +9 -2
- package/dist/web/server/assets/SkillsParts-D58l8voo.js +199 -0
- package/dist/web/server/assets/SpawnDialog-MJWwppgC.js +1648 -0
- package/dist/web/server/assets/SpawnTeamModal-RjzAeX_Q.js +124 -0
- package/dist/web/server/assets/TeamForm-DdOgIMiV.js +138 -0
- package/dist/web/server/assets/{TeamThread-DuLlGDcw.js → TeamThread-D-PvO3fu.js} +9 -9
- package/dist/web/server/assets/{UnsavedChangesGuard-DrOvPV14.js → UnsavedChangesGuard-Bb5frygQ.js} +1 -1
- package/dist/web/server/assets/{_id-TVruGcOd.js → _id-BKzOw78O.js} +11 -3
- package/dist/web/server/assets/_id-BPjVkcNb.js +396 -0
- package/dist/web/server/assets/_id-BUfy-GwH.js +16 -0
- package/dist/web/server/assets/{_id-yN0z7VqE.js → _id-C1_l6oSR.js} +257 -207
- package/dist/web/server/assets/{_id-DJnYgisy.js → _id-CHvYQhWt.js} +8 -4
- package/dist/web/server/assets/_id-De3Bm0SG.js +39 -0
- package/dist/web/server/assets/_tanstack-start-manifest_v-CR3jm1nY.js +256 -0
- package/dist/web/server/assets/access-CNfvQ3NB.js +295 -0
- package/dist/web/server/assets/{access-GMGed5O8.js → access-Cm_izIIC.js} +2 -2
- package/dist/web/server/assets/{access-C_pupPks.js → access-WWspT0v4.js} +2 -1
- package/dist/web/server/assets/agent-actions-COnfW5AU.js +20 -0
- package/dist/web/server/assets/agents-C7UmTjfO.js +13 -0
- package/dist/web/server/assets/{agents-BnWgFo6o.js → agents-CRtMfKqX.js} +9 -6
- package/dist/web/server/assets/agents-D0hfGIMK.js +134 -0
- package/dist/web/server/assets/agents-DQowl6Ly.js +31 -0
- package/dist/web/server/assets/agents-DzpqlIuJ.js +12 -0
- package/dist/web/server/assets/agents-NOkh61dV.js +323 -0
- package/dist/web/server/assets/attention-CRvxt22X.js +232 -0
- package/dist/web/server/assets/{attention-Cr7puThv.js → attention-CgWhXjX7.js} +4 -1
- package/dist/web/server/assets/{attention-DS3O9UmJ.js → attention-Cx9ZWPOO.js} +4 -2
- package/dist/web/server/assets/{config-DjTGA4iZ.js → config-B5CS8juO.js} +2 -2
- package/dist/web/server/assets/{config-Q7livfa3.js → config-D117117T.js} +51 -102
- package/dist/web/server/assets/createSsrRpc-CwTd0zrB.js +72 -0
- package/dist/web/server/assets/{login-VV10kZBl.js → login-IF0Gbsuq.js} +36 -2
- package/dist/web/server/assets/{login-JoIjlcmu.js → login-va4EtvA8.js} +34 -45
- package/dist/web/server/assets/manage-Ce6cI4eW.js +240 -0
- package/dist/web/server/assets/{mcp-ZARSOxZW.js → mcp-Bm9U6x7N.js} +2 -2
- package/dist/web/server/assets/mcp-C96PBxpb.js +376 -0
- package/dist/web/server/assets/page-title-CwcbXMhx.js +95 -0
- package/dist/web/server/assets/{router-Dh2-IvLL.js → router-8Iq19GOz.js} +366 -203
- package/dist/web/server/assets/{routes-C9NawqcV.js → routes-BLo-fWbQ.js} +2681 -1667
- package/dist/web/server/assets/{routes-CDskMy5C.js → routes-BXvYYFrN.js} +2 -2
- package/dist/web/server/assets/routes-Kwam6JmS.js +89 -0
- package/dist/web/server/assets/{skills-StN15QhC.js → skills-BqCnA-74.js} +2 -2
- package/dist/web/server/assets/skills-DSezIdDc.js +157 -0
- package/dist/web/server/assets/{skills-h5aHa7Q8.js → skills-DWzlT_hC.js} +9 -1
- package/dist/web/server/assets/{style-GYDODk2F.js → style-C2hIPY_Y.js} +2 -2
- package/dist/web/server/assets/{system-Dl-1RhoP.js → system-CcLCmkIC.js} +2 -2
- package/dist/web/server/assets/{system-DtswhLW6.js → system-D3th6n2E.js} +4 -2
- package/dist/web/server/assets/system-E0VePdzO.js +145 -0
- package/dist/web/server/assets/{teams-BxnvFTyn.js → teams-70u1XQTr.js} +1 -3
- package/dist/web/server/assets/{teams-YrmyutM4.js → teams-BopOP4x7.js} +8 -1
- package/dist/web/server/assets/teams-CQVV18D3.js +216 -0
- package/dist/web/server/assets/teams-CdCmBJIj.js +174 -0
- package/dist/web/server/assets/{teams-5PMGvHuM.js → teams-DScFp8mK.js} +2 -2
- package/dist/web/server/assets/{teams-CbIPKf99.js → teams-DxA-vnzY.js} +4 -2
- package/dist/web/server/assets/telegram-DJ8s_91Y.js +1057 -0
- package/dist/web/server/assets/{telegram-Cv0D4gyz.js → telegram-DR7xijeS.js} +2 -2
- package/dist/web/server/assets/{tools-ioJcPzMW.js → tools-CsH9DI-4.js} +2 -2
- package/dist/web/server/assets/{tools-OfD22R-C.js → tools-V6kezUpL.js} +55 -218
- package/dist/web/server/assets/{use-resource-DVzK0toP.js → use-resource-CjcJwn7F.js} +1 -1
- package/dist/web/server/assets/{welcome-jxmpE_Jb.js → welcome-BpmcD-ia.js} +2 -2
- package/dist/web/server/assets/{welcome-FFEbrNT1.js → welcome-Ya8TkL4v.js} +10 -10
- package/dist/web/server/server.js +19 -19
- package/dist/worker.js +17 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/AddProviderDialog-BiGLKnu2.js +0 -1
- package/dist/web/client/assets/ConfigPage-DvBzy2MN.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-CiZ5tk9R.js +0 -1
- package/dist/web/client/assets/ConnectionsView-Czkpm2JY.js +0 -1
- package/dist/web/client/assets/Dialog-s_kPtI-W.js +0 -1
- package/dist/web/client/assets/ModelMenu-BfUPoRjV.js +0 -1
- package/dist/web/client/assets/SectionTabs-DENNb6Nw.js +0 -1
- package/dist/web/client/assets/Segmented-Dh77vmpp.js +0 -1
- package/dist/web/client/assets/SkillFindings-Xng11qqx.js +0 -1
- package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +0 -1
- package/dist/web/client/assets/SpawnDialog-CKWFQ6jk.js +0 -1
- package/dist/web/client/assets/Tabs-f6bHvCGn.js +0 -1
- package/dist/web/client/assets/TeamForm-kda1HYZG.js +0 -1
- package/dist/web/client/assets/TeamThread-2rm1JGSk.js +0 -1
- package/dist/web/client/assets/UnsavedChangesGuard-nx6dv2Yw.js +0 -1
- package/dist/web/client/assets/_id-B72mIpcE.js +0 -1
- package/dist/web/client/assets/_id-Bzavnza1.js +0 -1
- package/dist/web/client/assets/access-Yw9jODuk.js +0 -1
- package/dist/web/client/assets/agents-C9xoyL7o.js +0 -1
- package/dist/web/client/assets/agents-TviG16wx.js +0 -1
- package/dist/web/client/assets/api-HC_YzjBy.js +0 -1
- package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +0 -1
- package/dist/web/client/assets/attention-DmURtlJm.js +0 -1
- package/dist/web/client/assets/check-BjgKoGvU.js +0 -1
- package/dist/web/client/assets/chevron-right-CUZiA2aG.js +0 -1
- package/dist/web/client/assets/config-UZz_mjO5.js +0 -1
- package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +0 -1
- package/dist/web/client/assets/dist-BWppw70N.js +0 -41
- package/dist/web/client/assets/dist-D2dwY7MR.js +0 -1
- package/dist/web/client/assets/entities-xVoB-p2j.js +0 -1
- package/dist/web/client/assets/index-Df1oUtAP.js +0 -14
- package/dist/web/client/assets/link-Cbztlp_R.js +0 -1
- package/dist/web/client/assets/login-CPfdaqsV.js +0 -1
- package/dist/web/client/assets/mcp-FlYnNon0.js +0 -1
- package/dist/web/client/assets/model-facts-DoB6QD5y.js +0 -1
- package/dist/web/client/assets/parts-tIDBNsYA.js +0 -1
- package/dist/web/client/assets/plus-CWrKMtvA.js +0 -1
- package/dist/web/client/assets/routes-BZaWCoQj.js +0 -76
- package/dist/web/client/assets/save-f9O-CQia.js +0 -1
- package/dist/web/client/assets/skills-C7yDPC8s.js +0 -1
- package/dist/web/client/assets/style-DDuTFJUu.js +0 -7
- package/dist/web/client/assets/styles-BviXU81u.css +0 -2
- package/dist/web/client/assets/system-CL3Kz36L.js +0 -1
- package/dist/web/client/assets/teams-CQTEF5gV.js +0 -1
- package/dist/web/client/assets/teams-DQ7SqVyF.js +0 -1
- package/dist/web/client/assets/telegram-BLgxtGhZ.js +0 -1
- package/dist/web/client/assets/tools-pOQyGVYo.js +0 -1
- package/dist/web/client/assets/use-resource-C3MBZJop.js +0 -1
- package/dist/web/client/assets/welcome-Hr6JpMef.js +0 -1
- package/dist/web/client/assets/wrench-6BEIqKDn.js +0 -1
- package/dist/web/server/assets/Dialog-aup_yJv5.js +0 -85
- package/dist/web/server/assets/ModelMenu-DUY9aHkE.js +0 -138
- package/dist/web/server/assets/SkillFindings-BdATze1A.js +0 -46
- package/dist/web/server/assets/SkillsPicker-DlqEfRWh.js +0 -67
- package/dist/web/server/assets/SpawnDialog-D_SMPCG_.js +0 -132
- package/dist/web/server/assets/Tabs-BhF41MfQ.js +0 -20
- package/dist/web/server/assets/TeamForm-ilBaeLI4.js +0 -96
- package/dist/web/server/assets/_id-BsZcsabI.js +0 -383
- package/dist/web/server/assets/_id-D8Kj0F30.js +0 -18
- package/dist/web/server/assets/_id-QYifTM9w.js +0 -28
- package/dist/web/server/assets/_tanstack-start-manifest_v-D6zrzUC7.js +0 -223
- package/dist/web/server/assets/access-DKOpcHIJ.js +0 -232
- package/dist/web/server/assets/agents-B6OR3x99.js +0 -327
- package/dist/web/server/assets/agents-B7642eRO.js +0 -130
- package/dist/web/server/assets/agents-BJ-_oC2e.js +0 -14
- package/dist/web/server/assets/agents-CjV0w-Zy.js +0 -12
- package/dist/web/server/assets/agents-Dy_Q-9lG.js +0 -27
- package/dist/web/server/assets/attention-CLP4HYBz.js +0 -216
- package/dist/web/server/assets/createSsrRpc-GCCF14VW.js +0 -169
- package/dist/web/server/assets/entities-Dn2xzKIw.js +0 -16
- package/dist/web/server/assets/mcp-BI-FD-JI.js +0 -250
- package/dist/web/server/assets/model-facts-mrfrWQne.js +0 -136
- package/dist/web/server/assets/parts-B31PJkhi.js +0 -190
- package/dist/web/server/assets/routes-BJIJWCIE.js +0 -16
- package/dist/web/server/assets/skills-BqLq3ZXq.js +0 -275
- package/dist/web/server/assets/system-BtRA2HUs.js +0 -138
- package/dist/web/server/assets/teams-COaU0wN9.js +0 -108
- package/dist/web/server/assets/teams-Ca8W4mvl.js +0 -88
- package/dist/web/server/assets/telegram-Yx8nm6Ei.js +0 -984
- package/dist/web/server/assets/utils-C_uf36nf.js +0 -8
- package/dist/web/server/assets/workspace-DaitCM0t.js +0 -651
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,r as i}from"./createLucideIcon-DkniuEtD.js";import{t as a}from"./Button-UiegBKOK.js";import{d as o,nt as s,ot as c,rt as l,st as u,v as d,x as f}from"./parts-LZxl9Gvc.js";import{n as p,t as m}from"./images-DSYgPKM7.js";import{t as ee}from"./chevron-right-bs0TUSl2.js";import{B as h,F as g,G as _,H as v,L as te,R as ne,V as y,W as b,z as re}from"./index-YW0gXPfk.js";import{r as ie}from"./use-resource-CQaIZbpy.js";var x=e(t(),1),S=r();function C({name:e,tone:t=`neutral`,className:n}){return(0,S.jsx)(`span`,{"aria-hidden":`true`,className:u(`flex size-9 shrink-0 items-center justify-center rounded-xl text-base font-bold`,t===`success`&&`bg-success/10 text-success`,t===`warning`&&`bg-warning/10 text-warning`,t===`accent`&&`bg-accent text-accent-foreground`,t===`neutral`&&`bg-muted text-muted-foreground`,n),children:e.replace(/[^\p{L}\p{N}]/gu,``).slice(0,1)||`?`})}function w({provider:e,now:t}){let n=v(e,t);return(0,S.jsx)(o,{tone:n.tone,children:n.label})}function ae({failure:e,children:t}){return(0,S.jsxs)(`div`,{role:`alert`,className:`rounded-2xl border border-warning/35 bg-warning/10 p-4 text-sm`,children:[(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-warning`,"aria-hidden":`true`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-semibold text-foreground`,children:e.title}),(0,S.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:e.hint}),e.detail&&(0,S.jsxs)(`details`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,S.jsx)(`summary`,{className:`cursor-pointer font-semibold`,children:`Details`}),(0,S.jsx)(`div`,{className:`mt-1 break-words font-mono`,children:e.detail})]})]})]}),t&&(0,S.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:t})]})}function T({model:e,connect:t,checked:n,disabled:r,onToggle:i,className:a}){return(0,S.jsxs)(`label`,{className:u(`m-0 grid cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-0.5 border-b border-border py-2.5 sm:grid-cols-[auto_minmax(0,1.5fr)_minmax(0,1.2fr)_9.5rem]`,a),children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:n,disabled:r,onChange:i,className:`m-0 size-[18px]`}),(0,S.jsxs)(`span`,{className:`min-w-0`,children:[(0,S.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:h(e)}),e.suggested&&(0,S.jsx)(`span`,{className:`ml-2 rounded-full bg-accent px-2 py-0.5 text-xs font-semibold text-accent-foreground`,children:`Suggested`}),e.name&&(0,S.jsx)(`span`,{className:`block break-all font-mono text-xs text-muted-foreground`,children:e.id})]}),(0,S.jsx)(`span`,{className:`col-start-2 text-xs text-muted-foreground sm:col-start-auto`,children:te(e,t)}),(0,S.jsx)(`span`,{className:`col-start-2 text-xs text-foreground sm:col-start-auto sm:text-right`,children:y(e,t)})]})}var oe=60;function E(e){let t={};for(let n of e.fields)t[n.envVar]=n.kind===`config`?n.value??``:``;let n=e.fields.find(e=>e.kind===`config`&&!e.advanced);return e.connect===`local`&&n&&!n.set&&(t[n.envVar]=e.address??``),t}function se(e,t){let n={};for(let r of e.fields){let i=(t[r.envVar]??``).trim();if(r.kind===`secret`)i&&(n[r.envVar]=i);else if(i!==(r.value??``)){if(!r.set&&e.connect===`local`&&i===e.address)continue;n[r.envVar]=i}}return n}function D({provider:e,imageRoutes:t=[],onConnected:r}){let[o,c]=(0,x.useState)(()=>E(e)),[l,u]=(0,x.useState)(()=>O(e,E(e))),[p,_]=(0,x.useState)(null),[v,te]=(0,x.useState)([]),[y,b]=(0,x.useState)(``),[C,w]=(0,x.useState)(null),[D,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)(``),[M,N]=(0,x.useState)(`idle`),[P,le]=(0,x.useState)(e.configured),[F,ue]=(0,x.useState)(null),[I,L]=(0,x.useState)(null),R=(0,x.useRef)(null);(0,x.useEffect)(()=>()=>R.current?.abort(),[]);let z=(0,x.useRef)(null);(0,x.useEffect)(()=>{(F||I)&&z.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[F,I]);let B=ie(t=>i(`/api/config/providers/${encodeURIComponent(e.id)}/catalog`,{body:{fields:l},signal:t}),[e.id,JSON.stringify(l)]),V=(0,x.useMemo)(()=>{let t=t=>{let n=e.suggested.indexOf(t.id);return n===-1?e.suggested.length:n},n=[...B.data?.models??[]].sort((e,n)=>t(e)-t(n)),r=new Set(n.map(e=>e.id));return[...n,...v.filter(e=>!r.has(e)).map(e=>({id:e,selected:!1,suggested:!1}))]},[B.data,v,e.suggested]);(0,x.useEffect)(()=>{let e=B.data?.models;e&&(_(t=>t&&[...t].some(t=>e.some(e=>e.id===t))?t:new Set(ne(e))),w(t=>t??(e.length<=6||ne(e).length===0)))},[B.data]);let H=p??new Set,U=V.filter(e=>H.has(e.id)),W=g(U),G=M!==`idle`,K=e.connect===`local`,q=e.connect===`signin`,J=e.fields.filter(e=>!e.advanced),Y=e.fields.filter(e=>e.advanced),de=q||e.configured||J.every(e=>e.set||(o[e.envVar]??``).trim().length>0),fe=V.filter(e=>e.suggested||e.selected||H.has(e.id)),X=C===!0,Z=X?V.filter(e=>A?re(e,A):!e.dated||H.has(e.id)):fe,Q=Z.slice(0,oe);function pe(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function me(){let e=y.trim();e&&(te(t=>t.includes(e)?t:[...t,e]),_(t=>new Set(t).add(e)),b(``))}async function he(t){R.current?.abort();let a=new AbortController;R.current=a,ue(null),L(null);try{q&&!P&&(N(`signin`),await i(`/api/auth/openai/login`,{method:`POST`,signal:a.signal}),le(!0)),N(`connecting`);let n={fields:se(e,o),models:U.map(e=>e.id),...t&&U.length>0?{}:{test:!1}},s=await i(`/api/config/providers/${encodeURIComponent(e.id)}/connect`,{body:n,signal:a.signal});if(a.signal.aborted)return;s.connected?await r(s):ue(s.failure)}catch(e){a.signal.aborted||L(n(e))}finally{R.current===a&&N(`idle`)}}let $=`No chat model is ticked, so nothing is tested.`;if(U.length>0){let e=W?h(W):`a model`,t=W?.price?`cheapest`:`first`,n=U.length>1?`${e}, the ${t} one ticked`:e;$=q&&!P?`After the sign-in, one short message goes to ${n}.`:`The test sends one short message to ${n}.`,W?.price&&!q&&($+=` It costs a fraction of a cent.`)}return(0,S.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),he(!0)},className:`grid gap-4`,children:[e.hint&&(0,S.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:e.hint}),q&&(0,S.jsx)(`p`,{className:`m-0 rounded-xl border border-border bg-muted/40 p-3 text-sm text-muted-foreground`,children:P?`You are signed in with ChatGPT. Bazilion renews the sign-in by itself.`:`A browser tab opens on the machine Bazilion runs on, and you sign in with your ChatGPT account there. On another machine, run bazilion auth openai login --device-code on it instead.`}),J.map((t,n)=>(0,S.jsx)(ce,{field:t,value:o[t.envVar]??``,disabled:G,autoFocus:n===0&&!K,onChange:e=>c(n=>({...n,[t.envVar]:e})),onCommit:K?()=>u(O(e,o)):void 0},t.envVar)),Y.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`button`,{type:`button`,"aria-expanded":D,onClick:()=>k(e=>!e),className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[(0,S.jsx)(ee,{className:`size-4 text-muted-foreground transition-transform ${D?`rotate-90`:``}`,"aria-hidden":`true`}),`More settings`]}),D&&(0,S.jsx)(`div`,{className:`mt-2 grid gap-3 rounded-xl border border-border bg-muted/40 p-3`,children:Y.map(e=>(0,S.jsx)(ce,{field:e,value:o[e.envVar]??``,disabled:G,onChange:t=>c(n=>({...n,[e.envVar]:t}))},e.envVar))})]}),(0,S.jsxs)(`fieldset`,{className:`m-0 min-w-0 border-0 p-0`,children:[(0,S.jsxs)(`legend`,{className:`mb-2 flex w-full flex-wrap items-baseline gap-x-2 p-0`,children:[(0,S.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:`Models your Agents can use`}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:K?`What the server reports. You can change this later.`:`${V.length} available. You can change this later.`})]}),K&&B.data?.listError&&(0,S.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3 rounded-xl border border-warning/35 bg-warning/10 px-3 py-2 text-sm`,children:[(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Nothing answers at `,o[J[0]?.envVar??``]||`that address`,`. Start`,` `,e.displayName,` and switch its server on.`]}),(0,S.jsx)(a,{variant:`ghost`,disabled:B.loading,onClick:()=>{u(O(e,o)),B.reload()},children:B.loading?`Looking…`:`Look again`})]}),X&&V.length>8&&(0,S.jsx)(d,{label:`Search ${e.displayName} models`,placeholder:`Search by name`,value:A,onChange:j,className:`mb-2`}),X&&V.length>8&&U.length>0&&(0,S.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,S.jsx)(`span`,{className:`text-muted-foreground`,children:`Ticked:`}),U.map(e=>(0,S.jsxs)(`button`,{type:`button`,disabled:G,onClick:()=>pe(e.id),"aria-label":`Untick ${h(e)}`,className:`inline-flex items-center gap-1 rounded-full bg-accent px-2.5 py-1 font-semibold text-accent-foreground`,children:[h(e),(0,S.jsx)(s,{className:`size-3`,"aria-hidden":`true`})]},e.id))]}),(0,S.jsxs)(`div`,{className:`max-h-72 overflow-y-auto rounded-xl border border-border`,children:[B.loading&&!B.data&&(0,S.jsx)(`div`,{className:`p-3 text-sm text-muted-foreground`,children:`Reading the model list…`}),B.error&&(0,S.jsx)(`div`,{className:`p-3 text-sm text-danger`,children:B.error}),B.data&&Q.length===0&&(0,S.jsx)(`div`,{className:`p-3 text-sm text-muted-foreground`,children:A?`No model matches.`:K?`The server lists no model yet.`:`No models are listed for this provider. Add one by its id below.`}),Q.map(t=>(0,S.jsx)(T,{model:t,connect:e.connect,checked:H.has(t.id),disabled:G,onToggle:()=>pe(t.id),className:`px-3 last:border-b-0`},t.id)),Z.length>Q.length&&(0,S.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[Z.length-Q.length,` more: search to narrow them down.`]})]}),(0,S.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-2`,children:[!X&&V.length>fe.length&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>w(!0),className:`text-sm font-semibold text-primary`,children:[`See all `,V.length]}),X&&!K&&(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-1 basis-64 items-center gap-2`,children:[(0,S.jsx)(`input`,{type:`text`,"aria-label":`A model id that is not listed`,placeholder:`A model id that is not listed`,value:y,disabled:G,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),me())},className:`min-h-10 font-mono text-sm`}),(0,S.jsx)(a,{variant:`ghost`,disabled:G||!y.trim(),onClick:me,children:`Add`})]})]})]}),t.length>0&&(0,S.jsxs)(`p`,{className:`m-0 flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,S.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-accent-foreground`,"aria-hidden":`true`}),(0,S.jsxs)(`span`,{children:[q?`The same sign-in`:`The same key`,` makes`,` `,[...new Set(t.map(e=>e.model))].join(` and `),` available under Images.`]})]}),(0,S.jsxs)(`div`,{ref:z,className:`grid gap-3 empty:hidden`,children:[F&&(0,S.jsx)(ae,{failure:F}),I&&(0,S.jsx)(`p`,{role:`alert`,className:`m-0 rounded-xl bg-danger/10 px-3 py-2 text-sm text-danger`,children:I})]}),G?(0,S.jsx)(f,{children:M===`signin`?`Waiting for the ChatGPT sign-in in the browser…`:W?`Asking ${h(W)} for a short reply…`:`Saving…`}):(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,S.jsx)(a,{variant:`primary`,type:`submit`,disabled:!de||K&&U.length===0,children:q&&!P?`Sign in with ChatGPT`:U.length===0?`Connect`:`Connect and test`}),U.length>0&&!(q&&!P)&&(0,S.jsx)(`button`,{type:`button`,disabled:!de,onClick:()=>void he(!1),className:`text-sm font-semibold text-primary disabled:opacity-50`,children:`Save without testing`})]}),(0,S.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:$})]})]})}function O(e,t){if(e.connect!==`local`)return{};let n=se(e,t);return Object.fromEntries(Object.entries(n).filter(([t])=>e.fields.some(e=>e.envVar===t&&e.kind===`config`)))}function ce({field:e,value:t,disabled:n,autoFocus:r=!1,onChange:i,onCommit:a}){let o=e.kind===`secret`;return(0,S.jsxs)(`label`,{className:`m-0 text-sm font-semibold text-foreground`,children:[e.label,(0,S.jsx)(`input`,{type:o?`password`:`text`,value:t,disabled:n,autoFocus:r,autoComplete:`off`,spellCheck:!1,placeholder:o&&e.set?`Saved. Paste another to replace it.`:e.placeholder??``,onChange:e=>i(e.target.value),onBlur:a,onKeyDown:e=>{e.key===`Enter`&&a&&(e.preventDefault(),a())},className:`mt-1.5 font-mono font-normal`}),(e.description||o)&&(0,S.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:e.description??`Stored encrypted on the machine Bazilion runs on. It is never shown again.`})]})}function k(e){try{return new URL(e).host}catch{return e}}function A(e,t){if(!e)return t?`Looking…`:`A model server on this computer`;if(!e.found)return`Nothing at ${k(e.address)}`;let n=e.models.length;return`Running at ${k(e.address)}, ${n===1?`1 model`:`${n} models`}`}function j(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.id,e.hint??``].some(e=>e.toLowerCase().includes(n)):!0}function M({providers:e,expanded:t=!1,onPick:n}){let[r,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(t),l=ie(e=>i(`/api/config/providers/local`,{signal:e}),[]),u=(0,x.useMemo)(()=>Date.now(),[]),f=e.filter(e=>j(e,r)),p=e=>f.filter(t=>t.group===e),m=p(`more`),h=r.trim().length>0,g=e=>{let t=l.data?.servers.find(t=>t.id===e.id),r=e.group===`local`&&t?.found,i=e.listed?v(e,u).label:e.group===`local`?A(t,l.loading):e.hint??e.id;return(0,S.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`flex min-h-16 min-w-0 items-center gap-3 rounded-2xl border border-border bg-card px-3.5 py-2.5 text-left transition-colors hover:border-primary/40 hover:bg-accent/40`,children:[(0,S.jsx)(C,{name:e.displayName,tone:e.listed||r?`success`:`neutral`}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.displayName}),(0,S.jsx)(`span`,{className:`line-clamp-2 text-xs leading-snug ${e.listed||r?`text-success`:`text-muted-foreground`}`,children:i})]}),e.listed?(0,S.jsx)(c,{className:`size-4 shrink-0 text-success`,"aria-hidden":`true`}):(0,S.jsx)(ee,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]},e.id)},_=(e,t)=>t.length>0&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`m-0 mb-2 font-body text-xs font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:e}),(0,S.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:t.map(g)})]});return(0,S.jsxs)(`div`,{className:`grid gap-4`,children:[(0,S.jsx)(d,{label:`Search providers`,placeholder:`Search ${e.length} providers`,value:r,onChange:a}),_(`Most used`,p(`popular`)),_(`On this computer`,p(`local`)),(h||o)&&_(`More`,m),f.length===0&&(0,S.jsxs)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:[`No provider matches “`,r,`”.`]}),!h&&!o&&m.length>0&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`justify-self-start text-sm font-semibold text-primary`,children:[`Show `,m.length,` more:`,` `,m.slice(0,4).map(e=>e.displayName).join(`, `),`…`]})]})}function N({result:e,imageRoutes:t}){let{provider:n,check:r,dropped:i,movedTemplates:a}=e,o=n.models.length,s=[...new Set(t.map(e=>e.model))];return(0,S.jsxs)(`div`,{role:`status`,className:`flex items-start gap-4`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-11 shrink-0 items-center justify-center rounded-full ${r?`bg-success/10 text-success`:`bg-muted text-muted-foreground`}`,children:(0,S.jsx)(c,{className:`size-6`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm`,children:[(0,S.jsx)(`div`,{className:`text-base font-semibold text-foreground`,children:r?`${n.displayName} is connected`:`${n.displayName} is saved, not tested`}),(0,S.jsxs)(`ul`,{className:`m-0 mt-1 list-none space-y-0.5 p-0 text-muted-foreground`,children:[r&&(0,S.jsxs)(`li`,{children:[r.modelName??r.model,` answered in `,((r.ms??0)/1e3).toFixed(1),` s.`]}),(0,S.jsxs)(`li`,{children:[o===0?`No chat model is in use from it.`:o===1?`1 model is in Chat.`:`${o} models are in Chat.`,!r&&o>0&&` Test it from its row before you rely on it.`]}),i.map(e=>(0,S.jsxs)(`li`,{className:`text-warning`,children:[e.model,` was left out: this account cannot use it.`]},e.model)),s.length>0&&(0,S.jsxs)(`li`,{children:[s.join(` and `),` can now be chosen under Images.`]}),a.map(e=>(0,S.jsxs)(`li`,{children:[`The `,e.name,` template now uses `,e.model,`.`]},e.id))]})]})]})}function P({providers:e,imageRoutes:t,start:n,onClose:r,onConnected:i,onOpenProvider:o}){let[s,c]=(0,x.useState)(n&&e.some(e=>e.id===n)?n:null),[l,u]=(0,x.useState)(null),d=e.find(e=>e.id===s)??null,f=e=>t.filter(t=>t.provider===e);return l?(0,S.jsxs)(b,{title:l.provider.displayName,onClose:r,className:`max-w-xl`,children:[(0,S.jsx)(N,{result:l,imageRoutes:f(l.provider.id)}),(0,S.jsx)(_,{children:(0,S.jsx)(a,{variant:`primary`,onClick:r,children:`Done`})})]}):d?(0,S.jsxs)(b,{title:`Connect ${d.displayName}`,onClose:r,className:`top-[6dvh] max-h-[88dvh] max-w-2xl translate-y-0 content-start`,children:[!n&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>c(null),className:`-mt-1 flex items-center gap-1 justify-self-start text-sm font-semibold text-primary`,children:[(0,S.jsx)(p,{className:`size-4`,"aria-hidden":`true`}),`All providers`]}),(0,S.jsx)(D,{provider:d,imageRoutes:f(d.id).filter(e=>!e.ready),onConnected:async e=>{await i(),u(e)}},d.id)]}):(0,S.jsx)(b,{title:`Add a provider`,onClose:r,className:`top-[6dvh] max-h-[88dvh] max-w-2xl translate-y-0 content-start`,children:(0,S.jsx)(M,{providers:e,onPick:e=>e.listed?o(e.id):c(e.id)})})}export{D as a,C as c,k as i,w as l,N as n,ae as o,M as r,T as s,P as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,r as i,s as a}from"./createLucideIcon-DkniuEtD.js";import{t as o}from"./Button-UiegBKOK.js";import{g as s}from"./parts-LZxl9Gvc.js";import{A as c,G as l,N as u,W as d,b as f,x as p}from"./index-YW0gXPfk.js";import{S as m,x as h}from"./manage-SRGSx8n2.js";var g=e(t(),1),_=r(),v=[{key:`soul`,name:`SOUL.md`,hint:`Persona, values and operating principles. Part of every session.`,optional:!1},{key:`identity`,name:`IDENTITY.md`,hint:`Name, creature, vibe, emoji and avatar: filled in during the first conversation.`,optional:!1},{key:`bootstrap`,name:`BOOTSTRAP.md`,hint:`The first-run ritual in which the Agent introduces itself; it retires the file once done.`,optional:!0},{key:`agents`,name:`AGENTS.md`,hint:`How the Agent works in its workspace: memory, red lines, who it hands work to.`,optional:!0},{key:`tools`,name:`TOOLS.md`,hint:`Notes on its tools and environment beyond the tool descriptions.`,optional:!0}],y=[{value:`all`,label:`All skills`,hint:`Every installed skill, including ones imported later.`},{value:`selected`,label:`Chosen skills`,hint:`Only the ones ticked below.`}];function b({mode:e,picked:t,skills:n,disabled:r,onModeChange:i,onPickedChange:a}){return(0,_.jsxs)(`div`,{className:`grid gap-3`,children:[(0,_.jsx)(p,{legend:`Skills at spawn`,name:`template-skills`,value:e,options:y,disabled:r,onChange:i}),e===`selected`&&(n.length===0?(0,_.jsxs)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:[`No skills are installed yet. Import some under `,(0,_.jsx)(`a`,{href:`/skills`,children:`Skills`}),`.`]}):(0,_.jsxs)(`fieldset`,{className:`m-0 grid max-h-64 min-w-0 gap-2.5 overflow-y-auto rounded-xl border border-border bg-muted/30 p-3.5`,children:[(0,_.jsx)(`legend`,{className:`sr-only`,children:`Chosen skills`}),n.map(e=>(0,_.jsx)(f,{checked:t.has(e.name),disabled:r,label:(0,_.jsxs)(`span`,{className:`min-w-0`,children:[(0,_.jsx)(`span`,{className:`font-mono text-[0.9em] font-semibold`,children:e.name}),e.description&&(0,_.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.description]})]}),onChange:n=>{let r=new Set(t);n?r.add(e.name):r.delete(e.name),a(r)}},e.name))]})),(0,_.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:`Each Agent can still attach or detach skills after it is spawned.`})]})}function x({chat:e,skills:t,starter:r,onClose:p}){let y=a(),[x,S]=(0,g.useState)(``),[C,w]=(0,g.useState)(``),[T,E]=(0,g.useState)(!1),[D,O]=(0,g.useState)(``),[k,A]=(0,g.useState)(`all`),[j,M]=(0,g.useState)(new Set),[N,P]=(0,g.useState)({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),[F,I]=(0,g.useState)(!1),[L,R]=(0,g.useState)(null),z=T?C:m(x),B=h(z),V=z!==``&&!B&&D!==``;async function H(e){if(e.preventDefault(),!(!V||F)){I(!0),R(null);try{await i(`/api/profiles`,{body:{id:z,name:x.trim()||void 0,defaultModel:D,skillsMode:k,defaultSkills:k===`selected`?[...j]:[],soul:r.soul,identity:r.identity,bootstrap:N.bootstrap?r.bootstrap:null,agents:N.agents?r.agents:null,tools:N.tools?r.tools:null}}),await y({to:`/templates/agents/$id`,params:{id:z}})}catch(e){R(n(e)),I(!1)}}}return(0,_.jsx)(d,{title:`New Agent template`,description:`It starts from the built-in files, which you can edit next. Agents spawned from it get their own copies.`,busy:F,onClose:p,className:`max-w-xl`,children:(0,_.jsxs)(`form`,{onSubmit:e=>void H(e),className:`grid gap-4`,children:[(0,_.jsxs)(`div`,{className:`grid items-start gap-x-3 gap-y-4 sm:grid-cols-2`,children:[(0,_.jsx)(c,{label:`Name`,value:x,disabled:F,placeholder:`Writer`,className:`max-w-none`,onChange:S}),(0,_.jsx)(c,{label:`ID`,value:z,disabled:F,placeholder:`writer`,mono:!0,className:`max-w-none`,problem:B,onChange:e=>{E(!0),w(e)}})]}),(0,_.jsx)(u,{kit:!0,label:`Default model`,value:D,onChange:O,models:e,required:!0}),e.length===0&&(0,_.jsxs)(s,{tone:`warning`,children:[`No chat model is in use yet. Add one under `,(0,_.jsx)(`a`,{href:`/config`,children:`Setup → Models`}),` first.`]}),(0,_.jsx)(b,{mode:k,picked:j,skills:t,disabled:F,onModeChange:A,onPickedChange:M}),(0,_.jsxs)(`fieldset`,{className:`m-0 grid min-w-0 gap-2.5 border-0 p-0`,children:[(0,_.jsx)(`legend`,{className:`mb-2 p-0 text-sm font-semibold text-foreground`,children:`Files`}),(0,_.jsx)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:`SOUL.md and IDENTITY.md are always there. These three can be left out:`}),v.filter(e=>e.optional).map(e=>(0,_.jsx)(f,{checked:N[e.key],disabled:F,label:(0,_.jsxs)(`span`,{className:`min-w-0`,children:[(0,_.jsx)(`span`,{className:`font-mono text-[0.9em] font-semibold`,children:e.name}),(0,_.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.hint]})]}),onChange:t=>P(n=>({...n,[e.key]:t}))},e.key))]}),L&&(0,_.jsx)(s,{tone:`warning`,role:`alert`,title:`The template was not created.`,children:L}),(0,_.jsxs)(l,{children:[(0,_.jsx)(o,{variant:`ghost`,disabled:F,onClick:p,children:`Cancel`}),(0,_.jsx)(o,{variant:`primary`,type:`submit`,disabled:F||!V,children:F?`Creating…`:`Create and edit its files`})]})]})})}export{b as n,v as r,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e}from"./createLucideIcon-DkniuEtD.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})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e}from"./createLucideIcon-DkniuEtD.js";import{Dt as t,Ot as n}from"./index-YW0gXPfk.js";import{r,t as i}from"./SectionTabs-ViZKm3-B.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:`Setup`,title:e,description:o,actions:c}),(0,a.jsx)(r,{label:`Setup sections`,base:`/config`,tabs:i}),(0,a.jsx)(`div`,{className:`space-y-6`,children:s})]})}export{o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r}from"./createLucideIcon-DkniuEtD.js";import{t as i}from"./Button-UiegBKOK.js";import{G as a,W as o}from"./index-YW0gXPfk.js";var s=e(t(),1),c=r();function l({open:e,title:t,description:r,confirmLabel:l,confirmVariant:u=`danger`,onConfirm:d,onOpenChange:f}){let[p,m]=(0,s.useState)(!1),[h,g]=(0,s.useState)(null);(0,s.useEffect)(()=>{e||(m(!1),g(null))},[e]);async function _(){m(!0),g(null);try{await d(),f(!1)}catch(e){g(n(e)),m(!1)}}return(0,c.jsxs)(o,{open:e,busy:p,onClose:()=>f(!1),title:t,description:r,className:`max-w-md`,children:[h&&(0,c.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger/10 px-3 py-2 text-sm text-danger`,children:h}),(0,c.jsxs)(a,{children:[(0,c.jsx)(i,{variant:`ghost`,disabled:p,onClick:()=>f(!1),children:`Cancel`}),(0,c.jsx)(i,{variant:u,disabled:p,onClick:()=>void _(),children:p?`Working…`:l})]})]})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,o as i,r as a,t as o,u as s}from"./createLucideIcon-DkniuEtD.js";import{t as c}from"./UnsavedChangesGuard-BmdwLH99.js";import{t as l}from"./Button-UiegBKOK.js";import{t as u}from"./arrow-right-D0HKRb7U.js";import{c as d,d as f,i as p,n as m,p as h,t as g}from"./TeamThread-mkwODO0S.js";import{C as _,_ as v,b as ee,c as y,d as te,f as b,g as x,h as S,i as C,l as w,n as T,o as E,r as D,s as O,t as k,u as A,v as ne,y as re}from"./style-CA2GAk9b.js";import{t as j}from"./message-square-DM2MP9vF.js";import{X as M,ot as N}from"./index-YW0gXPfk.js";import{r as ie}from"./use-resource-CQaIZbpy.js";import{t as ae}from"./ConfirmDialog-VqBOFZEp.js";import{t as oe}from"./Segmented-MYKKTuZO.js";var se=o(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),P=e(t(),1),F=r(),I=`!size-2.5 !border-2 !border-snow !bg-sapphire`,L=[{id:`t`,position:A.Top},{id:`r`,position:A.Right},{id:`b`,position:A.Bottom},{id:`l`,position:A.Left}];function R(){return(0,F.jsx)(F.Fragment,{children:L.map(e=>(0,F.jsx)(C,{id:e.id,type:`source`,position:e.position,className:I},e.id))})}function z({data:e,selected:t}){let{member:n}=e;return(0,F.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,F.jsx)(R,{}),(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,F.jsx)(M,{identity:n.identity,size:34}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`span`,{className:`block truncate text-sm font-semibold text-chocolate`,children:n.name}),(0,F.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-1.5 text-xs ${n.isolated?`font-semibold text-warning`:`text-mocha`}`,children:[(0,F.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${d[n.state.kind]}`,"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:n.isolated?`No connections`:n.state.text})]})]})]})]})}function B({selected:e}){return(0,F.jsxs)(`div`,{className:`w-[160px] rounded-2xl border border-dashed bg-ivory px-3 py-2.5 ${e?`border-sapphire`:`border-fawn`}`,children:[(0,F.jsx)(R,{}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(_,{className:`size-4 shrink-0 text-rose-baziu`,"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`block text-sm font-semibold text-chocolate`,children:`Other teams`})]})]})}var V={member:z,outside:B},H=(e,t)=>`pair:${p(e,t)}`;function ce(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 le({document:e,members:t,traffic:n,selectedId:r,onSelect:i,onConnect:a,onMove:o,onOpenMember:s}){let c=(0,P.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:b,type:`outside`,position:{x:e,y:n},data:{},ariaLabel:`Agents in other teams`,selected:r===b,draggable:!1,deletable:!1}]},[t,r]),[l,u,d]=O(c);(0,P.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,P.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=x(e,c,l),d=x(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:w.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,F.jsx)(`div`,{className:`h-full min-h-[420px] w-full bg-ivory`,children:(0,F.jsxs)(E,{nodes:l,edges:f,nodeTypes:V,connectionMode:y.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,F.jsx)(k,{variant:T.Dots,gap:20,size:1.2,color:`var(--color-fawn)`}),(0,F.jsx)(D,{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 ue={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 de(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:b,K=e=>`bz_map_${e}`;function fe(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=ie(t=>a(`/api/teams/${encodeURIComponent(e.id)}/policy`,{signal:t}),[e.id]);return t.error?(0,F.jsx)(f,{view:`connections`,children:(0,F.jsx)(`p`,{role:`alert`,className:`err m-4`,children:t.error})}):t.data?(0,F.jsx)(J,{team:e,policy:t.data},e.id):(0,F.jsx)(f,{view:`connections`,children:(0,F.jsx)(`p`,{role:`status`,className:`m-4 text-sm text-muted-foreground`,children:`Loading the connections…`})})}function J({team:e,policy:t}){let{agentById:r,search:i}=h(),o=N(),u=s(),d=m(e.id,300),[p,_]=(0,P.useState)(()=>v(t)),[y,x]=(0,P.useState)(p),[C,w]=(0,P.useState)(`map`),[T,E]=(0,P.useState)(null),[D,O]=(0,P.useState)({}),[k,A]=(0,P.useState)(!1),[j,M]=(0,P.useState)(null),[ie,I]=(0,P.useState)(!1),L=!re(p,y);(0,P.useEffect)(()=>O(fe(e.id)),[e.id]);let R=(t,n)=>{O(r=>{let i={...r,[t]:n};try{window.localStorage.setItem(K(e.id),JSON.stringify(i))}catch{}return i})},z=(0,P.useMemo)(()=>y.members.filter(e=>e.status!==`archived`),[y.members]),B=(0,P.useMemo)(()=>new Set(z.map(e=>e.key)),[z]),V=z.map((e,t)=>({id:e.key,name:e.name,identity:r(e.key)?.identity,state:o.stateOf(e.key),isolated:y.mode===`restricted`&&!y.edges.some(t=>t.from===e.key||t.to===e.key),position:D[e.key]??de(t,z.length)})),U=e=>G(B,e),W=d.data,q=(0,P.useMemo)(()=>{let e=new Map;for(let t of W??[]){let n=G(B,t.fromAgentId),r=G(B,t.toAgentId);if(n===r)continue;let i=H(n,r);e.set(i,(e.get(i)??0)+1)}return e},[W,B]),J=(e,t,n)=>{M(null),x(r=>ee(r,e,t,n))};async function Y(){A(!0),M(null);try{let t=v(await a(`/api/teams/${encodeURIComponent(e.id)}/policy`,{method:`PATCH`,body:{mode:y.mode,edges:ne(y)}}));_(t),x(t),M({error:!1,text:`Saved. It applies to the next message an Agent sends.`}),await u.invalidate()}catch(e){M({error:!0,text:n(e)})}finally{A(!1)}}let X=ce(T),Z=T&&(B.has(T)||T===b)?T:null,Q=(e,t)=>U(e.fromAgentId)===t||U(e.toAgentId)===t,$=W??[],he=X?$.filter(e=>Q(e,X[0])&&Q(e,X[1])):Z?$.filter(e=>Q(e,Z)):$;return(0,F.jsxs)(f,{view:`connections`,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(oe,{label:`How members reach each other`,value:y.mode,options:[{id:`open`,label:`Open`},{id:`restricted`,label:`Restricted`}],onChange:e=>{M(null),x(t=>({...t,mode:e}))}}),(0,F.jsx)(oe,{label:`Show as`,value:C,options:[{id:`map`,label:`Map`},{id:`matrix`,label:`Table`}],onChange:w}),(0,F.jsx)(l,{variant:`ghost`,className:`min-h-8 px-3 py-1 text-xs`,disabled:!L||k,onClick:()=>I(!0),children:`Discard`}),(0,F.jsxs)(l,{variant:`primary`,className:`min-h-8 px-3 py-1 text-xs`,disabled:!L||k,onClick:()=>void Y(),children:[(0,F.jsx)(se,{className:`size-3.5`,"aria-hidden":`true`}),k?`Saving…`:`Save`]})]}),children:[(0,F.jsx)(c,{when:L,subject:`connection changes`}),(0,F.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_23rem]`,children:[(0,F.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col max-lg:h-[52vh]`,children:[(0,F.jsx)(`p`,{className:`m-0 border-b border-border px-3 py-1.5 text-xs ${j?.error?`text-danger`:L?`text-warning`:`text-mocha`}`,role:j?.error?`alert`:`status`,children:j?.text??(L?`Unsaved changes. `:``)+ue[y.mode]+(C===`map`?` Drag from one Agent to another to connect them.`:``)}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1`,children:z.length===0?(0,F.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,F.jsx)(le,{document:y,members:V,traffic:q,selectedId:T,onSelect:E,onConnect:(e,t)=>{J(e,t,!0),E(H(e,t))},onMove:R,onOpenMember:e=>void u.navigate({to:`/`,search:{agent:e,panel:`connections`}})}):(0,F.jsx)(te,{document:{...y,members:z},selectedId:T,onSelect:E,onToggle:J})})]}),(0,F.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,F.jsx)(pe,{document:y,pair:X,onToggle:J,onClear:()=>E(null)}):Z?(0,F.jsx)(me,{document:y,actor:Z,others:[...z.map(e=>e.key),b].filter(e=>e!==Z),panel:i.panel,onToggle:J,onSelectPair:e=>E(H(Z,e))}):(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h2`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:[z.length,` member`,z.length===1?``:`s`,` ·`,` `,y.mode===`open`?`open Team`:`restricted Team`]}),(0,F.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,F.jsx)(`h2`,{className:`m-0 mb-1.5 mt-5 font-body text-xs font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:X?`Messages between them`:Z?`Messages of ${S(y,Z)}`:`Recent messages`}),d.error?(0,F.jsx)(`p`,{role:`alert`,className:`m-0 text-xs text-danger`,children:d.error}):(0,F.jsx)(g,{messages:he,limit:30,empty:X||Z?`None among the Team’s recent messages.`:`No messages between Agents yet.`})]})]}),(0,F.jsx)(ae,{open:ie,title:`Discard the connection changes?`,description:(0,F.jsx)(`p`,{children:`Every unsaved change is dropped. The saved connections stay as they are.`}),confirmLabel:`Discard changes`,onConfirm:()=>{x(p),E(null),M(null)},onOpenChange:I})]})}function Y({document:e,from:t,to:n,onToggle:r}){let i=x(e,t,n),a=e.mode===`open`&&t!==b&&n!==b;return(0,F.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,F.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:S(e,t)}),(0,F.jsx)(u,{className:`size-3.5 shrink-0 text-mocha`,"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:S(e,n)})]}),(0,F.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 pe({document:e,pair:[t,n],onToggle:r,onClear:i}){let a=x(e,t,n)||x(e,n,t);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h2`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:[S(e,t),` and `,S(e,n)]}),(0,F.jsxs)(`p`,{className:`m-0 mt-1 text-xs leading-relaxed text-mocha`,children:[`Each direction is its own connection.`,t===b||n===b?` Reaching another Team also needs that Team to connect its Agent to “Other teams”.`:``]}),(0,F.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,F.jsx)(Y,{document:e,from:t,to:n,onToggle:r}),(0,F.jsx)(Y,{document:e,from:n,to:t,onToggle:r})]}),a&&(0,F.jsx)(`div`,{className:`mt-2.5`,children:(0,F.jsx)(l,{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 me({document:e,actor:t,others:n,panel:r,onToggle:a,onSelectPair:o}){let{agentById:s}=h(),c=N(),l=t===b?void 0:s(t),u=l?c.stateOf(l.id):null;return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[t!==b&&(0,F.jsx)(M,{identity:l?.identity,size:34}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`m-0 truncate font-body text-sm font-semibold text-foreground`,children:S(e,t)}),u?(0,F.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-1.5 text-xs text-mocha`,children:[(0,F.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${d[u.kind]}`,"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:u.text})]}):(0,F.jsx)(`p`,{className:`m-0 text-xs text-mocha`,children:`Every Agent that is not in this Team.`})]}),l&&(0,F.jsxs)(i,{to:`/`,search:{agent:l.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,F.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`}),`Open`]})]}),(0,F.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.map(n=>(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>o(n),className:`unstyled mb-1 text-xs font-semibold text-mocha hover:text-sapphire`,children:[`With `,S(e,n)]}),(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(Y,{document:e,from:t,to:n,onToggle:a}),(0,F.jsx)(Y,{document:e,from:n,to:t,onToggle:a})]})]},n))})]})}export{q as ConnectionsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e}from"./createLucideIcon-DkniuEtD.js";import{Dt as t,Ot as n}from"./index-YW0gXPfk.js";import{n as r,r as i}from"./SectionTabs-ViZKm3-B.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:`Manage`,title:e,description:o,actions:c}),(0,a.jsx)(i,{label:`Manage sections`,base:``,tabs:r}),(0,a.jsx)(`div`,{className:`space-y-6`,children:s})]})}export{o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e,o as t}from"./createLucideIcon-DkniuEtD.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`,`Agents`],[`/teams`,`Teams`],[`/templates/agents`,`Agent templates`],[`/templates/teams`,`Team templates`],[`/skills`,`Skills`]],a=[[``,`Models`],[`/tools`,`Tools`],[`/mcp`,`MCP`],[`/telegram`,`Telegram`],[`/access`,`Access`],[`/system`,`System`]];export{i as n,r,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e}from"./createLucideIcon-DkniuEtD.js";var t=e();function n({label:e,value:n,options:r,onChange:i}){return(0,t.jsx)(`fieldset`,{"aria-label":e,className:`m-0 flex min-w-0 rounded-[12px] border border-border bg-card p-0.5`,children:r.map(e=>(0,t.jsx)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>i(e.id),className:`unstyled h-7 whitespace-nowrap rounded-[9px] px-2.5 text-xs font-semibold ${n===e.id?`bg-accent text-accent-foreground`:`text-mocha hover:text-foreground`}`,children:e.label},e.id))})}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,n as i,r as a,t as o}from"./createLucideIcon-DkniuEtD.js";import{t as s}from"./Button-UiegBKOK.js";import{g as c,st as l}from"./parts-LZxl9Gvc.js";import{A as u,G as d,W as f,b as p,x as m}from"./index-YW0gXPfk.js";import{s as h}from"./manage-SRGSx8n2.js";var g=o(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),_=e(t(),1),v=r();function y({findings:e}){return(0,v.jsx)(`ul`,{className:`m-0 mt-1 grid list-none gap-1 p-0`,children:e.map((e,t)=>(0,v.jsxs)(`li`,{className:`min-w-0`,children:[(0,v.jsxs)(`span`,{className:e.severity===`danger`?`font-semibold`:``,children:[e.severity===`danger`?`Risky`:`Check`,`:`]}),` `,e.message,` `,(0,v.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.code,e.line?`, line ${e.line}`:``,`)`]})]},t))})}function b({findings:e,title:t}){let n=e.some(e=>e.severity===`danger`);return(0,v.jsx)(c,{tone:n?`warning`:`neutral`,title:t??(n?`Read it before an Agent uses it: its text goes into the system prompt.`:`Worth a look.`),children:(0,v.jsx)(y,{findings:e})})}var x=[{value:`openclaw`,label:`OpenClaw`,hint:`Every skill in ~/.openclaw/skills on the computer Bazilion runs on.`},{value:`path`,label:`A folder`,hint:`One skill folder with a SKILL.md, or a folder of them, on that computer.`},{value:`zip`,label:`A ZIP file`,hint:`Uploaded from here: one folder per skill at its top level.`}];function S({onClose:e,onImported:t}){let[r,o]=(0,_.useState)(`openclaw`),[g,y]=(0,_.useState)(``),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[M,N]=(0,_.useState)([]),P=r===`path`&&g.trim()&&!g.trim().startsWith(`/`)?`The full path of the folder, starting with /.`:void 0,F=r===`openclaw`||r===`path`&&g.trim()!==``&&!P||r===`zip`&&S!==null;function I(e){if(e){if(j(null),!/\.zip$/i.test(e.name)){j(`Only ZIP archives can be imported.`);return}C(e)}}async function L(e){if(e.preventDefault(),!F||O)return;k(!0),j(null),N([]);let o;if(r===`zip`&&S){let e=new FormData;e.set(`file`,S),E&&e.set(`force`,`true`),o=e}else o={source:r===`openclaw`?`openclaw`:g.trim(),force:E};try{await t(await a(`/api/skills/import`,{body:o}))}catch(e){e instanceof i&&N(e.body?.findings??[]),j(n(e)),k(!1)}}return(0,v.jsx)(f,{title:`Import skills`,description:`A skill's SKILL.md is added to the system prompt of every Agent it is attached to. Each one is scanned before it is installed.`,busy:O,onClose:e,className:`max-w-2xl`,children:(0,v.jsxs)(`form`,{onSubmit:e=>void L(e),className:`grid gap-4`,children:[(0,v.jsx)(m,{legend:`From`,name:`skills-source`,value:r,options:x,columns:3,disabled:O,onChange:e=>{o(e),j(null),N([])}}),r===`path`&&(0,v.jsx)(u,{label:`Folder`,value:g,disabled:O,placeholder:`/home/you/my-skills`,mono:!0,className:`max-w-none`,problem:P,onChange:y}),r===`zip`&&(0,v.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),T(!0)},onDragLeave:()=>T(!1),onDrop:e=>{e.preventDefault(),T(!1),I(e.dataTransfer.files[0])},className:l(`relative m-0 block cursor-pointer rounded-xl border-2 border-dashed px-6 py-7 text-center text-sm transition-colors`,w?`border-primary bg-accent text-accent-foreground`:S?`border-solid border-primary/40 bg-card text-foreground`:`border-border bg-muted/30 text-muted-foreground hover:border-primary hover:bg-accent/60`),children:[(0,v.jsx)(`input`,{type:`file`,accept:`.zip,application/zip`,disabled:O,onChange:e=>I(e.target.files?.[0]),className:`absolute h-px w-px overflow-hidden opacity-0`}),S?(0,v.jsx)(`span`,{className:`block break-all font-mono text-foreground`,children:S.name}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`block font-semibold text-foreground`,children:`Choose a ZIP file`}),(0,v.jsx)(`span`,{className:`text-xs`,children:`or drop it here`})]})]}),(0,v.jsx)(p,{checked:E,disabled:O,label:`Replace skills that are already installed, and import despite scan findings`,onChange:D}),M.length>0&&(0,v.jsx)(b,{findings:M,title:`The scan found ${h(M.length,`thing`)} to check. Read them; to import anyway, tick the box above.`}),A&&M.length===0&&(0,v.jsx)(c,{tone:`warning`,role:`alert`,title:`Nothing was imported.`,children:A}),(0,v.jsxs)(d,{children:[(0,v.jsx)(s,{variant:`ghost`,disabled:O,onClick:e,children:`Cancel`}),(0,v.jsx)(s,{variant:`primary`,type:`submit`,disabled:O||!F,children:O?`Importing…`:r===`openclaw`?`Import from OpenClaw`:r===`zip`?`Upload and import`:`Import`})]})]})})}export{g as i,b as n,S as r,y as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,r as i}from"./createLucideIcon-DkniuEtD.js";import{t as a}from"./Button-UiegBKOK.js";import{g as o}from"./parts-LZxl9Gvc.js";import{A as s,E as c,G as l,W as u,x as d}from"./index-YW0gXPfk.js";import{S as f,s as p,x as m}from"./manage-SRGSx8n2.js";var h=e(t(),1),g=r();function _({template:e,teams:t,initialTeamId:r=``,onClose:_,onSpawned:v}){let y=t.some(e=>e.id===r),[b,x]=(0,h.useState)(y?`existing`:`new`),[S,C]=(0,h.useState)(y?r:t[0]?.id??``),[w,T]=(0,h.useState)(y?``:r||f(e.name)),[E,D]=(0,h.useState)(e.userMd??``),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!1),M=b===`existing`?S:w.trim(),N=b===`new`?m(M)??(t.some(e=>e.id===M)?`A Team with this ID exists: choose it under “A Team that exists”.`:void 0):void 0,P=M!==``&&!N&&e.slots.length>0;async function F(t){if(t.preventDefault(),!(!P||A)){j(!0),k(null);try{await i(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{body:{teamId:M,...b===`new`&&E!==(e.userMd??``)?{userMd:E}:{}}}),v(M)}catch(e){k(n(e)),j(!1)}}}return(0,g.jsx)(u,{title:`Spawn ${e.name}`,description:`Creates ${p(e.slots.length,`Agent`)} and ${p(e.edges.length,`connection`)} between them.`,busy:A,onClose:_,className:`max-w-xl`,children:(0,g.jsxs)(`form`,{onSubmit:e=>void F(e),className:`grid gap-4`,children:[(0,g.jsx)(d,{legend:`Into`,name:`spawn-team-target`,value:b,disabled:A,options:[{value:`new`,label:`A new Team`,hint:`It is ${e.policyMode===`restricted`?`restricted: members message each other along connections`:`open: members message each other freely`}, as the template is.`},{value:`existing`,label:`A Team that exists`,hint:`The Agents join it; it keeps its own messaging rules.`}],onChange:x}),b===`new`?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{label:`ID of the new Team`,value:w,disabled:A,placeholder:`launch`,mono:!0,className:`max-w-none`,problem:N,onChange:T}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`spawn-team-user-md`,className:`m-0 text-sm font-semibold text-foreground`,children:`USER.md`}),(0,g.jsx)(`textarea`,{id:`spawn-team-user-md`,rows:4,value:E,disabled:A,onChange:e=>D(e.target.value),className:`mt-1.5 font-mono text-sm leading-[1.55]`}),(0,g.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`What every Agent of the new Team knows about you. It starts from the template’s.`})]})]}):(0,g.jsx)(c,{label:`Team`,value:S,options:t.map(e=>({value:e.id,label:e.name})),disabled:A,className:`max-w-none`,onChange:C}),e.slots.length===0&&(0,g.jsx)(o,{tone:`warning`,children:`This template has no Agents yet: add some to it first.`}),O&&(0,g.jsx)(o,{tone:`warning`,role:`alert`,title:`The Team was not spawned.`,children:O}),(0,g.jsxs)(l,{children:[(0,g.jsx)(a,{variant:`ghost`,disabled:A,onClick:_,children:`Cancel`}),(0,g.jsx)(a,{variant:`primary`,type:`submit`,disabled:A||!P,children:A?`Spawning…`:`Spawn ${p(e.slots.length,`Agent`)}`})]})]})})}export{_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,r as i}from"./createLucideIcon-DkniuEtD.js";import{t as a}from"./Button-UiegBKOK.js";import{g as o}from"./parts-LZxl9Gvc.js";import{A as s,G as c,x as l}from"./index-YW0gXPfk.js";import{S as u,x as d}from"./manage-SRGSx8n2.js";var f=e(t(),1),p=r();function m(e){let t=e.id.trim(),n=e.folder.trim(),r={},i=d(t);return i&&(r.id=i),e.place===`link`&&n&&!n.startsWith(`/`)&&(r.folder=`The full path of the folder, starting with /.`),!(t!==``&&(e.place===`new`||n!==``))||r.id||r.folder?{body:null,problems:r}:{body:{id:t,...e.name.trim()?{name:e.name.trim()}:{},...e.place===`link`?{link:n}:{}},problems:r}}function h({onCreated:e,onBusyChange:t,extraActions:r}){let[d,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(`new`),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)(!1),[E,D]=(0,f.useState)(null),O=v?g:u(d),k=m({name:d,id:O,place:b,folder:S});function A(e){T(e),t?.(e)}async function j(t){if(t.preventDefault(),!(!k.body||w)){D(null),A(!0);try{await e(await i(`/api/teams`,{body:k.body}))}catch(e){D(n(e))}finally{A(!1)}}}return(0,p.jsxs)(`form`,{onSubmit:e=>void j(e),className:`grid gap-4`,children:[(0,p.jsxs)(`div`,{className:`grid items-start gap-x-3 gap-y-4 sm:grid-cols-2`,children:[(0,p.jsx)(s,{label:`Name`,value:d,disabled:w,placeholder:`My project`,className:`max-w-none`,onChange:e=>{h(e),D(null)}}),(0,p.jsx)(s,{label:`ID`,value:O,disabled:w,placeholder:`my-project`,mono:!0,className:`max-w-none`,hint:`Used in commands and addresses; it cannot change later.`,problem:k.problems.id,onChange:e=>{y(!0),_(e),D(null)}})]}),(0,p.jsx)(l,{legend:`Where its files are`,name:`team-place`,value:b,disabled:w,options:[{value:`new`,label:`A new folder`,hint:`Bazilion makes one for it in its home.`},{value:`link`,label:`A project folder`,hint:`Its Agents work in a folder that already exists, such as a code repository.`}],onChange:x}),b===`link`&&(0,p.jsx)(s,{label:`Folder`,value:S,disabled:w,placeholder:`/home/you/projects/my-project`,mono:!0,className:`max-w-none`,hint:`The Team links to it; removing the Team later removes only the link, never the folder.`,problem:k.problems.folder,onChange:C}),E&&(0,p.jsx)(o,{tone:`warning`,role:`alert`,title:`The Team was not created.`,children:E}),(0,p.jsxs)(c,{children:[r?.(w),(0,p.jsx)(a,{variant:`primary`,type:`submit`,disabled:w||!k.body,children:w?`Creating…`:`Create Team`})]})]})}export{h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,o as i,r as a,t as o,u as s}from"./createLucideIcon-DkniuEtD.js";import{t as c}from"./Button-UiegBKOK.js";import{A as l,C as u,E as d,S as f,T as p,at as m,j as h,k as g}from"./parts-LZxl9Gvc.js";import{n as _}from"./download-C4t9l5wR.js";import{n as v,t as y}from"./images-DSYgPKM7.js";import{t as b}from"./arrow-right-D0HKRb7U.js";import{t as ee}from"./bot-Bb--PFVU.js";import{t as te}from"./chevron-right-bs0TUSl2.js";import{t as x}from"./network-BJ4iPjQO.js";import{t as ne}from"./plus-CLGNN5QX.js";import{t as S}from"./users-round-BJrym3FG.js";import{Ct as re,G as C,K as w,W as T,X as E,Z as D,at as ie,it as O,ot as k,q as A,y as ae,yt as j}from"./index-YW0gXPfk.js";import{r as M,t as N}from"./use-resource-CQaIZbpy.js";import{t as oe}from"./ConfirmDialog-VqBOFZEp.js";import{r as P,t as se}from"./agent-actions-BgE9fKHH.js";import{t as ce}from"./SpawnTeamModal-DG5UbJNK.js";import{t as le}from"./TeamForm-DGlxWv4e.js";var F=o(`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`}]]),I=o(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),L=o(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),R=o(`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=o(`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=e(t(),1),V=r(),H=(0,B.createContext)(null);function U({value:e,children:t}){let n=(0,B.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,V.jsx)(H.Provider,{value:n,children:t})}function W(){let e=(0,B.useContext)(H);if(!e)throw Error(`useWorkspace needs a WorkspaceProvider`);return e}function G(){return(0,B.useContext)(H)}var K={connections:{label:`Connections`,icon:x},changes:{label:`Changes`,icon:F},files:{label:`Files`,icon:y}};function q({view:e,actions:t,children:n}){let{team:r,agent:a,to:o}=W();return(0,V.jsxs)(`section`,{"aria-label":`${K[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,V.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,V.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-sm font-semibold text-foreground hover:border-sapphire-light hover:text-sapphire`,children:[(0,V.jsx)(v,{className:`size-3.5`,"aria-hidden":`true`}),a?a.agent.name:`Back`]}),(0,V.jsx)(`h1`,{className:`m-0 min-w-0 truncate font-display text-xl leading-tight text-charcoal`,children:r?.name}),(0,V.jsx)(`nav`,{"aria-label":`Team views`,className:`flex rounded-[12px] border border-border bg-card p-0.5`,children:D.map(t=>{let n=K[t].icon,r=t===e;return(0,V.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-sm font-semibold ${r?`bg-accent text-accent-foreground`:`text-mocha hover:bg-muted hover:text-foreground`}`,children:[(0,V.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:r?``:`hidden sm:inline`,children:K[t].label})]},t)})}),t&&(0,V.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:t})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:n})]})}var J=`bz_sidebar_open_groups`;function ue(e){document.cookie=`${J}=${encodeURIComponent(JSON.stringify(e))}; Path=/; Max-Age=31536000; SameSite=Lax`}var Y=`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`,X=`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,Z={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 de(e){return[...e].sort((e,t)=>Number(t.id===A)-Number(e.id===A))}function fe({initialOpenGroups:e}){let{agents:t,teams:n,profiles:r,teamTemplates:a,agent:o,team:m,search:_}=W(),v=k(),y=s(),[b,x]=(0,B.useState)(null),[C,E]=(0,B.useState)(void 0),[D,O]=(0,B.useState)(null),[A,j]=(0,B.useState)(!1),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(null),[I,R]=(0,B.useState)(null),[z,H]=(0,B.useState)(e),U=(0,B.useRef)(null),G=()=>window.requestAnimationFrame(()=>U.current?.focus()),K=[...r].sort((e,t)=>Number(t.id===w)-Number(e.id===w)),q=de(n),J=a.find(e=>e.id===D),Z=o?.agent.id??null;return(0,V.jsxs)(`aside`,{className:`flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,V.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border bg-muted/60 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-[10px] bg-accent text-accent-foreground`,children:(0,V.jsx)(S,{className:`size-4`,"aria-hidden":`true`})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold leading-tight text-foreground`,children:`Teams`}),(0,V.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,V.jsxs)(g,{modal:!1,children:[(0,V.jsx)(h,{asChild:!0,children:(0,V.jsxs)(`button`,{ref:U,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,V.jsx)(ne,{className:`size-3.5`,"aria-hidden":`true`}),`New`,(0,V.jsx)(re,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":`true`})]})}),(0,V.jsx)(d,{children:(0,V.jsxs)(f,{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,V.jsxs)(p,{className:X,children:[(0,V.jsx)(ee,{className:`size-3`,"aria-hidden":`true`}),`Agent templates`]}),K.length===0?(0,V.jsx)(u,{asChild:!0,className:Y,children:(0,V.jsx)(`a`,{href:`/templates/agents?new=1`,children:`Create an Agent template`})}):K.map(e=>(0,V.jsxs)(u,{className:Y,onSelect:()=>{E(m?.id),x(e.id)},children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),e.id==="default"&&(0,V.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,V.jsx)(l,{className:`my-1.5 h-px bg-border`}),(0,V.jsxs)(p,{className:X,children:[(0,V.jsx)(S,{className:`size-3`,"aria-hidden":`true`}),`Team templates`]}),a.length===0?(0,V.jsx)(u,{asChild:!0,className:Y,children:(0,V.jsx)(`a`,{href:`/templates/teams?new=1`,children:`Create a Team template`})}):a.map(e=>(0,V.jsxs)(u,{className:Y,disabled:e.slots.length===0,title:e.slots.length===0?`Add at least one member before spawning`:void 0,onSelect:()=>O(e.id),children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),(0,V.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,V.jsx)(l,{className:`my-1.5 h-px bg-border`}),(0,V.jsxs)(u,{className:Y,onSelect:()=>j(!0),children:[(0,V.jsx)(ne,{className:`size-3.5`,"aria-hidden":`true`}),`Create a Team`]})]})})]})]}),(0,V.jsxs)(`nav`,{className:`flex-1 overflow-y-auto p-1.5`,"aria-label":`Teams and agents`,children:[t.length===0&&(0,V.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,V.jsx)(`p`,{className:`m-0 text-sm font-semibold text-foreground`,children:`No agents yet`}),(0,V.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,V.jsx)(c,{variant:`primary`,className:`mt-3`,onClick:()=>x(K[0]?.id??`default`),children:`Spawn first agent`}):(0,V.jsx)(`a`,{href:`/templates/agents?new=1`,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=m?.id===e.id,a=z[e.id]??(r||e.id==="default"),s=ie(n.map(e=>v.stateOf(e.id)));return(0,V.jsxs)(`details`,{open:a,onToggle:t=>{let n=t.currentTarget.open;if(n===a)return;let r={...z,[e.id]:n};ue(r),H(r)},className:`group/details mb-1 last:mb-0`,children:[(0,V.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,V.jsx)(te,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-open/details:rotate-90`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-semibold`,children:e.name}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:s||n.length}),(0,V.jsx)(i,{to:`/`,search:{...o?.team.id===e.id?{agent:o.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,V.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`})})]}),n.length===0?(0,V.jsx)(`div`,{className:`py-2 pl-7 pr-2 text-xs text-muted-foreground`,children:`No agents in this team`}):(0,V.jsx)(`div`,{className:`space-y-0.5 py-1 pl-1.5`,children:n.map(e=>(0,V.jsx)(pe,{agent:e,selected:e.id===Z,state:v.stateOf(e.id),lastActivityAt:v.byAgent.get(e.id)?.lastActivityAt??null,panel:_.panel,onRename:()=>F(e),onArchive:()=>R(e)},e.id))})]},e.id)})]}),b&&(0,V.jsx)(ae,{profiles:K,teams:q,profileId:b,teamId:C,onClose:()=>{x(null),G()}}),J&&(0,V.jsx)(ce,{template:J,teams:q,onClose:()=>{O(null),G()},onSpawned:e=>{O(null),y.navigate({to:`/`,search:{team:e,panel:`team`}})}}),A&&(0,V.jsx)(T,{title:`Create a Team`,description:`A Team is one workspace: its folder, its Agents, its USER.md and shared memory, and who may message whom.`,busy:M,onClose:()=>{j(!1),G()},children:(0,V.jsx)(le,{onBusyChange:N,onCreated:async e=>{j(!1),await y.navigate({to:`/`,search:{team:e.id,panel:`team`}})},extraActions:e=>(0,V.jsx)(c,{variant:`ghost`,disabled:e,onClick:()=>j(!1),children:`Cancel`})})}),P&&(0,V.jsx)(he,{agent:P,onClose:()=>F(null),onRenamed:()=>y.invalidate()}),(0,V.jsx)(oe,{open:I!==null,onOpenChange:e=>{e||R(null)},title:`Archive ${I?.name??`agent`}?`,description:(0,V.jsx)(`p`,{children:`The Agent leaves this list and receives no work. Restore it later under Manage → Agents, in Archived.`}),confirmLabel:`Archive agent`,confirmVariant:`primary`,onConfirm:async()=>{I&&(await se(I.id),I.id===Z?await y.navigate({to:`/`,search:{}}):await y.invalidate())}})]})}function pe({agent:e,selected:t,state:n,lastActivityAt:r,panel:a,onRename:o,onArchive:s}){let c=N();return(0,V.jsxs)(`div`,{className:`group/row relative rounded-2xl`,children:[(0,V.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,V.jsx)(E,{identity:e.identity,size:30}),(0,V.jsxs)(`span`,{className:`block min-w-0 flex-1`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,V.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,V.jsx)(`span`,{className:`shrink-0 text-primary`,title:`Telegram topic #${e.telegramTopicId}`,role:`img`,"aria-label":`Bound to Telegram topic ${e.telegramTopicId}`,children:(0,V.jsx)(z,{className:`size-3`,"aria-hidden":`true`})}),c&&r!==null&&(0,V.jsx)(`time`,{dateTime:new Date(r).toISOString(),className:`ml-auto shrink-0 text-xs font-normal text-muted-foreground`,children:O(r)})]}),(0,V.jsxs)(`span`,{className:`mt-0.5 flex items-center gap-1.5 text-xs leading-snug ${Z[n.kind]}`,children:[(0,V.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${Q[n.kind]}`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:n.text})]})]})]}),(0,V.jsxs)(g,{modal:!1,children:[(0,V.jsx)(h,{asChild:!0,children:(0,V.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,V.jsx)(m,{className:`size-4`,"aria-hidden":`true`})})}),(0,V.jsx)(d,{children:(0,V.jsxs)(f,{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,V.jsx)(u,{asChild:!0,className:Y,children:(0,V.jsxs)(i,{to:`/`,search:{agent:e.id,panel:`agent`},children:[(0,V.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`}),`Agent settings`]})}),(0,V.jsxs)(u,{className:Y,onSelect:o,children:[(0,V.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`}),`Rename`]}),(0,V.jsxs)(u,{className:Y,onSelect:s,children:[(0,V.jsx)(_,{className:`size-3.5`,"aria-hidden":`true`}),`Archive`]})]})})]})]})}function me(){let{agents:e,teams:t,agent:n,team:r,search:a}=W(),o=k(),s=de(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,V.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,V.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,V.jsx)(I,{className:`size-[18px]`,"aria-hidden":`true`})}),s.map(t=>(0,V.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`h-px w-8 bg-border`}),(0,V.jsx)(`span`,{className:`max-w-14 truncate text-xs 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,V.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,V.jsx)(E,{identity:e.identity,size:40}),(0,V.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 he({agent:e,onClose:t,onRenamed:r}){let[i,a]=(0,B.useState)(e.name),[o,s]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),d=!i.trim()||i.trim()===e.name;async function f(a){if(a.preventDefault(),!d){s(!0),u(null);try{await P(e.id,i.trim()),await r(),t()}catch(e){u(n(e)),s(!1)}}}return(0,V.jsx)(T,{title:`Rename ${e.name}`,description:`This changes the display name only; the Agent ID and history stay the same.`,busy:o,onClose:t,className:`max-w-md`,children:(0,V.jsxs)(`form`,{onSubmit:e=>void f(e),children:[(0,V.jsxs)(`label`,{children:[`Agent name`,(0,V.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),maxLength:120})]}),l&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:l}),(0,V.jsx)(`div`,{className:`mt-4`,children:(0,V.jsxs)(C,{children:[(0,V.jsx)(c,{variant:`ghost`,disabled:o,onClick:t,children:`Cancel`}),(0,V.jsx)(c,{variant:`primary`,type:`submit`,disabled:o||d,children:o?`Renaming…`:`Rename agent`})]})})]})})}function ge(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 _e(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 ve(e,t=100){let{turnsEnded:n}=k();return M(n=>a(`/api/teams/${encodeURIComponent(e)}/messages?limit=${t}`,{signal:n}).then(e=>e.messages),[e,t,n])}function ye({messages:e,limit:t=20,empty:n=`No messages between Agents yet.`}){let{agentById:r}=W(),i=N();if(e.length===0)return(0,V.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,V.jsxs)(`ol`,{className:`m-0 list-none space-y-1.5 p-0`,children:[e.slice(0,t).map(e=>{let t=ge(e.payload);return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`details`,{className:`group rounded-[10px] border border-border bg-card`,children:[(0,V.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-col gap-0.5 px-2.5 py-2 [&::-webkit-details-marker]:hidden`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,V.jsx)(E,{identity:r(e.fromAgentId)?.identity,size:18}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:a(e.fromAgentId)}),(0,V.jsx)(b,{className:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,V.jsx)(E,{identity:r(e.toAgentId)?.identity,size:18}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-foreground`,children:a(e.toAgentId)}),e.readAt===null&&(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-warning/15 px-1.5 text-xs font-semibold text-warning`,children:`unread`}),i&&(0,V.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),className:`ml-auto shrink-0 text-muted-foreground`,children:O(e.createdAt)})]}),(0,V.jsx)(`span`,{className:`line-clamp-2 break-words text-sm leading-snug text-mocha group-open:hidden`,children:t})]}),(0,V.jsx)(`p`,{className:`m-0 whitespace-pre-wrap break-words border-t border-frost/70 px-2.5 py-2 text-sm leading-snug text-chocolate`,children:t})]})},e.id)}),e.length>t&&(0,V.jsxs)(`li`,{className:`px-1 text-xs text-muted-foreground`,children:[`The newest `,t,` of `,e.length,` loaded.`]})]})}export{L as _,_e as a,Q as c,q as d,U as f,R as g,z as h,$ as i,Z as l,G as m,ve as n,fe as o,W as p,ge as r,he as s,ye as t,me as u,F as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,m as n,u as r}from"./createLucideIcon-DkniuEtD.js";import{t as i}from"./ConfirmDialog-VqBOFZEp.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{Q as e,X as t,a as n,m as r,r as i,s as a,t as o,u as s}from"./createLucideIcon-DkniuEtD.js";import{t as c}from"./UnsavedChangesGuard-BmdwLH99.js";import{t as l}from"./Button-UiegBKOK.js";import{_ as u,a as d,c as f,st as p,t as m,y as h}from"./parts-LZxl9Gvc.js";import{A as g,N as _,j as v,t as y,w as b,y as x}from"./index-YW0gXPfk.js";import{t as S}from"./ConfirmDialog-VqBOFZEp.js";import{E as C,T as w,d as T,w as E}from"./manage-SRGSx8n2.js";import{t as D}from"./ManagePage-BJWZd1ts.js";import{n as O,r as k}from"./AgentTemplateParts-CEn_4qVs.js";var A=o(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),j=o(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),M=e(t(),1),N=r(),P=e=>`/api/profiles/${encodeURIComponent(e)}`;function F(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}function I({loaded:e,chat:t,skills:r,onDirtyChange:a,onSaved:o}){let{profile:s}=e,[c,l]=(0,M.useState)(()=>({name:s.name,model:s.defaultModel,mode:s.skillsMode,picked:new Set(e.defaultSkills)})),[u,f]=(0,M.useState)(c.name),[p,m]=(0,M.useState)(c.model),[y,x]=(0,M.useState)(c.mode),[S,C]=(0,M.useState)(()=>new Set(c.picked)),[w,T]=(0,M.useState)(!1),[E,D]=(0,M.useState)(null),[k,A]=(0,M.useState)(!1),I=u.trim()!==c.name||p!==c.model||y!==c.mode||y===`selected`&&!F(S,c.picked);(0,M.useEffect)(()=>a(I),[I,a]);let L=()=>{A(!1),D(null)};async function R(e){if(e.preventDefault(),!(!I||w||!p)){T(!0),D(null);try{let e={name:u.trim(),model:p,mode:y,picked:y===`selected`?new Set(S):c.picked},t=e.mode!==c.mode||e.mode===`selected`&&!F(e.picked,c.picked);await i(P(s.id),{method:`PATCH`,body:{...e.name===c.name?{}:{name:e.name},...e.model===c.model?{}:{defaultModel:e.model},...t?{skillsMode:e.mode,...e.mode===`selected`?{defaultSkills:[...e.picked]}:{}}:{}}}),l(e),f(e.name),C(new Set(e.picked)),A(!0),await o()}catch(e){D(n(e))}finally{T(!1)}}}return(0,N.jsx)(h,{labelledBy:`template-settings`,icon:(0,N.jsx)(j,{className:`size-5`}),title:`Settings`,description:`What it is called, the model its Agents answer with, and the skills they start with.`,children:(0,N.jsxs)(d,{onSubmit:R,children:[(0,N.jsxs)(`div`,{className:`grid items-start gap-x-3 gap-y-4 sm:grid-cols-2`,children:[(0,N.jsx)(g,{label:`Name`,value:u,disabled:w,placeholder:s.id,className:`max-w-none`,onChange:e=>{L(),f(e)}}),(0,N.jsx)(_,{kit:!0,label:`Default model`,value:p,models:t,required:!0,onChange:e=>{L(),m(e)}})]}),(0,N.jsx)(O,{mode:y,picked:S,skills:r,disabled:w,onModeChange:e=>{L(),x(e)},onPickedChange:e=>{L(),C(e)}}),(0,N.jsx)(b,{busy:w,disabled:!I||!p,status:v({error:E,dirty:I,saved:k,savedText:`Saved. Agents spawned from now on get these.`,footnote:`Agents already spawned keep their own model and skills.`})})]})})}function L(e){return{soul:e.soul,identity:e.identity,bootstrap:e.bootstrap,agents:e.agents,tools:e.tools}}function R({loaded:e,starter:t,onDirtyChange:r}){let a=e.profile.id,[o,s]=(0,M.useState)(()=>L(e.files)),[c,u]=(0,M.useState)(()=>L(e.files)),[m,g]=(0,M.useState)(`soul`),[_,y]=(0,M.useState)(!1),[x,S]=(0,M.useState)(null),[C,w]=(0,M.useState)(!1),T=k.filter(e=>c[e.key]!==o[e.key]),E=T.length>0;(0,M.useEffect)(()=>r(E),[E,r]);let D=k.find(e=>e.key===m)??k[0],O=D?c[D.key]:null;function j(e,t){w(!1),S(null),u(n=>({...n,[e]:t}))}let F=(0,M.useRef)({});function I(e){g(e),F.current[e]?.focus()}function R(e,t){let n=k.length-1,r=e.key===`ArrowRight`?t===n?0:t+1:e.key===`ArrowLeft`?t===0?n:t-1:e.key===`Home`?0:e.key===`End`?n:null,i=r===null?void 0:k[r];i&&(e.preventDefault(),I(i.key))}let[z,B]=(0,M.useState)(null);async function V(e){if(e.preventDefault(),!E||_)return;y(!0),S(null);let t={};try{for(let e of T){let n=c[e.key];n!==null&&(await i(`${P(a)}/files/${encodeURIComponent(e.name)}`,{method:`PUT`,body:{content:n}}),t[e.key]=n)}w(!0)}catch(e){S(n(e))}finally{s(e=>({...e,...t})),y(!1)}}return(0,N.jsxs)(h,{labelledBy:`template-files`,icon:(0,N.jsx)(A,{className:`size-5`}),title:`Files`,description:`Each Agent spawned from this template gets its own copy of these, and may change it.`,children:[(0,N.jsx)(f,{children:(0,N.jsx)(`div`,{role:`tablist`,"aria-label":`Template files`,className:`flex max-w-full gap-1 overflow-x-auto rounded-xl border border-border bg-muted/50 p-1`,children:k.map((e,t)=>{let n=e.key===m,r=c[e.key]===null,i=c[e.key]!==o[e.key];return(0,N.jsxs)(`button`,{type:`button`,role:`tab`,id:`template-file-${e.key}`,ref:t=>{F.current[e.key]=t},"aria-selected":n,"aria-controls":`template-file-panel`,tabIndex:n?0:-1,onClick:()=>g(e.key),onKeyDown:e=>R(e,t),className:p(`unstyled inline-flex items-center gap-1.5 whitespace-nowrap rounded-lg border px-2.5 py-1.5 font-mono text-xs font-semibold transition-colors sm:px-3`,n?`border-border bg-card text-foreground shadow-baziu-sm`:`border-transparent hover:bg-card/70 hover:text-foreground`,!n&&(r?`text-muted-foreground/70`:`text-muted-foreground`)),children:[e.name,i&&(0,N.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,role:`img`,"aria-label":`not saved`})]},e.key)})})}),(0,N.jsx)(`div`,{id:`template-file-panel`,role:`tabpanel`,"aria-labelledby":`template-file-${m}`,children:(0,N.jsxs)(d,{onSubmit:V,children:[D&&O===null?(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-xl border border-dashed border-border bg-muted/30 px-4 py-8 text-center`,children:[(0,N.jsxs)(`p`,{className:`m-0 text-base font-semibold text-foreground`,children:[`This template has no `,D.name]}),(0,N.jsxs)(`p`,{className:`m-0 max-w-md text-sm text-muted-foreground`,children:[D.hint,` It starts from the built-in text and is saved with the other files.`]}),(0,N.jsxs)(l,{variant:`ghost`,className:`mt-2`,disabled:_,onClick:()=>{B(D.key),j(D.key,t[D.key])},children:[`Add `,D.name]})]}):D&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:D.hint}),(0,N.jsx)(`textarea`,{autoFocus:z===D.key,"aria-label":`${D.name} contents`,value:O??``,disabled:_,spellCheck:!1,rows:22,onChange:e=>j(D.key,e.target.value),className:`min-h-[18rem] resize-y font-mono text-sm leading-[1.6]`},D.key)]}),(0,N.jsx)(b,{busy:_,disabled:!E,label:T.length>1?`Save ${T.length} files`:`Save`,status:v({error:x,dirty:E,saved:C,savedText:`Saved. Agents spawned from now on get these files.`,footnote:`Saving keeps every file you changed, not only the one in view.`}),extra:E&&(0,N.jsx)(l,{variant:`ghost`,disabled:_,onClick:()=>{u(o),S(null),F.current[m]?.focus()},children:`Discard changes`})})]})})]})}function z(){let{loaded:e,chat:t,skills:n,starter:r,templates:o,teamTemplates:d,teams:f}=y.useLoaderData(),{profile:p}=e,h=s(),g=a(),[_,v]=(0,M.useState)(!1),[b,O]=(0,M.useState)(!1),[k,A]=(0,M.useState)(!1),[j,P]=(0,M.useState)(!1),F=(0,M.useCallback)(e=>v(e),[]),L=(0,M.useCallback)(e=>O(e),[]),z=o.find(e=>e.id===p.id),B=z?E(z,d):null,V=T(p.defaultModel,t),H=w(p);return(0,N.jsxs)(D,{title:H,description:(0,N.jsxs)(N.Fragment,{children:[`What every Agent spawned from this template starts with.`,` `,z?`${C(z,d)}.`:``,` Agents already spawned keep their own copies.`]}),actions:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(l,{variant:`primary`,onClick:()=>A(!0),children:`Spawn an agent`}),(0,N.jsx)(u,{label:`More for ${H}`,items:[{label:`Delete template…`,danger:!0,disabledReason:B,onSelect:()=>P(!0)}]})]}),children:[(0,N.jsx)(c,{when:_||b,subject:`template changes`}),V.missing&&(0,N.jsx)(m,{tone:`warning`,lead:`Its default model, ${V.name}, is not in Chat.`,action:(0,N.jsx)(`a`,{href:`/config`,className:`ghost-btn no-underline`,children:`Open Setup → Models`}),children:`Agents spawned from it are refused until it is. Choose another model below, or add it in Setup.`}),(0,N.jsx)(I,{loaded:e,chat:t,skills:n,onDirtyChange:F,onSaved:()=>h.invalidate({sync:!0})}),(0,N.jsx)(R,{loaded:e,starter:r,onDirtyChange:L}),k&&(0,N.jsx)(x,{profiles:o,teams:f,profileId:p.id,onClose:()=>A(!1)}),(0,N.jsx)(S,{open:j,onOpenChange:P,title:`Delete the ${H} template?`,description:(0,N.jsx)(`p`,{className:`m-0`,children:`This deletes the template and its files. No Agent and no Team template uses it.`}),confirmLabel:`Delete template`,onConfirm:async()=>{await i(`/api/profiles/${encodeURIComponent(p.id)}`,{method:`DELETE`}),await g({to:`/templates/agents`})}})]})}export{z as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,r as i,s as a,t as o,u as s}from"./createLucideIcon-DkniuEtD.js";import{t as c}from"./UnsavedChangesGuard-BmdwLH99.js";import{t as l}from"./Button-UiegBKOK.js";import{_ as u,g as d}from"./parts-LZxl9Gvc.js";import{t as f}from"./bot-Bb--PFVU.js";import{C as p,S as m,a as h,b as g,d as _,f as v,g as y,h as b,i as x,l as S,m as C,n as w,o as T,p as E,r as D,s as O,t as k,u as A,x as j,y as M}from"./style-CA2GAk9b.js";import{t as N}from"./plus-CLGNN5QX.js";import{A as P,E as F,O as I,n as L}from"./index-YW0gXPfk.js";import{t as R}from"./ConfirmDialog-VqBOFZEp.js";import{t as z}from"./Segmented-MYKKTuZO.js";import{s as B}from"./manage-SRGSx8n2.js";import{t as V}from"./SpawnTeamModal-DG5UbJNK.js";import{t as H}from"./ManagePage-BJWZd1ts.js";var U=o(`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`}]]),W=o(`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`}]]),G=e(t(),1),K=r();function q({data:e,selected:t}){return(0,K.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,K.jsx)(x,{type:`target`,position:A.Left,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,K.jsx)(`span`,{className:`flex h-8 w-8 flex-none items-center justify-center rounded-md bg-sapphire-glow text-sapphire`,children:(0,K.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-sm font-semibold text-chocolate`,children:e.member.name}),(0,K.jsx)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate text-xs text-mocha-light`,children:e.subtitle})]}),e.isolated&&(0,K.jsx)(W,{className:`h-4 w-4 flex-none text-[#a56568]`,"aria-label":`No connections`}),e.incomplete&&(0,K.jsx)(U,{className:`h-4 w-4 flex-none text-warning`,"aria-label":`No template`})]}),(0,K.jsx)(x,{type:`source`,position:A.Right,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`})]})}function J({data:e,selected:t}){return(0,K.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,K.jsx)(x,{type:`target`,position:A.Left,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(p,{className:`h-4 w-4 flex-none text-rose-baziu`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-chocolate`,children:e.label})]}),(0,K.jsx)(x,{type:`source`,position:A.Right,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`})]})}var Y={agent:q,outside:J},X={};function Z({document:e,selectedId:t,incompleteKeys:n,templateNames:r=X,onSelect:i,onConnect:a,onRemoveEdge:o,onMoveMember:s,onOpenMember:c}){let l=(0,G.useMemo)(()=>[{id:v,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===v,draggable:!1,deletable:!1},...e.members.map(i=>{let a=e.mode===`restricted`&&!e.edges.some(e=>e.from===i.key||e.to===i.key),o=n.has(i.key);return{id:i.key,type:`agent`,position:i.position,data:{member:i,subtitle:r[i.profileId]??`No template`,isolated:a,incomplete:o},ariaLabel:`${i.name}${a?`, no connections`:``}${o?`, no template`:``}`,selected:t===i.key,deletable:!1}})],[e,n,t,r]),[u,d,f]=O(l);(0,G.useEffect)(()=>{d(e=>{let t=new Map(e.map(e=>[e.id,e]));return l.map(e=>({...t.get(e.id),...e}))})},[l,d]);let p=(0,G.useMemo)(()=>e.edges.map(e=>{let n=C(e.from,e.to);return{id:n,source:e.from,target:e.to,selected:t===n,markerEnd:{type:S.ArrowClosed,width:16,height:16},style:{stroke:`var(--color-sapphire)`,strokeWidth:1.7}}}),[e.edges,t]),m=e=>{e.source&&e.target&&a(e.source,e.target)},g=t=>e.members.find(e=>e.key===t);return(0,K.jsx)(`div`,{className:`h-full min-h-[420px] w-full bg-ivory`,children:(0,K.jsxs)(T,{nodes:u,edges:p,nodeTypes:Y,onConnect:m,onNodesChange:f,onNodeClick:(e,t)=>i(t.id),onNodeDoubleClick:(e,t)=>{let n=g(t.id);n&&c(n)},onEdgeClick:(e,t)=>i(t.id),onPaneClick:()=>i(null),onEdgesDelete:e=>{for(let t of e)o(t.source,t.target)},onNodeDragStop:(e,t)=>{g(t.id)&&s(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,K.jsx)(k,{variant:w.Dots,gap:20,size:1.2,color:`var(--color-fawn)`}),(0,K.jsx)(D,{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,K.jsx)(h,{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; connections only matter for messages to and from other Teams.`,restricted:`Members message each other only along connections.`};function $({template:e,profiles:t,onSaved:r,onDirtyChange:a}){let[o,s]=(0,G.useState)(()=>j(e)),[u,d]=(0,G.useState)(o),[f,p]=(0,G.useState)(`flow`),[h,v]=(0,G.useState)(null),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(!1),T=!M(o,u);(0,G.useEffect)(()=>a?.(T),[T,a]);let E=(0,G.useMemo)(()=>new Set(u.members.filter(e=>!t.some(t=>t.id===e.profileId)).map(e=>e.key)),[u.members,t]),D=(0,G.useMemo)(()=>Object.fromEntries(t.map(e=>[e.id,`${e.name||e.id} template`])),[t]),O=(e,t,n)=>d(r=>g(r,e,t,n)),k=async()=>{b(!0),S(null);try{let n=j(await i(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`PUT`,body:m(u,t)}));s(n),d(n),v(null),S({text:`Saved.`,ok:!0}),await r?.()}catch(e){S({text:n(e),ok:!1})}finally{b(!1)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(c,{when:T,subject:`Team template draft`}),(0,K.jsxs)(`section`,{className:`min-w-0 overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,"aria-label":`Roster and connections`,children:[(0,K.jsxs)(`header`,{className:`flex flex-wrap items-end gap-x-3 gap-y-3 border-b border-border px-4 py-4 sm:px-5`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1 basis-60`,children:(0,K.jsx)(P,{label:`Name`,value:u.name,disabled:y,className:`max-w-none`,onChange:e=>d(t=>({...t,name:e}))})}),(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:`Messaging`}),(0,K.jsx)(z,{label:`Messaging`,value:u.mode,onChange:e=>d(t=>({...t,mode:e})),options:[{id:`open`,label:`Open`},{id:`restricted`,label:`Restricted`}]})]}),(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:`View`}),(0,K.jsx)(z,{label:`View`,value:f,onChange:p,options:[{id:`flow`,label:`Flow`},{id:`matrix`,label:`Matrix`}]})]}),(0,K.jsx)(`p`,{className:`m-0 basis-full text-sm text-muted-foreground`,children:Q[u.mode]})]}),(0,K.jsxs)(`div`,{className:`grid min-h-[620px] grid-cols-1 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,K.jsx)(`div`,{className:`min-h-[480px] overflow-hidden`,children:f===`flow`?(0,K.jsx)(Z,{document:u,templateNames:D,selectedId:h,incompleteKeys:E,onSelect:v,onConnect:(e,t)=>O(e,t,!0),onRemoveEdge:(e,t)=>O(e,t,!1),onMoveMember:(e,t)=>d(n=>({...n,members:n.members.map(n=>n.key===e?{...n,position:t}:n)})),onOpenMember:e=>v(e.key)}):(0,K.jsx)(_,{document:u,selectedId:h,onSelect:v,onToggle:O})}),(0,K.jsx)(`aside`,{className:`border-t border-border p-4 lg:border-l lg:border-t-0`,children:(0,K.jsx)(ee,{document:u,selectedId:h,profiles:t,onDraft:d,onSelect:v,onToggle:O})})]}),(0,K.jsxs)(`footer`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-border px-4 py-4 sm:px-5`,children:[(0,K.jsx)(l,{variant:`primary`,disabled:!T||y,onClick:()=>void k(),children:y?`Saving…`:`Save`}),T&&(0,K.jsx)(l,{variant:`ghost`,disabled:y,onClick:()=>w(!0),children:`Discard changes`}),(0,K.jsx)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 basis-56 text-sm font-medium ${x&&!x.ok||T?`text-warning`:x?`text-success`:`text-muted-foreground`}`,children:x&&!x.ok?`Nothing was saved: ${x.text}`:T?`Not saved yet.`:x?`Saved. Teams spawned from now on get this roster.`:`Teams already spawned keep their own Agents and connections.`})]})]}),(0,K.jsx)(R,{open:C,title:`Discard your changes to this template?`,description:(0,K.jsx)(`p`,{children:`The saved roster and connections stay as they are.`}),confirmLabel:`Discard changes`,onConfirm:()=>{d(o),v(null),S(null)},onOpenChange:w})]})}function ee({document:e,selectedId:t,profiles:n,onDraft:r,onSelect:i,onToggle:a}){let o=[...e.members.map(e=>e.key),v],s=e.edges.find(e=>C(e.from,e.to)===t),c=t&&o.includes(t)?t:null,u=e.members.find(e=>e.key===c),f=e=>r(t=>({...t,members:t.members.map(t=>t.key===u?.key?{...t,...e}:t)}));if(s)return(0,K.jsxs)(`div`,{className:`grid gap-3`,children:[(0,K.jsx)(`h3`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:`Connection`}),(0,K.jsxs)(`p`,{className:`m-0 text-sm`,children:[b(e,s.from),` may message `,b(e,s.to),`.`]}),(0,K.jsx)(`div`,{children:(0,K.jsx)(l,{variant:`danger`,onClick:()=>{a(s.from,s.to,!1),i(null)},children:`Remove connection`})})]});if(!c)return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsxs)(`h3`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:[e.members.length===1?`1 Agent`:`${e.members.length} Agents`,` ·`,` `,e.edges.length===1?`1 connection`:`${e.edges.length} connections`]}),(0,K.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:`Select an Agent to choose who it may message, or drag from one Agent's dot to another. A message to another Team needs a connection to Other teams here, and one from Other teams in that Team.`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`team-template-user-md`,className:`m-0 text-sm font-semibold text-foreground`,children:`USER.md`}),(0,K.jsx)(`textarea`,{id:`team-template-user-md`,rows:6,value:e.userMd??``,onChange:e=>{let t=e.target.value;r(e=>({...e,userMd:t||null}))},className:`mt-1.5 font-mono text-[0.85em]`}),(0,K.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`What every Agent of a Team spawned from it knows about you.`})]}),(0,K.jsx)(`div`,{children:(0,K.jsxs)(l,{variant:`ghost`,onClick:()=>r(e=>({...e,members:[...e.members,{key:`draft:${crypto.randomUUID()}`,profileId:n[0]?.id??``,name:`Agent ${e.members.length+1}`,position:E(e.members.length)}]})),children:[(0,K.jsx)(N,{className:`size-4`,"aria-hidden":`true`}),` Add an Agent`]})})]});let p=u&&n.some(e=>e.id===u.profileId);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsx)(`h3`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:u?u.name||`Agent`:`Other teams`}),u&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(P,{label:`Name`,value:u.name,className:`max-w-none`,onChange:e=>f({name:e})}),(0,K.jsx)(F,{label:`Template`,value:u.profileId,className:`max-w-none`,options:[...p?[]:[{value:u.profileId,label:u.profileId||`Choose a template`}],...n.map(e=>({value:e.id,label:e.name||e.id}))],onChange:e=>f({profileId:e})}),!p&&(0,K.jsx)(d,{tone:`warning`,children:`Choose a template: an Agent cannot be spawned without one.`})]}),(0,K.jsxs)(`fieldset`,{className:`m-0 grid min-w-0 gap-3 border-0 p-0`,children:[(0,K.jsx)(`legend`,{className:`mb-2 p-0 text-sm font-semibold text-foreground`,children:`May message`}),o.filter(e=>e!==c).map(t=>(0,K.jsx)(I,{label:b(e,t),checked:y(e,c,t),onChange:e=>a(c,t,e)},t))]}),u&&(0,K.jsx)(`div`,{children:(0,K.jsx)(l,{variant:`danger`,onClick:()=>{r(e=>({...e,members:e.members.filter(e=>e.key!==u.key),edges:e.edges.filter(e=>e.from!==u.key&&e.to!==u.key)})),i(null)},children:`Remove this Agent`})})]})}function te(){let{template:e,profiles:t,teams:n}=L.useLoaderData(),r=a(),o=s(),[c,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1);return(0,K.jsxs)(H,{title:e.name,description:`A roster of ${B(e.slots.length,`Agent`)} and ${B(e.edges.length,`connection`)}. Spawning it creates them in a new Team or one that exists; Teams already spawned keep their own.`,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(l,{variant:`primary`,disabled:e.slots.length===0||m,"aria-describedby":m?`spawn-needs-save`:void 0,onClick:()=>d(!0),children:`Spawn this Team`}),(0,K.jsx)(u,{label:`More for ${e.name}`,items:[{label:`Delete template…`,danger:!0,onSelect:()=>p(!0)}]})]}),children:[m&&(0,K.jsx)(`p`,{id:`spawn-needs-save`,className:`m-0 text-sm font-medium text-warning`,children:`Save the roster to spawn it as it is on screen.`}),(0,K.jsx)($,{template:e,profiles:t,onSaved:()=>o.invalidate({sync:!0}),onDirtyChange:h}),c&&(0,K.jsx)(V,{template:e,teams:n,onClose:()=>d(!1),onSpawned:e=>{d(!1),r({to:`/`,search:{team:e,panel:`team`}})}}),(0,K.jsx)(R,{open:f,onOpenChange:p,title:`Delete the ${e.name} Team template?`,description:(0,K.jsx)(`p`,{className:`m-0`,children:`Teams already spawned from it keep their Agents and connections.`}),confirmLabel:`Delete template`,onConfirm:async()=>{await i(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`DELETE`}),await r({to:`/templates/teams`})}})]})}export{te as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,r as i,t as a,u as o}from"./createLucideIcon-DkniuEtD.js";import{t as s}from"./Button-UiegBKOK.js";import{a as c,d as l,g as u,h as d,o as f,s as p,y as m}from"./parts-LZxl9Gvc.js";import{t as h}from"./key-round-BpK4-E3T.js";import{t as g}from"./plus-CLGNN5QX.js";import{A as _,a as v}from"./index-YW0gXPfk.js";import{t as y}from"./ConfirmDialog-VqBOFZEp.js";import{t as b}from"./ConfigPage-CUbHBhzx.js";var x=a(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),S=e(t(),1);function C(e){let t=e.label.trim(),n=e.days.trim(),r={};n!==``&&(!/^\d+$/.test(n)||Number(n)<1)&&(r.days=`A whole number of days, 1 or more. Empty means it never expires.`);let i=t===``&&n!==``?`A token needs a label to tell it from the others.`:null;return t===``||r.days?{problems:r,missing:i,body:null}:{problems:r,missing:i,body:{label:t,...n?{expiresInDays:Number(n)}:{}}}}function w(e,t){return e.revokedAt?{label:`Revoked`,tone:`neutral`}:e.expiresAt!==null&&e.expiresAt<=t?{label:`Expired`,tone:`neutral`}:{label:`Active`,tone:`success`}}function T(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}var E=r();function D({onMinted:e}){let[t,r]=(0,S.useState)({label:``,days:``}),[a,o]=(0,S.useState)(null),[l,d]=(0,S.useState)(!1),[f,p]=(0,S.useState)(null),h=C(t),v=e=>{p(null),r(t=>({...t,...e}))};async function y(t){if(t.preventDefault(),!(!h.body||l)){d(!0),p(null);try{let{token:t}=await i(`/api/tokens`,{body:h.body});o(t),r({label:``,days:``}),await e()}catch(e){p(n(e))}finally{d(!1)}}}return(0,E.jsx)(m,{labelledBy:`access-mint`,icon:(0,E.jsx)(g,{className:`size-5`}),title:`Mint a new token`,description:`One for each other device or script, so that each can be revoked on its own.`,children:(0,E.jsxs)(c,{onSubmit:y,children:[(0,E.jsxs)(`div`,{className:`grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,18rem)_minmax(0,11rem)]`,children:[(0,E.jsx)(_,{label:`Label`,value:t.label,disabled:l,placeholder:`e.g. laptop-tailscale`,onChange:e=>v({label:e})}),(0,E.jsx)(_,{label:`Expires in days`,value:t.days,disabled:l,placeholder:`never`,inputMode:`numeric`,problem:h.problems.days,onChange:e=>v({days:e})})]}),(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,E.jsx)(s,{variant:`primary`,type:`submit`,disabled:l||!h.body,children:l?`Creating…`:`Create`}),f?(0,E.jsxs)(`p`,{role:`alert`,className:`m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning`,children:[`Nothing was created: `,f]}):h.missing&&(0,E.jsx)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning`,children:h.missing})]}),a&&(0,E.jsx)(u,{tone:`warning`,title:`Copy this token now; it cannot be shown again.`,children:(0,E.jsx)(`code`,{className:`mt-1 block break-all bg-transparent p-0 text-[0.85em] text-foreground`,children:a})})]})})}function O({tokens:e,sessions:t,includeRevoked:n,now:r,onRevoked:a}){let[o,c]=(0,S.useState)(null),u=e=>t.some(t=>t.current&&t.tokenId===e?.id);return(0,E.jsxs)(m,{labelledBy:`access-tokens`,icon:(0,E.jsx)(h,{className:`size-5`}),title:`Tokens`,description:`Each signs in to the HTTP API, the CLI and the web UI, with full access.`,action:(0,E.jsx)(`a`,{className:`ghost-btn`,href:n?`/config/access`:`/config/access?all=1`,children:n?`Hide revoked`:`Show revoked`}),children:[e.length===0?(0,E.jsx)(p,{className:`py-4 text-sm text-muted-foreground`,children:`No tokens yet; mint one above.`}):(0,E.jsx)(f,{children:e.map(e=>{let t=e.kind===`bootstrap`,n=w(e,r);return(0,E.jsx)(d,{title:e.label,chip:(0,E.jsx)(l,{tone:n.tone,children:n.label}),meta:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{children:t?`bootstrap (auth.json)`:e.kind}),(0,E.jsxs)(`span`,{children:[`created `,T(e.createdAt)]}),(0,E.jsxs)(`span`,{children:[`last used `,e.lastUsedAt?T(e.lastUsedAt):`never`]}),(0,E.jsxs)(`span`,{children:[`expires `,e.expiresAt?T(e.expiresAt):`never`]}),(0,E.jsx)(`code`,{children:e.id})]}),actions:!e.revokedAt&&!t&&(0,E.jsx)(s,{variant:`danger`,"aria-label":`Revoke ${e.label}`,onClick:()=>c(e),children:`Revoke`})},e.id)})}),(0,E.jsx)(y,{open:o!==null,onOpenChange:e=>{e||c(null)},title:`Revoke ${o?.label??``}?`,description:(0,E.jsxs)(`p`,{className:`m-0`,children:[`This permanently revokes token `,(0,E.jsx)(`code`,{children:o?.id}),` and ends every browser session opened with it.`,u(o)&&` This includes the session you are using now.`]}),confirmLabel:`Revoke token and sessions`,onConfirm:async()=>{o&&(await i(`/api/tokens/${encodeURIComponent(o.id)}`,{method:`DELETE`}),await a(u(o)))}})]})}function k({sessions:e,onRevoked:t}){let[n,r]=(0,S.useState)(null);return(0,E.jsxs)(m,{labelledBy:`access-sessions`,icon:(0,E.jsx)(x,{className:`size-5`}),title:`Browser sessions`,description:`A session ends after 30 days without use. Revoking a token also ends every session opened with it.`,children:[e.length===0?(0,E.jsx)(p,{className:`py-4 text-sm text-muted-foreground`,children:`No active browser sessions.`}):(0,E.jsx)(f,{children:e.map(e=>(0,E.jsx)(d,{title:e.tokenLabel,chip:e.current&&(0,E.jsx)(l,{tone:`success`,children:`This browser`}),meta:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{children:[`last seen `,T(e.lastSeenAt)]}),(0,E.jsxs)(`span`,{children:[`expires `,T(e.expiresAt)]}),(0,E.jsx)(`code`,{children:e.id})]}),actions:(0,E.jsx)(s,{variant:`danger`,"aria-label":e.current?`Revoke the session of this browser`:`Revoke the ${e.tokenLabel} session last seen ${T(e.lastSeenAt)}`,onClick:()=>r(e),children:`Revoke`})},e.id))}),(0,E.jsx)(y,{open:n!==null,onOpenChange:e=>{e||r(null)},title:`Revoke the ${n?.tokenLabel??``} browser session?`,description:(0,E.jsxs)(`p`,{className:`m-0`,children:[`This ends browser session `,(0,E.jsx)(`code`,{children:n?.id}),n?.current?` and signs this browser out.`:`. The token stays active for later logins.`]}),confirmLabel:n?.current?`Sign out this browser`:`Revoke session`,onConfirm:async()=>{n&&(await i(`/api/sessions/${encodeURIComponent(n.id)}`,{method:`DELETE`}),await t(n.current))}})]})}function A(){let{tokens:e,sessions:t,now:n}=v.useLoaderData(),r=v.useSearch().all===1,i=o();async function a(e){e?window.location.assign(`/login`):await i.invalidate({sync:!0})}return(0,E.jsxs)(b,{title:`Access`,description:(0,E.jsxs)(E.Fragment,{children:[`Every token has full access to the HTTP API, the CLI and browser login. The`,` `,(0,E.jsx)(`code`,{children:`bootstrap`}),` token from `,(0,E.jsx)(`code`,{children:`~/.bazilion/auth.json`}),` cannot be revoked; mint a separate, revocable token for each other device.`]}),children:[(0,E.jsx)(D,{onMinted:()=>i.invalidate({sync:!0})}),(0,E.jsx)(O,{tokens:e,sessions:t,includeRevoked:r,now:n,onRevoked:a}),(0,E.jsx)(k,{sessions:t,onRevoked:a})]})}export{A as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./createLucideIcon-DkniuEtD.js";var t=e=>`/api/agents/${encodeURIComponent(e)}`;function n(n){return e(`${t(n)}/archive`,{method:`POST`})}function r(n){return e(`${t(n)}/unarchive`,{method:`POST`})}function i(n){return e(t(n),{method:`DELETE`})}function a(n,r){return e(t(n),{method:`PATCH`,body:{name:r}})}export{r as i,i as n,a as r,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,o as i,r as a,u as o}from"./createLucideIcon-DkniuEtD.js";import{t as s}from"./Button-UiegBKOK.js";import{_ as c,c as l,d as u,g as d,h as f,i as p,m,o as h,r as g,v as _,y as v}from"./parts-LZxl9Gvc.js";import{t as y}from"./bot-Bb--PFVU.js";import{E as b,G as x,W as S,X as C,u as w,y as T}from"./index-YW0gXPfk.js";import{t as ee}from"./ConfirmDialog-VqBOFZEp.js";import{t as te}from"./Segmented-MYKKTuZO.js";import{i as ne,n as E,t as D}from"./agent-actions-BgE9fKHH.js";import{T as O,c as k,n as A,r as j,s as M}from"./manage-SRGSx8n2.js";import{t as N}from"./ManagePage-BJWZd1ts.js";var P=e(t(),1),F=r();function I({agent:e,teams:t,onClose:r,onMoved:i}){let o=t.filter(t=>t.id!==e.teamId),[c,l]=(0,P.useState)(o[0]?.id??``),[u,f]=(0,P.useState)(!1),[p,m]=(0,P.useState)(null),h=t.find(t=>t.id===e.teamId)?.name??e.teamId;async function g(t){if(t.preventDefault(),!(!c||u)){f(!0),m(null);try{await a(`/api/agents/${encodeURIComponent(e.id)}/team`,{method:`PATCH`,body:{teamId:c}}),await i()}catch(e){m(n(e)),f(!1)}}}return(0,F.jsx)(S,{title:`Move ${e.name}`,description:`From ${h} to another Team. Its conversations and files go with it; its connections stay behind, so it joins the other Team with none.`,busy:u,onClose:r,children:(0,F.jsxs)(`form`,{onSubmit:e=>void g(e),className:`grid gap-4`,children:[(0,F.jsx)(b,{label:`Team`,value:c,options:o.map(e=>({value:e.id,label:e.name})),disabled:u,className:`max-w-none`,onChange:l}),p&&(0,F.jsx)(d,{tone:`warning`,role:`alert`,title:`It was not moved.`,children:p}),(0,F.jsxs)(x,{children:[(0,F.jsx)(s,{variant:`ghost`,disabled:u,onClick:r,children:`Cancel`}),(0,F.jsx)(s,{variant:`primary`,type:`submit`,disabled:u||!c,children:u?`Moving…`:`Move to ${t.find(e=>e.id===c)?.name??`Team`}`})]})]})})}function L({agents:e,teams:t,templates:r,chat:a,onSpawn:o,onChanged:b}){let[x,S]=(0,P.useState)(``),[w,T]=(0,P.useState)(`current`),[N,L]=(0,P.useState)(null),[z,B]=(0,P.useState)(null),[V,H]=(0,P.useState)(null),[U,W]=(0,P.useState)(null),[G,K]=(0,P.useState)(null),q=A(e),J=(0,P.useRef)(null),[Y,X]=(0,P.useState)(!1);(0,P.useEffect)(()=>{!Y||N!==null||(J.current?.focus(),X(!1))},[Y,N]);let Z=k(e,t,w,x);async function Q(e,t){L(e.id),B(null);try{await t(),await b()}catch(e){B(n(e))}finally{L(null)}}let re=e=>Q(e,async()=>{await D(e.id),H(e),X(!0)}),$=e=>Q(e,async()=>{await ne(e.id),H(null)});return(0,F.jsxs)(v,{labelledBy:`manage-agents`,icon:(0,F.jsx)(y,{className:`size-5`}),title:`Agents`,description:`Grouped by Team. An archived Agent keeps its files and conversations, takes no work, and can be restored.`,children:[(0,F.jsxs)(l,{children:[(0,F.jsx)(_,{label:`Find an Agent`,placeholder:`Find by name, creature or vibe`,value:x,onChange:S,className:`min-w-0 flex-1 basis-60`}),(0,F.jsx)(te,{label:`Which Agents`,value:w,onChange:T,options:[{id:`current`,label:`Current ${q.current}`},{id:`archived`,label:`Archived ${q.archived}`},{id:`all`,label:`All`}]})]}),V&&(0,F.jsx)(g,{className:`py-3`,children:(0,F.jsxs)(d,{tone:`neutral`,actions:(0,F.jsxs)(s,{ref:J,variant:`ghost`,disabled:N!==null,onClick:()=>void $(V),children:[`Restore `,V.name]}),children:[V.name,` is archived. It keeps its files and conversations and takes no work until it is restored.`]})}),z&&(0,F.jsx)(g,{className:`py-3`,children:(0,F.jsx)(d,{tone:`warning`,role:`alert`,title:`That did not work.`,children:z})}),e.length===0?(0,F.jsx)(p,{icon:(0,F.jsx)(y,{className:`size-5`}),title:`No Agents yet`,action:(0,F.jsx)(s,{variant:`primary`,disabled:r.length===0||t.length===0,onClick:o,children:`Spawn an agent`}),children:`An Agent is spawned from a template into a Team, and starts talking as soon as it is.`}):Z.length===0?(0,F.jsx)(p,{title:x.trim()?`No Agent matches “${x.trim()}”`:R(w),children:x.trim()?`Try another name, or look in all of them.`:`Archived Agents appear here when there are any.`}):Z.map(({team:e,agents:n})=>(0,F.jsxs)(`section`,{"aria-label":e.name,children:[(0,F.jsx)(m,{title:e.name,meta:`${M(n.length,`Agent`)} · ${e.policyMode===`restricted`?`Restricted`:`Open`}`,action:(0,F.jsx)(i,{to:`/`,search:{team:e.id,panel:`team`},children:`Open Team`})}),(0,F.jsx)(h,{children:n.map(e=>{let n=r.find(t=>t.id===e.profileId),o=j(e,r,a),l=e.status===`archived`,d=[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `);return(0,F.jsx)(f,{inline:!0,leading:(0,F.jsx)(C,{identity:e.identity,size:32}),title:(0,F.jsx)(i,{to:`/`,search:{agent:e.id},className:`text-foreground hover:text-primary`,children:e.name}),chip:l&&(0,F.jsx)(u,{tone:`neutral`,children:`Archived`}),meta:(0,F.jsxs)(F.Fragment,{children:[d&&(0,F.jsx)(`span`,{children:d}),(0,F.jsxs)(`span`,{children:[n?(0,F.jsx)(`a`,{href:`/templates/agents/${encodeURIComponent(n.id)}`,children:O(n)}):e.profileId,` `,`template`]}),o&&(0,F.jsxs)(`span`,{className:o.missing?`font-semibold text-warning`:``,children:[o.name,o.missing?`, not in Chat`:o.inherited?``:`, its own`]})]}),actions:(0,F.jsxs)(F.Fragment,{children:[l&&(0,F.jsx)(s,{variant:`ghost`,disabled:N===e.id,onClick:()=>void $(e),children:`Restore`}),(0,F.jsx)(c,{label:`More for ${e.name}`,disabled:N===e.id,items:[t.length>1&&{label:`Move to another Team…`,onSelect:()=>W(e)},!l&&{label:`Archive`,onSelect:()=>void re(e)},{label:`Delete permanently…`,danger:!0,onSelect:()=>K(e)}]})]})},e.id)})})]},e.id)),U&&(0,F.jsx)(I,{agent:U,teams:t,onClose:()=>W(null),onMoved:async()=>{W(null),await b()}}),(0,F.jsx)(ee,{open:G!==null,onOpenChange:e=>{e||K(null)},title:`Delete ${G?.name??`this Agent`} permanently?`,description:(0,F.jsx)(`p`,{className:`m-0`,children:`This removes the Agent, its conversations, messages, schedules, skill attachments and its folder. It cannot be undone. To keep them, archive it instead.`}),confirmLabel:`Delete permanently`,onConfirm:async()=>{G&&(await E(G.id),V?.id===G.id&&H(null),await b())}})]})}function R(e){return e===`archived`?`No archived Agents`:`No current Agents`}function z(){let{agents:e,templates:t,teams:n,chat:r}=w.useLoaderData(),i=o(),[a,c]=(0,P.useState)(!1);return(0,F.jsxs)(N,{title:`Agents`,description:`Every Agent in every Team. Open one to talk to it; its model, skills and schedules are in its side panel.`,actions:(0,F.jsx)(s,{variant:`primary`,disabled:t.length===0||n.length===0,onClick:()=>c(!0),children:`Spawn an agent`}),children:[(0,F.jsx)(L,{agents:e,teams:n,templates:t,chat:r,onSpawn:()=>c(!0),onChanged:()=>i.invalidate({sync:!0})}),a&&(0,F.jsx)(T,{profiles:t,teams:n,onClose:()=>c(!1)})]})}export{z as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,m as n,r,s as i,u as a}from"./createLucideIcon-DkniuEtD.js";import{t as o}from"./Button-UiegBKOK.js";import{_ as s,d as c,h as l,i as u,o as d,y as f}from"./parts-LZxl9Gvc.js";import{t as p}from"./file-text-DzbjpYrV.js";import{r as m,y as h}from"./index-YW0gXPfk.js";import{t as g}from"./ConfirmDialog-VqBOFZEp.js";import{E as _,T as v,d as y,s as b,w as x,y as S}from"./manage-SRGSx8n2.js";import{t as C}from"./ManagePage-BJWZd1ts.js";import{t as w}from"./AgentTemplateParts-CEn_4qVs.js";var T=e(t()),E=n();function D(){let{templates:e,teamTemplates:t,chat:n,skills:D,starter:O,teams:k}=m.useLoaderData(),A=m.useSearch(),j=i(),M=a(),[N,P]=(0,T.useState)(A.new===1),[F,I]=(0,T.useState)(null),[L,R]=(0,T.useState)(null);return(0,E.jsxs)(C,{title:`Agent templates`,description:`What a new Agent starts with: its files, its model and its skills. Agents already spawned keep their own copies.`,actions:(0,E.jsx)(o,{variant:`primary`,onClick:()=>P(!0),children:`New Agent template`}),children:[(0,E.jsx)(f,{labelledBy:`manage-agent-templates`,icon:(0,E.jsx)(p,{className:`size-5`}),title:`Agent templates`,description:`Open one to edit its files, model and skills.`,action:(0,E.jsx)(c,{tone:`neutral`,children:b(e.length,`template`)}),children:e.length===0?(0,E.jsx)(u,{icon:(0,E.jsx)(p,{className:`size-5`}),title:`No Agent templates yet`,action:(0,E.jsx)(o,{variant:`primary`,onClick:()=>P(!0),children:`New Agent template`}),children:`Every Agent is spawned from a template.`}):(0,E.jsx)(d,{children:e.map(e=>{let r=y(e.defaultModel,n),i=x(e,t),a=`/templates/agents/${encodeURIComponent(e.id)}`;return(0,E.jsx)(l,{inline:!0,title:(0,E.jsx)(`a`,{href:a,className:`text-foreground hover:text-primary`,children:v(e)}),chip:r.missing&&(0,E.jsx)(c,{tone:`warning`,children:`Model not in Chat`}),meta:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{className:r.missing?`font-semibold text-warning`:``,children:r.name}),(0,E.jsx)(`span`,{children:S(e)}),(0,E.jsx)(`span`,{children:_(e,t)}),(0,E.jsx)(`code`,{children:e.id})]}),actions:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(o,{variant:`ghost`,"aria-label":`Spawn an agent from ${v(e)}`,onClick:()=>I(e.id),children:`Spawn`}),(0,E.jsx)(s,{label:`More for ${v(e)}`,items:[{label:`Edit files and settings`,onSelect:()=>{window.location.assign(a)}},{label:`Delete…`,danger:!0,disabledReason:i,onSelect:()=>R(e)}]})]})},e.id)})})}),N&&(0,E.jsx)(w,{chat:n,skills:D,starter:O,onClose:()=>{P(!1),A.new&&j({to:`/templates/agents`,search:{},replace:!0})}}),F&&(0,E.jsx)(h,{profiles:e,teams:k,profileId:F,onClose:()=>I(null)}),(0,E.jsx)(g,{open:L!==null,onOpenChange:e=>{e||R(null)},title:`Delete the ${L?v(L):``} template?`,description:(0,E.jsx)(`p`,{className:`m-0`,children:`This deletes the template and its files. No Agent and no Team template uses it.`}),confirmLabel:`Delete template`,onConfirm:async()=>{L&&(await r(`/api/profiles/${encodeURIComponent(L.id)}`,{method:`DELETE`}),await M.invalidate({sync:!0}))}})]})}export{D as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DkniuEtD.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{Q as e,X as t,a as n,m as r,o as i,r as a}from"./createLucideIcon-DkniuEtD.js";import{t as o}from"./Button-UiegBKOK.js";import{c as s,d as c,g as l,h as u,i as d,o as f,r as p,t as m,y as h}from"./parts-LZxl9Gvc.js";import{Dt as ee,Ot as g,P as _,S as v,d as te,jt as y,wt as b}from"./index-YW0gXPfk.js";import{t as ne}from"./use-resource-CQaIZbpy.js";import{t as x}from"./Segmented-MYKKTuZO.js";import{a as S,m as re,o as ie,t as C}from"./manage-SRGSx8n2.js";var w=e(t()),T=r(),E=`/api/attention?state=all&limit=200`,D=`/api/attention/summary`,O=5e3;function k(e){switch(e.kind){case`agent_question`:return`Answer`;case`command_approval`:return`Decide`;case`lesson_proposal`:return`Review lesson`;default:return`Open`}}var A=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});function j(){let e=te.useLoaderData(),[t,r]=(0,w.useState)(e.list),[j,M]=(0,w.useState)(e.summary),[N,P]=(0,w.useState)(e.now),[F,I]=(0,w.useState)(`open`),[L,R]=(0,w.useState)(`all`),[z,B]=(0,w.useState)(`all`),[V,H]=(0,w.useState)(null),[U,W]=(0,w.useState)(null),G=y(),K=ne(),q=t.items.filter(e=>(F===`all`||(F===`open`?e.acknowledgedAt===null:e.acknowledgedAt!==null))&&(L===`all`||e.kind===L)&&(z===`all`||e.severity===z)),J=t.items.filter(e=>e.acknowledgedAt===null).length,Y=t.items.filter(e=>e.acknowledgeable&&e.acknowledgedAt===null).length,X=[...new Set([...t.degraded,...j.degraded].map(e=>e.kind))],Z=ie(j);async function Q(){let[e,t]=await Promise.all([a(E),a(D)]);r(e),M(t),P(Date.now())}(0,w.useEffect)(()=>{if(V!==null)return;let e=setInterval(()=>{document.visibilityState===`visible`&&Q().catch(()=>{})},O);return()=>clearInterval(e)},[V]);async function $(e,t){H(e),W(null);try{let e=await t();e&&W({text:e,failed:!1})}catch(e){W({text:n(e),failed:!0})}finally{await Q().catch(()=>{}),G.refresh(),H(null)}}let ae=(e,t)=>$(e.key,async()=>{let n=`/api/attention/${encodeURIComponent(e.key)}`;return await a(t?`${n}/acknowledge`:`${n}/acknowledgement`,{method:t?`POST`:`DELETE`}),null}),oe=()=>$(`all`,async()=>{let{acknowledged:e}=await a(`/api/attention/acknowledge-all`,{method:`POST`});return`Acknowledged ${e===1?`1 item`:`${e} items`}. Lesson proposals and paused queues stay open until they are dealt with.`});return(0,T.jsxs)(g,{children:[(0,T.jsx)(ee,{title:`Attention`,description:`Decisions waiting for you and failures worth a look, from every Agent. Act on an item where it comes from; acknowledge the ones that only inform.`}),(0,T.jsx)(m,{tone:Z.tone,lead:Z.lead,children:Z.rest}),X.length>0&&(0,T.jsxs)(m,{tone:`warning`,role:`alert`,lead:`Some items could not be loaded.`,children:[X.map(e=>C[e]).join(`, `),` are missing from the list.`]}),(0,T.jsxs)(h,{labelledBy:`attention-items`,icon:(0,T.jsx)(b,{className:`size-5`}),title:`Items`,description:`Open items need you; history keeps the ones you acknowledged.`,action:Y>0&&(0,T.jsxs)(o,{variant:`ghost`,disabled:V!==null,onClick:()=>void oe(),children:[`Acknowledge `,Y===1?`the informational one`:`informational ones`]}),children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(x,{label:`Which items`,value:F,onChange:I,options:[{id:`open`,label:`Open ${J}`},{id:`acknowledged`,label:`History`},{id:`all`,label:`All`}]}),(0,T.jsx)(v,{label:`Kind`,value:L,onChange:R,options:[{value:`all`,label:`All kinds`},...Object.entries(C).map(([e,t])=>({value:e,label:t}))]}),(0,T.jsx)(v,{label:`Severity`,value:z,onChange:B,options:[{value:`all`,label:`Any severity`},{value:`action_required`,label:`Waiting for you`},{value:`error`,label:`Errors`},{value:`warning`,label:`Warnings`}]})]}),U&&(0,T.jsx)(p,{className:`py-3`,children:(0,T.jsx)(l,{tone:U.failed?`warning`:`success`,role:U.failed?`alert`:`status`,children:U.text})}),q.length===0?(0,T.jsx)(d,{icon:(0,T.jsx)(b,{className:`size-5`}),title:F===`open`&&L===`all`&&z===`all`?`Nothing needs you`:`No item matches`,children:`Items come from Agents' questions and commands to approve, learning reviews, schedules, follow-up queues and message loops.`}):(0,T.jsx)(f,{children:q.map(e=>{let t=re(e.severity),n=e.acknowledgedAt!==null;return(0,T.jsx)(u,{title:e.title,chip:n?(0,T.jsx)(c,{tone:`neutral`,children:`Acknowledged`}):(0,T.jsx)(c,{tone:t.tone,children:t.label}),meta:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{children:C[e.kind]}),(0,T.jsx)(`span`,{children:S(e)}),e.expiresAt!==void 0&&K&&(0,T.jsxs)(`span`,{className:`text-warning`,children:[`Waits until `,A(e.expiresAt)]}),(0,T.jsx)(`time`,{dateTime:new Date(e.occurredAt).toISOString(),title:new Date(e.occurredAt).toISOString().slice(0,16).replace(`T`,` `),children:_(e.occurredAt,N)})]}),actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(i,{to:e.href,className:`ghost-btn no-underline`,children:k(e)}),e.acknowledgeable&&(0,T.jsx)(o,{variant:`ghost`,disabled:V!==null,onClick:()=>void ae(e,!n),children:n?`Back to open`:`Acknowledge`})]}),children:(0,T.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:e.diagnostic})},e.key)})})]})]})}export{j as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DkniuEtD.js";var t=e(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DkniuEtD.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,X as t,a as n,m as r,r as i,t as a,u as o}from"./createLucideIcon-DkniuEtD.js";import{t as s}from"./Button-UiegBKOK.js";import{b as c,d as l,n as u,nt as d,ot as f,t as p,v as m,x as h,y as g}from"./parts-LZxl9Gvc.js";import{t as _}from"./images-DSYgPKM7.js";import{t as v}from"./chevron-right-bs0TUSl2.js";import{t as y}from"./message-square-DM2MP9vF.js";import{t as b}from"./plus-CLGNN5QX.js";import{B as x,H as S,I as C,L as w,P as T,U as E,V as D,W as O,f as k,z as A}from"./index-YW0gXPfk.js";import{r as j}from"./use-resource-CQaIZbpy.js";import{t as M}from"./ConfirmDialog-VqBOFZEp.js";import{t as N}from"./Segmented-MYKKTuZO.js";import{t as P}from"./ConfigPage-CUbHBhzx.js";import{c as F,l as I,o as L,s as R,t as z}from"./AddProviderDialog-CkwSq3C7.js";var B=a(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),V=e(t(),1),H=r(),U=[{id:`all`,label:`All`},{id:`images`,label:`Sees images`},{id:`reasoning`,label:`Reasoning`}],W=80;function G({providers:e,chat:t,onClose:r,onSaved:a,onAddProvider:o}){let[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(`all`),[f,p]=(0,V.useState)(!1),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),S=j(async t=>{let n=await Promise.all(e.map(async e=>({provider:e,catalog:await i(`/api/config/providers/${encodeURIComponent(e.id)}/catalog`,{signal:t})})));return g(Object.fromEntries(n.map(({provider:e,catalog:t})=>[e.id,t.models.filter(e=>e.selected).map(e=>e.id)]))),n},[e.map(e=>e.id).join(`,`)]),C=h??{},w=(e,t)=>C[e]?.includes(t)??!1,T=(e,t)=>g(n=>{let r=n?.[e]??[];return{...n,[e]:r.includes(t)?r.filter(e=>e!==t):[...r,t]}}),E=(e,t)=>c?A(e,c):e.dated&&!f&&!w(t.id,e.id)?!1:u===`images`?e.images===!0:u===`reasoning`?e.reasoning===!0:!0,D=(0,V.useMemo)(()=>(S.data??[]).filter(({provider:e,catalog:t})=>{let n=t.models.filter(e=>e.selected).map(e=>e.id),r=C[e.id]??[];return n.length!==r.length||n.some(e=>!r.includes(e))}),[S.data,C]),k=t.filter(e=>e.usedBy.agents>0&&D.some(({provider:t})=>t.id===e.provider)&&!w(e.provider,e.id)),M=Object.values(C).reduce((e,t)=>e+t.length,0);async function P(){v(!0),b(null);try{for(let{provider:e}of D)await i(`/api/config/providers/${encodeURIComponent(e.id)}/models`,{method:`PUT`,body:{models:C[e.id]??[]}});await a(),r()}catch(e){b(n(e)),v(!1)}}return(0,H.jsxs)(O,{title:`Chat models`,description:`Tick the models your Agents may use. Each Agent and each template picks one of them.`,onClose:r,busy:_,className:`top-[4dvh] max-h-[92dvh] max-w-3xl translate-y-0 content-start`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(m,{label:`Search models`,placeholder:`Search by name, for example haiku`,value:c,onChange:l,className:`flex-1 basis-60`}),(0,H.jsx)(N,{label:`Show`,value:u,options:U,onChange:d})]}),(0,H.jsxs)(`div`,{className:`max-h-[min(58dvh,36rem)] min-h-40 overflow-y-auto rounded-xl border border-border`,children:[S.loading&&!S.data&&(0,H.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Reading the model lists…`}),S.error&&(0,H.jsx)(`div`,{role:`alert`,className:`p-4 text-sm text-danger`,children:S.error}),S.data?.length===0&&(0,H.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No provider is connected yet. Add one to see its models here.`}),(S.data??[]).map(({provider:e,catalog:t})=>{let n=t.models.filter(t=>E(t,e)),r=n.slice(0,W),i=t.models.filter(t=>t.dated&&!w(e.id,t.id)).length;return c&&n.length===0?null:(0,H.jsxs)(`section`,{"aria-label":e.displayName,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 border-b border-border bg-muted/50 px-4 py-2`,children:[(0,H.jsx)(`h3`,{className:`m-0 font-body text-xs font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:e.displayName}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(C[e.id]??[]).length,` of `,t.models.length,` in use`]}),t.listError&&(0,H.jsxs)(`span`,{className:`text-xs text-warning`,children:[`Its own list could not be read: `,t.listError]})]}),r.length===0&&(0,H.jsx)(`div`,{className:`border-b border-border px-4 py-3 text-sm text-muted-foreground`,children:t.models.length===0?`It lists no model.`:`Nothing matches.`}),r.map(t=>(0,H.jsx)(R,{model:{...t,suggested:!1},connect:e.connect,checked:w(e.id,t.id),disabled:_,onToggle:()=>T(e.id,t.id),className:`px-4 hover:bg-accent/30`},t.id)),n.length>r.length&&(0,H.jsxs)(`div`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground`,children:[n.length-r.length,` more: search to narrow them down.`]}),!c&&i>0&&(0,H.jsx)(`div`,{className:`border-b border-border px-4 py-1.5`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`text-xs font-semibold text-primary`,children:f?`Hide dated versions`:`Show ${i} dated ${i===1?`version`:`versions`} of the same models`})})]},e.id)})]}),k.length>0&&(0,H.jsxs)(`p`,{role:`status`,className:`m-0 rounded-xl bg-warning/10 px-3 py-2 text-sm text-warning`,children:[k.map(e=>x(e)).join(`, `),` `,k.length===1?`is`:`are`,` in use by Agents. They are refused until you give them another model in their Agent tab.`]}),y&&(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-xl bg-danger/10 px-3 py-2 text-sm text-danger`,children:y}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-frost pt-4`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 text-sm text-muted-foreground`,children:M===1?`1 model in Chat`:`${M} models in Chat`}),(0,H.jsx)(`button`,{type:`button`,onClick:o,className:`text-sm font-semibold text-primary`,children:`A model from another provider?`}),(0,H.jsx)(s,{variant:`ghost`,disabled:_,onClick:r,children:`Cancel`}),(0,H.jsx)(s,{variant:`primary`,disabled:_||D.length===0,onClick:()=>void P(),children:_?`Saving…`:`Save`})]})]})}function K({providers:e,chat:t,now:n,onOpen:r,onTestAll:i,testing:a}){let o=e.filter(e=>e.enabled);if(o.length===0)return null;let c=o.filter(e=>e.state===`failing`||e.state===`incomplete`),l=o.filter(e=>e.state===`untested`&&e.models.length>0);if(c.length>0)return(0,H.jsx)(`div`,{className:`grid gap-2`,children:c.map(e=>{let i=t.filter(t=>t.provider===e.id),a=i.reduce((e,t)=>e+t.usedBy.agents,0);return(0,H.jsx)(p,{tone:`warning`,lead:(0,H.jsxs)(H.Fragment,{children:[e.check?.failure?.title??`${e.displayName}: ${S(e,n).label.toLowerCase()}`,`.`]}),action:(0,H.jsxs)(s,{variant:`ghost`,onClick:()=>r(e.id),children:[`Open `,e.displayName]}),children:i.length===0?`No chat model runs on it.`:`${i.length===1?`1 chat model runs`:`${i.length} chat models run`} on it${a===0?``:`, used by ${a===1?`1 Agent`:`${a} Agents`}`}.`},e.id)})});if(l.length>0)return(0,H.jsx)(p,{tone:`neutral`,lead:l.length===1?`${l[0]?.displayName} has not been tested.`:`${l.length} providers have not been tested.`,action:(0,H.jsx)(s,{variant:`ghost`,disabled:a,onClick:i,children:a?`Testing…`:l.length===1?`Test it`:`Test them`}),children:`A test sends one short message to the cheapest model of each.`});let u=o.filter(e=>e.state===`working`);return u.length===0?null:(0,H.jsxs)(p,{tone:`success`,lead:u.length===1?`Your provider answers.`:`Every provider answers.`,action:(0,H.jsx)(s,{variant:`ghost`,disabled:a,onClick:i,children:a?`Testing…`:`Test again`}),children:[t.length===1?`1 chat model`:`${t.length} chat models`,` for your Agents.`]})}function q({chat:e,hasProviders:t,onPick:r,onChanged:a}){let[o,c]=(0,V.useState)(null),[l,f]=(0,V.useState)(null);async function p(t){let n=e.filter(e=>e.provider===t.provider&&e.id!==t.id).map(e=>e.id);await i(`/api/config/providers/${encodeURIComponent(t.provider)}/models`,{method:`PUT`,body:{models:n}}),await a()}function m(e){f(null),e.usedBy.agents>0||e.usedBy.templates.length>0?c(e):p(e).catch(e=>f(n(e)))}return(0,H.jsxs)(g,{labelledBy:`setup-chat`,icon:(0,H.jsx)(y,{className:`size-5`}),title:`Chat`,description:`The models Agents think with. Each Agent and each template uses one of them.`,action:(0,H.jsxs)(s,{variant:`primary`,disabled:!t,onClick:r,children:[(0,H.jsx)(b,{className:`size-4`,"aria-hidden":`true`}),`Add models`]}),children:[e.length>0&&(0,H.jsxs)(`div`,{"aria-hidden":`true`,className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5 hidden bg-muted/50 py-2 text-xs font-bold uppercase tracking-[0.08em] text-muted-foreground lg:flex`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-[2.2] basis-52`,children:`Model`}),(0,H.jsx)(`span`,{className:`w-28 shrink-0`,children:`Provider`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-[2] basis-48`,children:`Can do`}),(0,H.jsx)(`span`,{className:`w-40 shrink-0`,children:`Price per 1M tokens`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-[1.4] basis-36`,children:`Used by`}),(0,H.jsx)(`span`,{className:`w-8 shrink-0`})]}),e.map(e=>{let t=e.providerState===`failing`||e.providerState===`incomplete`;return(0,H.jsxs)(`div`,{className:`${u} min-h-16 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-[2.2] basis-52`,children:[(0,H.jsx)(`div`,{className:`text-base font-semibold text-foreground`,children:x(e)}),e.name&&(0,H.jsx)(`div`,{className:`break-all font-mono text-xs text-muted-foreground`,children:e.id})]}),(0,H.jsx)(`div`,{className:`w-28 shrink-0 text-sm`,children:e.providerName}),(0,H.jsx)(`div`,{className:`min-w-0 flex-[2] basis-48 text-sm ${t?`font-semibold text-warning`:`text-muted-foreground`}`,children:t?`${e.providerName} is not working`:w(e,e.providerConnect)}),(0,H.jsx)(`div`,{className:`w-40 shrink-0 text-sm`,children:D(e,e.providerConnect)}),(0,H.jsx)(`div`,{className:`min-w-0 flex-[1.4] basis-36 text-sm text-muted-foreground`,children:E(e.usedBy)}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Remove ${x(e)} from Chat`,onClick:()=>m(e),className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-danger`,children:(0,H.jsx)(d,{className:`size-4`,"aria-hidden":`true`})})]},e.value)}),e.length===0&&(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5 py-5 text-sm text-muted-foreground`,children:t?`No chat model yet. Agents cannot answer until one is added.`:`No chat model yet. Add a provider below, and its models appear here.`}),l&&(0,H.jsx)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5 py-3 text-sm text-danger`,children:l}),(0,H.jsx)(M,{open:o!==null,onOpenChange:e=>{e||c(null)},title:`Remove ${o?x(o):``} from Chat?`,description:o&&(0,H.jsxs)(`p`,{className:`m-0`,children:[`It is used by `,E(o.usedBy),`.`,` `,o.usedBy.agents>0&&`Those Agents are refused until you give them another model in their Agent tab. `,o.usedBy.templates.length>0&&`An Agent template on it moves to another model by itself.`]}),confirmLabel:`Remove from Chat`,onConfirm:async()=>{o&&await p(o)}})]})}function J({images:e,onConnect:t,onChanged:r}){let[a,o]=(0,V.useState)(null),[c,d]=(0,V.useState)(null),f=e.routes.find(t=>t.id===e.selected),p=f?.ready===!0,m=a??e.selected;async function h(e){o(e),d(null);try{await i(`/api/config/fields/BAZILION_IMAGE_MODEL`,{method:`PUT`,body:{value:e}}),await r()}catch(e){d(n(e))}finally{o(null)}}let v=(e,t,n,r)=>(0,H.jsxs)(`label`,{className:`${u} m-0 min-h-[3.25rem] py-2 ${n?`cursor-pointer`:``} ${m===e?`bg-accent/40`:``}`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`image-model`,checked:m===e,disabled:!n||a!==null,onChange:()=>void h(e),className:`m-0 size-[18px] shrink-0 accent-[var(--color-sapphire)]`}),t,(0,H.jsx)(`span`,{className:`ml-auto flex shrink-0 justify-end sm:w-44`,children:r})]},e);return(0,H.jsxs)(g,{labelledBy:`setup-images`,icon:(0,H.jsx)(_,{className:`size-5`}),title:`Images`,description:`What Agents draw with. One model for every Agent, up to four images a turn.`,action:(0,H.jsx)(l,{tone:p?`success`:f?`warning`:`neutral`,children:p?`On: ${f.model}`:f?`Needs ${f.needs}`:`Off`}),children:[e.routes.map(e=>v(e.id,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-[1.6] basis-60 text-base`,children:[(0,H.jsx)(`span`,{className:`font-semibold ${e.ready?`text-foreground`:`text-muted-foreground`}`,children:e.model}),` `,(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`through `,e.providerName]})]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 basis-44 text-sm text-muted-foreground`,children:e.billing})]}),e.ready,e.ready?(0,H.jsx)(`span`,{className:`text-sm font-semibold text-success`,children:`Ready`}):(0,H.jsx)(s,{variant:`ghost`,onClick:()=>t(e.provider),children:e.provider===`openai-codex`?`Sign in`:`Connect ${e.providerName}`}))),v(`off`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-[1.6] basis-60 text-base font-semibold text-foreground`,children:`Off`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 basis-44 text-sm text-muted-foreground`,children:`Agents have no image tool`})]}),!0,null),e.selected!==`off`&&!f&&(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5 py-3 text-sm text-warning`,children:[`BAZILION_IMAGE_MODEL is set to “`,e.selected,`”, which is not an image route. Choose one above.`]}),c&&(0,H.jsx)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5 py-3 text-sm text-danger`,children:c})]})}function Y({providers:e,total:t,images:n,now:r,onOpen:i,onAdd:a}){let o=n.routes.find(e=>e.id===n.selected&&e.ready);return(0,H.jsxs)(g,{labelledBy:`setup-providers`,icon:(0,H.jsx)(B,{className:`size-5`}),title:`Providers`,description:`The accounts and local servers your models run on.`,action:(0,H.jsxs)(s,{variant:`primary`,onClick:a,children:[(0,H.jsx)(b,{className:`size-4`,"aria-hidden":`true`}),`Add a provider`]}),children:[e.map(e=>{let t=e.enabled?e.models.length:0,n=[t>0?`Chat: ${t===1?`1 model`:`${t} models`}`:null,o?.provider===e.id?`Images`:null].filter(Boolean),a=S(e,r);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:`${u} min-h-[4.25rem] w-full py-3 text-left transition-colors hover:bg-accent/30`,children:[(0,H.jsx)(F,{name:e.displayName,tone:a.tone}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-[1.6] basis-56`,children:[(0,H.jsx)(`span`,{className:`block text-base font-semibold text-foreground`,children:e.displayName}),(0,H.jsx)(`span`,{className:`block truncate text-sm text-muted-foreground`,children:C(e)})]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 text-sm text-muted-foreground`,children:n.length>0?n.join(` · `):`Not used yet`}),(0,H.jsx)(I,{provider:e,now:r}),(0,H.jsx)(v,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]},e.id)}),e.length===0&&(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5 py-5 text-sm text-muted-foreground`,children:`No provider yet. Add one to give your Agents a model.`}),(0,H.jsxs)(`div`,{className:`${u} bg-muted/50 py-3 text-sm text-muted-foreground`,children:[t-e.length,` more can be added: a ChatGPT plan, API keys from OpenAI, Anthropic, Google and many others, or a model server on this computer.`]})]})}function X({field:e}){let t=o(),r=`/api/config/fields/${encodeURIComponent(e.envVar)}`,a=(0,V.useId)(),c=`${a}-description`,[l,u]=(0,V.useState)(e.kind===`config`?e.value??``:``),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),y=e.kind===`secret`&&l.trim().length===0;async function b(a){if(a.preventDefault(),y){m(e.set?`Paste a replacement value, or use remove credential to explicitly clear the stored secret.`:`A secret value is required.`);return}f(!0),m(null);try{await i(r,{method:`PUT`,body:{value:l}}),g(Date.now()),e.kind===`secret`&&u(``),await t.invalidate()}catch(e){m(n(e))}finally{f(!1)}}async function x(){await i(r,{method:`DELETE`}),u(``),m(null),g(Date.now()),await t.invalidate()}return(0,H.jsxs)(`form`,{onSubmit:b,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,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`label`,{htmlFor:a,className:`text-sm font-medium text-foreground`,children:e.label}),e.description&&(0,H.jsx)(`div`,{id:c,className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),(0,H.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer`,children:`Advanced identifier`}),(0,H.jsx)(`code`,{className:`mt-1 inline-block break-all font-mono`,children:e.envVar})]})]}),(0,H.jsx)(`div`,{className:`min-w-0`,children:e.kind===`config`?(0,H.jsx)(`input`,{id:a,type:`text`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{id:a,type:`password`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(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,H.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank keeps the current credential. Removal is a separate explicit action.`})]})}),(0,H.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,H.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),h&&Date.now()-h<2e3&&(0,H.jsx)(`span`,{role:`status`,className:`text-success ml-2`,children:`saved ✓`})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-self-end`,children:[(0,H.jsx)(s,{variant:`ghost`,type:`submit`,disabled:d||y,className:`text-xs`,children:`save`}),e.kind===`secret`&&e.set&&(0,H.jsx)(s,{variant:`danger`,className:`text-xs`,onClick:()=>v(!0),children:`remove`})]}),p&&(0,H.jsx)(`p`,{role:`alert`,className:`text-xs text-danger md:col-span-4`,children:p}),(0,H.jsx)(M,{open:_,title:`Remove ${e.label}?`,description:(0,H.jsxs)(`p`,{children:[`This permanently deletes the stored `,(0,H.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:x,onOpenChange:v})]})}var Z=`m-0 font-body text-xs font-bold uppercase tracking-[0.08em] text-muted-foreground`;function Q({provider:e,chat:t,imageRoutes:r,imageSelected:a,onClose:o,onChanged:l,onPickModels:u,onReconnect:d}){let p=(0,V.useMemo)(()=>Date.now(),[]),[m,g]=(0,V.useState)(null),[_,y]=(0,V.useState)(null),[b,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(!1),D=`/api/config/providers/${encodeURIComponent(e.id)}`,{state:k,check:A}=e,j=e.connect===`signin`,N=e.fields.filter(e=>!e.advanced),P=e.fields.filter(e=>e.advanced),F=t.reduce((e,t)=>e+t.usedBy.agents,0),I=r.find(e=>e.id===a);async function R(e,t){g(e),y(null);try{await t(),await l()}catch(e){y(n(e))}finally{g(null)}}let z=()=>R(`test`,()=>i(`${D}/test`,{method:`POST`})),B=e=>R(`switch`,()=>i(`${D}/enabled`,{method:`PUT`,body:{enabled:e}})),U=()=>R(`signin`,()=>i(`/api/auth/openai/login`,{method:`POST`}));async function W(){await i(D,{method:`DELETE`}),await l(),o()}let G=e.models.length>0,K=(e,t=!1)=>(0,H.jsx)(s,{variant:t?`primary`:`ghost`,disabled:m!==null,onClick:()=>void z(),children:e});return(0,H.jsxs)(O,{title:e.displayName,description:e.hint,onClose:o,busy:m===`signin`,className:`top-[4dvh] max-h-[92dvh] max-w-2xl translate-y-0 content-start gap-5`,children:[m===`test`?(0,H.jsx)(`div`,{className:`rounded-2xl border border-border bg-muted/40 p-4`,children:(0,H.jsx)(h,{children:`Asking for a short reply…`})}):m===`signin`?(0,H.jsx)(`div`,{className:`rounded-2xl border border-border bg-muted/40 p-4`,children:(0,H.jsx)(h,{children:`Waiting for the ChatGPT sign-in in the browser…`})}):k===`working`&&A?(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-success/30 bg-success/10 p-4 text-sm`,children:[(0,H.jsx)(f,{className:`size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,H.jsxs)(`div`,{className:`font-semibold text-foreground`,children:[A.modelName??A.model,` answered in `,((A.ms??0)/1e3).toFixed(1),` s`]}),(0,H.jsxs)(`div`,{className:`text-muted-foreground`,children:[`Tested `,T(A.at,p)]})]}),K(`Test again`)]}):k===`failing`&&A?.failure?(0,H.jsxs)(L,{failure:A.failure,children:[(0,H.jsxs)(`span`,{className:`mr-auto self-center text-xs text-muted-foreground`,children:[`Tried `,T(A.at,p)]}),A.failure.kind===`credentials`&&(0,H.jsx)(s,{variant:`ghost`,onClick:j?()=>void U():d,children:j?`Sign in again`:`Replace the key`}),K(`Try again`,!0)]}):k===`incomplete`?(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-warning/35 bg-warning/10 p-4 text-sm`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,H.jsx)(`div`,{className:`font-semibold text-foreground`,children:j?`Not signed in`:`Switched on, but its credentials are missing`}),(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:`Agents on its models are refused until it is connected again.`})]}),(0,H.jsx)(s,{variant:`primary`,onClick:j?()=>void U():d,children:j?`Sign in with ChatGPT`:`Connect`})]}):k===`off`?(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-border bg-muted/40 p-4 text-sm`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,H.jsx)(`div`,{className:`font-semibold text-foreground`,children:e.models.length===0?`Saved, not in use`:`Turned off`}),(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:e.models.length===0?`Connect it to choose its models and test it.`:`Its models are out of Chat until you turn it on again. What is saved stays saved.`})]}),e.models.length===0?(0,H.jsx)(s,{variant:`primary`,disabled:m!==null,onClick:d,children:`Connect`}):(0,H.jsx)(s,{variant:`primary`,disabled:m!==null||!e.configured,onClick:()=>void B(!0),children:`Turn on`})]}):(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-border bg-muted/40 p-4 text-sm`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-48`,children:[(0,H.jsx)(`div`,{className:`font-semibold text-foreground`,children:`Not tested yet`}),(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:G?`A test sends one short message to its cheapest model in Chat.`:`It has no model in Chat, so there is nothing to ask.`})]}),G&&K(`Test now`,!0)]}),_&&(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-xl bg-danger/10 px-3 py-2 text-sm text-danger`,children:_}),(0,H.jsxs)(`section`,{"aria-label":`Credentials`,children:[(0,H.jsx)(`h3`,{className:Z,children:j?`Sign-in`:e.connect===`local`?`Address`:`Credentials`}),(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1 basis-56 text-sm`,children:j?e.configured?(0,H.jsxs)(H.Fragment,{children:[`Signed in with your ChatGPT account`,e.account&&(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.account,`)`]}),`. Bazilion renews the sign-in by itself.`]}):`Not signed in.`:N.length===0?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:e.configured?`Read from the environment of the machine Bazilion runs on.`:`Not found in the environment of the machine Bazilion runs on.`}):(0,H.jsx)(`dl`,{className:`m-0 grid gap-1`,children:N.map(t=>(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-x-2`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:t.label}),(0,H.jsx)(`dd`,{className:`m-0 min-w-0 break-all font-mono text-[0.85em]`,children:t.kind===`secret`?t.set?`${t.preview??`saved`}, stored encrypted`:`not saved`:t.value||(e.address??`not set`)})]},t.envVar))})}),j?(0,H.jsx)(s,{variant:`ghost`,disabled:m!==null,onClick:()=>void U(),children:e.configured?`Sign in again`:`Sign in with ChatGPT`}):N.length>0&&(0,H.jsx)(s,{variant:`ghost`,disabled:m!==null,onClick:d,children:e.connect===`local`?`Change the address`:N.some(e=>e.kind===`secret`&&!e.set)?`Add the key`:`Replace the key`})]})]}),(0,H.jsxs)(`section`,{"aria-label":`Its models in Chat`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`h3`,{className:`${Z} flex-1`,children:`Its models in Chat`}),(0,H.jsx)(`button`,{type:`button`,onClick:u,className:`text-sm font-semibold text-primary`,children:`Choose models`})]}),(0,H.jsxs)(`ul`,{className:`m-0 mt-2 list-none divide-y divide-border overflow-hidden rounded-xl border border-border p-0`,children:[e.models.length===0&&(0,H.jsx)(`li`,{className:`px-3 py-2.5 text-sm text-muted-foreground`,children:`None of its models is in Chat.`}),e.models.map(e=>{let n=t.find(t=>t.id===e);return(0,H.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 px-3 py-2.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 font-semibold text-foreground`,children:n?x(n):e}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:n?E(n.usedBy):`Out of Chat while this is turned off`})]},e)})]}),r.length>0&&(0,H.jsx)(`p`,{className:`m-0 mt-2 text-sm text-muted-foreground`,children:I?`Images are drawn by ${I.model} through this provider.`:`Can also draw images: ${[...new Set(r.map(e=>e.model))].join(`, `)}.`})]}),(0,H.jsxs)(`section`,{"aria-label":`More settings`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":b,onClick:()=>S(e=>!e),className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[(0,H.jsx)(v,{className:`size-4 text-muted-foreground transition-transform ${b?`rotate-90`:``}`,"aria-hidden":`true`}),`More settings`]}),b&&(0,H.jsxs)(`div`,{className:`mt-2 grid gap-3 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm`,children:[(0,H.jsx)(`div`,{className:`font-semibold text-foreground`,children:`Agents may use this provider`}),(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:`Turn off to pause it without removing what is saved.`})]}),(0,H.jsx)(c,{checked:e.enabled,label:`Agents may use this provider`,disabled:m!==null||!e.enabled&&!e.configured,onChange:e=>void B(e)})]}),P.map(e=>(0,H.jsx)(X,{field:e},e.envVar)),e.fields.length>0&&(0,H.jsxs)(`p`,{className:`m-0 text-xs text-muted-foreground`,children:[`Setting names, for `,(0,H.jsx)(`code`,{children:`bazilion config set`}),` and the daemon’s environment:`,` `,e.fields.map(e=>e.envVar).join(`, `),`. A value set in the environment wins over the one saved here.`]})]})]}),(0,H.jsxs)(`section`,{"aria-label":`Disconnect`,className:`border-t border-frost pt-4`,children:[(0,H.jsxs)(s,{variant:`danger`,disabled:m!==null,onClick:()=>w(!0),children:[`Disconnect `,e.displayName]}),(0,H.jsxs)(`p`,{className:`m-0 mt-2 text-sm text-muted-foreground`,children:[`Removes`,` `,j?`the sign-in`:e.connect===`local`?`the address`:`the key`,`, its models from Chat and its test.`]})]}),(0,H.jsx)(M,{open:C,onOpenChange:w,title:`Disconnect ${e.displayName}?`,description:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`m-0`,children:[`This removes`,` `,j?`the saved ChatGPT sign-in`:e.connect===`local`?`the saved address`:`the saved credentials`,` `,`and takes its `,e.models.length===1?`model`:`models`,` out of Chat.`]}),F>0&&(0,H.jsxs)(`p`,{className:`m-0 mt-2`,children:[F===1?`1 Agent runs`:`${F} Agents run`,` on its models and will be refused until given another model. Agent templates move to another model by themselves.`]}),I&&(0,H.jsx)(`p`,{className:`m-0 mt-2`,children:`Image generation stops until another route is chosen.`})]}),confirmLabel:`Disconnect ${e.displayName}`,onConfirm:W})]})}function $(){let{providers:e,models:t,now:n}=k.useLoaderData(),r=k.useSearch(),a=k.useNavigate(),s=o(),[c,l]=(0,V.useState)(!1),u=e.filter(e=>e.listed),d=u.filter(e=>e.enabled),f=e=>void a({search:e}),p=()=>f({}),m=()=>s.invalidate({sync:!0}),h=e.find(e=>e.id===r.provider&&e.listed);async function g(){l(!0);try{await Promise.all(d.filter(e=>e.models.length>0).map(e=>i(`/api/config/providers/${encodeURIComponent(e.id)}/test`,{method:`POST`}).catch(()=>void 0))),await m()}finally{l(!1)}}return(0,H.jsxs)(P,{title:`Models`,description:`What your Agents think and draw with, and the accounts behind it.`,children:[(0,H.jsx)(K,{providers:u,chat:t.chat,now:n,testing:c,onOpen:e=>f({provider:e}),onTestAll:()=>void g()}),(0,H.jsx)(q,{chat:t.chat,hasProviders:d.length>0,onPick:()=>f({pick:!0}),onChanged:m}),(0,H.jsx)(J,{images:t.images,onConnect:e=>f({add:e}),onChanged:m}),(0,H.jsx)(Y,{providers:u,total:e.length,images:t.images,now:n,onOpen:e=>f({provider:e}),onAdd:()=>f({add:`new`})}),r.add&&(0,H.jsx)(z,{providers:e,imageRoutes:t.images.routes,start:r.add===`new`?void 0:r.add,onClose:p,onConnected:m,onOpenProvider:e=>f({provider:e})},r.add),r.pick&&(0,H.jsx)(G,{providers:d,chat:t.chat,onClose:p,onSaved:m,onAddProvider:()=>f({add:`new`})}),h&&(0,H.jsx)(Q,{provider:h,chat:t.chat.filter(e=>e.provider===h.id),imageRoutes:t.images.routes.filter(e=>e.provider===h.id),imageSelected:t.images.selected,onClose:p,onChanged:m,onPickModels:()=>f({pick:!0}),onReconnect:()=>f({add:h.id})},h.id)]})}export{$ as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function k(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function A(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+k(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(te,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+k(a,u),c+=j(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+k(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(A(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var re=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ie={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ie,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,re)}catch(e){re(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),f=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=d()}));function p(e){return e[e.length-1]}function m(e){return typeof e==`function`}function h(e,t){return m(e)?e(t):e}var g=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;function v(e){for(let t in e)if(g.call(e,t))return!0;return!1}var y=()=>Object.create(null),b=(e,t)=>x(e,t,y);function x(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=T(e)&&T(i);if(!a&&!(C(e)&&C(i)))return i;let o=a?e:S(e);if(!o)return i;let s=a?i:S(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:g.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=x(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function S(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!_.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!_.call(e,t))return!1;r.push(t)}return r}function C(e){if(!w(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!w(n)||!n.hasOwnProperty(`isPrototypeOf`))}function w(e){return Object.prototype.toString.call(e)===`[object Object]`}function T(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function E(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!E(e[r],t[r],n))return!1;return!0}if(C(e)&&C(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!E(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!E(e[o],t[o],n)))return!1;return i===a}return!1}function D(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function O(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function ee(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var te=/[\x00-\x1f\x7f"<>`{}]/g;function k(e){return e.replace(te,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function A(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return k(t)}var j=[`http:`,`https:`,`mailto:`,`tel:`];function M(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var ne={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},re=/[&><\u2028\u2029]/g;function ie(e){return e.replace(re,e=>ne[e])}function ae(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=A(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=A(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function oe(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function se(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function N(){throw Error(`Invariant failed`)}function P(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var F=4,I=5;function L(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function R(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=L(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function z(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=R(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=H(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=H(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=U(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=U(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=U(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=H(n.fullPath??n.from);e.kind=I,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=H(n.fullPath??n.from);e.kind=F,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)z(e,t,r,s,i,a,o)}function B(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function V(e){if(e.pathless)for(let t of e.pathless)V(t);if(e.static)for(let t of e.static.values())V(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())V(t);if(e.dynamic?.length){e.dynamic.sort(B);for(let t of e.dynamic)V(t)}if(e.optional?.length){e.optional.sort(B);for(let t of e.optional)V(t)}if(e.wildcard?.length){e.wildcard.sort(B);for(let t of e.wildcard)V(t)}}function H(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function U(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function ce(e,t){let n=H(`/`),r=new Uint16Array(6);for(let t of e)z(!1,r,t,1,n,0);V(n),t.masksTree=n,t.flatCache=P(1e3)}function le(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=G(e,t.masksTree);return t.flatCache.set(e,r),r}function ue(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=H(`/`),z(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),G(r,o,n)}function de(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=G(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=pe(a.route)),t.matchCache.set(r,a),a}function fe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function W(e,t=!1,n){let r=H(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return z(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&N(),a[e.id]=e,s!==0&&e.path){let t=fe(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),V(r),{processedTree:{segmentTree:r,singleCache:P(1e3),matchCache:P(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function G(e,t,n=!1){let r=e.split(`/`),i=he(e,r,t,n);if(!i)return null;let[a]=K(e,r,i);return{route:i.node.route,rawParams:a}}function K(e,t,n){let r=me(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===F)break;if(u.kind===I){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function pe(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function me(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function he(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!p(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!J(l,n))continue;if(i.parse){if(!_e(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==F&&J(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===F||i.kind===2)&&J(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(_e(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&ge(p,o))return n;J(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+q(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+q(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+q(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+q(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function q(e,t){return 2**(e-t-1)}function ge(e,t){return e===2**(t-1)-1}function _e(e,t,n){let r,i;try{[r,i]=K(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function J(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===F)>(e.node.kind===F)||t.node.kind===F==(e.node.kind===F)&&t.depth>e.depth))):!0}function ve(e){return ye(e.filter(e=>e!==void 0).join(`/`))}function ye(e){return e.replace(/\/{2,}/g,`/`)}function be(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function xe(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Se(e){return xe(be(e))}function Y(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ce(e,t,n){return Y(e,n)===Y(t,n)}function we({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&p(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(p(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=ye(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function Te(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Ee(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Oe(e,n)).join(`/`):Oe(r,n):r}function De({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=R(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Ee(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ee(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ee(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Oe(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var ke=`Error preloading route! ☝️`,X=c(u(),1),Ae=X.use,je=typeof window<`u`?X.useLayoutEffect:X.useEffect;function Me(e){let t=X.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Ne(e,t,n={},r={}){X.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function Pe(e){let t=X.useRef(null);return X.useImperativeHandle(e,()=>t.current,[]),t}var Fe=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ie=o(((e,t)=>{t.exports=Fe()})),Le=Ie();function Re({children:e,fallback:t=null}){return Z()?(0,Le.jsx)(X.Fragment,{children:e}):(0,Le.jsx)(X.Fragment,{children:t})}function Z(){return X.useSyncExternalStore(ze,()=>!0,()=>!1)}function ze(){return()=>{}}var Be=X.createContext(null);function Ve(e){return X.useContext(Be)}var He=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ue=o(((e,t)=>{t.exports=He()})),We=o((e=>{var t=u(),n=Ue();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ge=o(((e,t)=>{t.exports=We()})),Ke=c(Ge(),1);function qe(e,t){return e===t}function Je(e,t,n=qe){let r=(0,X.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,X.useCallback)(()=>e?.get(),[e]);return(0,Ke.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function Ye(e){let t=Ve();return X.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var Xe=c(f(),1);function Ze(e,t){let n=Ve(),r=Pe(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:g,children:_,target:v,disabled:y,style:b,className:x,onClick:S,onBlur:C,onFocus:w,onMouseEnter:T,onMouseLeave:D,onTouchStart:O,ignoreBlocker:ee,params:te,search:k,hash:A,state:j,mask:ne,reloadDocument:re,unsafeRelative:ie,from:ae,_fromLocation:oe,...se}=e,N=Z(),P=X.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),F=Je(n.stores.location,e=>e,(e,t)=>e.href===t.href),I=X.useMemo(()=>{let e={_fromLocation:F,...P};return n.buildLocation(e)},[n,F,P]),L=I.maskedLocation?I.maskedLocation.publicHref:I.publicHref,R=I.maskedLocation?I.maskedLocation.external:I.external,z=X.useMemo(()=>it(L,R,n.history,y),[y,R,L,n.history]),B=X.useMemo(()=>{if(z?.external)return M(z.href,n.protocolAllowlist)?void 0:z.href;if(!at(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),M(s,n.protocolAllowlist)?void 0:s}catch{}},[s,z,n.protocolAllowlist]),V=X.useMemo(()=>{if(B)return!1;if(o?.exact){if(!Ce(F.pathname,I.pathname,n.basepath))return!1}else{let e=Y(F.pathname,n.basepath),t=Y(I.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!E(F.search,I.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?N&&F.hash===I.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,F,B,N,I.hash,I.pathname,I.search,n.basepath]),H=V?h(i,{})??$e:Qe,U=V?Qe:h(a,{})??Qe,ce=[x,H.className,U.className].filter(Boolean).join(` `),le=(b||H.style||U.style)&&{...b,...H.style,...U.style},[ue,de]=X.useState(!1),fe=X.useRef(!1),W=e.reloadDocument||B?!1:c??n.options.defaultPreload,G=l??n.options.defaultPreloadDelay??0,K=X.useCallback(()=>{n.preloadRoute({...P,_builtLocation:I}).catch(e=>{console.warn(e),console.warn(ke)})},[n,P,I]);Ne(r,X.useCallback(e=>{e?.isIntersecting&&K()},[K]),rt,{disabled:!!y||W!==`viewport`}),X.useEffect(()=>{fe.current||!y&&W===`render`&&(K(),fe.current=!0)},[y,K,W]);let pe=e=>{let t=e.currentTarget.getAttribute(`target`),r=v===void 0?t:v;if(!y&&!st(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Xe.flushSync)(()=>{de(!0)});let t=n.subscribe(`onResolved`,()=>{t(),de(!1)});n.navigate({...P,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:g,ignoreBlocker:ee})}};if(B)return{...se,ref:r,href:B,..._&&{children:_},...v&&{target:v},...y&&{disabled:y},...b&&{style:b},...x&&{className:x},...S&&{onClick:S},...C&&{onBlur:C},...w&&{onFocus:w},...T&&{onMouseEnter:T},...D&&{onMouseLeave:D},...O&&{onTouchStart:O}};let me=e=>{if(y||W!==`intent`)return;if(!G){K();return}let t=e.currentTarget;if(Q.has(t))return;let n=setTimeout(()=>{Q.delete(t),K()},G);Q.set(t,n)},he=e=>{y||W!==`intent`||K()},q=e=>{if(y||!W||!G)return;let t=e.currentTarget,n=Q.get(t);n&&(clearTimeout(n),Q.delete(t))};return{...se,...H,...U,href:z?.href,ref:r,onClick:$([S,pe]),onBlur:$([C,q]),onFocus:$([w,me]),onMouseEnter:$([T,me]),onMouseLeave:$([D,q]),onTouchStart:$([O,he]),disabled:!!y,target:v,...le&&{style:le},...ce&&{className:ce},...y&&et,...V&&tt,...N&&ue&&nt}}var Qe={},$e={className:`active`},et={role:`link`,"aria-disabled":!0},tt={"data-status":`active`,"aria-current":`page`},nt={"data-transitioning":`transitioning`},Q=new WeakMap,rt={rootMargin:`100px`},$=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function it(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function at(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var ot=X.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Ze(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return X.createElement(`a`,t,o)}return X.createElement(n,a,o)});function st(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var ct=[`__Host-bz_csrf`,`bz_csrf_dev`];function lt(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 ut(e,t){return lt(e,t)[0]}var dt=class extends Error{status;code;body;constructor(e,t,n,r){super(e),this.status=t,this.code=n,this.body=r}};function ft(){for(let e of ct){let t=ut(document.cookie,e);if(t)return{"x-bazilion-csrf":t}}return{}}async function pt(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 dt(r,e.status,i,n)}async function mt(e,t={}){let n=t.method??(t.body===void 0?`GET`:`POST`),r=n===`GET`?{}:ft(),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 pt(a);return a}async function ht(e,t={}){let n=await(await mt(e,t)).text();return n?JSON.parse(n):void 0}function gt(e){return e instanceof Error?e.message:String(e)}var _t=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),vt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),yt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),bt=e=>{let t=yt(e);return t.charAt(0).toUpperCase()+t.slice(1)},xt={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`},St=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ct=(0,X.createContext)({}),wt=()=>(0,X.useContext)(Ct),Tt=(0,X.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=wt()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,X.createElement)(`svg`,{ref:c,...xt,width:t??l??xt.width,height:t??l??xt.height,stroke:e??f,strokeWidth:m,className:_t(`lucide`,p,i),...!a&&!St(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,X.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Et=(e,t)=>{let n=(0,X.forwardRef)(({className:n,...r},i)=>(0,X.createElement)(Tt,{ref:i,iconNode:t,className:_t(`lucide-${vt(bt(e))}`,`lucide-${e}`,n),...r}));return n.displayName=bt(e),n};export{ce as A,ie as B,Se as C,le as D,pe as E,se as F,ee as G,v as H,D as I,x as J,p as K,ae as L,P as M,N,de as O,j as P,c as Q,E as R,we as S,xe as T,M as U,h as V,O as W,u as X,f as Y,o as Z,Me as _,gt as a,De as b,Je as c,Be as d,Re as f,je as g,Ae as h,mt as i,W as j,ue as k,Ge as l,Ie as m,dt as n,ot as o,Z as p,b as q,ht as r,Ye as s,Et as t,Ve as u,ye as v,be as w,ve as x,Te as y,oe as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DkniuEtD.js";var t=e(`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`}]]),n=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DkniuEtD.js";var t=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DkniuEtD.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`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`}]]);export{t as n,n as t};
|