bazilion 0.50.0 → 0.51.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 +245 -65
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +863 -209
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-Diic36c_.js +1 -0
- package/dist/web/client/assets/ConfigPage-pupvtSCX.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-GFDcHI1L.js +1 -0
- package/dist/web/client/assets/ConnectionsView-y1CeY-6U.js +1 -0
- package/dist/web/client/assets/Dialog-bg86_x4v.js +1 -0
- package/dist/web/client/assets/FieldRow-B8eIni5r.js +1 -0
- package/dist/web/client/assets/ModelSelect-DvCLUmkW.js +1 -0
- package/dist/web/client/assets/SectionTabs-D4ezA6U4.js +1 -0
- package/dist/web/client/assets/Segmented-Dh77vmpp.js +1 -0
- package/dist/web/client/assets/SkillFindings-BzLO1lNA.js +1 -0
- package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +1 -0
- package/dist/web/client/assets/SpawnDialog-YJX6UMBC.js +1 -0
- package/dist/web/client/assets/Tabs-f6bHvCGn.js +1 -0
- package/dist/web/client/assets/TeamForm-kda1HYZG.js +1 -0
- package/dist/web/client/assets/TeamThread-DFvbakHo.js +1 -0
- package/dist/web/client/assets/UnsavedChangesGuard-DBJikVgc.js +1 -0
- package/dist/web/client/assets/_id-BjNtLwak.js +1 -0
- package/dist/web/client/assets/_id-BklaQf3z.js +1 -0
- package/dist/web/client/assets/agents-D9cUF2d9.js +1 -0
- package/dist/web/client/assets/agents-wuBlzx4e.js +1 -0
- package/dist/web/client/assets/api-HC_YzjBy.js +1 -0
- package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +1 -0
- package/dist/web/client/assets/attention-8ZkSLl2e.js +1 -0
- package/dist/web/client/assets/check-BjgKoGvU.js +1 -0
- package/dist/web/client/assets/config-Con_BbSh.js +1 -0
- package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +1 -0
- package/dist/web/client/assets/index-Br9qkGM-.js +54 -0
- package/dist/web/client/assets/link-Cbztlp_R.js +1 -0
- package/dist/web/client/assets/login-llnOKSJc.js +1 -0
- package/dist/web/client/assets/mcp-zIUguMSI.js +1 -0
- package/dist/web/client/assets/plus-CWrKMtvA.js +1 -0
- package/dist/web/client/assets/routes-BY5uqJ2n.js +76 -0
- package/dist/web/client/assets/save-f9O-CQia.js +1 -0
- package/dist/web/client/assets/services-esLrcTwe.js +1 -0
- package/dist/web/client/assets/skills-DzYXksM0.js +1 -0
- package/dist/web/client/assets/style-Cdzqt_TJ.js +7 -0
- package/dist/web/client/assets/styles-BRSS6yrm.css +2 -0
- package/dist/web/client/assets/system-CsI66nyZ.js +1 -0
- package/dist/web/client/assets/teams-CHE_zpxS.js +1 -0
- package/dist/web/client/assets/teams-dxG9OESG.js +1 -0
- package/dist/web/client/assets/telegram-C3dGndJV.js +1 -0
- package/dist/web/client/assets/tokens-CNNH-Wr9.js +1 -0
- package/dist/web/client/assets/use-resource-BjnxgGvh.js +1 -0
- package/dist/web/client/assets/welcome-C8EOtc8P.js +1 -0
- package/dist/web/server/assets/AddProviderDialog-CR6TRYdZ.js +910 -0
- package/dist/web/server/assets/{ConfigPage-DSLM5CLw.js → ConfigPage-CIh3ohea.js} +4 -4
- package/dist/web/server/assets/ConfirmDialog-B79K2KEW.js +52 -0
- package/dist/web/server/assets/{ConnectionsView-DVLNH81Y.js → ConnectionsView-BIMYdp9C.js} +6 -4
- package/dist/web/server/assets/{ConfirmDialog-CvLZgbfY.js → Dialog-CVqpXxuN.js} +3 -50
- package/dist/web/server/assets/{FieldRow-DQBzMtcR.js → FieldRow-CHVhX2rS.js} +1 -1
- package/dist/web/server/assets/{ModelSelect-Vwro6OkL.js → ModelSelect-DrZrdndo.js} +7 -7
- package/dist/web/server/assets/{Rail-D8LhjS38.js → Rail-Cg-efcpA.js} +6 -64
- package/dist/web/server/assets/{SectionTabs-CNcvxbR8.js → SectionTabs-DrcgVeZd.js} +3 -2
- package/dist/web/server/assets/Segmented-3ZLdqa5U.js +18 -0
- package/dist/web/server/assets/{SkillFindings-DX8lCMG7.js → SkillFindings-DSDiL6hn.js} +1 -1
- package/dist/web/server/assets/{SpawnDialog-Brmkl_ll.js → SpawnDialog-BUUlLxE9.js} +2 -2
- package/dist/web/server/assets/{TeamThread-BNJi6gPM.js → TeamThread-5CjVPcDr.js} +3 -18
- package/dist/web/server/assets/{UnsavedChangesGuard-B3Lpl08z.js → UnsavedChangesGuard-CyF2Z9p1.js} +1 -1
- package/dist/web/server/assets/{_id-BH1631a8.js → _id-0fEWiVZX.js} +5 -5
- package/dist/web/server/assets/{_id-DIXUiIaB.js → _id-8bsYEcGg.js} +2 -2
- package/dist/web/server/assets/{_id-CA3QO7J5.js → _id-BvAaRSUW.js} +2 -2
- package/dist/web/server/assets/{_id-CO1PgvyG.js → _id-Dg6M_qfr.js} +5 -5
- package/dist/web/server/assets/{_id-E2N4gZ4O.js → _id-Dji7xr9C.js} +1 -1
- package/dist/web/server/assets/_tanstack-start-manifest_v-sxiIH4M7.js +214 -0
- package/dist/web/server/assets/{agents-CalSKogx.js → agents-BDA5yYZ2.js} +4 -4
- package/dist/web/server/assets/{agents-CdZvooeQ.js → agents-BTDxmp-F.js} +2 -2
- package/dist/web/server/assets/{agents-DPZVni4Q.js → agents-DM7guWF2.js} +2 -2
- package/dist/web/server/assets/{agents-DrkEwIpR.js → agents-DktqUffG.js} +7 -7
- package/dist/web/server/assets/{agents-C63VycUw.js → agents-xgZ9rsac.js} +1 -1
- package/dist/web/server/assets/{attention-BbE4yc-V.js → attention-CHQEQiZl.js} +2 -2
- package/dist/web/server/assets/{attention-DIyX3VMB.js → attention-De3-ehuf.js} +2 -2
- package/dist/web/server/assets/config-DOp28gcy.js +1067 -0
- package/dist/web/server/assets/config-DzgkbBoD.js +17 -0
- package/dist/web/server/assets/config-X7qWbbpH.js +20 -0
- package/dist/web/server/assets/{Page-KIL1CsME.js → createSsrRpc-CcLbajrF.js} +16 -1
- package/dist/web/server/assets/{mcp-Cf7KzOJ9.js → mcp-CO_tycXU.js} +4 -4
- package/dist/web/server/assets/{mcp-DE14q5c0.js → mcp-D3OCoHtO.js} +2 -2
- package/dist/web/server/assets/{router-w2yPgmC1.js → router-Cs2Ak4II.js} +57 -69
- package/dist/web/server/assets/{routes-D1NHwz6f.js → routes-BSNOKE-C.js} +13 -10
- package/dist/web/server/assets/{routes-1FEodTRm.js → routes-BVwqgZGI.js} +2 -2
- package/dist/web/server/assets/{routes-B6AO0LjK.js → routes-CO4l-GJ0.js} +1 -1
- package/dist/web/server/assets/{services-Cdk40QHq.js → services-DZLxUSG8.js} +2 -2
- package/dist/web/server/assets/{services-BjroGXgC.js → services-DsvpaF3L.js} +4 -4
- package/dist/web/server/assets/{skills-CA17GjuZ.js → skills-CggQJk6a.js} +2 -2
- package/dist/web/server/assets/{skills-DC1OTc8n.js → skills-DKYV7PTk.js} +4 -4
- package/dist/web/server/assets/system-CZ2qzBz3.js +138 -0
- package/dist/web/server/assets/system-DsJfpBPl.js +12 -0
- package/dist/web/server/assets/system-DtswhLW62.js +18 -0
- package/dist/web/server/assets/{teams-Cg-QQWpH.js → teams-B6PzNcoy.js} +3 -3
- package/dist/web/server/assets/{teams-Bm63mbTt.js → teams-B6lBhvdL.js} +2 -2
- package/dist/web/server/assets/{teams-D6Tx-Jyn.js → teams-Bp2tERZe.js} +2 -2
- package/dist/web/server/assets/{teams-OzHTyVi9.js → teams-C-8iz-uV.js} +3 -3
- package/dist/web/server/assets/{telegram-BJ4l_TA_.js → telegram-CXrP3hMp.js} +3 -3
- package/dist/web/server/assets/{telegram-xU-vXgef.js → telegram-D2RZriz_.js} +2 -2
- package/dist/web/server/assets/{tokens-ByPTGFBQ.js → tokens-C-oDTqnp.js} +2 -2
- package/dist/web/server/assets/{tokens-CsqoRt5T.js → tokens-DSLwQ1Pw.js} +4 -4
- package/dist/web/server/assets/use-resource-ChQozXVI.js +63 -0
- package/dist/web/server/assets/welcome-BLw1G6SS.js +318 -0
- package/dist/web/server/assets/welcome-ByAkvHSP.js +26 -0
- package/dist/web/server/assets/welcome-CxXMI4HI.js +15 -0
- package/dist/web/server/server.js +17 -9
- package/dist/worker.js +77 -35
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/ConfigPage-_FY--9PB.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-BblXqMVb.js +0 -1
- package/dist/web/client/assets/ConnectionsView-BZHJysCa.js +0 -1
- package/dist/web/client/assets/FieldRow-k05wfDy9.js +0 -1
- package/dist/web/client/assets/ModelSelect-CvOHjUyB.js +0 -1
- package/dist/web/client/assets/SectionTabs-DlfXtepS.js +0 -1
- package/dist/web/client/assets/SkillFindings-CHf5ZGY0.js +0 -1
- package/dist/web/client/assets/SkillsPicker-Cr87y_W-.js +0 -1
- package/dist/web/client/assets/SpawnDialog-C-Ujb4bC.js +0 -1
- package/dist/web/client/assets/Tabs-D0LgBNIk.js +0 -1
- package/dist/web/client/assets/TeamForm-D6EAAF7m.js +0 -1
- package/dist/web/client/assets/TeamThread-DpUOwMoi.js +0 -1
- package/dist/web/client/assets/UnsavedChangesGuard-DTUP7hwu.js +0 -1
- package/dist/web/client/assets/_id-C94dgBDe.js +0 -1
- package/dist/web/client/assets/_id-CxmEfoEp.js +0 -1
- package/dist/web/client/assets/agents-C-bJ5R_0.js +0 -1
- package/dist/web/client/assets/agents-odqBNx-A.js +0 -1
- package/dist/web/client/assets/api-CPzQ_z9m.js +0 -1
- package/dist/web/client/assets/arrow-right-Dyta3p06.js +0 -1
- package/dist/web/client/assets/attention-D0e7o7fh.js +0 -1
- package/dist/web/client/assets/chevron-right-B2YEg9rw.js +0 -1
- package/dist/web/client/assets/config-B7Y5MtpM.js +0 -3
- package/dist/web/client/assets/createLucideIcon-Cgab8gqu.js +0 -1
- package/dist/web/client/assets/index-CNVw44IE.js +0 -54
- package/dist/web/client/assets/jsx-runtime-bzQ4Vb5N.js +0 -1
- package/dist/web/client/assets/link-ClwtaO_E.js +0 -1
- package/dist/web/client/assets/login-Br1F4rQx.js +0 -1
- package/dist/web/client/assets/mcp-B8bIAY6k.js +0 -1
- package/dist/web/client/assets/routes-BZdlkRdC.js +0 -76
- package/dist/web/client/assets/save-ZqeB_I-c.js +0 -1
- package/dist/web/client/assets/services-CPJxDrVG.js +0 -1
- package/dist/web/client/assets/skills-DE_kQQGj.js +0 -1
- package/dist/web/client/assets/style-BWShXY3e.js +0 -7
- package/dist/web/client/assets/styles-Tney8jZq.css +0 -2
- package/dist/web/client/assets/teams-AcuSLc3I.js +0 -1
- package/dist/web/client/assets/teams-tRamPg7O.js +0 -1
- package/dist/web/client/assets/telegram-Ku69-GAv.js +0 -1
- package/dist/web/client/assets/tokens-DuLNZMgi.js +0 -1
- package/dist/web/client/assets/welcome-CrQk6n6I.js +0 -1
- package/dist/web/server/assets/_tanstack-start-manifest_v-BVfrV7LQ.js +0 -191
- package/dist/web/server/assets/config-3tPtOmPE.js +0 -12
- package/dist/web/server/assets/config-DJGZiPBJ.js +0 -798
- package/dist/web/server/assets/config-rUqhMjIs.js +0 -25
- package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +0 -16
- package/dist/web/server/assets/welcome-O6Rjd7yO.js +0 -93
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,l as t,q as n}from"./link-Cbztlp_R.js";import{a as r,i,n as a}from"./api-HC_YzjBy.js";import{t as o}from"./createLucideIcon-C6gOo8sD.js";import{a as s,i as c,o as l,r as u}from"./use-resource-BjnxgGvh.js";import{t as d}from"./check-BjgKoGvU.js";import{n as f,r as p,t as m}from"./Dialog-bg86_x4v.js";import{$ as h,pt as g}from"./index-Br9qkGM-.js";var _=o(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),v=n(e(),1);function y(e){return e.name??e.id}function b(e){return!e||e<=0?null:e>=1e6?`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:`${Math.round(e/1e3)}K`}function x(e){if(Number.isInteger(e))return`$${e}`;let t=e.toFixed(3);return`$${t.endsWith(`0`)?t.slice(0,-1):t}`}function S(e,t){let n=b(e.contextWindow);return!e.name&&!n?t===`local`?`Loaded on the server`:`Not in the bundled catalog`:[n?`${n} context`:null,e.images?`sees images`:`text only`,e.reasoning?`reasoning`:null].filter(Boolean).join(` · `)}function C(e,t){return t===`signin`?`Included in your plan`:t===`local`?`Runs on your hardware`:e.price?`${x(e.price.input)} in · ${x(e.price.output)} out`:`No list price`}function w(e){let t=[...e.templates.map(e=>`${e} template`),e.agents===1?`1 Agent`:e.agents>1?`${e.agents} Agents`:null].filter(Boolean);return t.length>0?t.join(`, `):`Not used yet`}function ee(e,t){let n=`${e.name??``} ${e.id}`.toLowerCase();return t.toLowerCase().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function T(e,t){let n=Math.max(0,Math.round((t-e)/1e3));if(n<45)return`just now`;let r=Math.round(n/60);if(r<60)return r===1?`1 minute ago`:`${r} minutes ago`;let i=Math.round(r/60);if(i<24)return i===1?`1 hour ago`:`${i} hours ago`;let a=Math.round(i/24);return a<30?a===1?`yesterday`:`${a} days ago`:`on ${new Date(e).toISOString().slice(0,10)}`}var E={credentials:`Key rejected`,unreachable:`Not answering`,model:`Model unavailable`,limit:`Limit reached`,other:`Failing`};function D(e,t){switch(e.state){case`working`:return{label:e.check?`Working · tested ${T(e.check.at,t)}`:`Working`,tone:`success`};case`failing`:{let n=e.check?.failure?.kind??`other`,r=n===`credentials`&&e.connect===`signin`?`Sign-in rejected`:E[n];return{label:e.check?`${r} · tried ${T(e.check.at,t)}`:r,tone:`warning`}}case`incomplete`:return{label:e.connect===`signin`?`Not signed in`:e.fields.some(e=>e.kind===`secret`)?`Needs a key`:`Needs credentials`,tone:`warning`};case`off`:return{label:e.models.length===0?`Saved, not in use`:`Turned off`,tone:`neutral`};default:return{label:`Not tested yet`,tone:`neutral`}}}function O(e){if(e.connect===`signin`)return e.configured?`Signed in with your ChatGPT account`:`Not signed in`;if(e.connect===`local`)return e.address??`A model server on this network`;let t=e.fields.find(e=>e.kind===`secret`&&e.set);return t?`${t.label} ${t.preview??`saved`}`:e.configured?`Credentials from the daemon’s environment`:`No credentials saved`}function te(e){let t=e.filter(e=>e.selected).map(e=>e.id);return t.length>0?t:e.filter(e=>e.suggested).map(e=>e.id)}function ne(e){let t=e=>e.price?e.price.input+e.price.output:1/0;return e.map((e,t)=>({model:e,index:t})).sort((e,n)=>t(e.model)-t(n.model)||e.index-n.index)[0]?.model}var k=t();function A({name:e,tone:t=`neutral`,className:n}){return(0,k.jsx)(`span`,{"aria-hidden":`true`,className:g(`flex size-9 shrink-0 items-center justify-center rounded-xl text-[0.95rem] 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)||`?`})}var j={success:`bg-success/10 text-success`,warning:`bg-warning/10 text-warning`,neutral:`bg-muted text-muted-foreground`};function M({tone:e,children:t}){return(0,k.jsxs)(`span`,{className:g(`inline-flex min-h-7 items-center gap-1.5 rounded-full px-3 text-xs font-semibold`,j[e]),children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-current`}),t]})}function N({provider:e,now:t}){let n=D(e,t);return(0,k.jsx)(M,{tone:n.tone,children:n.label})}function re({failure:e,children:t}){return(0,k.jsxs)(`div`,{role:`alert`,className:`rounded-2xl border border-warning/35 bg-warning/10 p-4 text-sm`,children:[(0,k.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,k.jsx)(_,{className:`mt-0.5 size-5 shrink-0 text-warning`,"aria-hidden":`true`}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`div`,{className:`font-semibold text-foreground`,children:e.title}),(0,k.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:e.hint}),e.detail&&(0,k.jsxs)(`details`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,k.jsx)(`summary`,{className:`cursor-pointer font-semibold`,children:`Details`}),(0,k.jsx)(`div`,{className:`mt-1 break-words font-mono`,children:e.detail})]})]})]}),t&&(0,k.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:t})]})}function P({label:e,placeholder:t,value:n,onChange:r,className:i}){return(0,k.jsxs)(`label`,{className:g(`m-0 flex min-w-0 items-center gap-2 rounded-xl border border-border bg-muted/40 px-3 transition-shadow focus-within:border-primary focus-within:bg-card focus-within:shadow-[0_0_0_3px_var(--color-sapphire-glow)]`,i),children:[(0,k.jsx)(h,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,k.jsx)(`input`,{type:`search`,"aria-label":e,placeholder:t,value:n,onChange:e=>r(e.target.value),className:`min-h-10 border-0 bg-transparent px-0 shadow-none focus:bg-transparent focus:shadow-none`,style:{outline:`none`}})]})}function ie({model:e,connect:t,checked:n,disabled:r,onToggle:i,className:a}){return(0,k.jsxs)(`label`,{className:g(`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,k.jsx)(`input`,{type:`checkbox`,checked:n,disabled:r,onChange:i,className:`m-0 size-[18px]`}),(0,k.jsxs)(`span`,{className:`min-w-0`,children:[(0,k.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:y(e)}),e.suggested&&(0,k.jsx)(`span`,{className:`ml-2 rounded-full bg-accent px-2 py-0.5 text-[0.7rem] font-semibold text-accent-foreground`,children:`Suggested`}),e.name&&(0,k.jsx)(`span`,{className:`block break-all font-mono text-[0.72rem] text-muted-foreground`,children:e.id})]}),(0,k.jsx)(`span`,{className:`col-start-2 text-xs text-muted-foreground sm:col-start-auto`,children:S(e,t)}),(0,k.jsx)(`span`,{className:`col-start-2 text-xs text-foreground sm:col-start-auto sm:text-right`,children:C(e,t)})]})}function F({checked:e,label:t,disabled:n=!1,onChange:r}){return(0,k.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":t,disabled:n,onClick:()=>r(!e),className:g(`relative h-7 w-[46px] shrink-0 rounded-full transition-colors disabled:opacity-50`,e?`bg-primary`:`bg-fawn`),children:(0,k.jsx)(`span`,{className:g(`absolute top-[3px] size-[22px] rounded-full bg-white shadow transition-[left]`,e?`left-[21px]`:`left-[3px]`)})})}function ae({children:e}){return(0,k.jsxs)(`div`,{role:`status`,className:`flex items-center gap-3 text-sm font-semibold text-foreground`,children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center`,children:(0,k.jsx)(`span`,{className:`size-2.5 animate-pulse rounded-full bg-primary`})}),(0,k.jsx)(`span`,{children:e})]})}function I({icon:e,title:t,description:n,action:r,labelledBy:i,children:a}){return(0,k.jsxs)(`section`,{"aria-labelledby":i,className:`min-w-0 overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 px-4 py-4 sm:px-5`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-64 items-center gap-4`,children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent text-accent-foreground`,children:e}),(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`h2`,{id:i,className:`m-0 font-body text-[1.05rem] font-semibold text-foreground`,children:t}),(0,k.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:n})]})]}),r]}),a]})}var oe=60;function se(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 ce(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 L({provider:e,imageRoutes:t=[],onConnected:n}){let[o,l]=(0,v.useState)(()=>se(e)),[d,f]=(0,v.useState)(()=>R(e,se(e))),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)([]),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(``),[O,A]=(0,v.useState)(`idle`),[j,M]=(0,v.useState)(e.configured),[N,F]=(0,v.useState)(null),[I,L]=(0,v.useState)(null),z=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>z.current?.abort(),[]);let B=(0,v.useRef)(null);(0,v.useEffect)(()=>{(N||I)&&B.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[N,I]);let V=u(t=>a(`/api/config/providers/${encodeURIComponent(e.id)}/catalog`,{body:{fields:d},signal:t}),[e.id,JSON.stringify(d)]),H=(0,v.useMemo)(()=>{let t=t=>{let n=e.suggested.indexOf(t.id);return n===-1?e.suggested.length:n},n=[...V.data?.models??[]].sort((e,n)=>t(e)-t(n)),r=new Set(n.map(e=>e.id));return[...n,...g.filter(e=>!r.has(e)).map(e=>({id:e,selected:!1,suggested:!1}))]},[V.data,g,e.suggested]);(0,v.useEffect)(()=>{let e=V.data?.models;e&&(h(t=>t&&[...t].some(t=>e.some(e=>e.id===t))?t:new Set(te(e))),C(t=>t??(e.length<=6||te(e).length===0)))},[V.data]);let U=m??new Set,W=H.filter(e=>U.has(e.id)),G=ne(W),K=O!==`idle`,q=e.connect===`local`,J=e.connect===`signin`,Y=e.fields.filter(e=>!e.advanced),ue=e.fields.filter(e=>e.advanced),de=J||e.configured||Y.every(e=>e.set||(o[e.envVar]??``).trim().length>0),fe=H.filter(e=>e.suggested||e.selected||U.has(e.id)),X=S===!0,Z=X?H.filter(e=>E?ee(e,E):!e.dated||U.has(e.id)):fe,Q=Z.slice(0,oe);function pe(e){h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function me(){let e=b.trim();e&&(_(t=>t.includes(e)?t:[...t,e]),h(t=>new Set(t).add(e)),x(``))}async function he(t){z.current?.abort();let r=new AbortController;z.current=r,F(null),L(null);try{J&&!j&&(A(`signin`),await a(`/api/auth/openai/login`,{method:`POST`,signal:r.signal}),M(!0)),A(`connecting`);let i={fields:ce(e,o),models:W.map(e=>e.id),...t&&W.length>0?{}:{test:!1}},s=await a(`/api/config/providers/${encodeURIComponent(e.id)}/connect`,{body:i,signal:r.signal});if(r.signal.aborted)return;s.connected?await n(s):F(s.failure)}catch(e){r.signal.aborted||L(i(e))}finally{z.current===r&&A(`idle`)}}let $=`No chat model is ticked, so nothing is tested.`;if(W.length>0){let e=G?y(G):`a model`,t=G?.price?`cheapest`:`first`,n=W.length>1?`${e}, the ${t} one ticked`:e;$=J&&!j?`After the sign-in, one short message goes to ${n}.`:`The test sends one short message to ${n}.`,G?.price&&!J&&($+=` It costs a fraction of a cent.`)}return(0,k.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),he(!0)},className:`grid gap-4`,children:[e.hint&&(0,k.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:e.hint}),J&&(0,k.jsx)(`p`,{className:`m-0 rounded-xl border border-border bg-muted/40 p-3 text-sm text-muted-foreground`,children:j?`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.`}),Y.map((t,n)=>(0,k.jsx)(le,{field:t,value:o[t.envVar]??``,disabled:K,autoFocus:n===0&&!q,onChange:e=>l(n=>({...n,[t.envVar]:e})),onCommit:q?()=>f(R(e,o)):void 0},t.envVar)),ue.length>0&&(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`button`,{type:`button`,"aria-expanded":w,onClick:()=>T(e=>!e),className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[(0,k.jsx)(s,{className:`size-4 text-muted-foreground transition-transform ${w?`rotate-90`:``}`,"aria-hidden":`true`}),`More settings`]}),w&&(0,k.jsx)(`div`,{className:`mt-2 grid gap-3 rounded-xl border border-border bg-muted/40 p-3`,children:ue.map(e=>(0,k.jsx)(le,{field:e,value:o[e.envVar]??``,disabled:K,onChange:t=>l(n=>({...n,[e.envVar]:t}))},e.envVar))})]}),(0,k.jsxs)(`fieldset`,{className:`m-0 min-w-0 border-0 p-0`,children:[(0,k.jsxs)(`legend`,{className:`mb-2 flex w-full flex-wrap items-baseline gap-x-2 p-0`,children:[(0,k.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:`Models your Agents can use`}),(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:q?`What the server reports. You can change this later.`:`${H.length} available. You can change this later.`})]}),q&&V.data?.listError&&(0,k.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,k.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Nothing answers at `,o[Y[0]?.envVar??``]||`that address`,`. Start`,` `,e.displayName,` and switch its server on.`]}),(0,k.jsx)(r,{variant:`ghost`,disabled:V.loading,onClick:()=>{f(R(e,o)),V.reload()},children:V.loading?`Looking…`:`Look again`})]}),X&&H.length>8&&(0,k.jsx)(P,{label:`Search ${e.displayName} models`,placeholder:`Search by name`,value:E,onChange:D,className:`mb-2`}),X&&H.length>8&&W.length>0&&(0,k.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,k.jsx)(`span`,{className:`text-muted-foreground`,children:`Ticked:`}),W.map(e=>(0,k.jsxs)(`button`,{type:`button`,disabled:K,onClick:()=>pe(e.id),"aria-label":`Untick ${y(e)}`,className:`inline-flex items-center gap-1 rounded-full bg-accent px-2.5 py-1 font-semibold text-accent-foreground`,children:[y(e),(0,k.jsx)(p,{className:`size-3`,"aria-hidden":`true`})]},e.id))]}),(0,k.jsxs)(`div`,{className:`max-h-72 overflow-y-auto rounded-xl border border-border`,children:[V.loading&&!V.data&&(0,k.jsx)(`div`,{className:`p-3 text-sm text-muted-foreground`,children:`Reading the model list…`}),V.error&&(0,k.jsx)(`div`,{className:`p-3 text-sm text-danger`,children:V.error}),V.data&&Q.length===0&&(0,k.jsx)(`div`,{className:`p-3 text-sm text-muted-foreground`,children:E?`No model matches.`:q?`The server lists no model yet.`:`No models are listed for this provider. Add one by its id below.`}),Q.map(t=>(0,k.jsx)(ie,{model:t,connect:e.connect,checked:U.has(t.id),disabled:K,onToggle:()=>pe(t.id),className:`px-3 last:border-b-0`},t.id)),Z.length>Q.length&&(0,k.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[Z.length-Q.length,` more: search to narrow them down.`]})]}),(0,k.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-2`,children:[!X&&H.length>fe.length&&(0,k.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),className:`text-sm font-semibold text-primary`,children:[`See all `,H.length]}),X&&!q&&(0,k.jsxs)(`span`,{className:`flex min-w-0 flex-1 basis-64 items-center gap-2`,children:[(0,k.jsx)(`input`,{type:`text`,"aria-label":`A model id that is not listed`,placeholder:`A model id that is not listed`,value:b,disabled:K,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),me())},className:`min-h-10 font-mono text-sm`}),(0,k.jsx)(r,{variant:`ghost`,disabled:K||!b.trim(),onClick:me,children:`Add`})]})]})]}),t.length>0&&(0,k.jsxs)(`p`,{className:`m-0 flex items-start gap-2 text-sm text-muted-foreground`,children:[(0,k.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-accent-foreground`,"aria-hidden":`true`}),(0,k.jsxs)(`span`,{children:[J?`The same sign-in`:`The same key`,` makes`,` `,[...new Set(t.map(e=>e.model))].join(` and `),` available under Images.`]})]}),(0,k.jsxs)(`div`,{ref:B,className:`grid gap-3 empty:hidden`,children:[N&&(0,k.jsx)(re,{failure:N}),I&&(0,k.jsx)(`p`,{role:`alert`,className:`m-0 rounded-xl bg-danger/10 px-3 py-2 text-sm text-danger`,children:I})]}),K?(0,k.jsx)(ae,{children:O===`signin`?`Waiting for the ChatGPT sign-in in the browser…`:G?`Asking ${y(G)} for a short reply…`:`Saving…`}):(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,k.jsx)(r,{variant:`primary`,type:`submit`,disabled:!de||q&&W.length===0,children:J&&!j?`Sign in with ChatGPT`:W.length===0?`Connect`:`Connect and test`}),W.length>0&&!(J&&!j)&&(0,k.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,k.jsx)(`p`,{className:`m-0 mt-2 text-xs text-muted-foreground`,children:$})]})]})}function R(e,t){if(e.connect!==`local`)return{};let n=ce(e,t);return Object.fromEntries(Object.entries(n).filter(([t])=>e.fields.some(e=>e.envVar===t&&e.kind===`config`)))}function le({field:e,value:t,disabled:n,autoFocus:r=!1,onChange:i,onCommit:a}){let o=e.kind===`secret`;return(0,k.jsxs)(`label`,{className:`m-0 text-sm font-semibold text-foreground`,children:[e.label,(0,k.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,k.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 z(e){try{return new URL(e).host}catch{return e}}function B(e,t){if(!e)return t?`Looking…`:`A model server on this computer`;if(!e.found)return`Nothing at ${z(e.address)}`;let n=e.models.length;return`Running at ${z(e.address)}, ${n===1?`1 model`:`${n} models`}`}function V(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.id,e.hint??``].some(e=>e.toLowerCase().includes(n)):!0}function H({providers:e,expanded:t=!1,onPick:n}){let[r,i]=(0,v.useState)(``),[o,c]=(0,v.useState)(t),l=u(e=>a(`/api/config/providers/local`,{signal:e}),[]),f=(0,v.useMemo)(()=>Date.now(),[]),p=e.filter(e=>V(e,r)),m=e=>p.filter(t=>t.group===e),h=m(`more`),g=r.trim().length>0,_=e=>{let t=l.data?.servers.find(t=>t.id===e.id),r=e.group===`local`&&t?.found,i=e.listed?D(e,f).label:e.group===`local`?B(t,l.loading):e.hint??e.id;return(0,k.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,k.jsx)(A,{name:e.displayName,tone:e.listed||r?`success`:`neutral`}),(0,k.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.displayName}),(0,k.jsx)(`span`,{className:`line-clamp-2 text-xs leading-snug ${e.listed||r?`text-success`:`text-muted-foreground`}`,children:i})]}),e.listed?(0,k.jsx)(d,{className:`size-4 shrink-0 text-success`,"aria-hidden":`true`}):(0,k.jsx)(s,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]},e.id)},y=(e,t)=>t.length>0&&(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h3`,{className:`m-0 mb-2 font-body text-[0.72rem] font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:e}),(0,k.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:t.map(_)})]});return(0,k.jsxs)(`div`,{className:`grid gap-4`,children:[(0,k.jsx)(P,{label:`Search providers`,placeholder:`Search ${e.length} providers`,value:r,onChange:i}),y(`Most used`,m(`popular`)),y(`On this computer`,m(`local`)),(g||o)&&y(`More`,h),p.length===0&&(0,k.jsxs)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:[`No provider matches “`,r,`”.`]}),!g&&!o&&h.length>0&&(0,k.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),className:`justify-self-start text-sm font-semibold text-primary`,children:[`Show `,h.length,` more:`,` `,h.slice(0,4).map(e=>e.displayName).join(`, `),`…`]})]})}function U({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,k.jsxs)(`div`,{role:`status`,className:`flex items-start gap-4`,children:[(0,k.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,k.jsx)(d,{className:`size-6`})}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm`,children:[(0,k.jsx)(`div`,{className:`text-base font-semibold text-foreground`,children:r?`${n.displayName} is connected`:`${n.displayName} is saved, not tested`}),(0,k.jsxs)(`ul`,{className:`m-0 mt-1 list-none space-y-0.5 p-0 text-muted-foreground`,children:[r&&(0,k.jsxs)(`li`,{children:[r.modelName??r.model,` answered in `,((r.ms??0)/1e3).toFixed(1),` s.`]}),(0,k.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,k.jsxs)(`li`,{className:`text-warning`,children:[e.model,` was left out: this account cannot use it.`]},e.model)),s.length>0&&(0,k.jsxs)(`li`,{children:[s.join(` and `),` can now be chosen under Images.`]}),a.map(e=>(0,k.jsxs)(`li`,{children:[`The `,e.name,` template now uses `,e.model,`.`]},e.id))]})]})]})}function W({providers:e,imageRoutes:t,start:n,onClose:i,onConnected:a,onOpenProvider:o}){let[s,c]=(0,v.useState)(n&&e.some(e=>e.id===n)?n:null),[u,d]=(0,v.useState)(null),p=e.find(e=>e.id===s)??null,h=e=>t.filter(t=>t.provider===e);return u?(0,k.jsxs)(m,{title:u.provider.displayName,onClose:i,className:`max-w-xl`,children:[(0,k.jsx)(U,{result:u,imageRoutes:h(u.provider.id)}),(0,k.jsx)(f,{children:(0,k.jsx)(r,{variant:`primary`,onClick:i,children:`Done`})})]}):p?(0,k.jsxs)(m,{title:`Connect ${p.displayName}`,onClose:i,className:`top-[6dvh] max-h-[88dvh] max-w-2xl translate-y-0 content-start`,children:[!n&&(0,k.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,k.jsx)(l,{className:`size-4`,"aria-hidden":`true`}),`All providers`]}),(0,k.jsx)(L,{provider:p,imageRoutes:h(p.id).filter(e=>!e.ready),onConnected:async e=>{await a(),d(e)}},p.id)]}):(0,k.jsx)(m,{title:`Add a provider`,onClose:i,className:`top-[6dvh] max-h-[88dvh] max-w-2xl translate-y-0 content-start`,children:(0,k.jsx)(H,{providers:e,onPick:e=>e.listed?o(e.id):c(e.id)})})}export{_ as C,w as S,S as _,L as a,C as b,ie as c,I as d,N as f,O as g,T as h,z as i,A as l,ae as m,U as n,M as o,F as p,H as r,re as s,W as t,P as u,ee as v,D as x,y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./link-Cbztlp_R.js";import{ct as t,lt as n}from"./index-Br9qkGM-.js";import{n as r,t as i}from"./SectionTabs-D4ezA6U4.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{G as e,l as t,q as n}from"./link-Cbztlp_R.js";import{a as r,i}from"./api-HC_YzjBy.js";import{n as a,t as o}from"./Dialog-bg86_x4v.js";var s=n(e(),1),c=t();function l({open:e,title:t,description:n,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(i(e)),m(!1)}}return(0,c.jsxs)(o,{open:e,busy:p,onClose:()=>f(!1),title:t,description:n,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)(r,{variant:`ghost`,disabled:p,onClick:()=>f(!1),children:`Cancel`}),(0,c.jsx)(r,{variant:u,disabled:p,onClick:()=>void _(),children:p?`Working…`:l})]})]})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,a as t,l as n,q as r,t as i}from"./link-Cbztlp_R.js";import{t as a}from"./UnsavedChangesGuard-DBJikVgc.js";import{a as o,i as s,n as c}from"./api-HC_YzjBy.js";import{c as l,d as u,i as d,n as f,p,t as m}from"./TeamThread-DFvbakHo.js";import{r as h}from"./use-resource-BjnxgGvh.js";import{t as g}from"./arrow-right-Gm_FDWJ_.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 ne,n as w,o as T,r as E,s as D,t as O,u as k,v as re,y as ie}from"./style-Cdzqt_TJ.js";import{n as A,t as j}from"./Segmented-Dh77vmpp.js";import{t as ae}from"./save-f9O-CQia.js";import{A as M,b as N}from"./index-Br9qkGM-.js";import{t as oe}from"./ConfirmDialog-GFDcHI1L.js";var P=r(e(),1),F=n(),I=`!size-2.5 !border-2 !border-snow !bg-sapphire`,L=[{id:`t`,position:k.Top},{id:`r`,position:k.Right},{id:`b`,position:k.Bottom},{id:`l`,position:k.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)(N,{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-[0.7rem] ${n.isolated?`font-semibold text-warning`:`text-mocha`}`,children:[(0,F.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full ${l[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:${d(e,t)}`;function se(e){if(!e?.startsWith(`pair:`))return null;let[t,n]=e.slice(5).split(`|`);return t&&n?[t,n]:null}var U={member:{w:210,h:62},outside:{w:160,h:46}};function W(e,t){let n=e=>U[e.type===`outside`?`outside`:`member`],r=t.position.x+n(t).w/2-(e.position.x+n(e).w/2),i=t.position.y+n(t).h/2-(e.position.y+n(e).h/2);return Math.abs(r)>=Math.abs(i)*1.4?r>0?{from:`r`,to:`l`}:{from:`l`,to:`r`}:i>0?{from:`b`,to:`t`}:{from:`t`,to:`b`}}function ce({document:e,members:t,traffic:n,selectedId:r,onSelect:i,onConnect:a,onMove:o,onOpenMember:s}){let c=(0,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]=D(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:ne.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)(T,{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)(O,{variant:w.Dots,gap:20,size:1.2,color:`var(--color-fawn)`}),(0,F.jsx)(E,{position:`bottom-left`,showInteractive:!1,className:`!overflow-hidden !rounded-md !border !border-frost !bg-snow !shadow-baziu-sm [&_button]:!border-frost [&_button]:!bg-snow [&_button]:!fill-chocolate`})]})})}var le={open:`Members message each other freely. A connection only matters for reaching other Teams.`,restricted:`A member can message a teammate only along a connection.`};function ue(e,t){if(t===1)return{x:220,y:140};let n=Math.max(135,t*38),r=e/t*2*Math.PI-Math.PI/2;return{x:Math.round(40+n*1.3*(1+Math.cos(r))),y:Math.round(40+n*(1+Math.sin(r)))}}var G=(e,t)=>e.has(t)?t:b,K=e=>`bz_map_${e}`;function de(e){try{let t=JSON.parse(window.localStorage.getItem(K(e))??`{}`);return t&&typeof t==`object`?t:{}}catch{return{}}}function q({team:e}){let t=h(t=>c(`/api/teams/${encodeURIComponent(e.id)}/policy`,{signal:t}),[e.id]);return t.error?(0,F.jsx)(u,{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)(u,{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:n}){let{agentById:r,search:i}=p(),l=M(),d=t(),h=f(e.id,300),[g,_]=(0,P.useState)(()=>v(n)),[y,x]=(0,P.useState)(g),[C,ne]=(0,P.useState)(`map`),[w,T]=(0,P.useState)(null),[E,D]=(0,P.useState)({}),[O,k]=(0,P.useState)(!1),[A,N]=(0,P.useState)(null),[I,L]=(0,P.useState)(!1),R=!ie(g,y);(0,P.useEffect)(()=>D(de(e.id)),[e.id]);let z=(t,n)=>{D(r=>{let i={...r,[t]:n};try{window.localStorage.setItem(K(e.id),JSON.stringify(i))}catch{}return i})},B=(0,P.useMemo)(()=>y.members.filter(e=>e.status!==`archived`),[y.members]),V=(0,P.useMemo)(()=>new Set(B.map(e=>e.key)),[B]),U=B.map((e,t)=>({id:e.key,name:e.name,identity:r(e.key)?.identity,state:l.stateOf(e.key),isolated:y.mode===`restricted`&&!y.edges.some(t=>t.from===e.key||t.to===e.key),position:E[e.key]??ue(t,B.length)})),W=e=>G(V,e),q=h.data,J=(0,P.useMemo)(()=>{let e=new Map;for(let t of q??[]){let n=G(V,t.fromAgentId),r=G(V,t.toAgentId);if(n===r)continue;let i=H(n,r);e.set(i,(e.get(i)??0)+1)}return e},[q,V]),Y=(e,t,n)=>{N(null),x(r=>ee(r,e,t,n))};async function me(){k(!0),N(null);try{let t=v(await c(`/api/teams/${encodeURIComponent(e.id)}/policy`,{method:`PATCH`,body:{mode:y.mode,edges:re(y)}}));_(t),x(t),N({error:!1,text:`Saved. It applies to the next message an Agent sends.`}),await d.invalidate()}catch(e){N({error:!0,text:s(e)})}finally{k(!1)}}let X=se(w),Z=w&&(V.has(w)||w===b)?w:null,Q=(e,t)=>W(e.fromAgentId)===t||W(e.toAgentId)===t,$=q??[],he=X?$.filter(e=>Q(e,X[0])&&Q(e,X[1])):Z?$.filter(e=>Q(e,Z)):$;return(0,F.jsxs)(u,{view:`connections`,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(j,{label:`How members reach each other`,value:y.mode,options:[{id:`open`,label:`Open`},{id:`restricted`,label:`Restricted`}],onChange:e=>{N(null),x(t=>({...t,mode:e}))}}),(0,F.jsx)(j,{label:`Show as`,value:C,options:[{id:`map`,label:`Map`},{id:`matrix`,label:`Table`}],onChange:ne}),(0,F.jsx)(o,{variant:`ghost`,className:`min-h-8 px-3 py-1 text-xs`,disabled:!R||O,onClick:()=>L(!0),children:`Discard`}),(0,F.jsxs)(o,{variant:`primary`,className:`min-h-8 px-3 py-1 text-xs`,disabled:!R||O,onClick:()=>void me(),children:[(0,F.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),O?`Saving…`:`Save`]})]}),children:[(0,F.jsx)(a,{when:R,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 ${A?.error?`text-danger`:R?`text-warning`:`text-mocha`}`,role:A?.error?`alert`:`status`,children:A?.text??(R?`Unsaved changes. `:``)+le[y.mode]+(C===`map`?` Drag from one Agent to another to connect them.`:``)}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1`,children:B.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)(ce,{document:y,members:U,traffic:J,selectedId:w,onSelect:T,onConnect:(e,t)=>{Y(e,t,!0),T(H(e,t))},onMove:z,onOpenMember:e=>void d.navigate({to:`/`,search:{agent:e,panel:`connections`}})}):(0,F.jsx)(te,{document:{...y,members:B},selectedId:w,onSelect:T,onToggle:Y})})]}),(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)(fe,{document:y,pair:X,onToggle:Y,onClear:()=>T(null)}):Z?(0,F.jsx)(pe,{document:y,actor:Z,others:[...B.map(e=>e.key),b].filter(e=>e!==Z),panel:i.panel,onToggle:Y,onSelectPair:e=>T(H(Z,e))}):(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h2`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:[B.length,` member`,B.length===1?``:`s`,` ·`,` `,y.mode===`open`?`open Team`:`restricted Team`]}),(0,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-[0.72rem] font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:X?`Messages between them`:Z?`Messages of ${S(y,Z)}`:`Recent messages`}),h.error?(0,F.jsx)(`p`,{role:`alert`,className:`m-0 text-xs text-danger`,children:h.error}):(0,F.jsx)(m,{messages:he,limit:30,empty:X||Z?`None among the Team’s recent messages.`:`No messages between Agents yet.`})]})]}),(0,F.jsx)(oe,{open:I,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(g),T(null),N(null)},onOpenChange:L})]})}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)(g,{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 fe({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)(o,{variant:`danger`,className:`min-h-8 px-3 py-1 text-xs`,onClick:()=>{r(t,n,!1),r(n,t,!1),i()},children:`Disconnect both ways`})})]})}function pe({document:e,actor:t,others:n,panel:r,onToggle:a,onSelectPair:o}){let{agentById:s}=p(),c=M(),u=t===b?void 0:s(t),d=u?c.stateOf(u.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)(N,{identity:u?.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)}),d?(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 ${l[d.kind]}`,"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:d.text})]}):(0,F.jsx)(`p`,{className:`m-0 text-xs text-mocha`,children:`Every Agent that is not in this Team.`})]}),u&&(0,F.jsxs)(i,{to:`/`,search:{agent:u.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)(A,{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{G as e,l as t,q as n}from"./link-Cbztlp_R.js";import{t as r}from"./createLucideIcon-C6gOo8sD.js";import{G as i,J as a,K as o,U as s,W as c,Y as l,pt as u,q as d}from"./index-Br9qkGM-.js";var f=r(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),p=n(e(),1),m=t(),h=typeof document>`u`?p.useEffect:p.useLayoutEffect;function g(e){let t=e.activeElement;return!t||t===e.body||t===e.documentElement||!(`focus`in t)||typeof t.focus!=`function`?null:t}function _(e,t){!e?.isConnected||e.ownerDocument!==t||e.focus({preventScroll:!0})}function v({open:e=!0,onClose:t,busy:n=!1,title:r,description:v,className:y,children:b}){let x=(0,p.useRef)(null),S=(0,p.useRef)(!1);return h(()=>{e&&!S.current&&(x.current=g(document)),S.current=e},[e]),(0,m.jsx)(s,{open:e,onOpenChange:e=>{!e&&!n&&t()},children:(0,m.jsxs)(a,{children:[(0,m.jsx)(d,{className:`fixed inset-0 z-50 bg-chocolate/35 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=open]:fade-in-0`}),(0,m.jsxs)(i,{className:u(`fixed left-1/2 top-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-[16px] border border-frost bg-snow p-5 text-chocolate shadow-baziu-lg outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:p-6`,y),onCloseAutoFocus:e=>{e.preventDefault(),_(x.current,document),x.current=null},onEscapeKeyDown:e=>{n&&e.preventDefault()},onPointerDownOutside:e=>{n&&e.preventDefault()},children:[(0,m.jsxs)(`div`,{className:`flex flex-col gap-2 pr-6`,children:[(0,m.jsx)(l,{className:`font-serif text-xl text-chocolate`,children:r}),v?(0,m.jsx)(o,{asChild:!0,children:(0,m.jsx)(`div`,{className:`text-sm leading-6 text-mocha`,children:v})}):(0,m.jsx)(o,{className:`sr-only`,children:r})]}),b,!n&&(0,m.jsx)(c,{"aria-label":`Close`,className:`absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-lg text-mocha hover:bg-ivory hover:text-sapphire`,children:(0,m.jsx)(f,{className:`size-4`,"aria-hidden":`true`})})]})]})})}function y({children:e}){return(0,m.jsx)(`div`,{className:`flex flex-col-reverse gap-2 border-t border-frost pt-4 sm:flex-row sm:justify-end`,children:e})}export{y as n,f as r,v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{t as s}from"./ConfirmDialog-GFDcHI1L.js";var c=r(e(),1),l=n();function u({field:e}){let n=t(),r=`/api/config/fields/${encodeURIComponent(e.envVar)}`,u=(0,c.useId)(),d=`${u}-description`,[f,p]=(0,c.useState)(e.kind===`config`?e.value??``:``),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(!1),S=e.kind===`secret`&&f.trim().length===0;async function C(t){if(t.preventDefault(),S){_(e.set?`Paste a replacement value, or use remove credential to explicitly clear the stored secret.`:`A secret value is required.`);return}h(!0),_(null);try{await o(r,{method:`PUT`,body:{value:f}}),y(Date.now()),e.kind===`secret`&&p(``),await n.invalidate()}catch(e){_(a(e))}finally{h(!1)}}async function w(){await o(r,{method:`DELETE`}),p(``),_(null),y(Date.now()),await n.invalidate()}return(0,l.jsxs)(`form`,{onSubmit:C,className:`grid grid-cols-1 gap-2 border-b py-3 last:border-0 md:grid-cols-[12rem_minmax(0,1fr)_auto_auto] md:items-center`,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsx)(`label`,{htmlFor:u,className:`text-sm font-medium text-foreground`,children:e.label}),e.description&&(0,l.jsx)(`div`,{id:d,className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),(0,l.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer`,children:`Advanced identifier`}),(0,l.jsx)(`code`,{className:`mt-1 inline-block break-all font-mono`,children:e.envVar})]})]}),(0,l.jsx)(`div`,{className:`min-w-0`,children:e.kind===`config`&&e.options?(0,l.jsxs)(`select`,{id:u,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`,children:[(0,l.jsx)(`option`,{value:``,children:`Not set (default)`}),f&&!e.options.includes(f)&&(0,l.jsxs)(`option`,{value:f,children:[`Unsupported: `,f]}),e.options.map(t=>(0,l.jsx)(`option`,{value:t,children:e.optionLabels?.[t]??t},t))]}):e.kind===`config`?(0,l.jsx)(`input`,{id:u,type:`text`,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),placeholder:e.placeholder??``,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`input`,{id:u,type:`password`,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),placeholder:e.set?`(paste to replace stored value)`:e.placeholder??`paste key…`,autoComplete:`off`,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}),e.set&&(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank keeps the current credential. Removal is a separate explicit action.`})]})}),(0,l.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,l.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),v&&Date.now()-v<2e3&&(0,l.jsx)(`span`,{role:`status`,className:`text-success ml-2`,children:`saved ✓`})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-self-end`,children:[(0,l.jsx)(i,{variant:`ghost`,type:`submit`,disabled:m||S,className:`text-xs`,children:`save`}),e.kind===`secret`&&e.set&&(0,l.jsx)(i,{variant:`danger`,className:`text-xs`,onClick:()=>x(!0),children:`remove`})]}),g&&(0,l.jsx)(`p`,{role:`alert`,className:`text-xs text-danger md:col-span-4`,children:g}),(0,l.jsx)(s,{open:b,title:`Remove ${e.label}?`,description:(0,l.jsxs)(`p`,{children:[`This permanently deletes the stored `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.envVar}),` `,`credential. Features that use it will fail until you save a replacement.`]}),confirmLabel:`remove stored credential`,onConfirm:w,onOpenChange:x})]})}export{u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./link-Cbztlp_R.js";var t=e(),n=`/api/config/available-models`;function r({label:e,value:n,onChange:r,groups:i,emptyOption:a,required:o}){let s=i.some(e=>e.models.some(t=>`${e.provider}:${t}`===n));return(0,t.jsxs)(`label`,{children:[e,(0,t.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),required:o,className:`min-w-0`,children:[a===void 0?!n&&(0,t.jsx)(`option`,{value:``,disabled:!0,children:i.length===0?`No chat model yet: add one under Setup`:`Pick a model`}):(0,t.jsx)(`option`,{value:``,children:a}),n&&!s&&(0,t.jsxs)(`option`,{value:n,children:[n,` (not in Chat)`]}),i.map(e=>(0,t.jsx)(`optgroup`,{label:e.provider,children:e.models.map(n=>{let r=`${e.provider}:${n}`;return(0,t.jsx)(`option`,{value:r,children:r},r)})},e.provider))]})]})}export{r as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e,t}from"./link-Cbztlp_R.js";var n=e();function r({label:e,base:r,tabs:i,children:a}){return(0,n.jsxs)(`nav`,{"aria-label":e,className:`mb-6 flex max-w-full gap-1 overflow-x-auto rounded-xl border border-border bg-muted/50 p-1`,children:[i.map(([e,i])=>{let a=`${r}${e}`;return(0,n.jsx)(t,{to:a,activeOptions:{exact:!e,includeSearch:!1},className:`inline-flex items-center whitespace-nowrap rounded-lg border px-2 py-1.5 text-xs font-semibold transition-colors sm:px-3 sm:text-sm`,activeProps:{className:`border-border bg-card text-foreground shadow-baziu-sm`},inactiveProps:{className:`border-transparent text-muted-foreground hover:bg-card/70 hover:text-foreground`},children:i},a)}),a]})}var i=[[`/agents`,`Agent templates`],[`/teams`,`Team templates`]],a=[[``,`Models`],[`/services`,`Services`],[`/mcp`,`MCP`],[`/integrations/telegram`,`Integrations`],[`/tokens`,`Tokens`],[`/system`,`System`]];export{r as n,i as r,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./link-Cbztlp_R.js";import{t}from"./createLucideIcon-C6gOo8sD.js";var n=t(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),r=e();function i({label:e,value:t,options:n,onChange:i}){return(0,r.jsx)(`fieldset`,{"aria-label":e,className:`m-0 flex min-w-0 rounded-[12px] border border-border bg-card p-0.5`,children:n.map(e=>(0,r.jsx)(`button`,{type:`button`,"aria-pressed":t===e.id,onClick:()=>i(e.id),className:`unstyled h-7 whitespace-nowrap rounded-[9px] px-2.5 text-xs font-semibold ${t===e.id?`bg-accent text-accent-foreground`:`text-mocha hover:text-foreground`}`,children:e.label},e.id))})}export{n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./link-Cbztlp_R.js";import{ft as t}from"./index-Br9qkGM-.js";var n=e();function r({findings:e}){return e.length===0?(0,n.jsx)(t,{variant:`success`,children:`Clean`}):(0,n.jsxs)(`details`,{className:`text-xs`,children:[(0,n.jsx)(`summary`,{className:`cursor-pointer list-none`,children:(0,n.jsxs)(t,{variant:e.some(e=>e.severity===`danger`)?`danger`:`warning`,children:[e.length,` finding`,e.length===1?``:`s`]})}),(0,n.jsx)(`div`,{className:`mt-2 min-w-64`,children:(0,n.jsx)(i,{findings:e})})]})}function i({findings:e}){return(0,n.jsx)(`ul`,{className:`m-0 space-y-1.5 pl-0`,children:e.map((e,r)=>(0,n.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,n.jsx)(t,{variant:e.severity===`danger`?`danger`:`warning`,children:e.severity===`danger`?`Danger`:`Warning`}),(0,n.jsxs)(`span`,{children:[(0,n.jsx)(`code`,{children:e.code}),e.line?`, line ${e.line}`:``,` — `,e.message]})]},r))})}export{r as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./link-Cbztlp_R.js";var t=e();function n({mode:e,onModeChange:n,picked:r,onPickedChange:i,skills:a}){function o(e){let t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(t)}return(0,t.jsxs)(`fieldset`,{className:`m-0 border-0 p-0`,children:[(0,t.jsx)(`legend`,{className:`sr-only`,children:`Skills at spawn`}),(0,t.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`radio`,checked:e===`all`,onChange:()=>n(`all`)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`strong`,{children:`All skills`}),`: every installed skill is attached at spawn.`]})]}),(0,t.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`radio`,checked:e===`selected`,onChange:()=>n(`selected`)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`strong`,{children:`Selected skills`}),`: only the ones ticked below.`]})]}),(0,t.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${e===`all`?`pointer-events-none opacity-50`:``}`,children:a.length===0?(0,t.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,t.jsx)(`a`,{href:`/skills`,children:`Skills`}),`.`]}):a.map(n=>(0,t.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:r.has(n.name),disabled:e===`all`,onChange:()=>o(n.name)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`code`,{children:n.name}),n.description&&(0,t.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,n.description]})]})]},n.name))}),(0,t.jsx)(`p`,{className:`muted mt-2 text-[0.85em]`,children:`Each Agent can still attach or detach skills after it is spawned.`})]})}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,l as t,n,q as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{n as s,t as c}from"./Dialog-bg86_x4v.js";import"./entities-xVoB-p2j.js";import{n as l,t as u}from"./ModelSelect-DvCLUmkW.js";var d=e=>`/api/agents/${encodeURIComponent(e)}`;function f(e){return o(`${d(e)}/archive`,{method:`POST`})}function p(e){return o(`${d(e)}/unarchive`,{method:`POST`})}function m(e){return o(d(e),{method:`DELETE`})}function h(e,t){return o(d(e),{method:`PATCH`,body:{name:t}})}var g=r(e(),1),_=t();function v({profiles:e,teams:t,profileId:r,teamId:d,onClose:f}){let p=n(),[m,h]=(0,g.useState)(r??e.find(e=>e.id==="default")?.id??e[0]?.id??``),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)([]),[w,T]=(0,g.useState)(t.find(e=>e.id===d)?.id??t.find(e=>e.id==="default")?.id??t[0]?.id??``),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(null),A=t.find(e=>e.id===w)?.policyMode===`restricted`;(0,g.useEffect)(()=>{let e=new AbortController;return o(u,{signal:e.signal}).then(e=>C(e.teams)).catch(()=>{}),()=>e.abort()},[]);async function j(e){e.preventDefault(),k(null),D(!0);try{let e={profileId:m,teamId:w};v.trim()&&(e.name=v.trim()),b&&(e.model=b);let{agent:t}=await o(`/api/agents`,{body:e});f(),await p({to:`/`,search:{agent:t.id}})}catch(e){k(a(e)),D(!1)}}return(0,_.jsx)(c,{title:`Spawn an agent`,busy:E,onClose:f,children:(0,_.jsxs)(`form`,{onSubmit:e=>void j(e),children:[(0,_.jsxs)(`label`,{children:[`Agent template`,(0,_.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),required:!0,children:e.map(e=>(0,_.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))})]}),(0,_.jsxs)(`label`,{children:[`Name (optional; defaults to the template's)`,(0,_.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),autoComplete:`off`})]}),(0,_.jsx)(l,{label:`Model`,value:b,onChange:x,groups:S,emptyOption:`Use the template default`}),(0,_.jsxs)(`label`,{children:[`Team`,(0,_.jsx)(`select`,{value:w,onChange:e=>T(e.target.value),children:t.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.name,e.id==="default"?` (default)`:``]},e.id))})]}),A&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This Team is restricted: the new Agent starts with no connections. Add them under Connections.`}),O&&(0,_.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:O}),(0,_.jsx)(`div`,{className:`mt-4`,children:(0,_.jsxs)(s,{children:[(0,_.jsx)(i,{variant:`ghost`,disabled:E,onClick:f,children:`Cancel`}),(0,_.jsx)(i,{variant:`primary`,type:`submit`,disabled:E||!m,children:E?`Spawning…`:`Spawn agent`})]})})]})})}export{p as a,h as i,f as n,m as r,v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./link-Cbztlp_R.js";var t=e();function n({items:e,active:n,onChange:r}){return(0,t.jsx)(`div`,{role:`tablist`,className:`mb-5 flex flex-wrap gap-1 border-b border-frost`,children:e.map(e=>(0,t.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e.id,disabled:e.disabled,onClick:()=>r(e.id),className:`unstyled -mb-px border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${e.disabled?`cursor-not-allowed border-transparent text-mocha-light/40`:n===e.id?`cursor-pointer border-sapphire text-sapphire`:`cursor-pointer border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,l as t,q as n}from"./link-Cbztlp_R.js";import{a as r,i,n as a}from"./api-HC_YzjBy.js";var o=n(e(),1),s=t();function c({onCreated:e,onBusyChange:t,extraActions:n}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(null);function v(e){h(e),t?.(e)}async function y(t){t.preventDefault(),_(null),v(!0);try{let t=await a(`/api/teams`,{body:{id:c.trim(),name:u.trim()||void 0,link:f.trim()||void 0}});l(``),d(``),p(``),await e(t)}catch(e){_(i(e))}finally{v(!1)}}return(0,s.jsxs)(`form`,{onSubmit:e=>void y(e),children:[(0,s.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,s.jsxs)(`label`,{children:[`ID (slug)`,(0,s.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),required:!0,pattern:`[a-z0-9][a-z0-9\\-]*`,placeholder:`my-project`})]}),(0,s.jsxs)(`label`,{children:[`Name (optional)`,(0,s.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`My project`})]}),(0,s.jsxs)(`label`,{className:`sm:col-span-2`,children:[`Link target (optional, absolute path)`,(0,s.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`/home/you/projects/my-project`}),(0,s.jsxs)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:[`Leave blank for a fresh directory under `,(0,s.jsx)(`code`,{children:`~/.bazilion/teams/<slug>/`}),`. Give a path to link the Team to an existing project tree.`]})]})]}),g&&(0,s.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:g}),(0,s.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-2`,children:[n?.(m),(0,s.jsx)(r,{variant:`primary`,type:`submit`,disabled:m||!c.trim(),children:m?`Creating…`:`Create team`})]})]})}export{c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,a as t,l as n,q as r,t as i}from"./link-Cbztlp_R.js";import{a,i as o,n as s}from"./api-HC_YzjBy.js";import{t as c}from"./createLucideIcon-C6gOo8sD.js";import{a as l,i as u,o as d,r as f,t as p}from"./use-resource-BjnxgGvh.js";import{t as m}from"./arrow-right-Gm_FDWJ_.js";import{t as h}from"./plus-CWrKMtvA.js";import{n as g,t as _}from"./Dialog-bg86_x4v.js";import{A as v,B as y,H as b,I as ee,L as x,O as S,Q as C,R as w,V as T,X as te,b as E,k as ne,nt as re,tt as ie,x as D,z as O}from"./index-Br9qkGM-.js";import{n as k,t as A}from"./entities-xVoB-p2j.js";import{t as ae}from"./ConfirmDialog-GFDcHI1L.js";import{i as j,n as oe,t as se}from"./SpawnDialog-YJX6UMBC.js";import{t as ce}from"./TeamForm-kda1HYZG.js";var M=c(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),N=c(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),P=c(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),F=c(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),I=c(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),L=c(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),R=c(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),z=c(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),B=r(e(),1),V=n(),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:F},changes:{label:`Changes`,icon:N},files:{label:`Files`,icon:u}};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-[0.82rem] font-semibold text-foreground hover:border-sapphire-light hover:text-sapphire`,children:[(0,V.jsx)(d,{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-[1.2rem] 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-[0.8rem] 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})]})}function J({template:e,teams:t,initialTeamId:n=``,onClose:r,onSpawned:i}){let[c,l]=(0,B.useState)(n),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(!1),v=c.trim(),y=t.some(e=>e.id===v);async function b(t){t.preventDefault(),h(!0),p(null);try{await s(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{body:{teamId:v,...u&&!y?{userMd:u}:{}}}),i(v)}catch(e){p(o(e))}finally{h(!1)}}return(0,V.jsx)(_,{title:`Spawn team: ${e.name}`,description:(0,V.jsxs)(V.Fragment,{children:[`Creates `,e.slots.length,` Agent`,e.slots.length===1?``:`s`,` and`,` `,e.edges.length,` allow edge`,e.edges.length===1?``:`s`,`. An unknown slug creates a new `,e.policyMode,` Team; an existing Team keeps its mode.`]}),busy:m,onClose:r,children:(0,V.jsxs)(`form`,{onSubmit:e=>void b(e),children:[(0,V.jsxs)(`label`,{children:[`Target Team slug`,(0,V.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),list:`spawn-team-targets`,required:!0}),(0,V.jsx)(`datalist`,{id:`spawn-team-targets`,children:t.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),!y&&(0,V.jsxs)(`label`,{children:[`Starter USER.md (new Team only; defaults to the template's)`,(0,V.jsx)(`textarea`,{rows:3,value:u,onChange:e=>d(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]}),f&&(0,V.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:f}),(0,V.jsx)(`div`,{className:`mt-4`,children:(0,V.jsxs)(g,{children:[(0,V.jsx)(a,{variant:`ghost`,disabled:m,onClick:r,children:`Cancel`}),(0,V.jsx)(a,{variant:`primary`,type:`submit`,disabled:m||!v||e.slots.length===0,children:m?`Spawning…`:`Spawn team`})]})})]})})}var Y=`bz_sidebar_open_groups`;function le(e){document.cookie=`${Y}=${encodeURIComponent(JSON.stringify(e))}; Path=/; Max-Age=31536000; SameSite=Lax`}var X=`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`,ue=`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===k)-Number(e.id===k))}function fe({initialOpenGroups:e}){let{agents:n,teams:r,profiles:o,teamTemplates:s,agent:c,team:u,search:d}=W(),f=v(),p=t(),[m,g]=(0,B.useState)(null),[S,C]=(0,B.useState)(void 0),[E,D]=(0,B.useState)(null),[k,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=[...o].sort((e,t)=>Number(t.id===A)-Number(e.id===A)),q=de(r),Y=s.find(e=>e.id===E),Z=c?.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)(te,{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:[n.length,` agent`,n.length===1?``:`s`,` in `,r.length,` team`,r.length===1?``:`s`]})]})]}),(0,V.jsxs)(y,{modal:!1,children:[(0,V.jsx)(b,{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)(h,{className:`size-3.5`,"aria-hidden":`true`}),`New`,(0,V.jsx)(ie,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":`true`})]})}),(0,V.jsx)(O,{children:(0,V.jsxs)(ee,{align:`end`,sideOffset:6,className:`z-50 w-60 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none`,children:[(0,V.jsxs)(w,{className:ue,children:[(0,V.jsx)(re,{className:`size-3`,"aria-hidden":`true`}),`Agent templates`]}),K.length===0?(0,V.jsx)(x,{asChild:!0,className:X,children:(0,V.jsx)(`a`,{href:`/templates/agents`,children:`Create an Agent template`})}):K.map(e=>(0,V.jsxs)(x,{className:X,onSelect:()=>{C(u?.id),g(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)(T,{className:`my-1.5 h-px bg-border`}),(0,V.jsxs)(w,{className:ue,children:[(0,V.jsx)(te,{className:`size-3`,"aria-hidden":`true`}),`Team templates`]}),s.length===0?(0,V.jsx)(x,{asChild:!0,className:X,children:(0,V.jsx)(`a`,{href:`/templates/teams`,children:`Create a Team template`})}):s.map(e=>(0,V.jsxs)(x,{className:X,disabled:e.slots.length===0,title:e.slots.length===0?`Add at least one member before spawning`:void 0,onSelect:()=>D(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)(T,{className:`my-1.5 h-px bg-border`}),(0,V.jsxs)(x,{className:X,onSelect:()=>j(!0),children:[(0,V.jsx)(h,{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:[n.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)(a,{variant:`primary`,className:`mt-3`,onClick:()=>g(K[0]?.id??`default`),children:`Spawn first agent`}):(0,V.jsx)(`a`,{href:`/templates/agents`,className:`mt-3 text-xs font-semibold`,children:`Create an Agent template`})]}),q.map(e=>{let t=n.filter(t=>t.teamId===e.id),r=u?.id===e.id,a=z[e.id]??(r||e.id==="default"),o=ne(t.map(e=>f.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};le(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)(l,{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:o||t.length}),(0,V.jsx)(i,{to:`/`,search:{...c?.team.id===e.id?{agent:c.agent.id}:{},team:e.id,panel:`team`},"aria-label":`Open ${e.name}: members, USER.md, memory`,title:`Open the Team`,className:`flex size-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-card hover:text-primary`,children:(0,V.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`})})]}),t.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:t.map(e=>(0,V.jsx)(pe,{agent:e,selected:e.id===Z,state:f.stateOf(e.id),lastActivityAt:f.byAgent.get(e.id)?.lastActivityAt??null,panel:d.panel,onRename:()=>F(e),onArchive:()=>R(e)},e.id))})]},e.id)})]}),m&&(0,V.jsx)(se,{profiles:K,teams:q,profileId:m,teamId:S,onClose:()=>{g(null),G()}}),Y&&(0,V.jsx)(J,{template:Y,teams:q,onClose:()=>{D(null),G()},onSpawned:e=>{D(null),p.navigate({to:`/`,search:{team:e,panel:`team`}})}}),k&&(0,V.jsx)(_,{title:`Create a team`,description:`A Team is one workspace with its own USER.md, members and shared memory.`,busy:M,onClose:()=>{j(!1),G()},children:(0,V.jsx)(ce,{onBusyChange:N,onCreated:async e=>{j(!1),await p.navigate({to:`/`,search:{team:e.id,panel:`team`}})},extraActions:e=>(0,V.jsx)(a,{variant:`ghost`,disabled:e,onClick:()=>j(!1),children:`Cancel`})})}),P&&(0,V.jsx)(he,{agent:P,onClose:()=>F(null),onRenamed:()=>p.invalidate()}),(0,V.jsx)(ae,{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, with “Show archived”.`}),confirmLabel:`Archive agent`,confirmVariant:`primary`,onConfirm:async()=>{I&&(await oe(I.id),I.id===Z?await p.navigate({to:`/`,search:{}}):await p.invalidate())}})]})}function pe({agent:e,selected:t,state:n,lastActivityAt:r,panel:a,onRename:o,onArchive:s}){let c=p();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-[0.7rem] font-normal text-muted-foreground`,children:S(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)(y,{modal:!1,children:[(0,V.jsx)(b,{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)(P,{className:`size-4`,"aria-hidden":`true`})})}),(0,V.jsx)(O,{children:(0,V.jsxs)(ee,{align:`start`,sideOffset:4,className:`z-50 w-48 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none`,children:[(0,V.jsx)(x,{asChild:!0,className:X,children:(0,V.jsxs)(i,{to:`/`,search:{agent:e.id,panel:`agent`},children:[(0,V.jsx)(C,{className:`size-3.5`,"aria-hidden":`true`}),`Agent settings`]})}),(0,V.jsxs)(x,{className:X,onSelect:o,children:[(0,V.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`}),`Rename`]}),(0,V.jsxs)(x,{className:X,onSelect:s,children:[(0,V.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),`Archive`]})]})})]})]})}function me(){let{agents:e,teams:t,agent:n,team:r,search:a}=W(),o=v(),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-[0.65rem] font-bold uppercase tracking-[0.06em] ${t.id===r?.id?`text-accent-foreground`:`text-muted-foreground`}`,title:t.name,children:t.name}),e.filter(e=>e.teamId===t.id).map(e=>{let t=o.stateOf(e.id);return(0,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:n}){let[r,i]=(0,B.useState)(e.name),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(null),d=!r.trim()||r.trim()===e.name;async function f(i){if(i.preventDefault(),!d){c(!0),u(null);try{await j(e.id,r.trim()),await n(),t()}catch(e){u(o(e)),c(!1)}}}return(0,V.jsx)(_,{title:`Rename ${e.name}`,description:`This changes the display name only; the Agent ID and history stay the same.`,busy:s,onClose:t,className:`max-w-md`,children:(0,V.jsxs)(`form`,{onSubmit:e=>void f(e),children:[(0,V.jsxs)(`label`,{children:[`Agent name`,(0,V.jsx)(`input`,{autoFocus:!0,value:r,onChange:e=>i(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)(g,{children:[(0,V.jsx)(a,{variant:`ghost`,disabled:s,onClick:t,children:`Cancel`}),(0,V.jsx)(a,{variant:`primary`,type:`submit`,disabled:s||d,children:s?`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}=v();return f(n=>s(`/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=p();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)(m,{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-[0.68rem] 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:S(e.createdAt)})]}),(0,V.jsx)(`span`,{className:`line-clamp-2 break-words text-[0.82rem] 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-[0.82rem] 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,me as l,G as m,ve as n,fe as o,W as p,ge as r,he as s,ye as t,J as u,F as v,N as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{t as i}from"./ConfirmDialog-GFDcHI1L.js";var a=r(e(),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,n){let{shouldBlockFn:r,enableBeforeUnload:i=!0,disabled:s=!1,withResolver:c=!1}=o(e,n),l=t(),{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 n=t(e.currentLocation),i=t(e.nextLocation);if(n.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let a=await r({action:e.action,current:n,next:i});if(!c)return a;if(!a)return!1;let o=await new Promise(t=>{f({status:`blocked`,current:n,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}),[r,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{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{t as i}from"./UnsavedChangesGuard-DBJikVgc.js";import{a,i as o,n as s}from"./api-HC_YzjBy.js";import{lt as c,t as l}from"./index-Br9qkGM-.js";import{n as u}from"./ModelSelect-DvCLUmkW.js";import{n as d,r as f}from"./SectionTabs-D4ezA6U4.js";import{t as p}from"./Tabs-f6bHvCGn.js";import{t as m}from"./SkillsPicker-hI3YXvib.js";var h=r(e()),g=n();function _(){let{loaded:e,modelGroups:t,skills:n}=l.useLoaderData(),{profile:r,files:a}=e,[o,s]=(0,h.useState)(`basics`),[u,m]=(0,h.useState)({}),_=(0,h.useCallback)((e,t)=>{m(n=>n[e]===t?n:{...n,[e]:t})},[]),v=Object.values(u).filter(Boolean).length;return(0,g.jsxs)(c,{children:[(0,g.jsx)(i,{when:v>0,subject:`Agent template changes`}),(0,g.jsx)(d,{label:`Template kinds`,base:`/templates`,tabs:f}),(0,g.jsxs)(`header`,{children:[(0,g.jsx)(`a`,{href:`/templates/agents`,className:`mb-1 inline-block text-[0.85em] text-mocha-light hover:text-sapphire`,children:`← Agent templates`}),(0,g.jsx)(`h1`,{children:r.name}),(0,g.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[0.9em] text-mocha-light`,children:[(0,g.jsx)(`code`,{children:r.id}),(0,g.jsx)(`span`,{children:`·`}),(0,g.jsxs)(`span`,{children:[`model: `,(0,g.jsx)(`code`,{children:r.defaultModel})]})]}),(0,g.jsx)(`p`,{className:`muted mt-4`,children:`These settings and files seed every agent spawned from this template from now on. Existing agents keep their own copies.`})]}),(0,g.jsx)(p,{items:[{id:`basics`,label:`Basics`},{id:`skills`,label:`Skills`}],active:o,onChange:s}),v>0&&(0,g.jsxs)(`p`,{role:`status`,className:`text-sm text-warning`,children:[v,` unsaved `,v===1?`section`:`sections`,`: switching tabs keeps them; leaving the page asks first.`]}),(0,g.jsxs)(`div`,{hidden:o!==`basics`,className:`space-y-5`,children:[(0,g.jsx)(E,{profileId:r.id,initialName:r.name,currentModel:r.defaultModel,modelGroups:t,onDirtyChange:_}),(0,g.jsx)(w,{profileId:r.id,file:`SOUL.md`,initial:a.soul,rows:14,onDirtyChange:_}),(0,g.jsx)(w,{profileId:r.id,file:`IDENTITY.md`,initial:a.identity,rows:10,onDirtyChange:_}),a.bootstrap===null?(0,g.jsx)(x,{title:`BOOTSTRAP.md`,children:(0,g.jsx)(`p`,{className:`muted`,children:`This template has no first-run ritual, so spawned agents get no intro message.`})}):(0,g.jsx)(w,{profileId:r.id,file:`BOOTSTRAP.md`,initial:a.bootstrap,rows:10,onDirtyChange:_}),(0,g.jsx)(T,{profileId:r.id,file:`AGENTS.md`,initial:a.agents,hint:`Peers and routing notes: who this agent can hand off to.`,onDirtyChange:_}),(0,g.jsx)(T,{profileId:r.id,file:`TOOLS.md`,initial:a.tools,hint:`Agent-specific tool notes beyond the generic tool descriptions.`,onDirtyChange:_})]}),(0,g.jsx)(`div`,{hidden:o!==`skills`,children:(0,g.jsx)(D,{profileId:r.id,initialMode:r.skillsMode,initialPicked:e.defaultSkills,skills:n,onDirtyChange:_})})]})}var v={kind:`idle`,message:``};function y(e,t){return e&&t.kind!==`saving`&&t.kind!==`error`?{kind:`idle`,message:`unsaved changes`,dirty:!0}:t}function b(e,t,n){(0,h.useEffect)(()=>n(e,t),[t,n,e])}function x({title:e,status:t,children:n}){let r=t?.kind===`saved`?`text-sapphire`:t?.kind===`error`?`text-danger`:t?.dirty?`text-mocha`:`text-mocha-light`;return(0,g.jsxs)(`section`,{className:`rounded-[16px] border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,g.jsx)(`h3`,{className:`m-0 font-mono text-[0.95em] font-semibold normal-case tracking-normal text-chocolate`,children:e}),t?.message&&(0,g.jsx)(`span`,{role:t.kind===`error`?`alert`:`status`,className:`text-[0.82em] ${r}`,children:t.message})]}),n]})}async function S(e,t){e({kind:`saving`,message:`saving…`});try{await t(),e({kind:`saved`,message:`saved`})}catch(t){e({kind:`error`,message:`error: ${o(t)}`})}}function C(e,t){return`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`}function w({profileId:e,file:t,initial:n,rows:r,onDirtyChange:i}){let[o,c]=(0,h.useState)(n),[l,u]=(0,h.useState)(n),[d,f]=(0,h.useState)(v),p=l!==o;return b(`file:${t}`,p,i),(0,g.jsxs)(x,{title:t,status:y(p,d),children:[(0,g.jsx)(`textarea`,{"aria-label":`${t} contents`,rows:r,value:l,onChange:e=>u(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`}),(0,g.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,g.jsx)(a,{variant:`primary`,disabled:d.kind===`saving`,onClick:()=>void S(f,async()=>{await s(C(e,t),{method:`PUT`,body:{content:l}}),c(l)}),children:`Save`}),(0,g.jsx)(a,{variant:`ghost`,onClick:()=>{u(o),f(v)},children:`Revert`})]})]})}function T({profileId:e,file:n,initial:r,hint:i,onDirtyChange:o}){let c=t(),[l,u]=(0,h.useState)(v);return r===null?(0,g.jsxs)(x,{title:n,status:l,children:[(0,g.jsx)(`p`,{className:`muted my-1`,children:i}),(0,g.jsx)(a,{variant:`primary`,className:`mt-3`,disabled:l.kind===`saving`,onClick:()=>void S(u,async()=>{await s(C(e,n),{method:`PUT`,body:{content:``}}),await c.invalidate()}),children:l.kind===`saving`?`Creating…`:`Create empty`})]}):(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`muted mb-2 ml-1 text-[0.85em]`,children:i}),(0,g.jsx)(w,{profileId:e,file:n,initial:r,rows:10,onDirtyChange:o})]})}function E({profileId:e,initialName:n,currentModel:r,modelGroups:i,onDirtyChange:o}){let c=t(),[l,d]=(0,h.useState)({name:n,model:r}),[f,p]=(0,h.useState)(n),[m,_]=(0,h.useState)(r),[C,w]=(0,h.useState)(v),T=f!==l.name||m!==l.model;return b(`settings`,T,o),(0,g.jsx)(x,{title:`settings`,status:y(T,C),children:(0,g.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),S(w,async()=>{let t={name:f.trim(),model:m};await s(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,body:{name:t.name,defaultModel:t.model}}),await c.invalidate(),p(t.name),d(t)})},children:[(0,g.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,g.jsxs)(`label`,{children:[`Name`,(0,g.jsx)(`input`,{value:f,onChange:e=>p(e.target.value)})]}),(0,g.jsx)(u,{label:`Default model`,value:m,onChange:_,groups:i,required:!0})]}),(0,g.jsx)(a,{variant:`primary`,type:`submit`,className:`mt-3`,disabled:!T||C.kind===`saving`,children:`Save settings`})]})})}function D({profileId:e,initialMode:n,initialPicked:r,skills:i,onDirtyChange:o}){let c=t(),[l,u]=(0,h.useState)({mode:n,picked:new Set(r)}),[d,f]=(0,h.useState)(n),[p,_]=(0,h.useState)(()=>new Set(r)),[C,w]=(0,h.useState)(v),T=d!==l.mode||p.size!==l.picked.size||[...p].some(e=>!l.picked.has(e));return b(`skills`,T,o),(0,g.jsxs)(x,{title:`skills`,status:y(T,C),children:[(0,g.jsx)(`p`,{className:`muted my-2`,children:`What agents spawned from this template start with. Existing agents keep their skills.`}),(0,g.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),S(w,async()=>{let t=d===`selected`?new Set(p):new Set;await s(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,body:{skillsMode:d,defaultSkills:[...t]}}),await c.invalidate(),_(t),u({mode:d,picked:t})})},children:[(0,g.jsx)(m,{mode:d,onModeChange:f,picked:p,onPickedChange:_,skills:i}),(0,g.jsx)(a,{variant:`primary`,type:`submit`,className:`mt-3`,disabled:!T||C.kind===`saving`,children:`Save skills`})]})]})}export{_ as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,l as t,q as n}from"./link-Cbztlp_R.js";import{t as r}from"./UnsavedChangesGuard-DBJikVgc.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{t as s}from"./createLucideIcon-C6gOo8sD.js";import{C as c,S as l,a as u,b as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,x as E,y as D}from"./style-Cdzqt_TJ.js";import{t as O}from"./plus-CWrKMtvA.js";import{t as k}from"./save-f9O-CQia.js";import{r as A}from"./Dialog-bg86_x4v.js";import{lt as j,n as M,nt as N}from"./index-Br9qkGM-.js";import{t as P}from"./ConfirmDialog-GFDcHI1L.js";import{n as F,r as I}from"./SectionTabs-D4ezA6U4.js";var L=s(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),R=s(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),z=s(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),B=s(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),V=n(e(),1),H=t();function U({data:e,selected:t}){return(0,H.jsxs)(`div`,{className:`relative w-[190px] rounded-md border bg-snow px-3 py-2.5 shadow-baziu-sm transition-shadow ${t?`border-sapphire shadow-baziu-md`:`border-frost`}`,children:[(0,H.jsx)(g,{type:`target`,position:T.Left,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,H.jsx)(`span`,{className:`flex h-8 w-8 flex-none items-center justify-center rounded-md bg-sapphire-glow text-sapphire`,children:(0,H.jsx)(N,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-sm font-semibold text-chocolate`,children:e.member.name}),(0,H.jsx)(`span`,{className:`mt-0.5 flex items-center gap-1.5 truncate text-[0.68rem] text-mocha-light`,children:`slot`})]}),e.isolated&&(0,H.jsx)(z,{className:`h-4 w-4 flex-none text-[#a56568]`,"aria-label":`No allow edges`}),e.incomplete&&(0,H.jsx)(L,{className:`h-4 w-4 flex-none text-warning`,"aria-label":`Incomplete slot`})]}),(0,H.jsx)(g,{type:`source`,position:T.Right,className:`!h-3 !w-3 !border-2 !border-snow !bg-sapphire`})]})}function W({data:e,selected:t}){return(0,H.jsxs)(`div`,{className:`w-[150px] rounded-md border bg-ivory px-3 py-2.5 shadow-baziu-sm ${t?`border-sapphire`:`border-fawn`}`,children:[(0,H.jsx)(g,{type:`target`,position:T.Left,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 flex-none text-rose-baziu`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`block text-sm font-semibold text-chocolate`,children:e.label})]}),(0,H.jsx)(g,{type:`source`,position:T.Right,className:`!h-3 !w-3 !border-2 !border-ivory !bg-rose-baziu`})]})}var G={agent:U,outside:W};function K({document:e,selectedId:t,incompleteKeys:n,onSelect:r,onConnect:i,onRemoveEdge:a,onMoveMember:o,onOpenMember:s}){let c=(0,V.useMemo)(()=>[{id:p,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===p,draggable:!1,deletable:!1},...e.members.map(r=>{let i=e.mode===`restricted`&&!e.edges.some(e=>e.from===r.key||e.to===r.key),a=n.has(r.key);return{id:r.key,type:`agent`,position:r.position,data:{member:r,isolated:i,incomplete:a},ariaLabel:`${r.name}${i?`, no allow edges`:``}${a?`, incomplete`:``}`,selected:t===r.key,deletable:!1}})],[e,n,t]),[l,d,f]=C(c);(0,V.useEffect)(()=>{d(e=>{let t=new Map(e.map(e=>[e.id,e]));return c.map(e=>({...t.get(e.id),...e}))})},[c,d]);let m=(0,V.useMemo)(()=>e.edges.map(e=>{let n=v(e.from,e.to);return{id:n,source:e.from,target:e.to,selected:t===n,markerEnd:{type:_.ArrowClosed,width:16,height:16},style:{stroke:`var(--color-sapphire)`,strokeWidth:1.7}}}),[e.edges,t]),h=e=>{e.source&&e.target&&i(e.source,e.target)},g=t=>e.members.find(e=>e.key===t);return(0,H.jsx)(`div`,{className:`h-full min-h-[420px] w-full bg-ivory`,children:(0,H.jsxs)(b,{nodes:l,edges:m,nodeTypes:G,onConnect:h,onNodesChange:f,onNodeClick:(e,t)=>r(t.id),onNodeDoubleClick:(e,t)=>{let n=g(t.id);n&&s(n)},onEdgeClick:(e,t)=>r(t.id),onPaneClick:()=>r(null),onEdgesDelete:e=>{for(let t of e)a(t.source,t.target)},onNodeDragStop:(e,t)=>{g(t.id)&&o(t.id,t.position)},minZoom:.35,maxZoom:1.8,edgesReconnectable:!1,fitView:!0,fitViewOptions:{padding:.22,maxZoom:1},proOptions:{hideAttribution:!0},className:`policy-flow`,children:[(0,H.jsx)(w,{variant:y.Dots,gap:20,size:1.2,color:`var(--color-fawn)`}),(0,H.jsx)(S,{position:`bottom-left`,showInteractive:!1,className:`!overflow-hidden !rounded-md !border !border-frost !bg-snow !shadow-baziu-sm [&_button]:!border-frost [&_button]:!bg-snow [&_button]:!fill-chocolate`}),(0,H.jsx)(u,{pannable:!0,zoomable:!0,position:`bottom-right`,className:`!hidden !rounded-md !border !border-frost !bg-snow sm:!block`,nodeColor:e=>e.type===`outside`?`var(--color-rose-baziu)`:`var(--color-sapphire)`,maskColor:`color-mix(in srgb, var(--color-cream) 70%, transparent)`})]})})}var q={open:`Members message each other freely; edges only matter for messages to and from other teams.`,restricted:`Members message each other only along allow edges.`};function J({template:e,profiles:t}){let[n,s]=(0,V.useState)(()=>E(e)),[c,u]=(0,V.useState)(n),[p,m]=(0,V.useState)(`flow`),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)(!1),C=!D(n,c),w=(0,V.useMemo)(()=>new Set(c.members.filter(e=>!t.some(t=>t.id===e.profileId)).map(e=>e.key)),[c.members,t]),T=(e,t,n)=>u(r=>d(r,e,t,n));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(r,{when:C,subject:`Team template draft`}),(0,H.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-frost bg-snow`,"aria-label":`Team policy editor`,children:[(0,H.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2 border-b border-frost bg-cream p-3`,children:[(0,H.jsxs)(`div`,{className:`mr-auto min-w-0`,children:[(0,H.jsxs)(`label`,{className:`m-0 text-xs`,children:[`Template name`,(0,H.jsx)(`input`,{value:c.name,onChange:e=>{let t=e.target.value;u(e=>({...e,name:t}))}})]}),(0,H.jsx)(`p`,{className:`muted m-0 text-xs`,children:q[c.mode]})]}),(0,H.jsx)(`fieldset`,{className:`m-0 flex min-w-0 rounded-md border border-frost bg-ivory p-0.5`,"aria-label":`Policy mode`,children:[`open`,`restricted`].map(e=>(0,H.jsx)(Y,{active:c.mode===e,label:e===`open`?`Open`:`Restricted`,onClick:()=>u(t=>({...t,mode:e}))},e))}),(0,H.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 rounded-md border border-frost bg-ivory p-0.5`,"aria-label":`Editor view`,children:[(0,H.jsx)(Y,{active:p===`flow`,label:`Flow`,icon:(0,H.jsx)(R,{className:`h-4 w-4`}),onClick:()=>m(`flow`)}),(0,H.jsx)(Y,{active:p===`matrix`,label:`Matrix`,icon:(0,H.jsx)(B,{className:`h-4 w-4`}),onClick:()=>m(`matrix`)})]}),(0,H.jsx)(i,{variant:`ghost`,disabled:!C||_,onClick:()=>S(!0),children:`Discard`}),(0,H.jsxs)(i,{variant:`primary`,disabled:!C||_,onClick:async()=>{v(!0),b(null);try{let n=E(await o(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`PUT`,body:l(c,t)}));s(n),u(n),g(null),b(`Saved.`)}catch(e){b(a(e))}finally{v(!1)}},children:[(0,H.jsx)(k,{className:`h-4 w-4`}),` `,_?`Saving…`:`Save`]})]}),y&&(0,H.jsx)(`div`,{role:`status`,className:`border-b border-frost bg-ivory px-4 py-2 text-sm`,children:y}),(0,H.jsxs)(`div`,{className:`grid min-h-[620px] grid-cols-1 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,H.jsx)(`div`,{className:`min-h-[480px] overflow-hidden`,children:p===`flow`?(0,H.jsx)(K,{document:c,selectedId:h,incompleteKeys:w,onSelect:g,onConnect:(e,t)=>T(e,t,!0),onRemoveEdge:(e,t)=>T(e,t,!1),onMoveMember:(e,t)=>u(n=>({...n,members:n.members.map(n=>n.key===e?{...n,position:t}:n)})),onOpenMember:e=>g(e.key)}):(0,H.jsx)(f,{document:c,selectedId:h,onSelect:g,onToggle:T})}),(0,H.jsx)(`aside`,{className:`border-t border-frost p-4 lg:border-l lg:border-t-0`,children:(0,H.jsx)(X,{document:c,selectedId:h,profiles:t,onDraft:u,onSelect:g,onToggle:T})})]})]}),(0,H.jsx)(P,{open:x,title:`Discard this Team template draft?`,description:(0,H.jsx)(`p`,{children:`This discards every unsaved change. The saved template stays as it is.`}),confirmLabel:`discard draft`,onConfirm:()=>{u(n),g(null),b(null)},onOpenChange:S})]})}function Y({active:e,label:t,icon:n,onClick:r}){return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:r,className:`flex items-center gap-1 rounded px-2 py-1 text-xs ${e?`bg-snow text-sapphire shadow-sm`:`text-mocha`}`,children:[n,t]})}function X({document:e,selectedId:t,profiles:n,onDraft:r,onSelect:a,onToggle:o}){let s=[...e.members.map(e=>e.key),p],c=e.edges.find(e=>v(e.from,e.to)===t),l=t&&s.includes(t)?t:null,u=e.members.find(e=>e.key===l),d=e=>r(t=>({...t,members:t.members.map(t=>t.key===u?.key?{...t,...e}:t)}));return c?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Allow edge`}),(0,H.jsxs)(`p`,{className:`text-sm`,children:[h(e,c.from),` → `,h(e,c.to)]}),(0,H.jsxs)(i,{variant:`danger`,onClick:()=>{o(c.from,c.to,!1),a(null)},children:[(0,H.jsx)(A,{className:`h-4 w-4`}),` Remove edge`]})]}):l?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:u?`Slot`:`Boundary`}),(0,H.jsx)(`h3`,{className:`mt-1 text-base`,children:h(e,l)})]}),u&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`label`,{className:`text-xs`,children:[`Agent name`,(0,H.jsx)(`input`,{value:u.name,onChange:e=>d({name:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`text-xs`,children:[`Agent template`,(0,H.jsxs)(`select`,{value:u.profileId,onChange:e=>d({profileId:e.target.value}),children:[!n.some(e=>e.id===u.profileId)&&(0,H.jsx)(`option`,{value:u.profileId,children:u.profileId||`Select a template`}),n.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold`,children:`May send to`}),s.filter(e=>e!==l).map(t=>{let n=m(e,l,t);return(0,H.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:()=>o(l,t,!n),className:`flex w-full items-center justify-between rounded border border-frost p-2 text-xs`,children:[(0,H.jsx)(`span`,{children:h(e,t)}),n?`Allowed`:`Not allowed`]},t)})]}),u&&(0,H.jsxs)(i,{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)})),a(null)},children:[(0,H.jsx)(A,{className:`h-4 w-4`}),` Remove slot and its edges`]})]}):(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Summary`}),(0,H.jsxs)(`p`,{className:`muted text-xs`,children:[e.members.length,` slots · `,e.edges.length,` allow edges`]}),(0,H.jsx)(`p`,{className:`muted mt-2 text-xs`,children:`Select a node to edit who it may message. Drag from one node's handle to another to add an edge. Other teams need an edge to Other teams in the sender's Team and one from Other teams in the recipient's Team.`})]}),(0,H.jsxs)(`label`,{className:`text-xs`,children:[`USER.md for spawned Teams`,(0,H.jsx)(`textarea`,{rows:6,value:e.userMd??``,onChange:e=>{let t=e.target.value;r(e=>({...e,userMd:t||null}))},className:`font-mono text-[0.85em]`})]}),(0,H.jsxs)(i,{variant:`ghost`,onClick:()=>r(e=>({...e,members:[...e.members,{key:`draft:${crypto.randomUUID()}`,profileId:n[0]?.id??``,name:`Agent ${e.members.length+1}`,position:x(e.members.length)}]})),children:[(0,H.jsx)(O,{className:`h-4 w-4`}),` Add slot`]})]})}function Z(){let{template:e,profiles:t}=M.useLoaderData(),[n,r]=(0,V.useState)(!1);return(0,H.jsxs)(j,{size:`wide`,children:[(0,H.jsx)(F,{label:`Template kinds`,base:`/templates`,tabs:I}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,H.jsx)(`a`,{href:`/templates/teams`,children:`← Team templates`}),(0,H.jsx)(i,{variant:`danger`,onClick:()=>r(!0),children:`Delete template`})]}),(0,H.jsx)(J,{template:e,profiles:t}),(0,H.jsx)(P,{open:n,title:`Delete Team template ${e.name}?`,description:(0,H.jsx)(`p`,{children:`Teams already spawned from it keep their Agents and edges.`}),confirmLabel:`Delete template`,onConfirm:async()=>{await o(`/api/team-templates/${encodeURIComponent(e.id)}`,{method:`DELETE`}),window.location.assign(`/templates/teams`)},onOpenChange:r})]})}export{Z as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{t as i}from"./UnsavedChangesGuard-DBJikVgc.js";import{a,i as o,n as s}from"./api-HC_YzjBy.js";import{ct as c,ft as l,i as u,lt as d,ot as f,st as p,ut as m}from"./index-Br9qkGM-.js";import{t as h}from"./ConfirmDialog-GFDcHI1L.js";import{n as g}from"./ModelSelect-DvCLUmkW.js";import{n as _,r as v}from"./SectionTabs-D4ezA6U4.js";import{t as y}from"./Tabs-f6bHvCGn.js";import{t as b}from"./SkillsPicker-hI3YXvib.js";var x=r(e()),S=n();function C(){let{profiles:e,modelGroups:n,skills:r,templates:i}=u.useLoaderData(),o=t(),[g,y]=(0,x.useState)(null);return(0,S.jsxs)(d,{size:`wide`,children:[(0,S.jsx)(c,{eyebrow:`Templates`,title:`Agent templates`,description:`Reusable identity, model and skills for newly spawned agents.`}),(0,S.jsx)(_,{label:`Template kinds`,base:`/templates`,tabs:v}),(0,S.jsx)(T,{modelGroups:n,skills:r,templates:i,onCreated:()=>o.invalidate()}),(0,S.jsx)(m,{title:`Templates`,children:e.length===0?(0,S.jsx)(`p`,{className:`muted`,children:`No Agent templates yet.`}):(0,S.jsx)(f,{children:e.map(e=>(0,S.jsx)(p,{title:(0,S.jsx)(`a`,{href:`/templates/agents/${encodeURIComponent(e.id)}`,children:e.name}),meta:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{children:e.id}),(0,S.jsx)(`code`,{children:e.defaultModel}),(0,S.jsxs)(`span`,{children:[e.agentCount,` agent`,e.agentCount===1?``:`s`]}),(0,S.jsxs)(`span`,{children:[`skills:`,` `,e.skillsMode===`all`?`all`:e.defaultSkills.join(`, `)||`none`]})]}),actions:e.agentCount===0?(0,S.jsx)(a,{variant:`danger`,onClick:()=>y(e),children:`Delete`}):(0,S.jsx)(l,{title:`${e.agentCount} agent(s) use this template`,children:`In use`})},e.id))})}),(0,S.jsx)(h,{open:g!==null,title:`Delete Agent template ${g?.name??``}?`,description:(0,S.jsxs)(`p`,{children:[`This permanently deletes `,(0,S.jsx)(`code`,{className:`font-mono`,children:g?.id}),` and its files. Existing Agents keep their own copies.`]}),confirmLabel:`Delete Agent template`,onConfirm:async()=>{g&&(await s(`/api/profiles/${encodeURIComponent(g.id)}`,{method:`DELETE`}),await o.invalidate())},onOpenChange:e=>{e||y(null)}})]})}var w=[{key:`soul`,label:`SOUL.md`,hint:`Persona, values and operating principles. Part of every session.`,rows:16,optional:!1},{key:`identity`,label:`IDENTITY.md`,hint:`Name, creature, vibe, emoji, avatar: filled in during the first-run ritual.`,rows:12,optional:!1},{key:`bootstrap`,label:`BOOTSTRAP.md`,hint:`The first-run ritual; the agent retires it once introductions are done.`,rows:16,optional:!0},{key:`agents`,label:`AGENTS.md`,hint:`The workspace operating manual: memory discipline, red lines, channel etiquette.`,rows:16,optional:!0},{key:`tools`,label:`TOOLS.md`,hint:`Agent-specific tool notes and environment facts beyond the tool descriptions.`,rows:14,optional:!0}];function T({modelGroups:e,skills:t,templates:n,onCreated:r}){let c=()=>({soul:n.soul,identity:n.identity,bootstrap:n.bootstrap,agents:n.agents,tools:n.tools}),[l,u]=(0,x.useState)(`basics`),[d,f]=(0,x.useState)(``),[p,h]=(0,x.useState)(``),[_,v]=(0,x.useState)(``),[C,T]=(0,x.useState)(c),[E,D]=(0,x.useState)({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),[O,k]=(0,x.useState)(`all`),[A,j]=(0,x.useState)(new Set),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1),I=c(),L=d.length>0||p.length>0||_.length>0||w.some(e=>C[e.key]!==I[e.key]||!E[e.key])||O!==`all`||A.size>0;function R(e,t){D(n=>({...n,[e]:t})),!t&&l===e&&u(`basics`)}async function z(e){e.preventDefault(),N(null),F(!0);try{await s(`/api/profiles`,{body:{id:d.trim(),name:p.trim()||void 0,defaultModel:_,skillsMode:O,defaultSkills:O===`selected`?Array.from(A):[],soul:C.soul,identity:C.identity,bootstrap:E.bootstrap?C.bootstrap:null,agents:E.agents?C.agents:null,tools:E.tools?C.tools:null}}),f(``),h(``),v(``),T(c()),D({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),j(new Set),k(`all`),u(`basics`),await r()}catch(e){N(o(e))}finally{F(!1)}}let B=w.find(e=>e.key===l);return(0,S.jsx)(m,{title:`Create an Agent template`,children:(0,S.jsxs)(`form`,{onSubmit:e=>void z(e),children:[(0,S.jsx)(i,{when:L&&!P,subject:`Agent template draft`}),M&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:M}),(0,S.jsx)(y,{items:[{id:`basics`,label:`Basics`},...w.map(e=>({id:e.key,label:e.label.replace(`.md`,``),disabled:!E[e.key]})),{id:`skills`,label:`Skills`}],active:l,onChange:u}),(0,S.jsxs)(`fieldset`,{className:`mb-5 rounded-md border border-frost p-3`,children:[(0,S.jsx)(`legend`,{className:`px-1 text-[0.85em] font-medium text-mocha`,children:`Files to include`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2 text-[0.9em]`,children:w.map(e=>(0,S.jsxs)(`label`,{className:`m-0 inline-flex items-center gap-1.5 ${e.optional?`cursor-pointer`:`opacity-60`}`,title:e.optional?void 0:`always included`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:E[e.key],disabled:!e.optional,onChange:t=>R(e.key,t.target.checked)}),e.label]},e.key))}),(0,S.jsx)(`p`,{className:`muted mt-2 text-[0.8em]`,children:`Each spawned agent gets its own copy of the included files.`})]}),l===`basics`&&(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`label`,{children:[`ID (slug)`,(0,S.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,S.jsxs)(`label`,{children:[`Name`,(0,S.jsx)(`input`,{value:p,onChange:e=>h(e.target.value)})]})]}),(0,S.jsx)(g,{label:`Default model`,value:_,onChange:v,groups:e,required:!0}),e.length===0&&(0,S.jsxs)(`p`,{className:`muted text-[0.85em]`,children:[`Connect a provider under `,(0,S.jsx)(`a`,{href:`/config`,children:`Setup`}),` first.`]})]}),B&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:B.hint}),(0,S.jsxs)(`label`,{children:[B.label,(0,S.jsx)(`textarea`,{rows:B.rows,value:C[B.key],onChange:e=>T(t=>({...t,[B.key]:e.target.value})),className:`font-mono text-[0.88em] leading-[1.55]`})]})]}),l===`skills`&&(0,S.jsx)(b,{mode:O,onModeChange:k,picked:A,onPickedChange:j,skills:t}),(0,S.jsx)(`div`,{className:`mt-5`,children:(0,S.jsx)(a,{variant:`primary`,type:`submit`,disabled:P||!d.trim()||!_,children:P?`Creating…`:`Create`})})]})})}export{C as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,a as t,l as n,q as r,t as i}from"./link-Cbztlp_R.js";import{a,i as o}from"./api-HC_YzjBy.js";import{at as s,b as c,ct as l,ft as u,lt as d,ot as f,st as p,u as m,ut as h}from"./index-Br9qkGM-.js";import{t as g}from"./ConfirmDialog-GFDcHI1L.js";import{a as _,n as v,r as y,t as b}from"./SpawnDialog-YJX6UMBC.js";var x=r(e()),S=n();function C(){let{agents:e,profiles:n,teams:r}=m.useLoaderData(),C=m.useSearch().all===1,w=t(),[T,E]=(0,x.useState)(!1),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(null);async function j(e){A(null);try{await _(e.id),await w.invalidate()}catch(e){A(o(e))}}return(0,S.jsxs)(d,{size:`wide`,children:[(0,S.jsx)(l,{eyebrow:`Workspace`,title:`Agents`,description:`Every Agent across your teams: spawn, archive, restore and delete. Open one to talk to it; its model, skills and schedules are in its side panel.`,actions:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`a`,{className:`ghost-btn`,href:C?`/agents`:`/agents?all=1`,children:C?`Hide archived`:`Show archived`}),(0,S.jsx)(a,{variant:`primary`,disabled:n.length===0,onClick:()=>E(!0),children:`Spawn agent`})]})}),k&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:k}),(0,S.jsx)(h,{title:C?`All agents`:`Current agents`,description:C?`Active and archived agents are shown together.`:`Archived agents stay hidden until you choose to show them.`,children:e.length===0?(0,S.jsx)(s,{title:C?`No agents yet`:`No current agents`,description:`Spawn an agent to give a team its first working member.`}):(0,S.jsx)(f,{children:e.map(e=>(0,S.jsx)(p,{title:(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(c,{identity:e.identity,size:26}),(0,S.jsx)(i,{to:`/`,search:{agent:e.id},className:`truncate`,children:e.name}),(0,S.jsx)(u,{variant:e.status===`archived`?`warning`:`success`,children:e.status})]}),meta:(0,S.jsxs)(S.Fragment,{children:[(e.identity?.creature||e.identity?.vibe)&&(0,S.jsx)(`span`,{children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)}),(0,S.jsxs)(`span`,{children:[`template `,(0,S.jsx)(`code`,{children:e.profileId})]}),(0,S.jsxs)(`span`,{children:[`team `,(0,S.jsx)(`code`,{children:e.teamId})]}),(0,S.jsx)(`code`,{title:e.id,children:e.id.slice(0,8)})]}),actions:(0,S.jsxs)(S.Fragment,{children:[e.status===`archived`?(0,S.jsx)(a,{variant:`ghost`,onClick:()=>void j(e),children:`Restore`}):(0,S.jsx)(a,{variant:`ghost`,onClick:()=>O({kind:`archive`,agent:e}),children:`Archive`}),(0,S.jsx)(a,{variant:`danger`,onClick:()=>O({kind:`delete`,agent:e}),children:`Delete`})]})},e.id))})}),T&&(0,S.jsx)(b,{profiles:n,teams:r,onClose:()=>E(!1)}),(0,S.jsx)(g,{open:D!==null,onOpenChange:e=>{e||O(null)},title:D?.kind===`delete`?`Delete ${D.agent.name} permanently?`:`Archive ${D?.agent.name??`agent`}?`,description:D?.kind===`delete`?(0,S.jsx)(`p`,{children:`This permanently removes the Agent, its messages, triggers, skill attachments, sessions, and private on-disk directory. This cannot be undone.`}):(0,S.jsx)(`p`,{children:`The Agent will stop appearing in current lists and cannot receive normal work. You can restore it later from “Show archived”.`}),confirmLabel:D?.kind===`delete`?`Delete permanently`:`Archive agent`,confirmVariant:D?.kind===`delete`?`danger`:`primary`,onConfirm:async()=>{D&&(D.kind===`delete`?await y(D.agent.id):await v(D.agent.id),await w.invalidate())}})]})}export{C as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./link-Cbztlp_R.js";var t=e(),n={primary:`btn-primary`,ghost:`ghost-btn`,danger:`danger-btn`};function r({variant:e,type:r,className:i,...a}){let o=i?`${n[e]} ${i}`:n[e];return(0,t.jsx)(`button`,{type:r??`button`,className:o,...a})}var i=[`__Host-bz_csrf`,`bz_csrf_dev`];function a(e,t){let n=[];for(let r of e?.split(`;`)??[]){let e=r.indexOf(`=`);e>0&&r.slice(0,e).trim()===t&&n.push(r.slice(e+1).trim())}return n}function o(e,t){return a(e,t)[0]}var s=class extends Error{status;code;body;constructor(e,t,n,r){super(e),this.status=t,this.code=n,this.body=r}};function c(){for(let e of i){let t=o(document.cookie,e);if(t)return{"x-bazilion-csrf":t}}return{}}async function l(e){let t=await e.text().catch(()=>``),n={};try{let e=JSON.parse(t);e&&typeof e==`object`&&(n=e)}catch{}let r=typeof n.error==`string`?n.error:t.slice(0,300)||`HTTP ${e.status}`,i=typeof n.code==`string`?n.code:void 0;return new s(r,e.status,i,n)}async function u(e,t={}){let n=t.method??(t.body===void 0?`GET`:`POST`),r=n===`GET`?{}:c(),i;t.body instanceof FormData?i=t.body:t.body!==void 0&&(r[`content-type`]=`application/json`,i=JSON.stringify(t.body));let a=await fetch(e,{method:n,headers:r,body:i,signal:t.signal});if(!a.ok)throw await l(a);return a}async function d(e,t={}){let n=await(await u(e,t)).text();return n?JSON.parse(n):void 0}function f(e){return e instanceof Error?e.message:String(e)}export{r as a,f as i,d as n,u as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-C6gOo8sD.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{G as e,l as t,q as n,t as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{at as s,ct as c,d as l,dt as u,ft as d,lt as f,ot as p,st as m,ut as h}from"./index-Br9qkGM-.js";var g=n(e()),_=t(),v=`/api/attention?state=all&limit=200`,y=`/api/attention/summary`,b={action_required:`warning`,error:`danger`,warning:`info`};function x(){let e=l.useLoaderData(),[t,n]=(0,g.useState)(e.list),[x,S]=(0,g.useState)(e.summary),[C,w]=(0,g.useState)(`open`),[T,E]=(0,g.useState)(`all`),[D,O]=(0,g.useState)(`all`),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=t.items.filter(e=>(C===`all`||(C===`open`?e.acknowledgedAt===null:e.acknowledgedAt!==null))&&(T===`all`||e.kind===T)&&(D===`all`||e.severity===D)),P=[...new Set([...t.degraded,...x.degraded].map(e=>e.kind))];async function F(){let[e,t]=await Promise.all([o(v),o(y)]);n(e),S(t)}async function I(e,t){A(e),M(null);try{M(await t())}catch(e){M(a(e))}finally{await F().catch(()=>{}),A(null)}}let L=(e,t)=>I(e.key,async()=>{let n=`/api/attention/${encodeURIComponent(e.key)}`;return await o(t?`${n}/acknowledge`:`${n}/acknowledgement`,{method:t?`POST`:`DELETE`}),null}),R=()=>I(`all`,async()=>{let{acknowledged:e}=await o(`/api/attention/acknowledge-all`,{method:`POST`});return`Acknowledged ${e} informational item(s). Lesson proposals and paused queues stay open.`});return(0,_.jsxs)(f,{size:`wide`,children:[(0,_.jsx)(c,{eyebrow:`Operations`,title:`Attention`,description:`Decisions waiting for you and failures worth a look. Act on an item at its source; acknowledge informational ones here.`,actions:(0,_.jsx)(i,{variant:`ghost`,disabled:k!==null,onClick:()=>void R(),children:`Acknowledge all informational items`})}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,_.jsx)(u,{label:`Open`,value:x.openTotal}),(0,_.jsx)(u,{label:`Action required`,value:x.bySeverity.action_required}),(0,_.jsx)(u,{label:`Errors and warnings`,value:x.bySeverity.error+x.bySeverity.warning})]}),P.length>0&&(0,_.jsxs)(`div`,{role:`alert`,className:`rounded-lg border border-danger/40 bg-danger/10 p-4 text-sm`,children:[(0,_.jsx)(`strong`,{children:`Partial results.`}),` `,P.join(`, `),` could not be loaded.`]}),j&&(0,_.jsx)(`p`,{role:`status`,className:`rounded-lg bg-muted px-4 py-3 text-sm`,children:j}),(0,_.jsx)(h,{title:`Queue`,description:`${N.length} matching item${N.length===1?``:`s`}`,actions:(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,_.jsxs)(`select`,{"aria-label":`Queue state`,value:C,onChange:e=>w(e.target.value),children:[(0,_.jsx)(`option`,{value:`open`,children:`Open`}),(0,_.jsx)(`option`,{value:`acknowledged`,children:`History`}),(0,_.jsx)(`option`,{value:`all`,children:`All`})]}),(0,_.jsxs)(`select`,{"aria-label":`Severity`,value:D,onChange:e=>O(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All severities`}),(0,_.jsx)(`option`,{value:`action_required`,children:`Action required`}),(0,_.jsx)(`option`,{value:`error`,children:`Errors`}),(0,_.jsx)(`option`,{value:`warning`,children:`Warnings`})]}),(0,_.jsxs)(`select`,{"aria-label":`Kind`,value:T,onChange:e=>E(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All kinds`}),(0,_.jsx)(`option`,{value:`lesson_proposal`,children:`Lessons`}),(0,_.jsx)(`option`,{value:`review_failure`,children:`Review failures`}),(0,_.jsx)(`option`,{value:`trigger_failure`,children:`Trigger failures`}),(0,_.jsx)(`option`,{value:`agent_loop_break`,children:`Loop breaks`}),(0,_.jsx)(`option`,{value:`queue_interrupted`,children:`Paused queues`})]})]}),children:N.length===0?(0,_.jsx)(s,{title:C===`open`?`Nothing needs attention`:`No matching history`,description:`Items come from learning reviews, triggers, follow-up queues and loop breaks.`}):(0,_.jsx)(p,{children:N.map(e=>(0,_.jsx)(m,{title:e.title,meta:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(d,{variant:b[e.severity],children:e.severity.replace(`_`,` `)}),(0,_.jsx)(`span`,{children:e.kind.replaceAll(`_`,` `)}),(0,_.jsx)(`span`,{children:[e.agentName,e.teamName].filter(Boolean).join(` · `)||`System`}),(0,_.jsx)(`time`,{dateTime:new Date(e.occurredAt).toISOString(),children:new Date(e.occurredAt).toLocaleString()})]}),actions:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(r,{to:e.href,className:`btn-primary`,children:e.kind===`lesson_proposal`?`Review lesson`:`Inspect source`}),e.acknowledgeable&&(0,_.jsx)(i,{variant:`ghost`,disabled:k===e.key,onClick:()=>void L(e,e.acknowledgedAt===null),children:e.acknowledgedAt===null?`Acknowledge`:`Restore to open`})]}),children:(0,_.jsx)(`p`,{className:`mb-0 mt-1 text-sm text-muted-foreground`,children:e.diagnostic})},e.key))})})]})}export{x as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-C6gOo8sD.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,a as t,l as n,q as r}from"./link-Cbztlp_R.js";import{a as i,i as a,n as o}from"./api-HC_YzjBy.js";import{t as s}from"./createLucideIcon-C6gOo8sD.js";import{a as c,i as l,r as u}from"./use-resource-BjnxgGvh.js";import{t as d}from"./check-BjgKoGvU.js";import{n as f,t as p}from"./Segmented-Dh77vmpp.js";import{t as m}from"./plus-CWrKMtvA.js";import{C as h,S as g,_,b as v,c as y,d as b,f as x,g as S,h as C,l as w,m as T,o as E,p as D,s as O,t as k,u as A,v as j,x as M,y as N}from"./AddProviderDialog-Diic36c_.js";import{r as P,t as F}from"./Dialog-bg86_x4v.js";import{f as I}from"./index-Br9qkGM-.js";import{t as L}from"./ConfirmDialog-GFDcHI1L.js";import{t as R}from"./ConfigPage-pupvtSCX.js";import{t as z}from"./FieldRow-B8eIni5r.js";var B=s(`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=r(e(),1),H=n(),U=[{id:`all`,label:`All`},{id:`images`,label:`Sees images`},{id:`reasoning`,label:`Reasoning`}],W=80;function G({providers:e,chat:t,onClose:n,onSaved:r,onAddProvider:s}){let[c,l]=(0,V.useState)(``),[d,f]=(0,V.useState)(`all`),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(null),[v,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(null),C=u(async t=>{let n=await Promise.all(e.map(async e=>({provider:e,catalog:await o(`/api/config/providers/${encodeURIComponent(e.id)}/catalog`,{signal:t})})));return _(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(`,`)]),w=g??{},T=(e,t)=>w[e]?.includes(t)??!1,E=(e,t)=>_(n=>{let r=n?.[e]??[];return{...n,[e]:r.includes(t)?r.filter(e=>e!==t):[...r,t]}}),D=(e,t)=>c?j(e,c):e.dated&&!m&&!T(t.id,e.id)?!1:d===`images`?e.images===!0:d===`reasoning`?e.reasoning===!0:!0,O=(0,V.useMemo)(()=>(C.data??[]).filter(({provider:e,catalog:t})=>{let n=t.models.filter(e=>e.selected).map(e=>e.id),r=w[e.id]??[];return n.length!==r.length||n.some(e=>!r.includes(e))}),[C.data,w]),k=t.filter(e=>e.usedBy.agents>0&&O.some(({provider:t})=>t.id===e.provider)&&!T(e.provider,e.id)),M=Object.values(w).reduce((e,t)=>e+t.length,0);async function P(){b(!0),S(null);try{for(let{provider:e}of O)await o(`/api/config/providers/${encodeURIComponent(e.id)}/models`,{method:`PUT`,body:{models:w[e.id]??[]}});await r(),n()}catch(e){S(a(e)),b(!1)}}return(0,H.jsxs)(F,{title:`Chat models`,description:`Tick the models your Agents may use. Each Agent and each template picks one of them.`,onClose:n,busy:v,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)(A,{label:`Search models`,placeholder:`Search by name, for example haiku`,value:c,onChange:l,className:`flex-1 basis-60`}),(0,H.jsx)(p,{label:`Show`,value:d,options:U,onChange:f})]}),(0,H.jsxs)(`div`,{className:`max-h-[min(58dvh,36rem)] min-h-40 overflow-y-auto rounded-xl border border-border`,children:[C.loading&&!C.data&&(0,H.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Reading the model lists…`}),C.error&&(0,H.jsx)(`div`,{role:`alert`,className:`p-4 text-sm text-danger`,children:C.error}),C.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.`}),(C.data??[]).map(({provider:e,catalog:t})=>{let n=t.models.filter(t=>D(t,e)),r=n.slice(0,W),i=t.models.filter(t=>t.dated&&!T(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-[0.72rem] font-bold uppercase tracking-[0.08em] text-muted-foreground`,children:e.displayName}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(w[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)(y,{model:{...t,suggested:!1},connect:e.connect,checked:T(e.id,t.id),disabled:v,onToggle:()=>E(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:()=>h(e=>!e),className:`text-xs font-semibold text-primary`,children:m?`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=>N(e)).join(`, `),` `,k.length===1?`is`:`are`,` in use by Agents. They are refused until you give them another model in their Agent tab.`]}),x&&(0,H.jsx)(`p`,{role:`alert`,className:`m-0 rounded-xl bg-danger/10 px-3 py-2 text-sm text-danger`,children:x}),(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:s,className:`text-sm font-semibold text-primary`,children:`A model from another provider?`}),(0,H.jsx)(i,{variant:`ghost`,disabled:v,onClick:n,children:`Cancel`}),(0,H.jsx)(i,{variant:`primary`,disabled:v||O.length===0,onClick:()=>void P(),children:v?`Saving…`:`Save`})]})]})}var K=`flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-4 sm:px-5`;function q({providers:e,chat:t,now:n,onOpen:r,onTestAll:a,testing:o}){let s=e.filter(e=>e.enabled);if(s.length===0)return null;let c=s.filter(e=>e.state===`failing`||e.state===`incomplete`),l=s.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 a=t.filter(t=>t.provider===e.id),o=a.reduce((e,t)=>e+t.usedBy.agents,0);return(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-warning/35 bg-warning/10 px-4 py-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-64 items-start gap-3`,children:[(0,H.jsx)(h,{className:`mt-0.5 size-5 shrink-0 text-warning`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[e.check?.failure?.title??`${e.displayName}: ${M(e,n).label.toLowerCase()}`,`.`]}),` `,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:a.length===0?`No chat model runs on it.`:`${a.length===1?`1 chat model runs`:`${a.length} chat models run`} on it${o===0?``:`, used by ${o===1?`1 Agent`:`${o} Agents`}`}.`})]})]}),(0,H.jsxs)(i,{variant:`ghost`,onClick:()=>r(e.id),children:[`Open `,e.displayName]})]},e.id)})});if(l.length>0)return(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-border bg-card px-4 py-3 text-sm shadow-baziu-sm`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1 basis-72`,children:[(0,H.jsx)(`span`,{className:`font-semibold text-foreground`,children:l.length===1?`${l[0]?.displayName} has not been tested.`:`${l.length} providers have not been tested.`}),` `,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`A test sends one short message to the cheapest model of each.`})]}),(0,H.jsx)(i,{variant:`ghost`,disabled:o,onClick:a,children:o?`Testing…`:l.length===1?`Test it`:`Test them`})]});let u=s.filter(e=>e.state===`working`);return u.length===0?null:(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-3 rounded-2xl border border-success/30 bg-success/10 px-4 py-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-64 items-start gap-3`,children:[(0,H.jsx)(d,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-semibold text-foreground`,children:u.length===1?`Your provider answers.`:`Every provider answers.`}),` `,(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[t.length===1?`1 chat model`:`${t.length} chat models`,` for your Agents.`]})]})]}),(0,H.jsx)(i,{variant:`ghost`,disabled:o,onClick:a,children:o?`Testing…`:`Test again`})]})}function J({chat:e,hasProviders:t,onPick:n,onChanged:r}){let[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null);async function d(t){let n=e.filter(e=>e.provider===t.provider&&e.id!==t.id).map(e=>e.id);await o(`/api/config/providers/${encodeURIComponent(t.provider)}/models`,{method:`PUT`,body:{models:n}}),await r()}function p(e){u(null),e.usedBy.agents>0||e.usedBy.templates.length>0?c(e):d(e).catch(e=>u(a(e)))}return(0,H.jsxs)(b,{labelledBy:`setup-chat`,icon:(0,H.jsx)(f,{className:`size-5`}),title:`Chat`,description:`The models Agents think with. Each Agent and each template uses one of them.`,action:(0,H.jsxs)(i,{variant:`primary`,disabled:!t,onClick:n,children:[(0,H.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),`Add models`]}),children:[e.length>0&&(0,H.jsxs)(`div`,{"aria-hidden":`true`,className:`${K} hidden bg-muted/50 py-2 text-[0.7rem] 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:`${K} 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-[0.95rem] font-semibold text-foreground`,children:N(e)}),e.name&&(0,H.jsx)(`div`,{className:`break-all font-mono text-[0.72rem] 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-[0.82rem] ${t?`font-semibold text-warning`:`text-muted-foreground`}`,children:t?`${e.providerName} is not working`:_(e,e.providerConnect)}),(0,H.jsx)(`div`,{className:`w-40 shrink-0 text-[0.82rem]`,children:v(e,e.providerConnect)}),(0,H.jsx)(`div`,{className:`min-w-0 flex-[1.4] basis-36 text-[0.82rem] text-muted-foreground`,children:g(e.usedBy)}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Remove ${N(e)} from Chat`,onClick:()=>p(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)(P,{className:`size-4`,"aria-hidden":`true`})})]},e.value)}),e.length===0&&(0,H.jsx)(`div`,{className:`${K} 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:`${K} py-3 text-sm text-danger`,children:l}),(0,H.jsx)(L,{open:s!==null,onOpenChange:e=>{e||c(null)},title:`Remove ${s?N(s):``} from Chat?`,description:s&&(0,H.jsxs)(`p`,{className:`m-0`,children:[`It is used by `,g(s.usedBy),`.`,` `,s.usedBy.agents>0&&`Those Agents are refused until you give them another model in their Agent tab. `,s.usedBy.templates.length>0&&`An Agent template on it moves to another model by itself.`]}),confirmLabel:`Remove from Chat`,onConfirm:async()=>{s&&await d(s)}})]})}function Y({images:e,onConnect:t,onChanged:n}){let[r,s]=(0,V.useState)(null),[c,u]=(0,V.useState)(null),d=e.routes.find(t=>t.id===e.selected),f=d?.ready===!0,p=r??e.selected;async function m(e){s(e),u(null);try{await o(`/api/config/fields/BAZILION_IMAGE_MODEL`,{method:`PUT`,body:{value:e}}),await n()}catch(e){u(a(e))}finally{s(null)}}let h=(e,t,n,i)=>(0,H.jsxs)(`label`,{className:`${K} m-0 min-h-[3.25rem] py-2 ${n?`cursor-pointer`:``} ${p===e?`bg-accent/40`:``}`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`image-model`,checked:p===e,disabled:!n||r!==null,onChange:()=>void m(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:i})]},e);return(0,H.jsxs)(b,{labelledBy:`setup-images`,icon:(0,H.jsx)(l,{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)(E,{tone:f?`success`:d?`warning`:`neutral`,children:f?`On: ${d.model}`:d?`Needs ${d.needs}`:`Off`}),children:[e.routes.map(e=>h(e.id,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-[1.6] basis-60 text-[0.95rem]`,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-[0.82rem] text-muted-foreground`,children:e.billing})]}),e.ready,e.ready?(0,H.jsx)(`span`,{className:`text-[0.82rem] font-semibold text-success`,children:`Ready`}):(0,H.jsx)(i,{variant:`ghost`,onClick:()=>t(e.provider),children:e.provider===`openai-codex`?`Sign in`:`Connect ${e.providerName}`}))),h(`off`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-[1.6] basis-60 text-[0.95rem] font-semibold text-foreground`,children:`Off`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 basis-44 text-[0.82rem] text-muted-foreground`,children:`Agents have no image tool`})]}),!0,null),e.selected!==`off`&&!d&&(0,H.jsxs)(`div`,{role:`alert`,className:`${K} 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:`${K} py-3 text-sm text-danger`,children:c})]})}function X({providers:e,total:t,images:n,now:r,onOpen:a,onAdd:o}){let s=n.routes.find(e=>e.id===n.selected&&e.ready);return(0,H.jsxs)(b,{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)(i,{variant:`primary`,onClick:o,children:[(0,H.jsx)(m,{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,s?.provider===e.id?`Images`:null].filter(Boolean),i=M(e,r);return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),className:`${K} min-h-[4.25rem] w-full py-3 text-left transition-colors hover:bg-accent/30`,children:[(0,H.jsx)(w,{name:e.displayName,tone:i.tone}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-[1.6] basis-56`,children:[(0,H.jsx)(`span`,{className:`block text-[0.95rem] font-semibold text-foreground`,children:e.displayName}),(0,H.jsx)(`span`,{className:`block truncate text-[0.82rem] text-muted-foreground`,children:S(e)})]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 basis-40 text-[0.82rem] text-muted-foreground`,children:n.length>0?n.join(` · `):`Not used yet`}),(0,H.jsx)(x,{provider:e,now:r}),(0,H.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]},e.id)}),e.length===0&&(0,H.jsx)(`div`,{className:`${K} py-5 text-sm text-muted-foreground`,children:`No provider yet. Add one to give your Agents a model.`}),(0,H.jsxs)(`div`,{className:`${K} bg-muted/50 py-3 text-[0.82rem] 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.`]})]})}var Z=`m-0 font-body text-[0.72rem] font-bold uppercase tracking-[0.08em] text-muted-foreground`;function Q({provider:e,chat:t,imageRoutes:n,imageSelected:r,onClose:s,onChanged:l,onPickModels:u,onReconnect:f}){let p=(0,V.useMemo)(()=>Date.now(),[]),[m,h]=(0,V.useState)(null),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),w=`/api/config/providers/${encodeURIComponent(e.id)}`,{state:E,check:k}=e,A=e.connect===`signin`,j=e.fields.filter(e=>!e.advanced),M=e.fields.filter(e=>e.advanced),P=t.reduce((e,t)=>e+t.usedBy.agents,0),I=n.find(e=>e.id===r);async function R(e,t){h(e),v(null);try{await t(),await l()}catch(e){v(a(e))}finally{h(null)}}let B=()=>R(`test`,()=>o(`${w}/test`,{method:`POST`})),U=e=>R(`switch`,()=>o(`${w}/enabled`,{method:`PUT`,body:{enabled:e}})),W=()=>R(`signin`,()=>o(`/api/auth/openai/login`,{method:`POST`}));async function G(){await o(w,{method:`DELETE`}),await l(),s()}let K=e.models.length>0,q=(e,t=!1)=>(0,H.jsx)(i,{variant:t?`primary`:`ghost`,disabled:m!==null,onClick:()=>void B(),children:e});return(0,H.jsxs)(F,{title:e.displayName,description:e.hint,onClose:s,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)(T,{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)(T,{children:`Waiting for the ChatGPT sign-in in the browser…`})}):E===`working`&&k?(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)(d,{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:[k.modelName??k.model,` answered in `,((k.ms??0)/1e3).toFixed(1),` s`]}),(0,H.jsxs)(`div`,{className:`text-muted-foreground`,children:[`Tested `,C(k.at,p)]})]}),q(`Test again`)]}):E===`failing`&&k?.failure?(0,H.jsxs)(O,{failure:k.failure,children:[(0,H.jsxs)(`span`,{className:`mr-auto self-center text-xs text-muted-foreground`,children:[`Tried `,C(k.at,p)]}),k.failure.kind===`credentials`&&(0,H.jsx)(i,{variant:`ghost`,onClick:A?()=>void W():f,children:A?`Sign in again`:`Replace the key`}),q(`Try again`,!0)]}):E===`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:A?`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)(i,{variant:`primary`,onClick:A?()=>void W():f,children:A?`Sign in with ChatGPT`:`Connect`})]}):E===`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)(i,{variant:`primary`,disabled:m!==null,onClick:f,children:`Connect`}):(0,H.jsx)(i,{variant:`primary`,disabled:m!==null||!e.configured,onClick:()=>void U(!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:K?`A test sends one short message to its cheapest model in Chat.`:`It has no model in Chat, so there is nothing to ask.`})]}),K&&q(`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:A?`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:A?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.`:j.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:j.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))})}),A?(0,H.jsx)(i,{variant:`ghost`,disabled:m!==null,onClick:()=>void W(),children:e.configured?`Sign in again`:`Sign in with ChatGPT`}):j.length>0&&(0,H.jsx)(i,{variant:`ghost`,disabled:m!==null,onClick:f,children:e.connect===`local`?`Change the address`:j.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?N(n):e}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:n?g(n.usedBy):`Out of Chat while this is turned off`})]},e)})]}),n.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(n.map(e=>e.model))].join(`, `)}.`})]}),(0,H.jsxs)(`section`,{"aria-label":`More settings`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":y,onClick:()=>b(e=>!e),className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[(0,H.jsx)(c,{className:`size-4 text-muted-foreground transition-transform ${y?`rotate-90`:``}`,"aria-hidden":`true`}),`More settings`]}),y&&(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)(D,{checked:e.enabled,label:`Agents may use this provider`,disabled:m!==null||!e.enabled&&!e.configured,onChange:e=>void U(e)})]}),M.map(e=>(0,H.jsx)(z,{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)(i,{variant:`danger`,disabled:m!==null,onClick:()=>S(!0),children:[`Disconnect `,e.displayName]}),(0,H.jsxs)(`p`,{className:`m-0 mt-2 text-sm text-muted-foreground`,children:[`Removes`,` `,A?`the sign-in`:e.connect===`local`?`the address`:`the key`,`, its models from Chat and its test.`]})]}),(0,H.jsx)(L,{open:x,onOpenChange:S,title:`Disconnect ${e.displayName}?`,description:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`m-0`,children:[`This removes`,` `,A?`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.`]}),P>0&&(0,H.jsxs)(`p`,{className:`m-0 mt-2`,children:[P===1?`1 Agent runs`:`${P} 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:G})]})}function $(){let{providers:e,models:n,now:r}=I.useLoaderData(),i=I.useSearch(),a=I.useNavigate(),s=t(),[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===i.provider&&e.listed);async function g(){l(!0);try{await Promise.all(d.filter(e=>e.models.length>0).map(e=>o(`/api/config/providers/${encodeURIComponent(e.id)}/test`,{method:`POST`}).catch(()=>void 0))),await m()}finally{l(!1)}}return(0,H.jsxs)(R,{title:`Models`,description:`What your Agents think and draw with, and the accounts behind it.`,children:[(0,H.jsx)(q,{providers:u,chat:n.chat,now:r,testing:c,onOpen:e=>f({provider:e}),onTestAll:()=>void g()}),(0,H.jsx)(J,{chat:n.chat,hasProviders:d.length>0,onPick:()=>f({pick:!0}),onChanged:m}),(0,H.jsx)(Y,{images:n.images,onConnect:e=>f({add:e}),onChanged:m}),(0,H.jsx)(X,{providers:u,total:e.length,images:n.images,now:r,onOpen:e=>f({provider:e}),onAdd:()=>f({add:`new`})}),i.add&&(0,H.jsx)(k,{providers:e,imageRoutes:n.images.routes,start:i.add===`new`?void 0:i.add,onClose:p,onConnected:m,onOpenProvider:e=>f({provider:e})},i.add),i.pick&&(0,H.jsx)(G,{providers:d,chat:n.chat,onClose:p,onSaved:m,onAddProvider:()=>f({add:`new`})}),h&&(0,H.jsx)(Q,{provider:h,chat:n.chat.filter(e=>e.provider===h.id),imageRoutes:n.images.routes.filter(e=>e.provider===h.id),imageSelected:n.images.selected,onClose:p,onChanged:m,onPickModels:()=>f({pick:!0}),onReconnect:()=>f({add:h.id})},h.id)]})}export{$ as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,q as t}from"./link-Cbztlp_R.js";var n=t(e(),1),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(0,n.createContext)({}),u=()=>(0,n.useContext)(l),d=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:a,className:o=``,children:l,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=u()??{},y=a??g?Number(i??h)*24/Number(t??m):i??h;return(0,n.createElement)(`svg`,{ref:p,...s,width:t??m??s.width,height:t??m??s.height,stroke:e??_,strokeWidth:y,className:r(`lucide`,v,o),...!l&&!c(f)&&{"aria-hidden":`true`},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])}),f=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(d,{ref:c,iconNode:t,className:r(`lucide-${i(o(e))}`,`lucide-${e}`,a),...s}));return a.displayName=o(e),a};export{f as t};
|