bazilion 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +3 -3
  2. package/dist/cli.js +20 -14
  3. package/dist/cli.js.map +1 -1
  4. package/dist/daemon.js +259 -197
  5. package/dist/daemon.js.map +1 -1
  6. package/dist/web/client/assets/{ProductionTeamPolicyEditor-CSL3W7XM.js → ProductionTeamPolicyEditor-CsWpTsy6.js} +1 -1
  7. package/dist/web/client/assets/{ProfileCommunicationEditor-CwU0QkmE.js → ProfileCommunicationEditor-C43HvUe-.js} +1 -1
  8. package/dist/web/client/assets/{TeamTabs-C1Hakkff.js → TeamTabs-DvqWieCq.js} +1 -1
  9. package/dist/web/client/assets/{TemplatesTabs-klEydJ8-.js → TemplatesTabs-6Jd_xQj7.js} +1 -1
  10. package/dist/web/client/assets/{_id-e4u7dmBb.js → _id-AOAT0H_5.js} +1 -1
  11. package/dist/web/client/assets/{_id-wkjjWLz0.js → _id-BUuz7Drv.js} +1 -1
  12. package/dist/web/client/assets/{_id-BOC7ioJu.js → _id-BegmVRmT.js} +1 -1
  13. package/dist/web/client/assets/{_id-CnVq-rED.js → _id-BrA4Crh_.js} +1 -1
  14. package/dist/web/client/assets/{activity-uqhwzmiy.js → activity-n0Fw9_w3.js} +1 -1
  15. package/dist/web/client/assets/{agents-FaQtkAWs.js → agents-B33VQtbl.js} +1 -1
  16. package/dist/web/client/assets/{agents-B2usE-L_.js → agents-C50pdxp7.js} +1 -1
  17. package/dist/web/client/assets/{approvals-DqLE6ttw.js → approvals-DVW0hX8h.js} +1 -1
  18. package/dist/web/client/assets/{attention-CkGozYnJ.js → attention-B2490jcN.js} +1 -1
  19. package/dist/web/client/assets/chevron-down-B0aNNOyn.js +1 -0
  20. package/dist/web/client/assets/{config-xrXoDEWM.js → config-CMMxxeX2.js} +2 -2
  21. package/dist/web/client/assets/{context-ZWqx3uiC.js → context-DcFzsfZ3.js} +1 -1
  22. package/dist/web/client/assets/{inbox-BoIvl9ZF.js → inbox-Bn1GbUsJ.js} +1 -1
  23. package/dist/web/client/assets/{index-nb2MV8X1.js → index-3nrK5iFr.js} +2 -2
  24. package/dist/web/client/assets/{learning-6_oYn1l7.js → learning-BUX1MFu2.js} +1 -1
  25. package/dist/web/client/assets/{login-DM1ytxQL.js → login-CMWpGDKv.js} +1 -1
  26. package/dist/web/client/assets/{mcp-CetZbyUh.js → mcp-lZV08dqc.js} +1 -1
  27. package/dist/web/client/assets/{members-DdqWtwZd.js → members-DAeaY2Cy.js} +1 -1
  28. package/dist/web/client/assets/{memory-FNrxFHmC.js → memory-HmMWxxdF.js} +1 -1
  29. package/dist/web/client/assets/plus-CPzRJg1V.js +1 -0
  30. package/dist/web/client/assets/{policy-BKPejYRI.js → policy-DaijITy7.js} +1 -1
  31. package/dist/web/client/assets/{routes-CH1ZTTo-.js → routes-BNk270AM.js} +1 -1
  32. package/dist/web/client/assets/{services-zk9SqN06.js → services-DtrpJrdo.js} +1 -1
  33. package/dist/web/client/assets/{skills-tXDpomHW.js → skills-Cv93A3P3.js} +1 -1
  34. package/dist/web/client/assets/{teams-D1c8zlxs.js → teams-CCFnSNKi.js} +1 -1
  35. package/dist/web/client/assets/{teams-BZYjekBN.js → teams-D92R9Pb7.js} +1 -1
  36. package/dist/web/client/assets/{telegram-DCe1CWMt.js → telegram-BF1vdgDB.js} +1 -1
  37. package/dist/web/client/assets/{tokens-DAPjRS0N.js → tokens-BXj6hWW-.js} +1 -1
  38. package/dist/web/client/assets/{triggers-D8R-5guA.js → triggers-NT24i4hZ.js} +1 -1
  39. package/dist/web/client/assets/{welcome-CuK0shDJ.js → welcome-D0cy68eZ.js} +1 -1
  40. package/dist/web/server/assets/{_tanstack-start-manifest_v-fLsYERQ-.js → _tanstack-start-manifest_v-BGDBdnUs.js} +53 -53
  41. package/dist/web/server/assets/{config-TeIoyYYc.js → config-1w2GiJUn.js} +1 -1
  42. package/dist/web/server/assets/{config-D2LAsud2.js → config-BmixCpz-.js} +17 -15
  43. package/dist/web/server/assets/{router-CQuj7553.js → router-CIVjTgNp.js} +2 -2
  44. package/dist/web/server/assets/{welcome-IYHGurWx.js → welcome-DDB11L5j.js} +2 -2
  45. package/dist/web/server/server.js +2 -2
  46. package/dist/worker.js +198 -135
  47. package/dist/worker.js.map +1 -1
  48. package/package.json +6 -6
  49. package/dist/web/client/assets/chevron-down-CJk0zGNT.js +0 -1
  50. package/dist/web/client/assets/plus-C3GroITC.js +0 -1
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{i}from"./index-nb2MV8X1.js";import{r as a}from"./Page-CwNuDhWz.js";import{t as o}from"./AgentTabs-R6gSjIj3.js";import{t as s}from"./Button-ByiV6fpd.js";var c=e(n()),l=t();function u(){let{resolved:e,config:t,reviews:n,proposals:u}=i.useLoaderData(),p=r(),[m,h]=(0,c.useState)(null),[g,_]=(0,c.useState)(!1);async function v(e,t,n){h(null),_(!0);try{let r=await fetch(e,{method:t,headers:n===void 0?void 0:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n)});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`request failed (${r.status})`)}await p.invalidate()}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}let y=encodeURIComponent(e.agent.id);return(0,l.jsxs)(a,{children:[(0,l.jsx)(`header`,{className:`mb-6`,children:(0,l.jsx)(`h1`,{children:e.agent.name})}),(0,l.jsx)(o,{agentId:e.agent.id,active:`learning`,archived:e.agent.status===`archived`}),m&&(0,l.jsxs)(`p`,{className:`mb-4 rounded border border-red-300 bg-red-50 p-3 text-sm text-red-800`,children:[m,`. Refresh before retrying if another operator changed this proposal.`]}),(0,l.jsxs)(`section`,{className:`mb-8 rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h2`,{className:`mb-2 text-xl`,children:`Reviewed learning`}),(0,l.jsxs)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:[`Reviews inspect at most 8 successful user turns and 40,000 characters. They use `,t.model??`the Agent model`,` at `,t.reasoningLevel,` reasoning, propose at most five lessons, and never apply anything without your approval.`]}),(0,l.jsx)(d,{agentId:e.agent.id,config:t,disabled:g,onError:h,onSaved:()=>p.invalidate()}),(0,l.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,l.jsx)(s,{variant:`primary`,disabled:g||e.agent.status===`archived`,onClick:()=>v(`/api/agents/${y}/reviews`,`POST`),children:`Review now`}),!t.enabled&&(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Periodic review is disabled; manual review remains available.`})]})]}),(0,l.jsx)(`h2`,{className:`mb-3 text-xl`,children:`Lesson proposals`}),u.length===0?(0,l.jsx)(`p`,{className:`mb-8 text-muted-foreground`,children:`No proposals yet. A successful review may also produce zero proposals.`}):(0,l.jsx)(`div`,{className:`mb-8 grid gap-3`,children:u.map(t=>(0,l.jsx)(f,{proposal:t,agentId:e.agent.id,busy:g,act:v},t.id))}),(0,l.jsx)(`h2`,{className:`mb-3 text-xl`,children:`Review history`}),n.length===0?(0,l.jsx)(`p`,{className:`text-muted-foreground`,children:`No reviews have been queued.`}):(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{children:`created`}),(0,l.jsx)(`th`,{children:`trigger`}),(0,l.jsx)(`th`,{children:`status`}),(0,l.jsx)(`th`,{children:`turns`}),(0,l.jsx)(`th`,{children:`proposals`}),(0,l.jsx)(`th`,{children:`diagnostic`})]})}),(0,l.jsx)(`tbody`,{children:n.map(e=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{children:new Date(e.createdAt).toLocaleString()}),(0,l.jsx)(`td`,{children:e.trigger}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{children:e.status})}),(0,l.jsx)(`td`,{children:e.turnsReviewed}),(0,l.jsx)(`td`,{children:e.proposalCount}),(0,l.jsx)(`td`,{children:e.lastError??`—`})]},e.id))})]})})]})}function d({agentId:e,config:t,disabled:n,onError:r,onSaved:i}){let[a,o]=(0,c.useState)(t.enabled),[u,d]=(0,c.useState)(t.everyNTurns),[f,p]=(0,c.useState)(t.model??``),[m,h]=(0,c.useState)(t.reasoningLevel);async function g(t){t.preventDefault(),r(null);let n=await fetch(`/api/agents/${encodeURIComponent(e)}/review-config`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:a,everyNTurns:u,model:f.trim()||null,reasoningLevel:m})});if(!n.ok){r((await n.json().catch(()=>null))?.error??`request failed (${n.status})`);return}i()}return(0,l.jsxs)(`form`,{onSubmit:g,className:`grid gap-3 md:grid-cols-4`,children:[(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Periodic review`}),(0,l.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),` enabled`]}),(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Every turns`}),(0,l.jsx)(`input`,{type:`number`,min:1,max:100,value:u,onChange:e=>d(Number(e.target.value))})]}),(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Model override`}),(0,l.jsx)(`input`,{value:f,placeholder:`agent model`,onChange:e=>p(e.target.value)})]}),(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Reasoning`}),(0,l.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),children:[(0,l.jsx)(`option`,{children:`off`}),(0,l.jsx)(`option`,{children:`minimal`}),(0,l.jsx)(`option`,{children:`low`}),(0,l.jsx)(`option`,{children:`medium`}),(0,l.jsx)(`option`,{children:`high`}),(0,l.jsx)(`option`,{children:`xhigh`})]})]}),(0,l.jsx)(`div`,{children:(0,l.jsx)(s,{variant:`primary`,type:`submit`,disabled:n,children:`Save learning settings`})})]})}function f({proposal:e,agentId:t,busy:n,act:r}){let[i,a]=(0,c.useState)(e.text),[o,u]=(0,c.useState)(e.scope),d=`/api/agents/${encodeURIComponent(t)}/lesson-proposals/${encodeURIComponent(e.id)}`;return(0,l.jsxs)(`article`,{className:`rounded-lg border bg-card p-4`,children:[(0,l.jsxs)(`div`,{className:`mb-2 flex justify-between gap-2`,children:[(0,l.jsx)(`code`,{children:e.status}),(0,l.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,e.version]})]}),e.status===`pending`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`textarea`,{className:`w-full`,rows:3,value:i,onChange:e=>a(e.target.value)}),(0,l.jsxs)(`select`,{className:`mt-2`,value:o,onChange:e=>u(e.target.value),children:[(0,l.jsx)(`option`,{value:`private`,children:`private Agent behavior`}),(0,l.jsx)(`option`,{value:`shared`,children:`shared Team knowledge`})]}),(0,l.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,l.jsx)(s,{variant:`ghost`,disabled:n,onClick:()=>r(d,`PATCH`,{version:e.version,text:i,scope:o}),children:`Save edit`}),(0,l.jsx)(s,{variant:`primary`,disabled:n,onClick:()=>r(`${d}/approve`,`POST`,{version:e.version}),children:`Approve`}),(0,l.jsx)(s,{variant:`danger`,disabled:n,onClick:()=>r(`${d}/reject`,`POST`,{version:e.version}),children:`Reject`})]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{children:e.text}),e.status===`approved`&&(0,l.jsx)(`div`,{className:`mt-3`,children:(0,l.jsx)(s,{variant:`danger`,disabled:n,onClick:()=>r(`${d}/revoke`,`POST`,{version:e.version}),children:`Revoke`})})]}),(0,l.jsxs)(`div`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Evidence: `,e.evidence.length===0?`none`:(0,l.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:e.evidence.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsxs)(`code`,{children:[e.sessionId,`:`,e.entryOrdinal]}),e.excerpt?` — ${e.excerpt}`:` — excerpt unavailable`]},`${e.sessionId}:${e.entryOrdinal}`))})]}),o===`shared`&&(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Shared lessons become searchable Team memory. Stable facts about the human belong in Team USER.md instead.`})]})}export{u as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{i}from"./index-3nrK5iFr.js";import{r as a}from"./Page-CwNuDhWz.js";import{t as o}from"./AgentTabs-R6gSjIj3.js";import{t as s}from"./Button-ByiV6fpd.js";var c=e(n()),l=t();function u(){let{resolved:e,config:t,reviews:n,proposals:u}=i.useLoaderData(),p=r(),[m,h]=(0,c.useState)(null),[g,_]=(0,c.useState)(!1);async function v(e,t,n){h(null),_(!0);try{let r=await fetch(e,{method:t,headers:n===void 0?void 0:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n)});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`request failed (${r.status})`)}await p.invalidate()}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}let y=encodeURIComponent(e.agent.id);return(0,l.jsxs)(a,{children:[(0,l.jsx)(`header`,{className:`mb-6`,children:(0,l.jsx)(`h1`,{children:e.agent.name})}),(0,l.jsx)(o,{agentId:e.agent.id,active:`learning`,archived:e.agent.status===`archived`}),m&&(0,l.jsxs)(`p`,{className:`mb-4 rounded border border-red-300 bg-red-50 p-3 text-sm text-red-800`,children:[m,`. Refresh before retrying if another operator changed this proposal.`]}),(0,l.jsxs)(`section`,{className:`mb-8 rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h2`,{className:`mb-2 text-xl`,children:`Reviewed learning`}),(0,l.jsxs)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:[`Reviews inspect at most 8 successful user turns and 40,000 characters. They use `,t.model??`the Agent model`,` at `,t.reasoningLevel,` reasoning, propose at most five lessons, and never apply anything without your approval.`]}),(0,l.jsx)(d,{agentId:e.agent.id,config:t,disabled:g,onError:h,onSaved:()=>p.invalidate()}),(0,l.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,l.jsx)(s,{variant:`primary`,disabled:g||e.agent.status===`archived`,onClick:()=>v(`/api/agents/${y}/reviews`,`POST`),children:`Review now`}),!t.enabled&&(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Periodic review is disabled; manual review remains available.`})]})]}),(0,l.jsx)(`h2`,{className:`mb-3 text-xl`,children:`Lesson proposals`}),u.length===0?(0,l.jsx)(`p`,{className:`mb-8 text-muted-foreground`,children:`No proposals yet. A successful review may also produce zero proposals.`}):(0,l.jsx)(`div`,{className:`mb-8 grid gap-3`,children:u.map(t=>(0,l.jsx)(f,{proposal:t,agentId:e.agent.id,busy:g,act:v},t.id))}),(0,l.jsx)(`h2`,{className:`mb-3 text-xl`,children:`Review history`}),n.length===0?(0,l.jsx)(`p`,{className:`text-muted-foreground`,children:`No reviews have been queued.`}):(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{children:`created`}),(0,l.jsx)(`th`,{children:`trigger`}),(0,l.jsx)(`th`,{children:`status`}),(0,l.jsx)(`th`,{children:`turns`}),(0,l.jsx)(`th`,{children:`proposals`}),(0,l.jsx)(`th`,{children:`diagnostic`})]})}),(0,l.jsx)(`tbody`,{children:n.map(e=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{children:new Date(e.createdAt).toLocaleString()}),(0,l.jsx)(`td`,{children:e.trigger}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{children:e.status})}),(0,l.jsx)(`td`,{children:e.turnsReviewed}),(0,l.jsx)(`td`,{children:e.proposalCount}),(0,l.jsx)(`td`,{children:e.lastError??`—`})]},e.id))})]})})]})}function d({agentId:e,config:t,disabled:n,onError:r,onSaved:i}){let[a,o]=(0,c.useState)(t.enabled),[u,d]=(0,c.useState)(t.everyNTurns),[f,p]=(0,c.useState)(t.model??``),[m,h]=(0,c.useState)(t.reasoningLevel);async function g(t){t.preventDefault(),r(null);let n=await fetch(`/api/agents/${encodeURIComponent(e)}/review-config`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:a,everyNTurns:u,model:f.trim()||null,reasoningLevel:m})});if(!n.ok){r((await n.json().catch(()=>null))?.error??`request failed (${n.status})`);return}i()}return(0,l.jsxs)(`form`,{onSubmit:g,className:`grid gap-3 md:grid-cols-4`,children:[(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Periodic review`}),(0,l.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),` enabled`]}),(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Every turns`}),(0,l.jsx)(`input`,{type:`number`,min:1,max:100,value:u,onChange:e=>d(Number(e.target.value))})]}),(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Model override`}),(0,l.jsx)(`input`,{value:f,placeholder:`agent model`,onChange:e=>p(e.target.value)})]}),(0,l.jsxs)(`label`,{className:`text-sm`,children:[(0,l.jsx)(`span`,{className:`block mb-1`,children:`Reasoning`}),(0,l.jsxs)(`select`,{value:m,onChange:e=>h(e.target.value),children:[(0,l.jsx)(`option`,{children:`off`}),(0,l.jsx)(`option`,{children:`minimal`}),(0,l.jsx)(`option`,{children:`low`}),(0,l.jsx)(`option`,{children:`medium`}),(0,l.jsx)(`option`,{children:`high`}),(0,l.jsx)(`option`,{children:`xhigh`})]})]}),(0,l.jsx)(`div`,{children:(0,l.jsx)(s,{variant:`primary`,type:`submit`,disabled:n,children:`Save learning settings`})})]})}function f({proposal:e,agentId:t,busy:n,act:r}){let[i,a]=(0,c.useState)(e.text),[o,u]=(0,c.useState)(e.scope),d=`/api/agents/${encodeURIComponent(t)}/lesson-proposals/${encodeURIComponent(e.id)}`;return(0,l.jsxs)(`article`,{className:`rounded-lg border bg-card p-4`,children:[(0,l.jsxs)(`div`,{className:`mb-2 flex justify-between gap-2`,children:[(0,l.jsx)(`code`,{children:e.status}),(0,l.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,e.version]})]}),e.status===`pending`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`textarea`,{className:`w-full`,rows:3,value:i,onChange:e=>a(e.target.value)}),(0,l.jsxs)(`select`,{className:`mt-2`,value:o,onChange:e=>u(e.target.value),children:[(0,l.jsx)(`option`,{value:`private`,children:`private Agent behavior`}),(0,l.jsx)(`option`,{value:`shared`,children:`shared Team knowledge`})]}),(0,l.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,l.jsx)(s,{variant:`ghost`,disabled:n,onClick:()=>r(d,`PATCH`,{version:e.version,text:i,scope:o}),children:`Save edit`}),(0,l.jsx)(s,{variant:`primary`,disabled:n,onClick:()=>r(`${d}/approve`,`POST`,{version:e.version}),children:`Approve`}),(0,l.jsx)(s,{variant:`danger`,disabled:n,onClick:()=>r(`${d}/reject`,`POST`,{version:e.version}),children:`Reject`})]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{children:e.text}),e.status===`approved`&&(0,l.jsx)(`div`,{className:`mt-3`,children:(0,l.jsx)(s,{variant:`danger`,disabled:n,onClick:()=>r(`${d}/revoke`,`POST`,{version:e.version}),children:`Revoke`})})]}),(0,l.jsxs)(`div`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Evidence: `,e.evidence.length===0?`none`:(0,l.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:e.evidence.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsxs)(`code`,{children:[e.sessionId,`:`,e.entryOrdinal]}),e.excerpt?` — ${e.excerpt}`:` — excerpt unavailable`]},`${e.sessionId}:${e.entryOrdinal}`))})]}),o===`shared`&&(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Shared lessons become searchable Team memory. Stable facts about the human belong in Team USER.md instead.`})]})}export{u as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{A as t,D as n,E as r,M as i,O as a,j as o}from"./index-nb2MV8X1.js";var s=t(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),c=t(`message-square-text`,[[`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`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),l=e();function u(){let{error:e}=r.useSearch();return(0,l.jsxs)(`main`,{className:`relative flex min-h-dvh items-center overflow-hidden bg-cream px-5 py-16 sm:px-8`,children:[(0,l.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,style:{background:`radial-gradient(circle at 16% 12%, rgba(61,120,153,0.18), transparent 36rem), radial-gradient(circle at 88% 84%, rgba(196,135,138,0.13), transparent 32rem)`}}),(0,l.jsx)(`div`,{className:`absolute right-4 top-4 z-10 sm:right-6 sm:top-6`,children:(0,l.jsx)(n,{})}),(0,l.jsxs)(`div`,{className:`relative mx-auto grid w-full max-w-5xl items-center gap-10 lg:grid-cols-[minmax(0,1fr)_25rem] lg:gap-20`,children:[(0,l.jsxs)(`section`,{className:`hidden lg:block`,children:[(0,l.jsxs)(`div`,{className:`mb-8 flex items-center gap-3`,children:[(0,l.jsx)(i,{className:`h-12 w-12`}),(0,l.jsx)(`span`,{className:`font-display text-3xl tracking-[-0.03em] text-charcoal`,children:`bazilion`})]}),(0,l.jsx)(`h1`,{className:`max-w-xl text-[3.4rem] leading-[0.98] tracking-[-0.035em]`,children:`Your agents, working as one thoughtful team.`}),(0,l.jsx)(`p`,{className:`mt-6 max-w-lg text-base leading-7 text-mocha`,children:`A private workspace for long-lived agents, shared context, and communication policies you can actually see and control.`}),(0,l.jsxs)(`div`,{className:`mt-8 grid max-w-lg gap-3 sm:grid-cols-2`,children:[(0,l.jsx)(d,{icon:(0,l.jsx)(c,{className:`h-4 w-4`}),label:`Persistent conversations`}),(0,l.jsx)(d,{icon:(0,l.jsx)(a,{className:`h-4 w-4`}),label:`Team-owned context`})]})]}),(0,l.jsxs)(`section`,{className:`w-full rounded-[24px] border border-frost bg-snow/95 p-7 shadow-baziu-lg backdrop-blur sm:p-9`,children:[(0,l.jsxs)(`div`,{className:`mb-6 flex items-center gap-3 lg:hidden`,children:[(0,l.jsx)(i,{className:`h-10 w-10`}),(0,l.jsx)(`span`,{className:`font-display text-2xl text-charcoal`,children:`bazilion`})]}),(0,l.jsx)(`div`,{className:`mb-6 flex h-10 w-10 items-center justify-center rounded-xl bg-sapphire-glow text-sapphire`,children:(0,l.jsx)(s,{className:`h-5 w-5`,"aria-hidden":`true`})}),(0,l.jsx)(`h2`,{className:`font-display text-3xl text-charcoal`,children:`Welcome back`}),(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-mocha-light`,children:`Use the local access token created by your Bazilion daemon.`}),e&&(0,l.jsx)(`div`,{className:`err mt-5`,children:`That token was not accepted.`}),(0,l.jsxs)(`form`,{method:`POST`,action:`/api/login`,className:`mt-6 text-left`,children:[(0,l.jsx)(`label`,{htmlFor:`token`,className:`block text-[0.85em] font-semibold text-mocha`,children:`Access token`}),(0,l.jsx)(`input`,{type:`password`,id:`token`,name:`token`,autoFocus:!0,required:!0,placeholder:`Paste your token`,className:`mb-4`}),(0,l.jsx)(`button`,{type:`submit`,className:`w-full`,children:`Open Bazilion`})]}),(0,l.jsxs)(`p`,{className:`mt-5 rounded-xl bg-ivory px-3 py-2.5 text-[0.78em] leading-relaxed text-mocha-light`,children:[`Find it in `,(0,l.jsx)(`code`,{children:`~/.bazilion/auth.json`}),`, created the first time you run`,` `,(0,l.jsx)(`code`,{children:`bazilion serve`}),`.`]})]})]}),(0,l.jsxs)(`footer`,{className:`absolute bottom-4 left-0 right-0 text-center text-[0.75em] text-fawn`,children:[`dedicated to Baziu`,(0,l.jsx)(o,{className:`ml-1 inline-block h-3 w-3 align-[-1px] opacity-40`})]})]})}function d({icon:e,label:t}){return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-frost bg-snow/70 px-3 py-2.5 text-sm font-semibold text-mocha shadow-baziu-sm`,children:[(0,l.jsx)(`span`,{className:`text-sapphire`,children:e}),t]})}export{u as component};
1
+ import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{A as t,D as n,E as r,M as i,O as a,j as o}from"./index-3nrK5iFr.js";var s=t(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),c=t(`message-square-text`,[[`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`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),l=e();function u(){let{error:e}=r.useSearch();return(0,l.jsxs)(`main`,{className:`relative flex min-h-dvh items-center overflow-hidden bg-cream px-5 py-16 sm:px-8`,children:[(0,l.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,style:{background:`radial-gradient(circle at 16% 12%, rgba(61,120,153,0.18), transparent 36rem), radial-gradient(circle at 88% 84%, rgba(196,135,138,0.13), transparent 32rem)`}}),(0,l.jsx)(`div`,{className:`absolute right-4 top-4 z-10 sm:right-6 sm:top-6`,children:(0,l.jsx)(n,{})}),(0,l.jsxs)(`div`,{className:`relative mx-auto grid w-full max-w-5xl items-center gap-10 lg:grid-cols-[minmax(0,1fr)_25rem] lg:gap-20`,children:[(0,l.jsxs)(`section`,{className:`hidden lg:block`,children:[(0,l.jsxs)(`div`,{className:`mb-8 flex items-center gap-3`,children:[(0,l.jsx)(i,{className:`h-12 w-12`}),(0,l.jsx)(`span`,{className:`font-display text-3xl tracking-[-0.03em] text-charcoal`,children:`bazilion`})]}),(0,l.jsx)(`h1`,{className:`max-w-xl text-[3.4rem] leading-[0.98] tracking-[-0.035em]`,children:`Your agents, working as one thoughtful team.`}),(0,l.jsx)(`p`,{className:`mt-6 max-w-lg text-base leading-7 text-mocha`,children:`A private workspace for long-lived agents, shared context, and communication policies you can actually see and control.`}),(0,l.jsxs)(`div`,{className:`mt-8 grid max-w-lg gap-3 sm:grid-cols-2`,children:[(0,l.jsx)(d,{icon:(0,l.jsx)(c,{className:`h-4 w-4`}),label:`Persistent conversations`}),(0,l.jsx)(d,{icon:(0,l.jsx)(a,{className:`h-4 w-4`}),label:`Team-owned context`})]})]}),(0,l.jsxs)(`section`,{className:`w-full rounded-[24px] border border-frost bg-snow/95 p-7 shadow-baziu-lg backdrop-blur sm:p-9`,children:[(0,l.jsxs)(`div`,{className:`mb-6 flex items-center gap-3 lg:hidden`,children:[(0,l.jsx)(i,{className:`h-10 w-10`}),(0,l.jsx)(`span`,{className:`font-display text-2xl text-charcoal`,children:`bazilion`})]}),(0,l.jsx)(`div`,{className:`mb-6 flex h-10 w-10 items-center justify-center rounded-xl bg-sapphire-glow text-sapphire`,children:(0,l.jsx)(s,{className:`h-5 w-5`,"aria-hidden":`true`})}),(0,l.jsx)(`h2`,{className:`font-display text-3xl text-charcoal`,children:`Welcome back`}),(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-mocha-light`,children:`Use the local access token created by your Bazilion daemon.`}),e&&(0,l.jsx)(`div`,{className:`err mt-5`,children:`That token was not accepted.`}),(0,l.jsxs)(`form`,{method:`POST`,action:`/api/login`,className:`mt-6 text-left`,children:[(0,l.jsx)(`label`,{htmlFor:`token`,className:`block text-[0.85em] font-semibold text-mocha`,children:`Access token`}),(0,l.jsx)(`input`,{type:`password`,id:`token`,name:`token`,autoFocus:!0,required:!0,placeholder:`Paste your token`,className:`mb-4`}),(0,l.jsx)(`button`,{type:`submit`,className:`w-full`,children:`Open Bazilion`})]}),(0,l.jsxs)(`p`,{className:`mt-5 rounded-xl bg-ivory px-3 py-2.5 text-[0.78em] leading-relaxed text-mocha-light`,children:[`Find it in `,(0,l.jsx)(`code`,{children:`~/.bazilion/auth.json`}),`, created the first time you run`,` `,(0,l.jsx)(`code`,{children:`bazilion serve`}),`.`]})]})]}),(0,l.jsxs)(`footer`,{className:`absolute bottom-4 left-0 right-0 text-center text-[0.75em] text-fawn`,children:[`dedicated to Baziu`,(0,l.jsx)(o,{className:`ml-1 inline-block h-3 w-3 align-[-1px] opacity-40`})]})]})}function d({icon:e,label:t}){return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-frost bg-snow/70 px-3 py-2.5 text-sm font-semibold text-mocha shadow-baziu-sm`,children:[(0,l.jsx)(`span`,{className:`text-sapphire`,children:e}),t]})}export{u as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{g as i}from"./index-nb2MV8X1.js";import{t as a}from"./ConfigPage-BCwfgyjD.js";var o=e(n()),s=t(),c=[`stdio`,`http`,`sse`];function l(){let{servers:e}=i.useLoaderData(),t=r(),[n,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(`stdio`),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(``),[g,_]=(0,o.useState)(``),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)(!1),[w,T]=(0,o.useState)({});async function E(e){e.preventDefault(),x(null),C(!0);try{let e={name:n,transport:u,command:u===`stdio`?f:null,args:u===`stdio`?m.split(` `).filter(Boolean):[],url:u===`stdio`?null:g,authToken:v||void 0},r=await fetch(`/api/mcp-servers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`${r.status} ${r.statusText}`)}l(``),p(``),h(``),_(``),y(``),await t.invalidate()}catch(e){x(e.message)}finally{C(!1)}}async function D(e){await fetch(`/api/mcp-servers/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})}),await t.invalidate()}async function O(e){await fetch(`/api/mcp-servers/${e}`,{method:`DELETE`}),await t.invalidate()}async function k(e){T(t=>({...t,[e]:`connecting…`}));let t=await(await fetch(`/api/mcp-servers/${e}/test`,{method:`POST`})).json().catch(()=>({}));T(n=>({...n,[e]:t.ok?`✓ ${t.tools?.length??0} tools: ${(t.tools??[]).map(e=>e.name).join(`, `)}`:`✗ ${t.error??`failed`}`}))}return(0,s.jsxs)(a,{active:`mcp`,title:`MCP servers`,description:(0,s.jsxs)(s.Fragment,{children:[`Expose tools from local or remote Model Context Protocol servers to every agent under the `,(0,s.jsx)(`code`,{className:`font-mono`,children:`mcp__<server>__<tool>`}),` namespace. Local stdio servers inherit configured secrets; HTTP and SSE servers can use a bearer token.`]}),children:[(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Add a server`}),(0,s.jsxs)(`form`,{onSubmit:E,className:`space-y-3`,children:[(0,s.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Name`,(0,s.jsx)(`input`,{type:`text`,value:n,onChange:e=>l(e.target.value),required:!0,placeholder:`playwright`,pattern:`[a-zA-Z0-9_]+`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-48`})]}),(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Transport`,(0,s.jsx)(`select`,{value:u,onChange:e=>d(e.target.value),className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm`,children:c.map(e=>(0,s.jsx)(`option`,{value:e,children:e},e))})]})]}),u===`stdio`?(0,s.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Command`,(0,s.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),placeholder:`npx`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-48`})]}),(0,s.jsxs)(`label`,{className:`w-full min-w-0 text-sm sm:flex-1`,children:[`Args (space-separated)`,(0,s.jsx)(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`-y @modelcontextprotocol/server-filesystem /tmp`,className:`block mt-1 rounded-md border bg-background px-3 py-2 text-sm w-full`})]})]}):(0,s.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full min-w-0 text-sm sm:flex-1`,children:[`URL`,(0,s.jsx)(`input`,{type:`url`,value:g,onChange:e=>_(e.target.value),placeholder:`https://mcp.example.com/sse`,className:`block mt-1 rounded-md border bg-background px-3 py-2 text-sm w-full`})]}),(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Bearer token (optional)`,(0,s.jsx)(`input`,{type:`password`,value:v,onChange:e=>y(e.target.value),autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-56`})]})]}),(0,s.jsx)(`button`,{type:`submit`,disabled:S,className:`w-full rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50 sm:w-auto`,children:S?`adding…`:`add server`}),b&&(0,s.jsx)(`p`,{className:`text-sm text-danger`,children:b})]})]}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,s.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{className:`py-2`,children:`name`}),(0,s.jsx)(`th`,{children:`transport`}),(0,s.jsx)(`th`,{children:`target`}),(0,s.jsx)(`th`,{children:`state`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsxs)(`tbody`,{children:[e.length===0&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:5,className:`py-6 text-center text-muted-foreground italic`,children:`no MCP servers yet — add one above`})}),e.map(e=>(0,s.jsxs)(`tr`,{className:`border-b last:border-0 align-top`,children:[(0,s.jsxs)(`td`,{className:`py-2`,children:[e.name,e.hasAuthToken&&(0,s.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth`}),w[e.id]&&(0,s.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 break-all`,children:w[e.id]})]}),(0,s.jsx)(`td`,{children:e.transport}),(0,s.jsx)(`td`,{className:`font-mono text-xs break-all`,children:e.transport===`stdio`?`${e.command??``} ${e.args.join(` `)}`.trim():e.url}),(0,s.jsx)(`td`,{children:e.enabled?(0,s.jsx)(`span`,{className:`text-success`,children:`enabled`}):(0,s.jsx)(`span`,{className:`text-muted-foreground`,children:`disabled`})}),(0,s.jsxs)(`td`,{className:`space-x-2 whitespace-nowrap`,children:[(0,s.jsx)(`button`,{type:`button`,onClick:()=>k(e.id),className:`rounded-md border px-2 py-1 text-xs hover:bg-accent`,children:`test`}),(0,s.jsx)(`button`,{type:`button`,onClick:()=>D(e),className:`rounded-md border px-2 py-1 text-xs hover:bg-accent`,children:e.enabled?`disable`:`enable`}),(0,s.jsx)(`button`,{type:`button`,onClick:()=>O(e.id),className:`rounded-md border px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:`delete`})]})]},e.id))]})]})})]})}export{l as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{g as i}from"./index-3nrK5iFr.js";import{t as a}from"./ConfigPage-BCwfgyjD.js";var o=e(n()),s=t(),c=[`stdio`,`http`,`sse`];function l(){let{servers:e}=i.useLoaderData(),t=r(),[n,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(`stdio`),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(``),[g,_]=(0,o.useState)(``),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)(!1),[w,T]=(0,o.useState)({});async function E(e){e.preventDefault(),x(null),C(!0);try{let e={name:n,transport:u,command:u===`stdio`?f:null,args:u===`stdio`?m.split(` `).filter(Boolean):[],url:u===`stdio`?null:g,authToken:v||void 0},r=await fetch(`/api/mcp-servers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`${r.status} ${r.statusText}`)}l(``),p(``),h(``),_(``),y(``),await t.invalidate()}catch(e){x(e.message)}finally{C(!1)}}async function D(e){await fetch(`/api/mcp-servers/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})}),await t.invalidate()}async function O(e){await fetch(`/api/mcp-servers/${e}`,{method:`DELETE`}),await t.invalidate()}async function k(e){T(t=>({...t,[e]:`connecting…`}));let t=await(await fetch(`/api/mcp-servers/${e}/test`,{method:`POST`})).json().catch(()=>({}));T(n=>({...n,[e]:t.ok?`✓ ${t.tools?.length??0} tools: ${(t.tools??[]).map(e=>e.name).join(`, `)}`:`✗ ${t.error??`failed`}`}))}return(0,s.jsxs)(a,{active:`mcp`,title:`MCP servers`,description:(0,s.jsxs)(s.Fragment,{children:[`Expose tools from local or remote Model Context Protocol servers to every agent under the `,(0,s.jsx)(`code`,{className:`font-mono`,children:`mcp__<server>__<tool>`}),` namespace. Local stdio servers inherit configured secrets; HTTP and SSE servers can use a bearer token.`]}),children:[(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Add a server`}),(0,s.jsxs)(`form`,{onSubmit:E,className:`space-y-3`,children:[(0,s.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Name`,(0,s.jsx)(`input`,{type:`text`,value:n,onChange:e=>l(e.target.value),required:!0,placeholder:`playwright`,pattern:`[a-zA-Z0-9_]+`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-48`})]}),(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Transport`,(0,s.jsx)(`select`,{value:u,onChange:e=>d(e.target.value),className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm`,children:c.map(e=>(0,s.jsx)(`option`,{value:e,children:e},e))})]})]}),u===`stdio`?(0,s.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Command`,(0,s.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),placeholder:`npx`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-48`})]}),(0,s.jsxs)(`label`,{className:`w-full min-w-0 text-sm sm:flex-1`,children:[`Args (space-separated)`,(0,s.jsx)(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`-y @modelcontextprotocol/server-filesystem /tmp`,className:`block mt-1 rounded-md border bg-background px-3 py-2 text-sm w-full`})]})]}):(0,s.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full min-w-0 text-sm sm:flex-1`,children:[`URL`,(0,s.jsx)(`input`,{type:`url`,value:g,onChange:e=>_(e.target.value),placeholder:`https://mcp.example.com/sse`,className:`block mt-1 rounded-md border bg-background px-3 py-2 text-sm w-full`})]}),(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Bearer token (optional)`,(0,s.jsx)(`input`,{type:`password`,value:v,onChange:e=>y(e.target.value),autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-56`})]})]}),(0,s.jsx)(`button`,{type:`submit`,disabled:S,className:`w-full rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50 sm:w-auto`,children:S?`adding…`:`add server`}),b&&(0,s.jsx)(`p`,{className:`text-sm text-danger`,children:b})]})]}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,s.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{className:`py-2`,children:`name`}),(0,s.jsx)(`th`,{children:`transport`}),(0,s.jsx)(`th`,{children:`target`}),(0,s.jsx)(`th`,{children:`state`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsxs)(`tbody`,{children:[e.length===0&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:5,className:`py-6 text-center text-muted-foreground italic`,children:`no MCP servers yet — add one above`})}),e.map(e=>(0,s.jsxs)(`tr`,{className:`border-b last:border-0 align-top`,children:[(0,s.jsxs)(`td`,{className:`py-2`,children:[e.name,e.hasAuthToken&&(0,s.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth`}),w[e.id]&&(0,s.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 break-all`,children:w[e.id]})]}),(0,s.jsx)(`td`,{children:e.transport}),(0,s.jsx)(`td`,{className:`font-mono text-xs break-all`,children:e.transport===`stdio`?`${e.command??``} ${e.args.join(` `)}`.trim():e.url}),(0,s.jsx)(`td`,{children:e.enabled?(0,s.jsx)(`span`,{className:`text-success`,children:`enabled`}):(0,s.jsx)(`span`,{className:`text-muted-foreground`,children:`disabled`})}),(0,s.jsxs)(`td`,{className:`space-x-2 whitespace-nowrap`,children:[(0,s.jsx)(`button`,{type:`button`,onClick:()=>k(e.id),className:`rounded-md border px-2 py-1 text-xs hover:bg-accent`,children:`test`}),(0,s.jsx)(`button`,{type:`button`,onClick:()=>D(e),className:`rounded-md border px-2 py-1 text-xs hover:bg-accent`,children:e.enabled?`disable`:`enable`}),(0,s.jsx)(`button`,{type:`button`,onClick:()=>O(e.id),className:`rounded-md border px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:`delete`})]})]},e.id))]})]})})]})}export{l as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{l as t}from"./index-nb2MV8X1.js";import{r as n}from"./Page-CwNuDhWz.js";import{t as r}from"./TeamTabs-C1Hakkff.js";var i=e();function a(){let e=t.useLoaderData(),{id:a}=t.useParams();return(0,i.jsxs)(n,{children:[(0,i.jsx)(`h1`,{children:`Team members`}),(0,i.jsxs)(`p`,{className:`muted`,children:[(0,i.jsx)(`code`,{children:`agents.team_id`}),` is the only live-membership authority.`]}),(0,i.jsx)(r,{teamId:a}),(0,i.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-frost`,children:(0,i.jsxs)(`table`,{className:`w-full`,children:[(0,i.jsx)(`thead`,{children:(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`th`,{children:`agent`}),(0,i.jsx)(`th`,{children:`status`}),(0,i.jsx)(`th`,{children:`agent template`}),(0,i.jsx)(`th`,{children:`source slot`})]})}),(0,i.jsxs)(`tbody`,{children:[e.members.map(t=>{let n=e.bindings.find(e=>e.agentId===t.id);return(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`td`,{children:(0,i.jsx)(`a`,{href:`/agents/${t.id}`,children:t.name})}),(0,i.jsx)(`td`,{children:t.status}),(0,i.jsx)(`td`,{children:t.profileId}),(0,i.jsx)(`td`,{children:(0,i.jsx)(`code`,{children:n?.sourceSlotId??`live-only`})})]},t.id)}),e.members.length===0&&(0,i.jsx)(`tr`,{children:(0,i.jsx)(`td`,{colSpan:4,className:`muted`,children:`No agents belong to this team.`})})]})]})})]})}export{a as component};
1
+ import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{l as t}from"./index-3nrK5iFr.js";import{r as n}from"./Page-CwNuDhWz.js";import{t as r}from"./TeamTabs-DvqWieCq.js";var i=e();function a(){let e=t.useLoaderData(),{id:a}=t.useParams();return(0,i.jsxs)(n,{children:[(0,i.jsx)(`h1`,{children:`Team members`}),(0,i.jsxs)(`p`,{className:`muted`,children:[(0,i.jsx)(`code`,{children:`agents.team_id`}),` is the only live-membership authority.`]}),(0,i.jsx)(r,{teamId:a}),(0,i.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-frost`,children:(0,i.jsxs)(`table`,{className:`w-full`,children:[(0,i.jsx)(`thead`,{children:(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`th`,{children:`agent`}),(0,i.jsx)(`th`,{children:`status`}),(0,i.jsx)(`th`,{children:`agent template`}),(0,i.jsx)(`th`,{children:`source slot`})]})}),(0,i.jsxs)(`tbody`,{children:[e.members.map(t=>{let n=e.bindings.find(e=>e.agentId===t.id);return(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`td`,{children:(0,i.jsx)(`a`,{href:`/agents/${t.id}`,children:t.name})}),(0,i.jsx)(`td`,{children:t.status}),(0,i.jsx)(`td`,{children:t.profileId}),(0,i.jsx)(`td`,{children:(0,i.jsx)(`code`,{children:n?.sourceSlotId??`live-only`})})]},t.id)}),e.members.length===0&&(0,i.jsx)(`tr`,{children:(0,i.jsx)(`td`,{colSpan:4,className:`muted`,children:`No agents belong to this team.`})})]})]})})]})}export{a as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{u as r}from"./index-nb2MV8X1.js";import{r as i}from"./Page-CwNuDhWz.js";import{t as a}from"./TeamTabs-C1Hakkff.js";var o=e(n()),s=t();function c(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function l(){let{team:e,memberCount:t,entries:n}=r.useLoaderData(),l=e.id,[u,d]=(0,o.useState)(()=>n.map(e=>({key:e.key,preview:e.content.slice(0,80)}))),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(``),[g,_]=(0,o.useState)(null),[v,y]=(0,o.useState)(`none`),[b,x]=(0,o.useState)(``),[S,C]=(0,o.useState)(``),[w,T]=(0,o.useState)(null),E=(0,o.useRef)(null);async function D(e){try{let t=e.trim().length>0?`/api/teams/${encodeURIComponent(l)}/memory/search?q=${encodeURIComponent(e)}&limit=50`:`/api/teams/${encodeURIComponent(l)}/memory`,n=await fetch(t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}let r=await n.json();e.trim().length>0?(d(r.map(e=>({key:e.key,preview:e.snippet,score:e.score}))),p(!0)):(d(r.map(e=>({key:e.key,preview:e.content.slice(0,80)}))),p(!1))}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}(0,o.useEffect)(()=>(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{D(m)},200),()=>{E.current&&clearTimeout(E.current)}),[m]);async function O(e){_(e),y(`edit`),T({msg:`loading…`,kind:`info`});try{let t=await fetch(`/api/teams/${encodeURIComponent(l)}/memory/${c(e)}`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}let n=await t.json();x(n.key),C(n.content??``),T({msg:`loaded ${n.key}`,kind:`info`})}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}function k(){_(null),y(`new`),x(``),C(``),T({msg:`new entry — type a key and content, then save`,kind:`info`})}async function A(){let e=b.trim();if(!e){T({msg:`key is required`,kind:`error`});return}try{let t=await fetch(`/api/teams/${encodeURIComponent(l)}/memory/${c(e)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:S})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}_(e),y(`edit`),T({msg:`saved`,kind:`info`}),await D(m)}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}async function j(){if(g&&confirm(`delete ${g}?`))try{let e=await fetch(`/api/teams/${encodeURIComponent(l)}/memory/${c(g)}`,{method:`DELETE`});if(!e.ok&&e.status!==204){let t=await e.json().catch(()=>null);throw Error(t?.error??e.statusText)}_(null),y(`none`),x(``),C(``),T({msg:`deleted`,kind:`info`}),await D(m)}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}let M=v!==`none`&&b.trim().length>0,N=v===`edit`&&g!==null;return(0,s.jsxs)(i,{children:[(0,s.jsxs)(`header`,{className:`mb-6`,children:[(0,s.jsxs)(`h1`,{className:`font-serif text-3xl text-foreground`,children:[e.name,` `,(0,s.jsx)(`span`,{className:`text-muted-foreground text-base`,children:`/ Shared memory`})]}),(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:[`BM25-indexed markdown notes shared by every agent in`,` `,(0,s.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.id)}`,className:`font-mono underline`,children:e.id}),` `,`(`,t,` member`,t===1?``:`s`,`). Anything written here is visible to every member; per-agent notes belong in the agent's own`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`IDENTITY.md`}),` via `,(0,s.jsx)(`code`,{children:`home_write`}),`.`]})]}),(0,s.jsx)(a,{teamId:e.id}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-[320px_1fr]`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsxs)(`div`,{className:`overflow-hidden rounded-[16px] border border-frost bg-snow`,children:[(0,s.jsx)(`div`,{className:`border-b border-frost p-2`,children:(0,s.jsx)(`input`,{type:`text`,placeholder:`search (BM25)...`,autoComplete:`off`,value:m,onChange:e=>h(e.target.value)})}),(0,s.jsx)(`div`,{className:`max-h-[520px] overflow-y-auto`,children:u.length===0?(0,s.jsx)(`div`,{className:`p-8 text-center text-mocha-light`,children:`no entries`}):u.map(e=>(0,s.jsxs)(`button`,{type:`button`,onClick:()=>O(e.key),className:`unstyled block w-full cursor-pointer border-b border-frost/50 px-3.5 py-2 text-left font-mono text-[0.84em] transition-colors last:border-b-0 hover:bg-sapphire-glow ${e.key===g?`bg-sapphire-glow font-medium text-sapphire-deep`:``}`,children:[f&&e.score!==void 0&&(0,s.jsx)(`span`,{className:`float-right text-[0.75em] text-sapphire`,children:e.score.toFixed(2)}),e.key,e.preview&&(0,s.jsx)(`span`,{className:`mt-1 block text-[0.9em] font-normal text-mocha-light`,children:e.preview})]},e.key))})]}),(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn mt-3 w-full`,onClick:k,children:`+ new entry`})]}),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`div`,{className:`mb-3 flex items-center gap-2`,children:(0,s.jsx)(`input`,{type:`text`,placeholder:`key (e.g. prefs/hiking.md)`,value:b,onChange:e=>x(e.target.value),disabled:v!==`new`,className:`flex-1 font-mono`})}),(0,s.jsx)(`textarea`,{placeholder:`select an entry on the left, or create a new one.`,value:S,onChange:e=>C(e.target.value),className:`min-h-[360px] w-full font-mono text-[0.9em] leading-[1.55]`}),(0,s.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,s.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:A,disabled:!M,children:`save`}),(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:j,disabled:!N,children:`delete`})]}),w&&(0,s.jsx)(`p`,{className:`mt-2 text-[0.9em] ${w.kind===`error`?`text-danger`:`text-mocha-light`}`,children:w.msg})]})]})]})}export{l as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{u as r}from"./index-3nrK5iFr.js";import{r as i}from"./Page-CwNuDhWz.js";import{t as a}from"./TeamTabs-DvqWieCq.js";var o=e(n()),s=t();function c(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function l(){let{team:e,memberCount:t,entries:n}=r.useLoaderData(),l=e.id,[u,d]=(0,o.useState)(()=>n.map(e=>({key:e.key,preview:e.content.slice(0,80)}))),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(``),[g,_]=(0,o.useState)(null),[v,y]=(0,o.useState)(`none`),[b,x]=(0,o.useState)(``),[S,C]=(0,o.useState)(``),[w,T]=(0,o.useState)(null),E=(0,o.useRef)(null);async function D(e){try{let t=e.trim().length>0?`/api/teams/${encodeURIComponent(l)}/memory/search?q=${encodeURIComponent(e)}&limit=50`:`/api/teams/${encodeURIComponent(l)}/memory`,n=await fetch(t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}let r=await n.json();e.trim().length>0?(d(r.map(e=>({key:e.key,preview:e.snippet,score:e.score}))),p(!0)):(d(r.map(e=>({key:e.key,preview:e.content.slice(0,80)}))),p(!1))}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}(0,o.useEffect)(()=>(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{D(m)},200),()=>{E.current&&clearTimeout(E.current)}),[m]);async function O(e){_(e),y(`edit`),T({msg:`loading…`,kind:`info`});try{let t=await fetch(`/api/teams/${encodeURIComponent(l)}/memory/${c(e)}`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}let n=await t.json();x(n.key),C(n.content??``),T({msg:`loaded ${n.key}`,kind:`info`})}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}function k(){_(null),y(`new`),x(``),C(``),T({msg:`new entry — type a key and content, then save`,kind:`info`})}async function A(){let e=b.trim();if(!e){T({msg:`key is required`,kind:`error`});return}try{let t=await fetch(`/api/teams/${encodeURIComponent(l)}/memory/${c(e)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:S})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}_(e),y(`edit`),T({msg:`saved`,kind:`info`}),await D(m)}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}async function j(){if(g&&confirm(`delete ${g}?`))try{let e=await fetch(`/api/teams/${encodeURIComponent(l)}/memory/${c(g)}`,{method:`DELETE`});if(!e.ok&&e.status!==204){let t=await e.json().catch(()=>null);throw Error(t?.error??e.statusText)}_(null),y(`none`),x(``),C(``),T({msg:`deleted`,kind:`info`}),await D(m)}catch(e){T({msg:`error: ${e.message}`,kind:`error`})}}let M=v!==`none`&&b.trim().length>0,N=v===`edit`&&g!==null;return(0,s.jsxs)(i,{children:[(0,s.jsxs)(`header`,{className:`mb-6`,children:[(0,s.jsxs)(`h1`,{className:`font-serif text-3xl text-foreground`,children:[e.name,` `,(0,s.jsx)(`span`,{className:`text-muted-foreground text-base`,children:`/ Shared memory`})]}),(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm mt-1`,children:[`BM25-indexed markdown notes shared by every agent in`,` `,(0,s.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.id)}`,className:`font-mono underline`,children:e.id}),` `,`(`,t,` member`,t===1?``:`s`,`). Anything written here is visible to every member; per-agent notes belong in the agent's own`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`IDENTITY.md`}),` via `,(0,s.jsx)(`code`,{children:`home_write`}),`.`]})]}),(0,s.jsx)(a,{teamId:e.id}),(0,s.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-[320px_1fr]`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsxs)(`div`,{className:`overflow-hidden rounded-[16px] border border-frost bg-snow`,children:[(0,s.jsx)(`div`,{className:`border-b border-frost p-2`,children:(0,s.jsx)(`input`,{type:`text`,placeholder:`search (BM25)...`,autoComplete:`off`,value:m,onChange:e=>h(e.target.value)})}),(0,s.jsx)(`div`,{className:`max-h-[520px] overflow-y-auto`,children:u.length===0?(0,s.jsx)(`div`,{className:`p-8 text-center text-mocha-light`,children:`no entries`}):u.map(e=>(0,s.jsxs)(`button`,{type:`button`,onClick:()=>O(e.key),className:`unstyled block w-full cursor-pointer border-b border-frost/50 px-3.5 py-2 text-left font-mono text-[0.84em] transition-colors last:border-b-0 hover:bg-sapphire-glow ${e.key===g?`bg-sapphire-glow font-medium text-sapphire-deep`:``}`,children:[f&&e.score!==void 0&&(0,s.jsx)(`span`,{className:`float-right text-[0.75em] text-sapphire`,children:e.score.toFixed(2)}),e.key,e.preview&&(0,s.jsx)(`span`,{className:`mt-1 block text-[0.9em] font-normal text-mocha-light`,children:e.preview})]},e.key))})]}),(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn mt-3 w-full`,onClick:k,children:`+ new entry`})]}),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`div`,{className:`mb-3 flex items-center gap-2`,children:(0,s.jsx)(`input`,{type:`text`,placeholder:`key (e.g. prefs/hiking.md)`,value:b,onChange:e=>x(e.target.value),disabled:v!==`new`,className:`flex-1 font-mono`})}),(0,s.jsx)(`textarea`,{placeholder:`select an entry on the left, or create a new one.`,value:S,onChange:e=>C(e.target.value),className:`min-h-[360px] w-full font-mono text-[0.9em] leading-[1.55]`}),(0,s.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,s.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:A,disabled:!M,children:`save`}),(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:j,disabled:!N,children:`delete`})]}),w&&(0,s.jsx)(`p`,{className:`mt-2 text-[0.9em] ${w.kind===`error`?`text-danger`:`text-mocha-light`}`,children:w.msg})]})]})]})}export{l as component};
@@ -0,0 +1 @@
1
+ import{A as e}from"./index-3nrK5iFr.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{n as r,t as i}from"./ProductionTeamPolicyEditor-CSL3W7XM.js";import{A as a,d as o}from"./index-nb2MV8X1.js";import{r as s}from"./Page-CwNuDhWz.js";import{t as c}from"./Button-ByiV6fpd.js";import{t as l}from"./RecoveryState-QfMSuwy3.js";import{t as u}from"./TeamTabs-C1Hakkff.js";var d=a(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),f=a(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),p=e(n(),1),m=t();function h({teamId:e,detail:t,templates:n}){let[i,a]=(0,p.useState)(null),[o,s]=(0,p.useState)(null),[l,u]=(0,p.useState)(!1),[h,v]=(0,p.useState)(`${e}-snapshot`),[y,b]=(0,p.useState)(`${e} snapshot`),x=(0,p.useMemo)(()=>new Set(t.bindings.map(e=>e.agentId)),[t.bindings]),S=t.members.filter(e=>!x.has(e.id)),C=async()=>{let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/diff`);if(!t.ok)throw Error((await t.json().catch(()=>null))?.error??`Could not load source comparison`);a(await t.json())};return(0,p.useEffect)(()=>{C().catch(e=>s(e instanceof Error?e.message:String(e)))},[e]),(0,m.jsxs)(`section`,{className:`card space-y-4`,"aria-labelledby":`source-workflows`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,m.jsx)(d,{className:`mt-1 h-5 w-5 text-sapphire`}),(0,m.jsxs)(`div`,{className:`mr-auto`,children:[(0,m.jsx)(`h2`,{id:`source-workflows`,className:`m-0 text-lg`,children:`Baseline and source`}),(0,m.jsx)(`p`,{className:`muted mt-1 text-sm`,children:`Lineage is retained for comparison; source edits never auto-propagate.`})]}),(0,m.jsxs)(c,{variant:`ghost`,onClick:()=>void C(),children:[(0,m.jsx)(f,{className:`h-4 w-4`}),`Refresh comparison`]})]}),i?(0,m.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,m.jsx)(g,{label:`Baseline`,value:i.baseline?`${i.baseline.templateId} r${i.baseline.templateRevision}`:`None`}),(0,m.jsx)(g,{label:`Live changes`,value:`+${i.comparison.addedSinceBaseline.length} / −${i.comparison.removedSinceBaseline.length} edges`}),(0,m.jsx)(g,{label:`Source slots`,value:`+${i.comparison.currentSourceAddedSlotIds.length} / −${i.comparison.currentSourceRemovedSlotIds.length}`}),(0,m.jsx)(g,{label:`Source state`,value:i.currentSource?i.sourceDiverged?`Diverged — rebaseline required`:`Aligned`:`Missing/tombstoned`,warning:i.sourceDiverged||!i.currentSource})]}):(0,m.jsx)(`p`,{className:`muted`,children:`Loading comparison…`}),i?.sourceDiverged&&(0,m.jsx)(`div`,{role:`alert`,className:`rounded-md border border-warning/25 bg-warning/10 p-3 text-sm text-warning`,children:`The source has changed since this Team retained its baseline. Both versions remain intact. Update-source is disabled; compare and explicitly rebaseline instead.`}),i?.currentSource&&!i.sourceDiverged&&(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,m.jsxs)(`p`,{className:`mr-auto text-sm`,children:[`Promote the current live policy to `,(0,m.jsx)(`strong`,{children:i.currentSource.template.name}),`, including `,S.length,` live-only Agent`,S.length===1?``:`s`,`.`]}),(0,m.jsx)(c,{variant:`ghost`,disabled:l,onClick:async()=>{if(!(!i?.currentSource||i.sourceDiverged)){u(!0),s(null);try{let n=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/update-source`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({teamExpectedRevision:t.teamPolicy.revision,templateExpectedRevision:i.currentSource.template.currentRevision,includeAgentIds:S.map(e=>e.id)})});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??`Update failed (${n.status})`);window.location.reload()}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}},children:`Update source after review`})]}),(0,m.jsxs)(`div`,{className:`grid gap-3 border-t border-frost pt-4 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,m.jsxs)(`label`,{className:`text-xs`,children:[`New template ID`,(0,m.jsx)(`input`,{value:h,onChange:e=>v(e.target.value)})]}),(0,m.jsxs)(`label`,{className:`text-xs`,children:[`New template name`,(0,m.jsx)(`input`,{value:y,onChange:e=>b(e.target.value)})]}),(0,m.jsxs)(c,{variant:`primary`,disabled:l||!h.trim()||!y.trim(),onClick:async()=>{u(!0),s(null);try{let n=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/save-as-template`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({expectedRevision:t.teamPolicy.revision,id:h,name:y})});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??`Save failed (${n.status})`);let r=await n.json();window.location.assign(`/templates/teams/${encodeURIComponent(r.template.id)}`)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}},children:[(0,m.jsx)(r,{className:`h-4 w-4`}),`Save independent Team template`]})]}),o&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:o}),(0,m.jsx)(_,{teamId:e,detail:t,templates:n})]})}function g({label:e,value:t,warning:n=!1}){return(0,m.jsxs)(`div`,{className:`rounded-md border p-3 ${n?`border-warning/25 bg-warning/10 dark:bg-amber-950/30`:`border-frost bg-ivory`}`,children:[(0,m.jsx)(`dt`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:e}),(0,m.jsx)(`dd`,{className:`mt-1 break-words text-sm font-semibold`,children:t})]})}function _({teamId:e,detail:t,templates:n}){let[r,i]=(0,p.useState)(n.find(e=>!e.deletedAt)?.id??``),[a,o]=(0,p.useState)(null),[s,l]=(0,p.useState)({}),[u,d]=(0,p.useState)({}),[f,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),v=async()=>{_(null),h(null);let e=await fetch(`/api/team-templates/${encodeURIComponent(r)}`);if(!e.ok){_(`Could not load Team (${e.status})`);return}let n=await e.json();o(n);let i={};n.slots.forEach((e,n)=>{let r=t.members[n];r&&(i[e.slotId]=r.id)}),l(i);let a=new Set(Object.values(i));d(Object.fromEntries(t.members.filter(e=>!a.has(e.id)).map(e=>[e.id,`isolated`])))},y=()=>({teamExpectedRevision:t.teamPolicy.revision,templateId:a?.template.id,templateExpectedRevision:a?.template.currentRevision,slotMappings:a?.slots.map(e=>({slotId:e.slotId,agentId:s[e.slotId]}))??[],remainingPlacements:t.members.filter(e=>!Object.values(s).includes(e.id)).map(e=>({agentId:e.id,placement:u[e.id]??`isolated`}))});return(0,m.jsxs)(`div`,{className:`space-y-4 border-t border-frost pt-5`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h3`,{className:`m-0 text-base`,children:`Adopt or rebaseline from Team Template`}),(0,m.jsx)(`p`,{className:`muted mt-1 text-sm`,children:`Map every stable source slot to one current Agent, choose placement for remaining Agents, then review the daemon-resolved edge set.`})]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,m.jsxs)(`label`,{className:`min-w-52 flex-1 text-xs`,children:[`Team Template`,(0,m.jsx)(`select`,{value:r,onChange:e=>{i(e.target.value),o(null),h(null)},children:n.filter(e=>!e.deletedAt).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.name,` · r`,e.currentRevision]},e.id))})]}),(0,m.jsx)(c,{variant:`ghost`,onClick:v,children:`Configure mapping`})]}),a&&(0,m.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Stable slots`}),a.slots.map(e=>(0,m.jsxs)(`label`,{className:`block text-xs`,children:[(0,m.jsxs)(`span`,{className:`block truncate`,title:e.slotId,children:[e.agentName,` · slot `,(0,m.jsx)(`code`,{children:e.slotId.slice(0,8)})]}),(0,m.jsxs)(`select`,{value:s[e.slotId]??``,onChange:t=>{l(n=>({...n,[e.slotId]:t.target.value})),h(null)},children:[(0,m.jsx)(`option`,{value:``,children:`Select Agent…`}),t.members.map(t=>(0,m.jsxs)(`option`,{value:t.id,disabled:Object.entries(s).some(([n,r])=>n!==e.slotId&&r===t.id),children:[t.name,t.status===`archived`?` (archived)`:``]},t.id))]})]},e.slotId))]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Remaining live Agents`}),t.members.filter(e=>!Object.values(s).includes(e.id)).map(e=>(0,m.jsxs)(`label`,{className:`block text-xs`,children:[e.name,(0,m.jsxs)(`select`,{value:u[e.id]??`isolated`,onChange:t=>{d(n=>({...n,[e.id]:t.target.value})),h(null)},children:[(0,m.jsx)(`option`,{value:`isolated`,children:`Isolated`}),(0,m.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`})]})]},e.id))]})]}),a&&(0,m.jsx)(c,{variant:`ghost`,onClick:async()=>{if(!a||a.slots.some(e=>!s[e.slotId])||new Set(Object.values(s)).size!==a.slots.length){_(`Map every stable slot to a distinct current Agent.`);return}let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/adopt-template/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(y())}),n=await t.json().catch(()=>null);if(!t.ok){_(n?.error??`Preview failed (${t.status})`);return}h(n.edges)},children:`Review exact resulting policy`}),f&&(0,m.jsxs)(`div`,{className:`rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,m.jsxs)(`p`,{children:[`The daemon resolved `,(0,m.jsx)(`strong`,{children:f.length}),` directed allow edges. This preview is submitted unchanged and recomputed transactionally at commit.`]}),(0,m.jsx)(`div`,{className:`mt-2 max-h-40 overflow-auto`,children:(0,m.jsx)(`ul`,{children:f.map((e,t)=>(0,m.jsx)(`li`,{children:(0,m.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))})}),(0,m.jsx)(c,{variant:`primary`,className:`mt-3`,onClick:async()=>{if(!f)return;let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/adopt-template`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...y(),previewEdges:f})}),n=await t.json().catch(()=>null);if(!t.ok){_(n?.error??`Rebaseline failed (${t.status})`);return}window.location.reload()},children:`Commit reviewed rebaseline`})]}),g&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:g})]})}function v(){let e=o.useLoaderData();if(!e.ok)return(0,m.jsx)(l,{title:`Team policy unavailable`,error:Error(e.error),reset:()=>window.location.reload(),fallbackHref:`/teams`});let{detail:t,profiles:n,templates:r}=e.value,{id:a}=o.useParams(),c=o.useSearch(),d=t.baseline;return(0,m.jsxs)(s,{size:`wide`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h1`,{children:`Team policy`}),(0,m.jsxs)(`p`,{className:`muted`,children:[`The sole effective live communication policy for `,(0,m.jsx)(`code`,{children:a}),`.`]})]}),(0,m.jsx)(u,{teamId:a}),(0,m.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,"aria-label":`Policy status`,children:[(0,m.jsx)(y,{label:`Revision`,value:t.teamPolicy.revision}),(0,m.jsx)(y,{label:`Allow edges`,value:t.edges.length}),(0,m.jsx)(y,{label:`Baseline`,value:d?`${d.templateId} r${d.templateRevision}`:`Not initialized`})]}),(0,m.jsx)(i,{source:{kind:`live`,teamId:a,detail:t},profiles:n,initialUi:{view:c.view,selectedId:c.selected,viewport:{x:c.vx,y:c.vy,zoom:c.vz}}}),(0,m.jsx)(h,{teamId:a,detail:t,templates:r})]})}function y({label:e,value:t}){return(0,m.jsxs)(`div`,{className:`card`,children:[(0,m.jsx)(`dt`,{className:`muted text-xs`,children:e}),(0,m.jsx)(`dd`,{className:`break-words font-semibold`,children:t})]})}export{v as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{n as r,t as i}from"./ProductionTeamPolicyEditor-CsWpTsy6.js";import{A as a,d as o}from"./index-3nrK5iFr.js";import{r as s}from"./Page-CwNuDhWz.js";import{t as c}from"./Button-ByiV6fpd.js";import{t as l}from"./RecoveryState-QfMSuwy3.js";import{t as u}from"./TeamTabs-DvqWieCq.js";var d=a(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),f=a(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),p=e(n(),1),m=t();function h({teamId:e,detail:t,templates:n}){let[i,a]=(0,p.useState)(null),[o,s]=(0,p.useState)(null),[l,u]=(0,p.useState)(!1),[h,v]=(0,p.useState)(`${e}-snapshot`),[y,b]=(0,p.useState)(`${e} snapshot`),x=(0,p.useMemo)(()=>new Set(t.bindings.map(e=>e.agentId)),[t.bindings]),S=t.members.filter(e=>!x.has(e.id)),C=async()=>{let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/diff`);if(!t.ok)throw Error((await t.json().catch(()=>null))?.error??`Could not load source comparison`);a(await t.json())};return(0,p.useEffect)(()=>{C().catch(e=>s(e instanceof Error?e.message:String(e)))},[e]),(0,m.jsxs)(`section`,{className:`card space-y-4`,"aria-labelledby":`source-workflows`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,m.jsx)(d,{className:`mt-1 h-5 w-5 text-sapphire`}),(0,m.jsxs)(`div`,{className:`mr-auto`,children:[(0,m.jsx)(`h2`,{id:`source-workflows`,className:`m-0 text-lg`,children:`Baseline and source`}),(0,m.jsx)(`p`,{className:`muted mt-1 text-sm`,children:`Lineage is retained for comparison; source edits never auto-propagate.`})]}),(0,m.jsxs)(c,{variant:`ghost`,onClick:()=>void C(),children:[(0,m.jsx)(f,{className:`h-4 w-4`}),`Refresh comparison`]})]}),i?(0,m.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,m.jsx)(g,{label:`Baseline`,value:i.baseline?`${i.baseline.templateId} r${i.baseline.templateRevision}`:`None`}),(0,m.jsx)(g,{label:`Live changes`,value:`+${i.comparison.addedSinceBaseline.length} / −${i.comparison.removedSinceBaseline.length} edges`}),(0,m.jsx)(g,{label:`Source slots`,value:`+${i.comparison.currentSourceAddedSlotIds.length} / −${i.comparison.currentSourceRemovedSlotIds.length}`}),(0,m.jsx)(g,{label:`Source state`,value:i.currentSource?i.sourceDiverged?`Diverged — rebaseline required`:`Aligned`:`Missing/tombstoned`,warning:i.sourceDiverged||!i.currentSource})]}):(0,m.jsx)(`p`,{className:`muted`,children:`Loading comparison…`}),i?.sourceDiverged&&(0,m.jsx)(`div`,{role:`alert`,className:`rounded-md border border-warning/25 bg-warning/10 p-3 text-sm text-warning`,children:`The source has changed since this Team retained its baseline. Both versions remain intact. Update-source is disabled; compare and explicitly rebaseline instead.`}),i?.currentSource&&!i.sourceDiverged&&(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,m.jsxs)(`p`,{className:`mr-auto text-sm`,children:[`Promote the current live policy to `,(0,m.jsx)(`strong`,{children:i.currentSource.template.name}),`, including `,S.length,` live-only Agent`,S.length===1?``:`s`,`.`]}),(0,m.jsx)(c,{variant:`ghost`,disabled:l,onClick:async()=>{if(!(!i?.currentSource||i.sourceDiverged)){u(!0),s(null);try{let n=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/update-source`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({teamExpectedRevision:t.teamPolicy.revision,templateExpectedRevision:i.currentSource.template.currentRevision,includeAgentIds:S.map(e=>e.id)})});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??`Update failed (${n.status})`);window.location.reload()}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}},children:`Update source after review`})]}),(0,m.jsxs)(`div`,{className:`grid gap-3 border-t border-frost pt-4 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,m.jsxs)(`label`,{className:`text-xs`,children:[`New template ID`,(0,m.jsx)(`input`,{value:h,onChange:e=>v(e.target.value)})]}),(0,m.jsxs)(`label`,{className:`text-xs`,children:[`New template name`,(0,m.jsx)(`input`,{value:y,onChange:e=>b(e.target.value)})]}),(0,m.jsxs)(c,{variant:`primary`,disabled:l||!h.trim()||!y.trim(),onClick:async()=>{u(!0),s(null);try{let n=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/save-as-template`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({expectedRevision:t.teamPolicy.revision,id:h,name:y})});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??`Save failed (${n.status})`);let r=await n.json();window.location.assign(`/templates/teams/${encodeURIComponent(r.template.id)}`)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}},children:[(0,m.jsx)(r,{className:`h-4 w-4`}),`Save independent Team template`]})]}),o&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:o}),(0,m.jsx)(_,{teamId:e,detail:t,templates:n})]})}function g({label:e,value:t,warning:n=!1}){return(0,m.jsxs)(`div`,{className:`rounded-md border p-3 ${n?`border-warning/25 bg-warning/10 dark:bg-amber-950/30`:`border-frost bg-ivory`}`,children:[(0,m.jsx)(`dt`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:e}),(0,m.jsx)(`dd`,{className:`mt-1 break-words text-sm font-semibold`,children:t})]})}function _({teamId:e,detail:t,templates:n}){let[r,i]=(0,p.useState)(n.find(e=>!e.deletedAt)?.id??``),[a,o]=(0,p.useState)(null),[s,l]=(0,p.useState)({}),[u,d]=(0,p.useState)({}),[f,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),v=async()=>{_(null),h(null);let e=await fetch(`/api/team-templates/${encodeURIComponent(r)}`);if(!e.ok){_(`Could not load Team (${e.status})`);return}let n=await e.json();o(n);let i={};n.slots.forEach((e,n)=>{let r=t.members[n];r&&(i[e.slotId]=r.id)}),l(i);let a=new Set(Object.values(i));d(Object.fromEntries(t.members.filter(e=>!a.has(e.id)).map(e=>[e.id,`isolated`])))},y=()=>({teamExpectedRevision:t.teamPolicy.revision,templateId:a?.template.id,templateExpectedRevision:a?.template.currentRevision,slotMappings:a?.slots.map(e=>({slotId:e.slotId,agentId:s[e.slotId]}))??[],remainingPlacements:t.members.filter(e=>!Object.values(s).includes(e.id)).map(e=>({agentId:e.id,placement:u[e.id]??`isolated`}))});return(0,m.jsxs)(`div`,{className:`space-y-4 border-t border-frost pt-5`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h3`,{className:`m-0 text-base`,children:`Adopt or rebaseline from Team Template`}),(0,m.jsx)(`p`,{className:`muted mt-1 text-sm`,children:`Map every stable source slot to one current Agent, choose placement for remaining Agents, then review the daemon-resolved edge set.`})]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,m.jsxs)(`label`,{className:`min-w-52 flex-1 text-xs`,children:[`Team Template`,(0,m.jsx)(`select`,{value:r,onChange:e=>{i(e.target.value),o(null),h(null)},children:n.filter(e=>!e.deletedAt).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.name,` · r`,e.currentRevision]},e.id))})]}),(0,m.jsx)(c,{variant:`ghost`,onClick:v,children:`Configure mapping`})]}),a&&(0,m.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Stable slots`}),a.slots.map(e=>(0,m.jsxs)(`label`,{className:`block text-xs`,children:[(0,m.jsxs)(`span`,{className:`block truncate`,title:e.slotId,children:[e.agentName,` · slot `,(0,m.jsx)(`code`,{children:e.slotId.slice(0,8)})]}),(0,m.jsxs)(`select`,{value:s[e.slotId]??``,onChange:t=>{l(n=>({...n,[e.slotId]:t.target.value})),h(null)},children:[(0,m.jsx)(`option`,{value:``,children:`Select Agent…`}),t.members.map(t=>(0,m.jsxs)(`option`,{value:t.id,disabled:Object.entries(s).some(([n,r])=>n!==e.slotId&&r===t.id),children:[t.name,t.status===`archived`?` (archived)`:``]},t.id))]})]},e.slotId))]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Remaining live Agents`}),t.members.filter(e=>!Object.values(s).includes(e.id)).map(e=>(0,m.jsxs)(`label`,{className:`block text-xs`,children:[e.name,(0,m.jsxs)(`select`,{value:u[e.id]??`isolated`,onChange:t=>{d(n=>({...n,[e.id]:t.target.value})),h(null)},children:[(0,m.jsx)(`option`,{value:`isolated`,children:`Isolated`}),(0,m.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`})]})]},e.id))]})]}),a&&(0,m.jsx)(c,{variant:`ghost`,onClick:async()=>{if(!a||a.slots.some(e=>!s[e.slotId])||new Set(Object.values(s)).size!==a.slots.length){_(`Map every stable slot to a distinct current Agent.`);return}let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/adopt-template/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(y())}),n=await t.json().catch(()=>null);if(!t.ok){_(n?.error??`Preview failed (${t.status})`);return}h(n.edges)},children:`Review exact resulting policy`}),f&&(0,m.jsxs)(`div`,{className:`rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,m.jsxs)(`p`,{children:[`The daemon resolved `,(0,m.jsx)(`strong`,{children:f.length}),` directed allow edges. This preview is submitted unchanged and recomputed transactionally at commit.`]}),(0,m.jsx)(`div`,{className:`mt-2 max-h-40 overflow-auto`,children:(0,m.jsx)(`ul`,{children:f.map((e,t)=>(0,m.jsx)(`li`,{children:(0,m.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))})}),(0,m.jsx)(c,{variant:`primary`,className:`mt-3`,onClick:async()=>{if(!f)return;let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/adopt-template`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...y(),previewEdges:f})}),n=await t.json().catch(()=>null);if(!t.ok){_(n?.error??`Rebaseline failed (${t.status})`);return}window.location.reload()},children:`Commit reviewed rebaseline`})]}),g&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:g})]})}function v(){let e=o.useLoaderData();if(!e.ok)return(0,m.jsx)(l,{title:`Team policy unavailable`,error:Error(e.error),reset:()=>window.location.reload(),fallbackHref:`/teams`});let{detail:t,profiles:n,templates:r}=e.value,{id:a}=o.useParams(),c=o.useSearch(),d=t.baseline;return(0,m.jsxs)(s,{size:`wide`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h1`,{children:`Team policy`}),(0,m.jsxs)(`p`,{className:`muted`,children:[`The sole effective live communication policy for `,(0,m.jsx)(`code`,{children:a}),`.`]})]}),(0,m.jsx)(u,{teamId:a}),(0,m.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,"aria-label":`Policy status`,children:[(0,m.jsx)(y,{label:`Revision`,value:t.teamPolicy.revision}),(0,m.jsx)(y,{label:`Allow edges`,value:t.edges.length}),(0,m.jsx)(y,{label:`Baseline`,value:d?`${d.templateId} r${d.templateRevision}`:`Not initialized`})]}),(0,m.jsx)(i,{source:{kind:`live`,teamId:a,detail:t},profiles:n,initialUi:{view:c.view,selectedId:c.selected,viewport:{x:c.vx,y:c.vy,zoom:c.vz}}}),(0,m.jsx)(h,{teamId:a,detail:t,templates:r})]})}function y({label:e,value:t}){return(0,m.jsxs)(`div`,{className:`card`,children:[(0,m.jsx)(`dt`,{className:`muted text-xs`,children:e}),(0,m.jsx)(`dd`,{className:`break-words font-semibold`,children:t})]})}export{v as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{a as r,d as i,o as a}from"./preload-helper-mNuBjNXU.js";import{t as o}from"./chevron-down-CJk0zGNT.js";import{t as s}from"./plus-C3GroITC.js";import{A as c,O as l,T as u,k as d}from"./index-nb2MV8X1.js";import{i as f}from"./wire-constants-BhVKOCQa.js";import{t as p}from"./Button-ByiV6fpd.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`}]]),h=c(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),g=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`}]]),_=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`}]]),v=e(n(),1),y=t();function b({onClose:e}){let t=i(),[n,r]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null);async function m(r){if(r.preventDefault(),f(null),!n.trim()){f(`id is required`);return}u(!0);try{let r={id:n.trim()};a.trim()&&(r.name=a.trim()),s.trim()&&(r.link=s.trim());let i=await fetch(`/api/teams`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??`${i.status} ${i.statusText}`)}e(),await t.invalidate()}catch(e){f(e.message),u(!1)}}return(0,y.jsx)(`div`,{onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},className:`fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm`,children:(0,y.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`create-team-title`,onSubmit:m,onClick:e=>e.stopPropagation(),className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,children:[(0,y.jsx)(`h2`,{id:`create-team-title`,className:`font-serif text-2xl text-foreground`,children:`Create a team`}),(0,y.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`A team is a collaboration context — one filesystem root, one USER.md, one roster. The slot lives at `,(0,y.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/teams/<slug>/`}),`.`]}),(0,y.jsxs)(`div`,{className:`mb-3 grid gap-3 sm:grid-cols-2`,children:[(0,y.jsxs)(`label`,{className:`block text-sm`,children:[`ID (slug)`,(0,y.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),required:!0,pattern:`[a-z0-9][a-z0-9_-]*`,placeholder:`myproject`,autoFocus:!0,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]}),(0,y.jsxs)(`label`,{className:`block text-sm`,children:[`Name `,(0,y.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`}),(0,y.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]})]}),(0,y.jsxs)(`label`,{className:`block text-sm mb-3`,children:[`Link target`,` `,(0,y.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional, absolute path)`}),(0,y.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`/home/you/projects/myrepo`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Leave blank to create a fresh directory. Supply an absolute path to materialize the slot as a symlink to your existing project tree.`})]}),d&&(0,y.jsx)(`p`,{className:`err mt-2`,children:d}),(0,y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,onClick:e,children:`Cancel`}),(0,y.jsx)(p,{variant:`primary`,type:`submit`,disabled:l,children:l?`Creating…`:`Create`})]})]})})}function x({profileId:e,teamHint:t,teams:n,onClose:r}){let i=a(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(t??n.find(e=>e.id==="default")?.id??n[0]?.id??``),[u,d]=(0,v.useState)(`profile_defaults`),[f,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,b]=(0,v.useState)(null);async function x(){let t=await fetch(`/api/teams/${encodeURIComponent(c)}/policy`);if(!t.ok)throw Error(`The selected Team policy is unavailable. Reload and try again.`);let n=await t.json();return{current:n,body:{profileId:e,teamId:c,teamExpectedRevision:n.teamPolicy.revision,placement:u}}}async function C(){g(null),m(!0);try{let{body:e}=await x(),t=await fetch(`/api/agents/placement-preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`Preview failed (${t.status})`)}b(await t.json())}catch(e){g(e.message)}finally{m(!1)}}async function w(t){t.preventDefault(),g(null),m(!0);try{if(!_){await C();return}let t={profile:e,teamExpectedRevision:_.currentRevision,placement:u};o.trim()&&(t.name=o.trim()),c&&(t.teamId=c);let n=await fetch(`/api/agents`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}let a=(await n.json()).agent;r(),await i({to:`/`,search:{agent:a.id}})}catch(e){g(e.message),m(!1)}}return(0,y.jsx)(S,{onClose:r,children:(0,y.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`spawn-agent-title`,onSubmit:w,className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,onClick:e=>e.stopPropagation(),children:[(0,y.jsx)(`h3`,{id:`spawn-agent-title`,className:`font-serif text-xl text-foreground mb-1`,children:`Spawn a new agent`}),(0,y.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`Profile: `,(0,y.jsx)(`code`,{className:`font-mono`,children:e})]}),(0,y.jsxs)(`label`,{className:`block text-sm text-foreground mb-3`,children:[`Agent name`,` `,(0,y.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional — defaults to the profile's name)`}),(0,y.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),autoFocus:!0,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]}),(0,y.jsxs)(`label`,{className:`block text-sm text-foreground mb-3`,children:[`Initial policy placement`,(0,y.jsxs)(`select`,{value:u,onChange:e=>{d(e.target.value),b(null)},className:`mt-1 block w-full rounded-md border bg-background px-3 py-2`,children:[(0,y.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`}),(0,y.jsx)(`option`,{value:`isolated`,children:`isolated`})]}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`The current Team revision is checked again when you submit.`})]}),(0,y.jsxs)(`label`,{className:`block text-sm text-foreground mb-3`,children:[`Team`,(0,y.jsx)(`select`,{value:c,onChange:e=>{l(e.target.value),b(null)},className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`,children:n.map(e=>(0,y.jsxs)(`option`,{value:e.id,children:[e.name,e.id==="default"?` (default)`:``]},e.id))})]}),h&&(0,y.jsx)(`p`,{className:`err mt-2`,children:h}),_&&(0,y.jsxs)(`div`,{className:`mt-3 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,y.jsxs)(`p`,{children:[`Creating this Agent advances Team revision `,_.currentRevision,` → `,(0,y.jsx)(`strong`,{children:_.resultingRevision}),` and adds `,(0,y.jsx)(`strong`,{children:_.addedEdges.length}),` directed edges to the existing `,_.existingEdges.length,`.`]}),(0,y.jsx)(`ul`,{className:`mt-2 max-h-36 overflow-auto`,children:_.addedEdges.map((e,t)=>(0,y.jsx)(`li`,{children:(0,y.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))}),_.addedEdges.length===0&&(0,y.jsx)(`p`,{className:`mt-2`,children:`The new Agent starts isolated.`})]}),(0,y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,onClick:r,children:`Cancel`}),(0,y.jsx)(p,{variant:`primary`,type:`submit`,disabled:f,children:f?`Working…`:_?`Commit reviewed creation`:`Review exact policy`})]})]})})}function S({children:e,onClose:t}){return(0,y.jsx)(`div`,{onClick:t,onKeyDown:e=>{e.key===`Escape`&&t()},className:`fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm`,children:e})}function C({profileGroup:e,teams:t,onClose:n,onSpawned:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[f,m]=(0,v.useState)(null),h=(0,v.useRef)(null);(0,v.useEffect)(()=>{h.current?.focus()},[]);async function g(){let n=i.trim();if(!n)throw Error(`target Team slug is required`);let r=t.find(e=>e.id===n),a;if(r){let e=await fetch(`/api/teams/${encodeURIComponent(n)}/policy`);if(!e.ok)throw Error(`The target Team policy is unavailable.`);a=(await e.json()).teamPolicy.revision}return{target:n,body:{templateExpectedRevision:e.currentRevision,teamId:n,...a?{teamExpectedRevision:a}:{},mode:r?`append`:`initialize`,...o?{userMd:o}:{}}}}async function _(){d(!0),l(null),m(null);try{let{body:t}=await g(),n=await fetch(`/api/team-templates/${encodeURIComponent(e.id)}/spawn/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??n.statusText);m(await n.json())}catch(e){l(e.message)}finally{d(!1)}}async function b(){let t=i.trim();if(!t){l(`target Team slug is required`);return}d(!0),l(null);try{let{body:n}=await g(),i=await fetch(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error((await i.json().catch(()=>null))?.error??i.statusText);r(t)}catch(e){l(e.message)}finally{d(!1)}}return(0,y.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`spawn-team-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},children:(0,y.jsxs)(`div`,{ref:h,tabIndex:-1,className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,role:`document`,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key!==`Escape`&&e.stopPropagation()},children:[(0,y.jsxs)(`h2`,{id:`spawn-team-title`,children:[`Spawn team — `,e.name]}),c&&(0,y.jsx)(`div`,{className:`err`,children:c}),(0,y.jsxs)(`p`,{className:`muted`,children:[`Uses immutable Team revision `,e.currentRevision,`. Existing Teams append at their current reviewed revision; a new Team initializes at revision 1. Conflicts never overwrite newer state.`]}),(0,y.jsxs)(`label`,{children:[`target Team slug`,(0,y.jsx)(`input`,{value:i,onChange:e=>{a(e.target.value),m(null)},list:`canonical-teams`,required:!0}),(0,y.jsx)(`datalist`,{id:`canonical-teams`,children:t.map(e=>(0,y.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,y.jsxs)(`label`,{children:[`starter USER.md (new Team only)`,(0,y.jsx)(`textarea`,{rows:3,value:o,onChange:e=>{s(e.target.value),m(null)},className:`font-mono text-[0.88em] leading-[1.55]`})]}),f&&(0,y.jsxs)(`div`,{className:`mt-4 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,y.jsxs)(`p`,{children:[(0,y.jsx)(`strong`,{children:f.mode===`initialize`?`Initialize`:`Append`}),` produces Team revision `,f.resultingRevision,`, adds `,f.newMembers.length,` Agents, and results in `,f.edges.length,` directed allow edges.`]}),(0,y.jsx)(`ul`,{className:`mt-2 max-h-40 overflow-auto`,children:f.newMembers.map(e=>(0,y.jsxs)(`li`,{children:[e.agentName,` · stable source slot `,(0,y.jsx)(`code`,{children:e.slotId})]},e.slotId))}),(0,y.jsxs)(`details`,{className:`mt-2`,children:[(0,y.jsx)(`summary`,{className:`cursor-pointer`,children:`Review exact edge topology`}),(0,y.jsx)(`ul`,{className:`mt-2 max-h-40 overflow-auto`,children:f.edges.map((e,t)=>(0,y.jsx)(`li`,{children:(0,y.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))})]})]}),(0,y.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,onClick:n,children:`cancel`}),f?(0,y.jsx)(p,{variant:`primary`,onClick:b,disabled:u,children:u?`spawning…`:`commit ${f.mode}`}):(0,y.jsx)(p,{variant:`primary`,onClick:_,disabled:u||e.slotCount===0,children:u?`reviewing…`:`review exact result`})]})]})})}var w=`bz_sidebar_open_groups`;function T(e){if(typeof document>`u`)return;let t=encodeURIComponent(JSON.stringify(e));document.cookie=`${w}=${t}; Path=/; Max-Age=31536000; SameSite=Lax`}function E({agents:e,teams:t,profiles:n,profileGroups:a,selectedAgentId:c,initialOpenGroups:u}){let f=i(),[p,S]=(0,v.useState)(null),[w,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(!1),j=(0,v.useRef)(null),M=()=>window.requestAnimationFrame(()=>j.current?.focus()),[N,P]=(0,v.useState)(()=>u??{});async function F(e){let t=window.prompt(`rename "${e.name}" to:`,e.name)?.trim();if(!t||t===e.name)return;let n=await fetch(`/api/agents/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t})});if(!n.ok){let e=await n.json().catch(()=>null);alert(e?.error??n.statusText);return}await f.invalidate()}async function I(e){if(!confirm(`archive "${e.name}"? (reversible — find under "show archived")`))return;let t=await fetch(`/api/agents/${e.id}/archive`,{method:`POST`});if(!t.ok&&t.status!==204){alert(t.statusText);return}await f.invalidate()}let L=[...n].sort((e,t)=>e.id==="default"?-1:+(t.id==="default")),R=[...t].sort((e,t)=>e.id==="default"?-1:+(t.id==="default")),z=new Map;for(let t of e){let e=z.get(t.teamId)??[];e.push(t),z.set(t.teamId,e)}let B=e.find(e=>e.id===c)?.teamId??null;return(0,y.jsxs)(`aside`,{className:`flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,y.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border bg-muted/30 px-3 py-2.5`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[(0,y.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-lg bg-accent text-accent-foreground`,children:(0,y.jsx)(d,{className:`size-4`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{children:`Agents`})]}),(0,y.jsxs)(`p`,{className:`mt-0.5 truncate pl-9 text-[0.7rem] text-muted-foreground`,children:[e.length,` agent`,e.length===1?``:`s`,` across `,t.length,` team`,t.length===1?``:`s`]})]}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsxs)(`button`,{ref:j,type:`button`,onClick:()=>A(e=>!e),"aria-expanded":k,"aria-haspopup":`menu`,className:`unstyled 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,y.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}),`New`,(0,y.jsx)(o,{className:`size-3.5 text-muted-foreground transition-transform ${k?`rotate-180`:``}`,"aria-hidden":`true`})]}),k&&(0,y.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-[calc(100%+0.4rem)] z-20 w-60 overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg`,onMouseLeave:()=>A(!1),children:[n.length===0?(0,y.jsxs)(`div`,{className:`rounded-lg bg-muted/40 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[`No Agent templates yet.`,` `,(0,y.jsx)(`a`,{href:`/templates/agents`,className:`text-primary underline`,children:`Create one to spawn agents.`})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-[0.68rem] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:[(0,y.jsx)(d,{className:`size-3`,"aria-hidden":`true`}),`Agent templates`]}),L.map(e=>(0,y.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{A(!1),S({profileId:e.id})},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,y.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),e.id==="default"&&(0,y.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-1.5 py-0.5 text-[0.65rem] font-semibold text-muted-foreground`,children:`Default`})]},e.id))]}),(0,y.jsx)(`div`,{className:`my-1.5 h-px bg-border`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-[0.68rem] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:[(0,y.jsx)(l,{className:`size-3`,"aria-hidden":`true`}),`Team templates`]}),a.length===0?(0,y.jsxs)(`div`,{className:`rounded-lg bg-muted/40 px-3 py-2 text-xs leading-5 text-muted-foreground`,children:[`No team templates yet.`,` `,(0,y.jsx)(`a`,{href:`/templates/teams`,className:`text-primary underline`,children:`Create one`}),`.`]}):a.map(e=>(0,y.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.slotCount===0,title:e.slotCount===0?`Add at least one member before spawning`:void 0,onClick:()=>{A(!1),E(e)},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`,children:[(0,y.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,y.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),(0,y.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-[0.68rem] text-muted-foreground`,children:e.slotCount})]},e.id)),(0,y.jsx)(`div`,{className:`my-1.5 h-px bg-border`}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>{A(!1),O(!0)},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,y.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}),`Create a team`]})]})]})]}),(0,y.jsx)(`nav`,{className:`flex-1 overflow-y-auto p-1.5`,"aria-label":`Teams and agents`,children:e.length===0&&t.length===0?(0,y.jsxs)(`div`,{className:`m-1 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center`,children:[(0,y.jsx)(`span`,{className:`mb-2 flex size-9 items-center justify-center rounded-full bg-accent text-accent-foreground`,children:(0,y.jsx)(d,{className:`size-4`,"aria-hidden":`true`})}),(0,y.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`No agents yet`}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Spawn your first agent to start a conversation.`}),(0,y.jsxs)(`a`,{href:`/agents`,className:`mt-3 inline-flex items-center gap-1 text-xs font-semibold text-primary hover:text-primary/80`,children:[`Open agent setup`,(0,y.jsx)(h,{className:`size-3.5`,"aria-hidden":`true`})]})]}):R.map(e=>{let t=z.get(e.id)??[],n=B===e.id,i=N[e.id];return(0,y.jsxs)(`details`,{open:i===void 0?n||e.id==="default":i,onToggle:t=>{let n=t.currentTarget.open;if(N[e.id]===n)return;let r={...N,[e.id]:n};T(r),P(r),f.invalidate()},className:`team/details mb-1 last:mb-0`,children:[(0,y.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${n?`bg-muted/60 text-foreground`:`text-muted-foreground`}`,children:[(0,y.jsx)(h,{className:`size-3.5 shrink-0 transition-transform team-open/details:rotate-90`,"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,y.jsx)(l,{className:`size-3`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),e.id==="default"&&(0,y.jsx)(`span`,{className:`text-[0.62rem] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Default`}),(0,y.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full border border-border bg-card px-1.5 font-mono text-[0.68rem] text-muted-foreground`,children:t.length})]}),t.length===0?(0,y.jsx)(`div`,{className:`py-2 pl-12 pr-2 text-xs text-muted-foreground`,children:`No agents in this team`}):(0,y.jsx)(`div`,{className:`space-y-0.5 py-0.5 pl-2`,children:t.map(e=>(0,y.jsxs)(`div`,{className:`team/row relative rounded-lg`,children:[(0,y.jsxs)(r,{to:`/`,search:{agent:e.id},"aria-current":e.id===c?`page`:void 0,className:`block min-h-11 rounded-lg border border-transparent py-1.5 pl-2.5 pr-[4.6rem] transition-colors hover:bg-accent/70 ${e.id===c?`border-primary/20 bg-accent text-accent-foreground shadow-baziu-sm`:`text-foreground`}`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,y.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${e.id===c?`bg-primary`:`bg-border`}`,"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.telegramTopicId!==null&&(0,y.jsx)(`span`,{className:`shrink-0 text-primary`,title:`Telegram topic #${e.telegramTopicId}`,"aria-label":`Bound to Telegram topic ${e.telegramTopicId}`,children:(0,y.jsx)(_,{className:`size-3`,"aria-hidden":`true`})})]}),(0,y.jsxs)(`div`,{className:`mt-0.5 flex gap-2 pl-3 font-mono text-[0.65rem] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.status}),(0,y.jsx)(`span`,{children:e.id.slice(0,8)})]})]}),(0,y.jsxs)(`div`,{className:`absolute right-1 top-1/2 z-10 flex -translate-y-1/2 gap-0.5`,children:[(0,y.jsx)(`button`,{type:`button`,onClick:()=>F(e),title:`Rename`,"aria-label":`Rename ${e.name}`,className:`unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-card hover:text-primary focus-visible:bg-card`,children:(0,y.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`})}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>I(e),title:`Archive`,"aria-label":`Archive ${e.name}`,className:`unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive`,children:(0,y.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`})})]})]},e.id))})]},e.id)})}),p&&(0,y.jsx)(x,{profileId:p.profileId,teamHint:p.teamHint,teams:R,onClose:()=>{S(null),M()}}),w&&(0,y.jsx)(C,{profileGroup:w,teams:R,onClose:()=>{E(null),M()},onSpawned:e=>{E(null),f.navigate({to:`/teams/$id`,params:{id:e}})}}),D&&(0,y.jsx)(b,{onClose:()=>{O(!1),M()}})]})}function D(){let e=u.useLoaderData(),t=e.selected?.resolved.agent.id??null;return(0,y.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 gap-3 py-3 lg:grid-cols-[18rem_minmax(0,1fr)]`,children:[(0,y.jsx)(`div`,{className:`min-h-0 ${e.selected?`hidden lg:block`:``}`,children:(0,y.jsx)(E,{agents:e.agents,teams:e.teams,profiles:e.profiles,profileGroups:e.profileGroups,selectedAgentId:t,initialOpenGroups:e.initialOpenGroups})}),(0,y.jsx)(`section`,{className:`min-h-0 overflow-hidden ${e.selected?``:`hidden lg:block`}`,children:e.selected?(0,y.jsx)(f,{agentId:e.selected.resolved.agent.id,agentName:e.selected.resolved.agent.name,initialMessages:e.selected.initialMessages,initialSessionHead:e.selected.sessionHead}):(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center rounded-lg border border-dashed bg-card text-muted-foreground`,children:e.agents.length===0?`No agents yet.`:`Pick an agent on the left to start chatting.`})})]})}export{D as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{a as r,d as i,o as a}from"./preload-helper-mNuBjNXU.js";import{t as o}from"./chevron-down-B0aNNOyn.js";import{t as s}from"./plus-CPzRJg1V.js";import{A as c,O as l,T as u,k as d}from"./index-3nrK5iFr.js";import{i as f}from"./wire-constants-BhVKOCQa.js";import{t as p}from"./Button-ByiV6fpd.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`}]]),h=c(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),g=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`}]]),_=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`}]]),v=e(n(),1),y=t();function b({onClose:e}){let t=i(),[n,r]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null);async function m(r){if(r.preventDefault(),f(null),!n.trim()){f(`id is required`);return}u(!0);try{let r={id:n.trim()};a.trim()&&(r.name=a.trim()),s.trim()&&(r.link=s.trim());let i=await fetch(`/api/teams`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??`${i.status} ${i.statusText}`)}e(),await t.invalidate()}catch(e){f(e.message),u(!1)}}return(0,y.jsx)(`div`,{onClick:e,onKeyDown:t=>{t.key===`Escape`&&e()},className:`fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm`,children:(0,y.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`create-team-title`,onSubmit:m,onClick:e=>e.stopPropagation(),className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,children:[(0,y.jsx)(`h2`,{id:`create-team-title`,className:`font-serif text-2xl text-foreground`,children:`Create a team`}),(0,y.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`A team is a collaboration context — one filesystem root, one USER.md, one roster. The slot lives at `,(0,y.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/teams/<slug>/`}),`.`]}),(0,y.jsxs)(`div`,{className:`mb-3 grid gap-3 sm:grid-cols-2`,children:[(0,y.jsxs)(`label`,{className:`block text-sm`,children:[`ID (slug)`,(0,y.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),required:!0,pattern:`[a-z0-9][a-z0-9_-]*`,placeholder:`myproject`,autoFocus:!0,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]}),(0,y.jsxs)(`label`,{className:`block text-sm`,children:[`Name `,(0,y.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`}),(0,y.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]})]}),(0,y.jsxs)(`label`,{className:`block text-sm mb-3`,children:[`Link target`,` `,(0,y.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional, absolute path)`}),(0,y.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`/home/you/projects/myrepo`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Leave blank to create a fresh directory. Supply an absolute path to materialize the slot as a symlink to your existing project tree.`})]}),d&&(0,y.jsx)(`p`,{className:`err mt-2`,children:d}),(0,y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,onClick:e,children:`Cancel`}),(0,y.jsx)(p,{variant:`primary`,type:`submit`,disabled:l,children:l?`Creating…`:`Create`})]})]})})}function x({profileId:e,teamHint:t,teams:n,onClose:r}){let i=a(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(t??n.find(e=>e.id==="default")?.id??n[0]?.id??``),[u,d]=(0,v.useState)(`profile_defaults`),[f,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(null),[_,b]=(0,v.useState)(null);async function x(){let t=await fetch(`/api/teams/${encodeURIComponent(c)}/policy`);if(!t.ok)throw Error(`The selected Team policy is unavailable. Reload and try again.`);let n=await t.json();return{current:n,body:{profileId:e,teamId:c,teamExpectedRevision:n.teamPolicy.revision,placement:u}}}async function C(){g(null),m(!0);try{let{body:e}=await x(),t=await fetch(`/api/agents/placement-preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`Preview failed (${t.status})`)}b(await t.json())}catch(e){g(e.message)}finally{m(!1)}}async function w(t){t.preventDefault(),g(null),m(!0);try{if(!_){await C();return}let t={profile:e,teamExpectedRevision:_.currentRevision,placement:u};o.trim()&&(t.name=o.trim()),c&&(t.teamId=c);let n=await fetch(`/api/agents`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}let a=(await n.json()).agent;r(),await i({to:`/`,search:{agent:a.id}})}catch(e){g(e.message),m(!1)}}return(0,y.jsx)(S,{onClose:r,children:(0,y.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`spawn-agent-title`,onSubmit:w,className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,onClick:e=>e.stopPropagation(),children:[(0,y.jsx)(`h3`,{id:`spawn-agent-title`,className:`font-serif text-xl text-foreground mb-1`,children:`Spawn a new agent`}),(0,y.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:[`Profile: `,(0,y.jsx)(`code`,{className:`font-mono`,children:e})]}),(0,y.jsxs)(`label`,{className:`block text-sm text-foreground mb-3`,children:[`Agent name`,` `,(0,y.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional — defaults to the profile's name)`}),(0,y.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),autoFocus:!0,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]}),(0,y.jsxs)(`label`,{className:`block text-sm text-foreground mb-3`,children:[`Initial policy placement`,(0,y.jsxs)(`select`,{value:u,onChange:e=>{d(e.target.value),b(null)},className:`mt-1 block w-full rounded-md border bg-background px-3 py-2`,children:[(0,y.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`}),(0,y.jsx)(`option`,{value:`isolated`,children:`isolated`})]}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`The current Team revision is checked again when you submit.`})]}),(0,y.jsxs)(`label`,{className:`block text-sm text-foreground mb-3`,children:[`Team`,(0,y.jsx)(`select`,{value:c,onChange:e=>{l(e.target.value),b(null)},className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`,children:n.map(e=>(0,y.jsxs)(`option`,{value:e.id,children:[e.name,e.id==="default"?` (default)`:``]},e.id))})]}),h&&(0,y.jsx)(`p`,{className:`err mt-2`,children:h}),_&&(0,y.jsxs)(`div`,{className:`mt-3 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,y.jsxs)(`p`,{children:[`Creating this Agent advances Team revision `,_.currentRevision,` → `,(0,y.jsx)(`strong`,{children:_.resultingRevision}),` and adds `,(0,y.jsx)(`strong`,{children:_.addedEdges.length}),` directed edges to the existing `,_.existingEdges.length,`.`]}),(0,y.jsx)(`ul`,{className:`mt-2 max-h-36 overflow-auto`,children:_.addedEdges.map((e,t)=>(0,y.jsx)(`li`,{children:(0,y.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))}),_.addedEdges.length===0&&(0,y.jsx)(`p`,{className:`mt-2`,children:`The new Agent starts isolated.`})]}),(0,y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,onClick:r,children:`Cancel`}),(0,y.jsx)(p,{variant:`primary`,type:`submit`,disabled:f,children:f?`Working…`:_?`Commit reviewed creation`:`Review exact policy`})]})]})})}function S({children:e,onClose:t}){return(0,y.jsx)(`div`,{onClick:t,onKeyDown:e=>{e.key===`Escape`&&t()},className:`fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm`,children:e})}function C({profileGroup:e,teams:t,onClose:n,onSpawned:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[f,m]=(0,v.useState)(null),h=(0,v.useRef)(null);(0,v.useEffect)(()=>{h.current?.focus()},[]);async function g(){let n=i.trim();if(!n)throw Error(`target Team slug is required`);let r=t.find(e=>e.id===n),a;if(r){let e=await fetch(`/api/teams/${encodeURIComponent(n)}/policy`);if(!e.ok)throw Error(`The target Team policy is unavailable.`);a=(await e.json()).teamPolicy.revision}return{target:n,body:{templateExpectedRevision:e.currentRevision,teamId:n,...a?{teamExpectedRevision:a}:{},mode:r?`append`:`initialize`,...o?{userMd:o}:{}}}}async function _(){d(!0),l(null),m(null);try{let{body:t}=await g(),n=await fetch(`/api/team-templates/${encodeURIComponent(e.id)}/spawn/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??n.statusText);m(await n.json())}catch(e){l(e.message)}finally{d(!1)}}async function b(){let t=i.trim();if(!t){l(`target Team slug is required`);return}d(!0),l(null);try{let{body:n}=await g(),i=await fetch(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error((await i.json().catch(()=>null))?.error??i.statusText);r(t)}catch(e){l(e.message)}finally{d(!1)}}return(0,y.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`spawn-team-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-charcoal/45 p-4 backdrop-blur-sm`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},children:(0,y.jsxs)(`div`,{ref:h,tabIndex:-1,className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,role:`document`,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key!==`Escape`&&e.stopPropagation()},children:[(0,y.jsxs)(`h2`,{id:`spawn-team-title`,children:[`Spawn team — `,e.name]}),c&&(0,y.jsx)(`div`,{className:`err`,children:c}),(0,y.jsxs)(`p`,{className:`muted`,children:[`Uses immutable Team revision `,e.currentRevision,`. Existing Teams append at their current reviewed revision; a new Team initializes at revision 1. Conflicts never overwrite newer state.`]}),(0,y.jsxs)(`label`,{children:[`target Team slug`,(0,y.jsx)(`input`,{value:i,onChange:e=>{a(e.target.value),m(null)},list:`canonical-teams`,required:!0}),(0,y.jsx)(`datalist`,{id:`canonical-teams`,children:t.map(e=>(0,y.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,y.jsxs)(`label`,{children:[`starter USER.md (new Team only)`,(0,y.jsx)(`textarea`,{rows:3,value:o,onChange:e=>{s(e.target.value),m(null)},className:`font-mono text-[0.88em] leading-[1.55]`})]}),f&&(0,y.jsxs)(`div`,{className:`mt-4 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,y.jsxs)(`p`,{children:[(0,y.jsx)(`strong`,{children:f.mode===`initialize`?`Initialize`:`Append`}),` produces Team revision `,f.resultingRevision,`, adds `,f.newMembers.length,` Agents, and results in `,f.edges.length,` directed allow edges.`]}),(0,y.jsx)(`ul`,{className:`mt-2 max-h-40 overflow-auto`,children:f.newMembers.map(e=>(0,y.jsxs)(`li`,{children:[e.agentName,` · stable source slot `,(0,y.jsx)(`code`,{children:e.slotId})]},e.slotId))}),(0,y.jsxs)(`details`,{className:`mt-2`,children:[(0,y.jsx)(`summary`,{className:`cursor-pointer`,children:`Review exact edge topology`}),(0,y.jsx)(`ul`,{className:`mt-2 max-h-40 overflow-auto`,children:f.edges.map((e,t)=>(0,y.jsx)(`li`,{children:(0,y.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))})]})]}),(0,y.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,onClick:n,children:`cancel`}),f?(0,y.jsx)(p,{variant:`primary`,onClick:b,disabled:u,children:u?`spawning…`:`commit ${f.mode}`}):(0,y.jsx)(p,{variant:`primary`,onClick:_,disabled:u||e.slotCount===0,children:u?`reviewing…`:`review exact result`})]})]})})}var w=`bz_sidebar_open_groups`;function T(e){if(typeof document>`u`)return;let t=encodeURIComponent(JSON.stringify(e));document.cookie=`${w}=${t}; Path=/; Max-Age=31536000; SameSite=Lax`}function E({agents:e,teams:t,profiles:n,profileGroups:a,selectedAgentId:c,initialOpenGroups:u}){let f=i(),[p,S]=(0,v.useState)(null),[w,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(!1),[k,A]=(0,v.useState)(!1),j=(0,v.useRef)(null),M=()=>window.requestAnimationFrame(()=>j.current?.focus()),[N,P]=(0,v.useState)(()=>u??{});async function F(e){let t=window.prompt(`rename "${e.name}" to:`,e.name)?.trim();if(!t||t===e.name)return;let n=await fetch(`/api/agents/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t})});if(!n.ok){let e=await n.json().catch(()=>null);alert(e?.error??n.statusText);return}await f.invalidate()}async function I(e){if(!confirm(`archive "${e.name}"? (reversible — find under "show archived")`))return;let t=await fetch(`/api/agents/${e.id}/archive`,{method:`POST`});if(!t.ok&&t.status!==204){alert(t.statusText);return}await f.invalidate()}let L=[...n].sort((e,t)=>e.id==="default"?-1:+(t.id==="default")),R=[...t].sort((e,t)=>e.id==="default"?-1:+(t.id==="default")),z=new Map;for(let t of e){let e=z.get(t.teamId)??[];e.push(t),z.set(t.teamId,e)}let B=e.find(e=>e.id===c)?.teamId??null;return(0,y.jsxs)(`aside`,{className:`flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,y.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border bg-muted/30 px-3 py-2.5`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[(0,y.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-lg bg-accent text-accent-foreground`,children:(0,y.jsx)(d,{className:`size-4`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{children:`Agents`})]}),(0,y.jsxs)(`p`,{className:`mt-0.5 truncate pl-9 text-[0.7rem] text-muted-foreground`,children:[e.length,` agent`,e.length===1?``:`s`,` across `,t.length,` team`,t.length===1?``:`s`]})]}),(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsxs)(`button`,{ref:j,type:`button`,onClick:()=>A(e=>!e),"aria-expanded":k,"aria-haspopup":`menu`,className:`unstyled 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,y.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}),`New`,(0,y.jsx)(o,{className:`size-3.5 text-muted-foreground transition-transform ${k?`rotate-180`:``}`,"aria-hidden":`true`})]}),k&&(0,y.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-[calc(100%+0.4rem)] z-20 w-60 overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg`,onMouseLeave:()=>A(!1),children:[n.length===0?(0,y.jsxs)(`div`,{className:`rounded-lg bg-muted/40 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[`No Agent templates yet.`,` `,(0,y.jsx)(`a`,{href:`/templates/agents`,className:`text-primary underline`,children:`Create one to spawn agents.`})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-[0.68rem] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:[(0,y.jsx)(d,{className:`size-3`,"aria-hidden":`true`}),`Agent templates`]}),L.map(e=>(0,y.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{A(!1),S({profileId:e.id})},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,y.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,y.jsx)(d,{className:`size-3.5`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),e.id==="default"&&(0,y.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-1.5 py-0.5 text-[0.65rem] font-semibold text-muted-foreground`,children:`Default`})]},e.id))]}),(0,y.jsx)(`div`,{className:`my-1.5 h-px bg-border`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-[0.68rem] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:[(0,y.jsx)(l,{className:`size-3`,"aria-hidden":`true`}),`Team templates`]}),a.length===0?(0,y.jsxs)(`div`,{className:`rounded-lg bg-muted/40 px-3 py-2 text-xs leading-5 text-muted-foreground`,children:[`No team templates yet.`,` `,(0,y.jsx)(`a`,{href:`/templates/teams`,className:`text-primary underline`,children:`Create one`}),`.`]}):a.map(e=>(0,y.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.slotCount===0,title:e.slotCount===0?`Add at least one member before spawning`:void 0,onClick:()=>{A(!1),E(e)},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`,children:[(0,y.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,y.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),(0,y.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-[0.68rem] text-muted-foreground`,children:e.slotCount})]},e.id)),(0,y.jsx)(`div`,{className:`my-1.5 h-px bg-border`}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>{A(!1),O(!0)},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,y.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}),`Create a team`]})]})]})]}),(0,y.jsx)(`nav`,{className:`flex-1 overflow-y-auto p-1.5`,"aria-label":`Teams and agents`,children:e.length===0&&t.length===0?(0,y.jsxs)(`div`,{className:`m-1 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center`,children:[(0,y.jsx)(`span`,{className:`mb-2 flex size-9 items-center justify-center rounded-full bg-accent text-accent-foreground`,children:(0,y.jsx)(d,{className:`size-4`,"aria-hidden":`true`})}),(0,y.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`No agents yet`}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Spawn your first agent to start a conversation.`}),(0,y.jsxs)(`a`,{href:`/agents`,className:`mt-3 inline-flex items-center gap-1 text-xs font-semibold text-primary hover:text-primary/80`,children:[`Open agent setup`,(0,y.jsx)(h,{className:`size-3.5`,"aria-hidden":`true`})]})]}):R.map(e=>{let t=z.get(e.id)??[],n=B===e.id,i=N[e.id];return(0,y.jsxs)(`details`,{open:i===void 0?n||e.id==="default":i,onToggle:t=>{let n=t.currentTarget.open;if(N[e.id]===n)return;let r={...N,[e.id]:n};T(r),P(r),f.invalidate()},className:`team/details mb-1 last:mb-0`,children:[(0,y.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${n?`bg-muted/60 text-foreground`:`text-muted-foreground`}`,children:[(0,y.jsx)(h,{className:`size-3.5 shrink-0 transition-transform team-open/details:rotate-90`,"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,y.jsx)(l,{className:`size-3`,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),e.id==="default"&&(0,y.jsx)(`span`,{className:`text-[0.62rem] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Default`}),(0,y.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full border border-border bg-card px-1.5 font-mono text-[0.68rem] text-muted-foreground`,children:t.length})]}),t.length===0?(0,y.jsx)(`div`,{className:`py-2 pl-12 pr-2 text-xs text-muted-foreground`,children:`No agents in this team`}):(0,y.jsx)(`div`,{className:`space-y-0.5 py-0.5 pl-2`,children:t.map(e=>(0,y.jsxs)(`div`,{className:`team/row relative rounded-lg`,children:[(0,y.jsxs)(r,{to:`/`,search:{agent:e.id},"aria-current":e.id===c?`page`:void 0,className:`block min-h-11 rounded-lg border border-transparent py-1.5 pl-2.5 pr-[4.6rem] transition-colors hover:bg-accent/70 ${e.id===c?`border-primary/20 bg-accent text-accent-foreground shadow-baziu-sm`:`text-foreground`}`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,y.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${e.id===c?`bg-primary`:`bg-border`}`,"aria-hidden":`true`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.telegramTopicId!==null&&(0,y.jsx)(`span`,{className:`shrink-0 text-primary`,title:`Telegram topic #${e.telegramTopicId}`,"aria-label":`Bound to Telegram topic ${e.telegramTopicId}`,children:(0,y.jsx)(_,{className:`size-3`,"aria-hidden":`true`})})]}),(0,y.jsxs)(`div`,{className:`mt-0.5 flex gap-2 pl-3 font-mono text-[0.65rem] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.status}),(0,y.jsx)(`span`,{children:e.id.slice(0,8)})]})]}),(0,y.jsxs)(`div`,{className:`absolute right-1 top-1/2 z-10 flex -translate-y-1/2 gap-0.5`,children:[(0,y.jsx)(`button`,{type:`button`,onClick:()=>F(e),title:`Rename`,"aria-label":`Rename ${e.name}`,className:`unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-card hover:text-primary focus-visible:bg-card`,children:(0,y.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`})}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>I(e),title:`Archive`,"aria-label":`Archive ${e.name}`,className:`unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive`,children:(0,y.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`})})]})]},e.id))})]},e.id)})}),p&&(0,y.jsx)(x,{profileId:p.profileId,teamHint:p.teamHint,teams:R,onClose:()=>{S(null),M()}}),w&&(0,y.jsx)(C,{profileGroup:w,teams:R,onClose:()=>{E(null),M()},onSpawned:e=>{E(null),f.navigate({to:`/teams/$id`,params:{id:e}})}}),D&&(0,y.jsx)(b,{onClose:()=>{O(!1),M()}})]})}function D(){let e=u.useLoaderData(),t=e.selected?.resolved.agent.id??null;return(0,y.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 gap-3 py-3 lg:grid-cols-[18rem_minmax(0,1fr)]`,children:[(0,y.jsx)(`div`,{className:`min-h-0 ${e.selected?`hidden lg:block`:``}`,children:(0,y.jsx)(E,{agents:e.agents,teams:e.teams,profiles:e.profiles,profileGroups:e.profileGroups,selectedAgentId:t,initialOpenGroups:e.initialOpenGroups})}),(0,y.jsx)(`section`,{className:`min-h-0 overflow-hidden ${e.selected?``:`hidden lg:block`}`,children:e.selected?(0,y.jsx)(f,{agentId:e.selected.resolved.agent.id,agentName:e.selected.resolved.agent.name,initialMessages:e.selected.initialMessages,initialSessionHead:e.selected.sessionHead}):(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center rounded-lg border border-dashed bg-card text-muted-foreground`,children:e.agents.length===0?`No agents yet.`:`Pick an agent on the left to start chatting.`})})]})}export{D as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{_ as t}from"./index-nb2MV8X1.js";import{t as n}from"./ConfigPage-BCwfgyjD.js";import{t as r}from"./FieldRow-avAFLgYW.js";var i=e(),a=`Other`;function o(e){let t=new Map;for(let n of e){let e=n.team??a,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=Array.from(t,([e,t])=>({team:e,items:t}));return n.length>1&&n.sort((e,t)=>e.team===a?1:t.team===a?-1:0),n}function s(){let{services:e}=t.useLoaderData(),a=o(e);return(0,i.jsxs)(n,{active:`services`,title:`Services`,description:(0,i.jsxs)(i.Fragment,{children:[`Configure non-LLM integrations such as web search and crawlers. Secret fields are encrypted in the `,(0,i.jsx)(`code`,{className:`font-mono`,children:`secrets`}),` table; URLs and IDs live in the `,(0,i.jsx)(`code`,{className:`font-mono`,children:`config`}),` table.`]}),children:[e.length===0&&(0,i.jsx)(`p`,{className:`text-muted-foreground italic`,children:`(no services registered)`}),a.map(({team:e,items:t})=>(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),t.map(e=>(0,i.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-3`,children:[(0,i.jsxs)(`header`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`font-mono font-semibold`,children:e.id}),(0,i.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[`· `,e.displayName]})]}),e.hint&&(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.fields.map(e=>(0,i.jsx)(r,{field:e},e.envVar))]},e.id))]},e))]})}export{s as component};
1
+ import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{_ as t}from"./index-3nrK5iFr.js";import{t as n}from"./ConfigPage-BCwfgyjD.js";import{t as r}from"./FieldRow-avAFLgYW.js";var i=e(),a=`Other`;function o(e){let t=new Map;for(let n of e){let e=n.team??a,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=Array.from(t,([e,t])=>({team:e,items:t}));return n.length>1&&n.sort((e,t)=>e.team===a?1:t.team===a?-1:0),n}function s(){let{services:e}=t.useLoaderData(),a=o(e);return(0,i.jsxs)(n,{active:`services`,title:`Services`,description:(0,i.jsxs)(i.Fragment,{children:[`Configure non-LLM integrations such as web search and crawlers. Secret fields are encrypted in the `,(0,i.jsx)(`code`,{className:`font-mono`,children:`secrets`}),` table; URLs and IDs live in the `,(0,i.jsx)(`code`,{className:`font-mono`,children:`config`}),` table.`]}),children:[e.length===0&&(0,i.jsx)(`p`,{className:`text-muted-foreground italic`,children:`(no services registered)`}),a.map(({team:e,items:t})=>(0,i.jsxs)(`section`,{children:[(0,i.jsx)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),t.map(e=>(0,i.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-3`,children:[(0,i.jsxs)(`header`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`font-mono font-semibold`,children:e.id}),(0,i.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[`· `,e.displayName]})]}),e.hint&&(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.fields.map(e=>(0,i.jsx)(r,{field:e},e.envVar))]},e.id))]},e))]})}export{s as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{C as i}from"./index-nb2MV8X1.js";import{a,i as o,n as s,r as c,t as l}from"./Page-CwNuDhWz.js";import{t as u}from"./Button-ByiV6fpd.js";var d=e(n()),f=t();function p(){let e=i.useLoaderData(),t=r();async function n(e){if(!confirm(`Remove skill "${e}"? This deletes the directory on disk.`))return;let n=await fetch(`/api/skills/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){alert(n.statusText);return}await t.invalidate()}return(0,f.jsxs)(c,{size:`wide`,children:[(0,f.jsx)(s,{title:`Skills`,description:`Install and review the prompt-only skills available to your agents.`}),(0,f.jsx)(m,{onImported:()=>t.invalidate()}),(0,f.jsx)(o,{title:`Installed skills`,description:`${e.length} skill${e.length===1?``:`s`} available`,children:e.length===0?(0,f.jsx)(l,{title:`No skills installed`,description:`Import from OpenClaw, a server directory, or a ZIP archive to get started.`}):(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`m-0 min-w-[760px]`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{children:`Name`}),(0,f.jsx)(`th`,{children:`Description`}),(0,f.jsx)(`th`,{children:`Scan`}),(0,f.jsx)(`th`,{children:`Source`}),(0,f.jsx)(`th`,{})]})}),(0,f.jsx)(`tbody`,{children:e.map(e=>(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{children:(0,f.jsx)(`code`,{children:e.name})}),(0,f.jsx)(`td`,{className:`max-w-xl`,children:e.parseError?(0,f.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,f.jsx)(a,{variant:`danger`,children:`Parse error`}),(0,f.jsx)(`span`,{className:`text-destructive`,children:e.parseError})]}):e.description}),(0,f.jsx)(`td`,{children:(0,f.jsx)(h,{findings:e.scanFindings??[]})}),(0,f.jsxs)(`td`,{className:`text-xs text-muted-foreground`,children:[(0,f.jsx)(`span`,{className:`font-mono`,children:e.source??`Unknown`}),e.importedAt&&(0,f.jsx)(`div`,{className:`mt-1 font-mono`,children:new Date(e.importedAt).toLocaleDateString()})]}),(0,f.jsx)(`td`,{className:`text-right`,children:(0,f.jsx)(u,{variant:`danger`,className:`whitespace-nowrap`,onClick:()=>n(e.name),children:`Remove`})})]},e.name))})]})})})]})}function m({onImported:e}){let[t,n]=(0,d.useState)(`openclaw`),[r,i]=(0,d.useState)(``),[s,c]=(0,d.useState)(!1),[l,p]=(0,d.useState)(null),[m,h]=(0,d.useState)(!1),[v,y]=(0,d.useState)(null),[b,x]=(0,d.useState)([]),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(null);async function T(n){n.preventDefault(),y(null),x([]),C(!0);try{let n;if(t===`zip`){if(!l){y(`Choose a ZIP file first.`),C(!1);return}let e=new FormData;e.set(`file`,l),s&&e.set(`force`,`true`),n=await fetch(`/api/skills/import`,{method:`POST`,body:e})}else{let e;if(t===`openclaw`)e=`openclaw`;else if(e=r.trim(),!e){y(`Enter the server path.`),C(!1);return}n=await fetch(`/api/skills/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({source:e,force:s})})}if(!n.ok){let e=await n.json().catch(()=>null);throw x(e?.findings??[]),Error(e?.error??`${n.status} ${n.statusText}`)}x(_((await n.json().catch(()=>null))?.findings)),i(``),p(null),e()}catch(e){y(e.message)}finally{C(!1)}}function E(e){p(e.target.files?.[0]??null)}function D(e){e.preventDefault(),h(!1);let t=e.dataTransfer?.files;if(!t||t.length===0)return;let n=t[0];if(n){if(!/\.zip$/i.test(n.name)){y(`Only ZIP archives are supported.`);return}if(p(n),w.current){let e=new DataTransfer;e.items.add(n),w.current.files=e.files}}}let O=b.some(e=>e.severity===`danger`)?`danger`:`warning`;return(0,f.jsxs)(o,{title:`Import skills`,description:(0,f.jsxs)(f.Fragment,{children:[`Choose a source. Each skill's `,(0,f.jsx)(`code`,{children:`SKILL.md`}),` body is injected into the system prompt of any agent it is attached to.`]}),children:[(0,f.jsx)(`div`,{role:`tablist`,className:`mb-5 inline-flex max-w-full gap-0 overflow-x-auto rounded-lg border border-border bg-muted p-1`,children:[{id:`openclaw`,label:`OpenClaw`},{id:`path`,label:`Server directory`},{id:`zip`,label:`Upload ZIP`}].map(e=>(0,f.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.id,onClick:()=>{n(e.id),y(null)},className:`unstyled cursor-pointer whitespace-nowrap rounded-md border-none bg-transparent px-3 py-1.5 text-sm font-medium transition-colors ${t===e.id?`bg-card text-accent-foreground shadow-baziu-sm`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`}`,children:e.label},e.id))}),v&&(0,f.jsx)(`div`,{role:`alert`,className:`mb-4 rounded-lg border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:v}),b.length>0&&(0,f.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-muted/30 p-4 text-sm`,children:[(0,f.jsx)(a,{variant:O,className:`mb-2`,children:`Scan findings`}),(0,f.jsx)(g,{findings:b})]}),(0,f.jsxs)(`form`,{className:`space-y-4`,onSubmit:T,children:[t===`openclaw`&&(0,f.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`One-click import of every skill found in `,(0,f.jsx)(`code`,{children:`~/.openclaw/skills`}),` on the server.`]}),t===`path`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Import from an absolute path on the server — either a single skill folder (contains `,(0,f.jsx)(`code`,{children:`SKILL.md`}),`) or a parent folder holding many skill subfolders.`]}),(0,f.jsxs)(`label`,{className:`max-w-2xl`,children:[`Server path`,(0,f.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`/home/you/my-skills`,required:!0})]})]}),t===`zip`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Upload a `,(0,f.jsx)(`code`,{children:`.zip`}),` archive whose top level contains one folder per skill — the folder name becomes the skill name.`]}),(0,f.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:D,className:`block cursor-pointer rounded-xl border-2 border-dashed p-8 text-center transition-colors ${m?`border-primary bg-accent text-accent-foreground`:l?`border-solid border-primary/40 bg-card text-foreground`:`border-border bg-muted/30 text-muted-foreground hover:border-primary hover:bg-accent hover:text-accent-foreground`}`,children:[(0,f.jsx)(`input`,{ref:w,type:`file`,accept:`.zip,application/zip`,onChange:E,className:`absolute h-px w-px overflow-hidden opacity-0`}),l?(0,f.jsx)(`span`,{className:`block break-all font-mono text-sm text-accent-foreground`,children:l.name}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:`Click to choose a ZIP file`}),(0,f.jsx)(`span`,{className:`text-xs`,children:`or drag and drop it here`})]})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,f.jsx)(u,{variant:`primary`,type:`submit`,disabled:S,children:S?`Importing…`:t===`zip`?`Upload and import`:t===`openclaw`?`Import from OpenClaw`:`Import`}),(0,f.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1 text-sm text-foreground`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),(0,f.jsx)(`span`,{children:`Overwrite existing`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`and confirm scan findings`})]})]})]})]})}function h({findings:e}){return e.length===0?(0,f.jsx)(a,{variant:`success`,children:`Clean`}):(0,f.jsxs)(`details`,{className:`text-xs`,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer list-none`,children:(0,f.jsxs)(a,{variant:e.some(e=>e.severity===`danger`)?`danger`:`warning`,children:[e.length,` finding`,e.length===1?``:`s`]})}),(0,f.jsx)(`div`,{className:`mt-2 min-w-64`,children:(0,f.jsx)(g,{findings:e})})]})}function g({findings:e}){return(0,f.jsx)(`ul`,{className:`m-0 space-y-1.5 pl-0`,children:e.map((e,t)=>(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(a,{variant:e.severity===`danger`?`danger`:`warning`,children:e.severity===`danger`?`Danger`:`Warning`}),(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`code`,{children:e.code}),e.line?`, line ${e.line}`:``,` — `,e.message]})]},`${e.code}-${e.line??0}-${t}`))})}function _(e){return e?Object.entries(e).flatMap(([e,t])=>t.map(t=>({...t,message:`${e}: ${t.message}`}))):[]}export{p as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{C as i}from"./index-3nrK5iFr.js";import{a,i as o,n as s,r as c,t as l}from"./Page-CwNuDhWz.js";import{t as u}from"./Button-ByiV6fpd.js";var d=e(n()),f=t();function p(){let e=i.useLoaderData(),t=r();async function n(e){if(!confirm(`Remove skill "${e}"? This deletes the directory on disk.`))return;let n=await fetch(`/api/skills/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){alert(n.statusText);return}await t.invalidate()}return(0,f.jsxs)(c,{size:`wide`,children:[(0,f.jsx)(s,{title:`Skills`,description:`Install and review the prompt-only skills available to your agents.`}),(0,f.jsx)(m,{onImported:()=>t.invalidate()}),(0,f.jsx)(o,{title:`Installed skills`,description:`${e.length} skill${e.length===1?``:`s`} available`,children:e.length===0?(0,f.jsx)(l,{title:`No skills installed`,description:`Import from OpenClaw, a server directory, or a ZIP archive to get started.`}):(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`m-0 min-w-[760px]`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{children:`Name`}),(0,f.jsx)(`th`,{children:`Description`}),(0,f.jsx)(`th`,{children:`Scan`}),(0,f.jsx)(`th`,{children:`Source`}),(0,f.jsx)(`th`,{})]})}),(0,f.jsx)(`tbody`,{children:e.map(e=>(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{children:(0,f.jsx)(`code`,{children:e.name})}),(0,f.jsx)(`td`,{className:`max-w-xl`,children:e.parseError?(0,f.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,f.jsx)(a,{variant:`danger`,children:`Parse error`}),(0,f.jsx)(`span`,{className:`text-destructive`,children:e.parseError})]}):e.description}),(0,f.jsx)(`td`,{children:(0,f.jsx)(h,{findings:e.scanFindings??[]})}),(0,f.jsxs)(`td`,{className:`text-xs text-muted-foreground`,children:[(0,f.jsx)(`span`,{className:`font-mono`,children:e.source??`Unknown`}),e.importedAt&&(0,f.jsx)(`div`,{className:`mt-1 font-mono`,children:new Date(e.importedAt).toLocaleDateString()})]}),(0,f.jsx)(`td`,{className:`text-right`,children:(0,f.jsx)(u,{variant:`danger`,className:`whitespace-nowrap`,onClick:()=>n(e.name),children:`Remove`})})]},e.name))})]})})})]})}function m({onImported:e}){let[t,n]=(0,d.useState)(`openclaw`),[r,i]=(0,d.useState)(``),[s,c]=(0,d.useState)(!1),[l,p]=(0,d.useState)(null),[m,h]=(0,d.useState)(!1),[v,y]=(0,d.useState)(null),[b,x]=(0,d.useState)([]),[S,C]=(0,d.useState)(!1),w=(0,d.useRef)(null);async function T(n){n.preventDefault(),y(null),x([]),C(!0);try{let n;if(t===`zip`){if(!l){y(`Choose a ZIP file first.`),C(!1);return}let e=new FormData;e.set(`file`,l),s&&e.set(`force`,`true`),n=await fetch(`/api/skills/import`,{method:`POST`,body:e})}else{let e;if(t===`openclaw`)e=`openclaw`;else if(e=r.trim(),!e){y(`Enter the server path.`),C(!1);return}n=await fetch(`/api/skills/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({source:e,force:s})})}if(!n.ok){let e=await n.json().catch(()=>null);throw x(e?.findings??[]),Error(e?.error??`${n.status} ${n.statusText}`)}x(_((await n.json().catch(()=>null))?.findings)),i(``),p(null),e()}catch(e){y(e.message)}finally{C(!1)}}function E(e){p(e.target.files?.[0]??null)}function D(e){e.preventDefault(),h(!1);let t=e.dataTransfer?.files;if(!t||t.length===0)return;let n=t[0];if(n){if(!/\.zip$/i.test(n.name)){y(`Only ZIP archives are supported.`);return}if(p(n),w.current){let e=new DataTransfer;e.items.add(n),w.current.files=e.files}}}let O=b.some(e=>e.severity===`danger`)?`danger`:`warning`;return(0,f.jsxs)(o,{title:`Import skills`,description:(0,f.jsxs)(f.Fragment,{children:[`Choose a source. Each skill's `,(0,f.jsx)(`code`,{children:`SKILL.md`}),` body is injected into the system prompt of any agent it is attached to.`]}),children:[(0,f.jsx)(`div`,{role:`tablist`,className:`mb-5 inline-flex max-w-full gap-0 overflow-x-auto rounded-lg border border-border bg-muted p-1`,children:[{id:`openclaw`,label:`OpenClaw`},{id:`path`,label:`Server directory`},{id:`zip`,label:`Upload ZIP`}].map(e=>(0,f.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.id,onClick:()=>{n(e.id),y(null)},className:`unstyled cursor-pointer whitespace-nowrap rounded-md border-none bg-transparent px-3 py-1.5 text-sm font-medium transition-colors ${t===e.id?`bg-card text-accent-foreground shadow-baziu-sm`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`}`,children:e.label},e.id))}),v&&(0,f.jsx)(`div`,{role:`alert`,className:`mb-4 rounded-lg border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive`,children:v}),b.length>0&&(0,f.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-muted/30 p-4 text-sm`,children:[(0,f.jsx)(a,{variant:O,className:`mb-2`,children:`Scan findings`}),(0,f.jsx)(g,{findings:b})]}),(0,f.jsxs)(`form`,{className:`space-y-4`,onSubmit:T,children:[t===`openclaw`&&(0,f.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`One-click import of every skill found in `,(0,f.jsx)(`code`,{children:`~/.openclaw/skills`}),` on the server.`]}),t===`path`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Import from an absolute path on the server — either a single skill folder (contains `,(0,f.jsx)(`code`,{children:`SKILL.md`}),`) or a parent folder holding many skill subfolders.`]}),(0,f.jsxs)(`label`,{className:`max-w-2xl`,children:[`Server path`,(0,f.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`/home/you/my-skills`,required:!0})]})]}),t===`zip`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Upload a `,(0,f.jsx)(`code`,{children:`.zip`}),` archive whose top level contains one folder per skill — the folder name becomes the skill name.`]}),(0,f.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:D,className:`block cursor-pointer rounded-xl border-2 border-dashed p-8 text-center transition-colors ${m?`border-primary bg-accent text-accent-foreground`:l?`border-solid border-primary/40 bg-card text-foreground`:`border-border bg-muted/30 text-muted-foreground hover:border-primary hover:bg-accent hover:text-accent-foreground`}`,children:[(0,f.jsx)(`input`,{ref:w,type:`file`,accept:`.zip,application/zip`,onChange:E,className:`absolute h-px w-px overflow-hidden opacity-0`}),l?(0,f.jsx)(`span`,{className:`block break-all font-mono text-sm text-accent-foreground`,children:l.name}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:`Click to choose a ZIP file`}),(0,f.jsx)(`span`,{className:`text-xs`,children:`or drag and drop it here`})]})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,f.jsx)(u,{variant:`primary`,type:`submit`,disabled:S,children:S?`Importing…`:t===`zip`?`Upload and import`:t===`openclaw`?`Import from OpenClaw`:`Import`}),(0,f.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1 text-sm text-foreground`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),(0,f.jsx)(`span`,{children:`Overwrite existing`}),(0,f.jsx)(`span`,{className:`text-muted-foreground`,children:`and confirm scan findings`})]})]})]})]})}function h({findings:e}){return e.length===0?(0,f.jsx)(a,{variant:`success`,children:`Clean`}):(0,f.jsxs)(`details`,{className:`text-xs`,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer list-none`,children:(0,f.jsxs)(a,{variant:e.some(e=>e.severity===`danger`)?`danger`:`warning`,children:[e.length,` finding`,e.length===1?``:`s`]})}),(0,f.jsx)(`div`,{className:`mt-2 min-w-64`,children:(0,f.jsx)(g,{findings:e})})]})}function g({findings:e}){return(0,f.jsx)(`ul`,{className:`m-0 space-y-1.5 pl-0`,children:e.map((e,t)=>(0,f.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(a,{variant:e.severity===`danger`?`danger`:`warning`,children:e.severity===`danger`?`Danger`:`Warning`}),(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`code`,{children:e.code}),e.line?`, line ${e.line}`:``,` — `,e.message]})]},`${e.code}-${e.line??0}-${t}`))})}function _(e){return e?Object.entries(e).flatMap(([e,t])=>t.map(t=>({...t,message:`${e}: ${t.message}`}))):[]}export{p as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{w as i}from"./index-nb2MV8X1.js";import{a,i as o,n as s,r as c,t as l}from"./Page-CwNuDhWz.js";import{t as u}from"./Button-ByiV6fpd.js";var d=e(n()),f=t();function p(){let{teams:e,memberCounts:t,policies:n,readiness:d}=i.useLoaderData(),p=r();async function h(e){if(!confirm(`remove this team registration?`))return;let t=n[e]?.revision;if(!t)return;let r=await fetch(`/api/teams/${encodeURIComponent(e)}?expectedTeamPolicyRevision=${t}`,{method:`DELETE`});if(!r.ok&&r.status!==204){alert(r.statusText);return}await p.invalidate()}return(0,f.jsxs)(c,{size:`wide`,children:[(0,f.jsx)(s,{eyebrow:`Workspace`,title:`Teams`,description:`Each Team owns one workspace, one live membership roster, and one effective communication policy. Every agent belongs to exactly one Team.`}),(0,f.jsx)(o,{title:`Policy enforcement`,description:`Management contract v${d.contractVersion} is ready for this daemon.`,actions:(0,f.jsx)(a,{variant:d.enforcementActive?`success`:`warning`,children:d.enforcementActive?`Enforcement on`:`Enforcement off`}),"aria-label":`Team Policy enforcement readiness`,children:(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d.enforcementActive?`Communication boundaries are currently enforcing each Team policy.`:(0,f.jsxs)(f.Fragment,{children:[`Set `,(0,f.jsx)(`code`,{children:`BAZILION_TEAM_POLICY_ENFORCEMENT=on`}),` and restart the daemon to enforce Team policies.`]})})}),(0,f.jsx)(m,{onRegistered:()=>p.invalidate()}),(0,f.jsx)(o,{title:`Registered teams`,description:`Open a Team to manage its context, members, shared memory, and policy.`,children:e.length===0?(0,f.jsx)(l,{title:`No teams registered`,description:`Register a Team above to create a workspace for your agents.`}):(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`min-w-[820px]`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{children:`ID`}),(0,f.jsx)(`th`,{children:`Name`}),(0,f.jsx)(`th`,{children:`Members`}),(0,f.jsx)(`th`,{children:`Policy`}),(0,f.jsx)(`th`,{children:`Baseline`}),(0,f.jsx)(`th`,{children:(0,f.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,f.jsx)(`tbody`,{children:e.map(e=>{let r=t[e.id]??0,i=n[e.id];return(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{children:(0,f.jsx)(`code`,{children:e.id})}),(0,f.jsx)(`td`,{children:(0,f.jsx)(`a`,{href:`/teams/${e.id}`,children:e.name})}),(0,f.jsx)(`td`,{children:r}),(0,f.jsx)(`td`,{children:(0,f.jsx)(`a`,{href:`/teams/${e.id}/policy`,children:i?`r${i.revision} · ${i.edges} edges`:`Unavailable`})}),(0,f.jsx)(`td`,{children:i?.baseline??`None`}),(0,f.jsx)(`td`,{children:(0,f.jsx)(`div`,{className:`flex justify-end`,children:r===0?(0,f.jsx)(u,{variant:`danger`,onClick:()=>h(e.id),children:`Remove`}):(0,f.jsx)(a,{variant:`neutral`,title:`${r} agent(s) belong to this Team`,children:`In use`})})})]},e.id)})})]})})})]})}function m({onRegistered:e}){let[t,n]=(0,d.useState)(``),[r,i]=(0,d.useState)(``),[a,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),[p,m]=(0,d.useState)(!1);async function h(o){if(o.preventDefault(),l(null),!t.trim()){l(`id is required`);return}m(!0);try{let o=await fetch(`/api/teams`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:t.trim(),name:r.trim()||void 0,link:a.trim()||void 0})});if(!o.ok){let e=await o.json().catch(()=>null);throw Error(e?.error??o.statusText)}n(``),i(``),s(``),e()}catch(e){l(e.message)}finally{m(!1)}}return(0,f.jsx)(o,{title:`Register a team`,description:(0,f.jsxs)(f.Fragment,{children:[`Teams live under `,(0,f.jsx)(`code`,{children:`~/.bazilion/teams/<slug>/`}),`. Link an existing project directory or leave the target blank to create a fresh workspace.`]}),children:(0,f.jsxs)(`form`,{onSubmit:h,children:[c&&(0,f.jsx)(`div`,{className:`err`,children:c}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`label`,{children:[`ID (slug)`,(0,f.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),required:!0,placeholder:`my-project`})]}),(0,f.jsxs)(`label`,{children:[`Name`,(0,f.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`My project`})]}),(0,f.jsxs)(`label`,{className:`sm:col-span-2`,children:[`Link target (optional, absolute path)`,(0,f.jsx)(`input`,{value:a,onChange:e=>s(e.target.value),placeholder:`/home/user/projects/my-project`})]})]}),(0,f.jsx)(`div`,{className:`mt-4`,children:(0,f.jsx)(u,{variant:`primary`,type:`submit`,disabled:p,children:p?`Registering…`:`Register team`})})]})})}export{p as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{w as i}from"./index-3nrK5iFr.js";import{a,i as o,n as s,r as c,t as l}from"./Page-CwNuDhWz.js";import{t as u}from"./Button-ByiV6fpd.js";var d=e(n()),f=t();function p(){let{teams:e,memberCounts:t,policies:n,readiness:d}=i.useLoaderData(),p=r();async function h(e){if(!confirm(`remove this team registration?`))return;let t=n[e]?.revision;if(!t)return;let r=await fetch(`/api/teams/${encodeURIComponent(e)}?expectedTeamPolicyRevision=${t}`,{method:`DELETE`});if(!r.ok&&r.status!==204){alert(r.statusText);return}await p.invalidate()}return(0,f.jsxs)(c,{size:`wide`,children:[(0,f.jsx)(s,{eyebrow:`Workspace`,title:`Teams`,description:`Each Team owns one workspace, one live membership roster, and one effective communication policy. Every agent belongs to exactly one Team.`}),(0,f.jsx)(o,{title:`Policy enforcement`,description:`Management contract v${d.contractVersion} is ready for this daemon.`,actions:(0,f.jsx)(a,{variant:d.enforcementActive?`success`:`warning`,children:d.enforcementActive?`Enforcement on`:`Enforcement off`}),"aria-label":`Team Policy enforcement readiness`,children:(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d.enforcementActive?`Communication boundaries are currently enforcing each Team policy.`:(0,f.jsxs)(f.Fragment,{children:[`Set `,(0,f.jsx)(`code`,{children:`BAZILION_TEAM_POLICY_ENFORCEMENT=on`}),` and restart the daemon to enforce Team policies.`]})})}),(0,f.jsx)(m,{onRegistered:()=>p.invalidate()}),(0,f.jsx)(o,{title:`Registered teams`,description:`Open a Team to manage its context, members, shared memory, and policy.`,children:e.length===0?(0,f.jsx)(l,{title:`No teams registered`,description:`Register a Team above to create a workspace for your agents.`}):(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`min-w-[820px]`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`th`,{children:`ID`}),(0,f.jsx)(`th`,{children:`Name`}),(0,f.jsx)(`th`,{children:`Members`}),(0,f.jsx)(`th`,{children:`Policy`}),(0,f.jsx)(`th`,{children:`Baseline`}),(0,f.jsx)(`th`,{children:(0,f.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,f.jsx)(`tbody`,{children:e.map(e=>{let r=t[e.id]??0,i=n[e.id];return(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{children:(0,f.jsx)(`code`,{children:e.id})}),(0,f.jsx)(`td`,{children:(0,f.jsx)(`a`,{href:`/teams/${e.id}`,children:e.name})}),(0,f.jsx)(`td`,{children:r}),(0,f.jsx)(`td`,{children:(0,f.jsx)(`a`,{href:`/teams/${e.id}/policy`,children:i?`r${i.revision} · ${i.edges} edges`:`Unavailable`})}),(0,f.jsx)(`td`,{children:i?.baseline??`None`}),(0,f.jsx)(`td`,{children:(0,f.jsx)(`div`,{className:`flex justify-end`,children:r===0?(0,f.jsx)(u,{variant:`danger`,onClick:()=>h(e.id),children:`Remove`}):(0,f.jsx)(a,{variant:`neutral`,title:`${r} agent(s) belong to this Team`,children:`In use`})})})]},e.id)})})]})})})]})}function m({onRegistered:e}){let[t,n]=(0,d.useState)(``),[r,i]=(0,d.useState)(``),[a,s]=(0,d.useState)(``),[c,l]=(0,d.useState)(null),[p,m]=(0,d.useState)(!1);async function h(o){if(o.preventDefault(),l(null),!t.trim()){l(`id is required`);return}m(!0);try{let o=await fetch(`/api/teams`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:t.trim(),name:r.trim()||void 0,link:a.trim()||void 0})});if(!o.ok){let e=await o.json().catch(()=>null);throw Error(e?.error??o.statusText)}n(``),i(``),s(``),e()}catch(e){l(e.message)}finally{m(!1)}}return(0,f.jsx)(o,{title:`Register a team`,description:(0,f.jsxs)(f.Fragment,{children:[`Teams live under `,(0,f.jsx)(`code`,{children:`~/.bazilion/teams/<slug>/`}),`. Link an existing project directory or leave the target blank to create a fresh workspace.`]}),children:(0,f.jsxs)(`form`,{onSubmit:h,children:[c&&(0,f.jsx)(`div`,{className:`err`,children:c}),(0,f.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,f.jsxs)(`label`,{children:[`ID (slug)`,(0,f.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),required:!0,placeholder:`my-project`})]}),(0,f.jsxs)(`label`,{children:[`Name`,(0,f.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`My project`})]}),(0,f.jsxs)(`label`,{className:`sm:col-span-2`,children:[`Link target (optional, absolute path)`,(0,f.jsx)(`input`,{value:a,onChange:e=>s(e.target.value),placeholder:`/home/user/projects/my-project`})]})]}),(0,f.jsx)(`div`,{className:`mt-4`,children:(0,f.jsx)(u,{variant:`primary`,type:`submit`,disabled:p,children:p?`Registering…`:`Register team`})})]})})}export{p as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{h as i}from"./index-nb2MV8X1.js";import{n as a,r as o}from"./Page-CwNuDhWz.js";import{t as s}from"./Button-ByiV6fpd.js";import{t as c}from"./TemplatesTabs-klEydJ8-.js";var l=e(n()),u=t();function d(){let e=i.useLoaderData(),t=r();return(0,u.jsxs)(o,{size:`wide`,children:[(0,u.jsx)(a,{eyebrow:`Templates`,title:`Team templates`,description:`Create revisioned rosters with stable slots and a reusable communication policy.`}),(0,u.jsx)(c,{}),(0,u.jsx)(f,{onCreated:()=>t.invalidate()}),(0,u.jsx)(`div`,{className:`overflow-x-auto`,children:(0,u.jsxs)(`table`,{children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`id`}),(0,u.jsx)(`th`,{children:`name`}),(0,u.jsx)(`th`,{children:`slots`}),(0,u.jsx)(`th`,{children:`revision`}),(0,u.jsx)(`th`,{children:`source state`})]})}),(0,u.jsxs)(`tbody`,{children:[e.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsx)(`a`,{href:`/templates/teams/${encodeURIComponent(e.id)}`,children:(0,u.jsx)(`code`,{children:e.id})})}),(0,u.jsx)(`td`,{children:e.name}),(0,u.jsx)(`td`,{children:e.slotCount}),(0,u.jsx)(`td`,{children:e.currentRevision}),(0,u.jsx)(`td`,{children:e.deletedAt?`deleted source`:`canonical`})]},e.id)),e.length===0&&(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:5,className:`muted`,children:`No team templates yet.`})})]})]})})]})}function f({onCreated:e}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(null),[c,d]=(0,l.useState)(!1);async function f(a){a.preventDefault(),d(!0),o(null);try{let a=await fetch(`/api/team-templates`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:t.trim(),name:r.trim()})});if(!a.ok)throw Error((await a.json().catch(()=>null))?.error??a.statusText);n(``),i(``),await e()}catch(e){o(e.message)}finally{d(!1)}}return(0,u.jsxs)(`form`,{className:`card`,onSubmit:f,children:[(0,u.jsx)(`h2`,{className:`text-xl`,children:`new team template`}),a&&(0,u.jsx)(`p`,{className:`err`,children:a}),(0,u.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,u.jsxs)(`label`,{children:[`id`,(0,u.jsx)(`input`,{required:!0,value:t,onChange:e=>n(e.target.value),placeholder:`review-team`})]}),(0,u.jsxs)(`label`,{children:[`name`,(0,u.jsx)(`input`,{required:!0,value:r,onChange:e=>i(e.target.value),placeholder:`Review team`})]})]}),(0,u.jsx)(s,{variant:`primary`,type:`submit`,disabled:c,children:c?`creating…`:`create team template`})]})}export{d as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{h as i}from"./index-3nrK5iFr.js";import{n as a,r as o}from"./Page-CwNuDhWz.js";import{t as s}from"./Button-ByiV6fpd.js";import{t as c}from"./TemplatesTabs-6Jd_xQj7.js";var l=e(n()),u=t();function d(){let e=i.useLoaderData(),t=r();return(0,u.jsxs)(o,{size:`wide`,children:[(0,u.jsx)(a,{eyebrow:`Templates`,title:`Team templates`,description:`Create revisioned rosters with stable slots and a reusable communication policy.`}),(0,u.jsx)(c,{}),(0,u.jsx)(f,{onCreated:()=>t.invalidate()}),(0,u.jsx)(`div`,{className:`overflow-x-auto`,children:(0,u.jsxs)(`table`,{children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`id`}),(0,u.jsx)(`th`,{children:`name`}),(0,u.jsx)(`th`,{children:`slots`}),(0,u.jsx)(`th`,{children:`revision`}),(0,u.jsx)(`th`,{children:`source state`})]})}),(0,u.jsxs)(`tbody`,{children:[e.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsx)(`a`,{href:`/templates/teams/${encodeURIComponent(e.id)}`,children:(0,u.jsx)(`code`,{children:e.id})})}),(0,u.jsx)(`td`,{children:e.name}),(0,u.jsx)(`td`,{children:e.slotCount}),(0,u.jsx)(`td`,{children:e.currentRevision}),(0,u.jsx)(`td`,{children:e.deletedAt?`deleted source`:`canonical`})]},e.id)),e.length===0&&(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:5,className:`muted`,children:`No team templates yet.`})})]})]})})]})}function f({onCreated:e}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(null),[c,d]=(0,l.useState)(!1);async function f(a){a.preventDefault(),d(!0),o(null);try{let a=await fetch(`/api/team-templates`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:t.trim(),name:r.trim()})});if(!a.ok)throw Error((await a.json().catch(()=>null))?.error??a.statusText);n(``),i(``),await e()}catch(e){o(e.message)}finally{d(!1)}}return(0,u.jsxs)(`form`,{className:`card`,onSubmit:f,children:[(0,u.jsx)(`h2`,{className:`text-xl`,children:`new team template`}),a&&(0,u.jsx)(`p`,{className:`err`,children:a}),(0,u.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,u.jsxs)(`label`,{children:[`id`,(0,u.jsx)(`input`,{required:!0,value:t,onChange:e=>n(e.target.value),placeholder:`review-team`})]}),(0,u.jsxs)(`label`,{children:[`name`,(0,u.jsx)(`input`,{required:!0,value:r,onChange:e=>i(e.target.value),placeholder:`Review team`})]})]}),(0,u.jsx)(s,{variant:`primary`,type:`submit`,disabled:c,children:c?`creating…`:`create team template`})]})}export{d as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{o as i}from"./index-nb2MV8X1.js";import{t as a}from"./Button-ByiV6fpd.js";import{t as o}from"./ConfigPage-BCwfgyjD.js";var s=e(n()),c=t();function l(){let e=i.useLoaderData(),t=r(),[n,l]=(0,s.useState)(``),[m,h]=(0,s.useState)(e.chatId),[g,_]=(0,s.useState)(!1),[v,y]=(0,s.useState)(null),[b,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(null),[w,T]=(0,s.useState)(!1);async function E(e){e.preventDefault(),_(!0),y(null),x(!1);try{let e=await fetch(`/api/config/telegram`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({botToken:n,chatId:m})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}l(``),x(!0),await t.invalidate()}catch(e){y(e.message)}finally{_(!1)}}async function D(){if(confirm(`Clear the saved Telegram credentials?`))try{await fetch(`/api/config/telegram`,{method:`DELETE`}),l(``),h(``),C(null),x(!1),y(null),await t.invalidate()}catch(e){y(e.message)}}async function O(){T(!0),C(null);try{C(await(await fetch(`/api/config/telegram/health`)).json())}catch(e){C({configured:!0,preflight:null,error:{step:`getMe`,message:e.message},polling:null})}finally{T(!1)}}return(0,c.jsxs)(o,{active:`integrations`,title:`Telegram`,description:`Connect one forum-supergroup bot with one topic per agent, so conversations stay reachable from your phone.`,size:`narrow`,children:[e.migratedChatId&&(0,c.jsx)(d,{toChatId:e.migratedChatId}),(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,c.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3`,children:`Credentials`}),e.configured&&(0,c.jsxs)(`p`,{className:`text-xs text-success mb-3`,children:[`✓ Stored: `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.botTokenPreview}),` `,e.chatId&&(0,c.jsxs)(c.Fragment,{children:[`· chat `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.chatId})]})]}),(0,c.jsxs)(`form`,{onSubmit:E,className:`space-y-3`,children:[(0,c.jsxs)(`label`,{className:`block`,children:[(0,c.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Bot token`}),(0,c.jsx)(`input`,{type:`password`,autoComplete:`off`,value:n,onChange:e=>l(e.target.value),placeholder:e.configured?`(leave blank to keep stored value)`:`1234567890:ABC...`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!e.configured}),(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`From @BotFather → /newbot. Disable Privacy Mode in `,(0,c.jsx)(`em`,{children:`Bot Settings → Team Privacy → Turn off`}),`.`]})]}),(0,c.jsxs)(`label`,{className:`block`,children:[(0,c.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Supergroup chat ID`}),(0,c.jsx)(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`-1001234567890`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!0}),(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Forum-enabled supergroup the bot is admin in (with`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`can_manage_topics`}),`).`]})]}),(0,c.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pt-1`,children:[(0,c.jsx)(a,{variant:`primary`,type:`submit`,disabled:g,children:g?`saving…`:`save credentials`}),e.configured&&(0,c.jsx)(a,{variant:`danger`,onClick:D,children:`clear credentials`}),b&&(0,c.jsx)(`span`,{className:`text-xs text-success`,children:`saved ✓`}),v&&(0,c.jsxs)(`span`,{className:`text-xs text-danger`,children:[`error: `,v]})]})]})]}),(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,c.jsxs)(`div`,{className:`mb-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,c.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground`,children:`Preflight checks`}),(0,c.jsx)(a,{variant:`ghost`,onClick:O,disabled:w||!e.configured,children:w?`checking…`:`run preflight`})]}),!e.configured&&(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Save credentials above first.`}),e.configured&&!S&&!w&&(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground italic`,children:[`Click `,(0,c.jsx)(`em`,{children:`run preflight`}),` to validate the stored credentials against the Telegram Bot API.`]}),S&&(0,c.jsx)(p,{health:S}),S?.polling&&(0,c.jsx)(f,{polling:S.polling})]}),e.configured&&(0,c.jsx)(u,{})]})}function u(){let[e,t]=(0,s.useState)(null),[n,r]=(0,s.useState)(``),[i,o]=(0,s.useState)(``),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null);async function p(){try{let e=await fetch(`/api/config/telegram/acl`);if(!e.ok)throw Error(e.statusText);t(await e.json())}catch(e){f(e.message)}}(0,s.useEffect)(()=>{p()},[]);async function m(e){e.preventDefault();let t=Number(n);if(!Number.isInteger(t)){f(`user id must be an integer`);return}u(!0),f(null);try{let e=await fetch(`/api/config/telegram/acl`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({userId:t,label:i.trim()||null})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}r(``),o(``),await p()}catch(e){f(e.message)}finally{u(!1)}}async function h(e){f(null);try{let t=await fetch(`/api/config/telegram/acl/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??t.statusText)}await p()}catch(e){f(e.message)}}return(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,c.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-1`,children:`Access control`}),(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:[`Allowlisted Telegram users can use the bot (commands + chat). While the list is empty the bot is open and the first person to message it becomes owner. Users find their id via`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`/whoami`}),`.`]}),e===null?(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`loading…`}):e.length===0?(0,c.jsx)(`p`,{className:`text-xs text-warning mb-3`,children:`Open — no allowlist yet. The first user to message the bot claims owner.`}):(0,c.jsx)(`ul`,{className:`mb-3 space-y-1 text-sm`,children:e.map(e=>(0,c.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,c.jsx)(`code`,{className:`font-mono`,children:e.userId}),(0,c.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.label??(e.username?`@${e.username}`:`—`),` · `,e.role]}),e.role!==`owner`&&(0,c.jsx)(`button`,{type:`button`,onClick:()=>void h(e.userId),className:`ghost-btn text-xs text-rose-baziu`,children:`remove`})]},e.userId))}),(0,c.jsxs)(`form`,{onSubmit:m,className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,c.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`user id`,className:`w-full rounded-md border bg-background px-2 py-1 font-mono text-sm sm:w-28`}),(0,c.jsx)(`input`,{value:i,onChange:e=>o(e.target.value),placeholder:`label (optional)`,className:`w-full rounded-md border bg-background px-2 py-1 text-sm sm:w-40`}),(0,c.jsx)(a,{variant:`ghost`,type:`submit`,disabled:l,children:`add`}),d&&(0,c.jsx)(`span`,{className:`text-xs text-danger`,children:d})]})]})}function d({toChatId:e}){let[t,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(null);async function o(){n(!0),i(null);try{let e=await fetch(`/api/config/telegram/reconnect`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}window.location.reload()}catch(e){i(e.message),n(!1)}}return(0,c.jsxs)(`div`,{className:`rounded-md border-2 border-danger/25 bg-danger/10 px-4 py-3 text-sm`,children:[(0,c.jsx)(`div`,{className:`font-semibold text-danger mb-1`,children:`Supergroup chat id changed`}),(0,c.jsxs)(`p`,{className:`text-danger mb-2`,children:[`Telegram migrated this supergroup to a new chat id (`,(0,c.jsx)(`code`,{className:`font-mono`,children:e}),`). The bot is still pointed at the old id. Reconnect to repoint it and re-create the `,(0,c.jsx)(`code`,{className:`font-mono`,children:`⚙ bazilion`}),` `,`service chat in the new team. Agent topic bindings will reconcile on next use.`]}),(0,c.jsx)(a,{variant:`primary`,onClick:o,disabled:t,children:t?`reconnecting…`:`Reconnect to ${e}`}),r&&(0,c.jsx)(`span`,{className:`ml-3 text-xs text-danger`,children:r})]})}function f({polling:e}){let t=e.startedAt?new Date(e.startedAt).toISOString():null,n=e.lastSuccessfulPollAt?new Date(e.lastSuccessfulPollAt).toISOString():null;return(0,c.jsxs)(`div`,{className:`mt-4 rounded-md border bg-muted/30 px-3 py-2 text-xs space-y-1`,children:[(0,c.jsx)(`p`,{className:`font-semibold uppercase tracking-wide text-muted-foreground`,children:`Polling state`}),(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono`,children:[(0,c.jsx)(`span`,{className:e.running?`text-success`:`text-danger`,children:e.running?`running`:`stopped`}),(0,c.jsx)(`span`,{className:e.activated?`text-success`:`text-warning`,children:e.activated?`activated`:`awaiting activation`}),e.lastUpdateId!==null&&(0,c.jsxs)(`span`,{children:[`last update `,e.lastUpdateId]}),t&&(0,c.jsxs)(`span`,{children:[`started `,t]}),n&&(0,c.jsxs)(`span`,{children:[`last poll `,n]})]}),e.error&&(0,c.jsxs)(`p`,{className:`text-danger`,children:[`error: `,e.error]})]})}function p({health:e}){if(e.error)return(0,c.jsxs)(`div`,{className:`rounded-md border border-danger/25 bg-danger/10 px-3 py-2 text-sm`,children:[(0,c.jsxs)(`p`,{className:`font-semibold text-danger`,children:[`Failed at `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.error.step})]}),(0,c.jsx)(`p`,{className:`text-danger mt-1`,children:e.error.message}),h(e.error.step)]});if(!e.preflight)return(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No preflight data.`});let t=e.preflight;return(0,c.jsxs)(`ul`,{className:`space-y-1.5`,children:[(0,c.jsxs)(m,{ok:t.botUsername.length>0,label:`Bot identity`,children:[`@`,t.botUsername]}),(0,c.jsx)(m,{ok:t.chatTitle.length>0,label:`Supergroup reachable`,children:t.chatTitle}),(0,c.jsx)(m,{ok:t.isForum,label:`Forum topics enabled`,children:t.isForum?`is_forum: true`:`is_forum: false — the supergroup owner must enable Topics in team settings`}),(0,c.jsx)(m,{ok:t.hasManageTopics,label:`Bot has can_manage_topics`,children:t.hasManageTopics?`admin with can_manage_topics`:`promote the bot to admin in the supergroup with the "Manage topics" permission`}),(0,c.jsx)(m,{ok:t.privacyModeOff,label:`Privacy Mode is OFF`,children:t.privacyModeOff?`can_read_all_group_messages: true`:`BotFather → /mybots → select bot → Bot Settings → Team Privacy → Turn off`})]})}function m({ok:e,label:t,children:n}){return(0,c.jsxs)(`li`,{className:`flex items-start gap-2 text-sm`,children:[(0,c.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-bold leading-none ${e?`bg-success/10 text-success`:`bg-danger/10 text-danger`}`,"aria-hidden":!0,children:e?`✓`:`✕`}),(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`span`,{className:`font-medium`,children:t}),(0,c.jsx)(`span`,{className:`ml-2 text-xs ${e?`text-muted-foreground`:`text-danger`}`,children:n})]})]})}function h(e){switch(e){case`getMe`:return(0,c.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The token is invalid or revoked. Re-issue with @BotFather → /token, or paste a fresh one above.`});case`getChat`:return(0,c.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The chat id either doesn't exist, points at a basic team (not a supergroup), or the bot isn't a member. Forward any message from the supergroup to the bot to double-check the id, then add the bot to the team.`});case`getChatMember`:return(0,c.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The bot is in the chat but the membership lookup failed. Usually means the bot was kicked or the chat id was migrated — confirm the bot is still in the supergroup.`})}}export{l as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{o as i}from"./index-3nrK5iFr.js";import{t as a}from"./Button-ByiV6fpd.js";import{t as o}from"./ConfigPage-BCwfgyjD.js";var s=e(n()),c=t();function l(){let e=i.useLoaderData(),t=r(),[n,l]=(0,s.useState)(``),[m,h]=(0,s.useState)(e.chatId),[g,_]=(0,s.useState)(!1),[v,y]=(0,s.useState)(null),[b,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(null),[w,T]=(0,s.useState)(!1);async function E(e){e.preventDefault(),_(!0),y(null),x(!1);try{let e=await fetch(`/api/config/telegram`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({botToken:n,chatId:m})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}l(``),x(!0),await t.invalidate()}catch(e){y(e.message)}finally{_(!1)}}async function D(){if(confirm(`Clear the saved Telegram credentials?`))try{await fetch(`/api/config/telegram`,{method:`DELETE`}),l(``),h(``),C(null),x(!1),y(null),await t.invalidate()}catch(e){y(e.message)}}async function O(){T(!0),C(null);try{C(await(await fetch(`/api/config/telegram/health`)).json())}catch(e){C({configured:!0,preflight:null,error:{step:`getMe`,message:e.message},polling:null})}finally{T(!1)}}return(0,c.jsxs)(o,{active:`integrations`,title:`Telegram`,description:`Connect one forum-supergroup bot with one topic per agent, so conversations stay reachable from your phone.`,size:`narrow`,children:[e.migratedChatId&&(0,c.jsx)(d,{toChatId:e.migratedChatId}),(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,c.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3`,children:`Credentials`}),e.configured&&(0,c.jsxs)(`p`,{className:`text-xs text-success mb-3`,children:[`✓ Stored: `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.botTokenPreview}),` `,e.chatId&&(0,c.jsxs)(c.Fragment,{children:[`· chat `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.chatId})]})]}),(0,c.jsxs)(`form`,{onSubmit:E,className:`space-y-3`,children:[(0,c.jsxs)(`label`,{className:`block`,children:[(0,c.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Bot token`}),(0,c.jsx)(`input`,{type:`password`,autoComplete:`off`,value:n,onChange:e=>l(e.target.value),placeholder:e.configured?`(leave blank to keep stored value)`:`1234567890:ABC...`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!e.configured}),(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`From @BotFather → /newbot. Disable Privacy Mode in `,(0,c.jsx)(`em`,{children:`Bot Settings → Team Privacy → Turn off`}),`.`]})]}),(0,c.jsxs)(`label`,{className:`block`,children:[(0,c.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Supergroup chat ID`}),(0,c.jsx)(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`-1001234567890`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!0}),(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Forum-enabled supergroup the bot is admin in (with`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`can_manage_topics`}),`).`]})]}),(0,c.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pt-1`,children:[(0,c.jsx)(a,{variant:`primary`,type:`submit`,disabled:g,children:g?`saving…`:`save credentials`}),e.configured&&(0,c.jsx)(a,{variant:`danger`,onClick:D,children:`clear credentials`}),b&&(0,c.jsx)(`span`,{className:`text-xs text-success`,children:`saved ✓`}),v&&(0,c.jsxs)(`span`,{className:`text-xs text-danger`,children:[`error: `,v]})]})]})]}),(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,c.jsxs)(`div`,{className:`mb-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,c.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground`,children:`Preflight checks`}),(0,c.jsx)(a,{variant:`ghost`,onClick:O,disabled:w||!e.configured,children:w?`checking…`:`run preflight`})]}),!e.configured&&(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Save credentials above first.`}),e.configured&&!S&&!w&&(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground italic`,children:[`Click `,(0,c.jsx)(`em`,{children:`run preflight`}),` to validate the stored credentials against the Telegram Bot API.`]}),S&&(0,c.jsx)(p,{health:S}),S?.polling&&(0,c.jsx)(f,{polling:S.polling})]}),e.configured&&(0,c.jsx)(u,{})]})}function u(){let[e,t]=(0,s.useState)(null),[n,r]=(0,s.useState)(``),[i,o]=(0,s.useState)(``),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null);async function p(){try{let e=await fetch(`/api/config/telegram/acl`);if(!e.ok)throw Error(e.statusText);t(await e.json())}catch(e){f(e.message)}}(0,s.useEffect)(()=>{p()},[]);async function m(e){e.preventDefault();let t=Number(n);if(!Number.isInteger(t)){f(`user id must be an integer`);return}u(!0),f(null);try{let e=await fetch(`/api/config/telegram/acl`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({userId:t,label:i.trim()||null})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}r(``),o(``),await p()}catch(e){f(e.message)}finally{u(!1)}}async function h(e){f(null);try{let t=await fetch(`/api/config/telegram/acl/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??t.statusText)}await p()}catch(e){f(e.message)}}return(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,c.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-1`,children:`Access control`}),(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:[`Allowlisted Telegram users can use the bot (commands + chat). While the list is empty the bot is open and the first person to message it becomes owner. Users find their id via`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`/whoami`}),`.`]}),e===null?(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`loading…`}):e.length===0?(0,c.jsx)(`p`,{className:`text-xs text-warning mb-3`,children:`Open — no allowlist yet. The first user to message the bot claims owner.`}):(0,c.jsx)(`ul`,{className:`mb-3 space-y-1 text-sm`,children:e.map(e=>(0,c.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,c.jsx)(`code`,{className:`font-mono`,children:e.userId}),(0,c.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.label??(e.username?`@${e.username}`:`—`),` · `,e.role]}),e.role!==`owner`&&(0,c.jsx)(`button`,{type:`button`,onClick:()=>void h(e.userId),className:`ghost-btn text-xs text-rose-baziu`,children:`remove`})]},e.userId))}),(0,c.jsxs)(`form`,{onSubmit:m,className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,c.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`user id`,className:`w-full rounded-md border bg-background px-2 py-1 font-mono text-sm sm:w-28`}),(0,c.jsx)(`input`,{value:i,onChange:e=>o(e.target.value),placeholder:`label (optional)`,className:`w-full rounded-md border bg-background px-2 py-1 text-sm sm:w-40`}),(0,c.jsx)(a,{variant:`ghost`,type:`submit`,disabled:l,children:`add`}),d&&(0,c.jsx)(`span`,{className:`text-xs text-danger`,children:d})]})]})}function d({toChatId:e}){let[t,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(null);async function o(){n(!0),i(null);try{let e=await fetch(`/api/config/telegram/reconnect`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}window.location.reload()}catch(e){i(e.message),n(!1)}}return(0,c.jsxs)(`div`,{className:`rounded-md border-2 border-danger/25 bg-danger/10 px-4 py-3 text-sm`,children:[(0,c.jsx)(`div`,{className:`font-semibold text-danger mb-1`,children:`Supergroup chat id changed`}),(0,c.jsxs)(`p`,{className:`text-danger mb-2`,children:[`Telegram migrated this supergroup to a new chat id (`,(0,c.jsx)(`code`,{className:`font-mono`,children:e}),`). The bot is still pointed at the old id. Reconnect to repoint it and re-create the `,(0,c.jsx)(`code`,{className:`font-mono`,children:`⚙ bazilion`}),` `,`service chat in the new team. Agent topic bindings will reconcile on next use.`]}),(0,c.jsx)(a,{variant:`primary`,onClick:o,disabled:t,children:t?`reconnecting…`:`Reconnect to ${e}`}),r&&(0,c.jsx)(`span`,{className:`ml-3 text-xs text-danger`,children:r})]})}function f({polling:e}){let t=e.startedAt?new Date(e.startedAt).toISOString():null,n=e.lastSuccessfulPollAt?new Date(e.lastSuccessfulPollAt).toISOString():null;return(0,c.jsxs)(`div`,{className:`mt-4 rounded-md border bg-muted/30 px-3 py-2 text-xs space-y-1`,children:[(0,c.jsx)(`p`,{className:`font-semibold uppercase tracking-wide text-muted-foreground`,children:`Polling state`}),(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono`,children:[(0,c.jsx)(`span`,{className:e.running?`text-success`:`text-danger`,children:e.running?`running`:`stopped`}),(0,c.jsx)(`span`,{className:e.activated?`text-success`:`text-warning`,children:e.activated?`activated`:`awaiting activation`}),e.lastUpdateId!==null&&(0,c.jsxs)(`span`,{children:[`last update `,e.lastUpdateId]}),t&&(0,c.jsxs)(`span`,{children:[`started `,t]}),n&&(0,c.jsxs)(`span`,{children:[`last poll `,n]})]}),e.error&&(0,c.jsxs)(`p`,{className:`text-danger`,children:[`error: `,e.error]})]})}function p({health:e}){if(e.error)return(0,c.jsxs)(`div`,{className:`rounded-md border border-danger/25 bg-danger/10 px-3 py-2 text-sm`,children:[(0,c.jsxs)(`p`,{className:`font-semibold text-danger`,children:[`Failed at `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.error.step})]}),(0,c.jsx)(`p`,{className:`text-danger mt-1`,children:e.error.message}),h(e.error.step)]});if(!e.preflight)return(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No preflight data.`});let t=e.preflight;return(0,c.jsxs)(`ul`,{className:`space-y-1.5`,children:[(0,c.jsxs)(m,{ok:t.botUsername.length>0,label:`Bot identity`,children:[`@`,t.botUsername]}),(0,c.jsx)(m,{ok:t.chatTitle.length>0,label:`Supergroup reachable`,children:t.chatTitle}),(0,c.jsx)(m,{ok:t.isForum,label:`Forum topics enabled`,children:t.isForum?`is_forum: true`:`is_forum: false — the supergroup owner must enable Topics in team settings`}),(0,c.jsx)(m,{ok:t.hasManageTopics,label:`Bot has can_manage_topics`,children:t.hasManageTopics?`admin with can_manage_topics`:`promote the bot to admin in the supergroup with the "Manage topics" permission`}),(0,c.jsx)(m,{ok:t.privacyModeOff,label:`Privacy Mode is OFF`,children:t.privacyModeOff?`can_read_all_group_messages: true`:`BotFather → /mybots → select bot → Bot Settings → Team Privacy → Turn off`})]})}function m({ok:e,label:t,children:n}){return(0,c.jsxs)(`li`,{className:`flex items-start gap-2 text-sm`,children:[(0,c.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-bold leading-none ${e?`bg-success/10 text-success`:`bg-danger/10 text-danger`}`,"aria-hidden":!0,children:e?`✓`:`✕`}),(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`span`,{className:`font-medium`,children:t}),(0,c.jsx)(`span`,{className:`ml-2 text-xs ${e?`text-muted-foreground`:`text-danger`}`,children:n})]})]})}function h(e){switch(e){case`getMe`:return(0,c.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The token is invalid or revoked. Re-issue with @BotFather → /token, or paste a fresh one above.`});case`getChat`:return(0,c.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The chat id either doesn't exist, points at a basic team (not a supergroup), or the bot isn't a member. Forward any message from the supergroup to the bot to double-check the id, then add the bot to the team.`});case`getChatMember`:return(0,c.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The bot is in the chat but the membership lookup failed. Usually means the bot was kicked or the chat id was migrated — confirm the bot is still in the supergroup.`})}}export{l as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{v as i}from"./index-nb2MV8X1.js";import{t as a}from"./ConfigPage-BCwfgyjD.js";var o=e(n()),s=t();function c(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}function l(){let{tokens:e}=i.useLoaderData(),{all:t}=i.useSearch(),n=t===`1`,l=r(),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(null),[m,h]=(0,o.useState)(null),[g,_]=(0,o.useState)(!1);async function v(e){e.preventDefault(),h(null),_(!0);try{let e=await fetch(`/api/tokens`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({label:u})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}p((await e.json()).token),d(``),await l.invalidate()}catch(e){h(e.message)}finally{_(!1)}}async function y(e){await fetch(`/api/tokens/${e}`,{method:`DELETE`}),await l.invalidate()}return(0,s.jsxs)(a,{active:`tokens`,title:`API tokens`,description:(0,s.jsxs)(s.Fragment,{children:[`Manage per-client credentials for the HTTP API and CLI. The`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`bootstrap`}),` token from`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/auth.json`}),` remains protected; mint separate credentials for mobile, LAN, and remote clients.`]}),children:[(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Mint a new token`}),(0,s.jsxs)(`form`,{onSubmit:v,className:`mb-3 flex flex-col items-stretch gap-2 sm:flex-row sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Label`,(0,s.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),required:!0,placeholder:`e.g. laptop-tailscale`,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-72`})]}),(0,s.jsx)(`button`,{type:`submit`,disabled:g,className:`rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:g?`creating…`:`create`})]}),f&&(0,s.jsxs)(`div`,{className:`rounded-md border border-warning/25 bg-warning/10 p-3`,children:[(0,s.jsx)(`p`,{className:`text-xs text-warning mb-1`,children:`copy this token now — it is not recoverable later.`}),(0,s.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-all`,children:f})]}),m&&(0,s.jsx)(`p`,{className:`text-sm text-danger`,children:m})]}),(0,s.jsx)(`div`,{children:(0,s.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>{window.location.assign(e.target.checked?`/config/tokens?all=1`:`/config/tokens`)}}),`show revoked`]})}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,s.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{className:`py-2`,children:`label`}),(0,s.jsx)(`th`,{children:`id`}),(0,s.jsx)(`th`,{children:`state`}),(0,s.jsx)(`th`,{children:`created`}),(0,s.jsx)(`th`,{children:`last used`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsxs)(`tbody`,{children:[e.length===0&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:6,className:`py-6 text-center text-muted-foreground italic`,children:`no tokens yet — mint one above`})}),e.map(e=>{let t=e.label===`bootstrap`;return(0,s.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,s.jsxs)(`td`,{className:`py-2`,children:[e.label,t&&(0,s.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth.json`})]}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,s.jsx)(`td`,{children:e.revokedAt?(0,s.jsx)(`span`,{className:`text-muted-foreground`,children:`revoked`}):(0,s.jsx)(`span`,{className:`text-success`,children:`active`})}),(0,s.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:c(e.createdAt)}),(0,s.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.lastUsedAt?c(e.lastUsedAt):`(never)`}),(0,s.jsx)(`td`,{children:!e.revokedAt&&!t&&(0,s.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),className:`rounded-md border px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:`revoke`})})]},e.id)})]})]})})]})}export{l as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{v as i}from"./index-3nrK5iFr.js";import{t as a}from"./ConfigPage-BCwfgyjD.js";var o=e(n()),s=t();function c(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}function l(){let{tokens:e}=i.useLoaderData(),{all:t}=i.useSearch(),n=t===`1`,l=r(),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(null),[m,h]=(0,o.useState)(null),[g,_]=(0,o.useState)(!1);async function v(e){e.preventDefault(),h(null),_(!0);try{let e=await fetch(`/api/tokens`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({label:u})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}p((await e.json()).token),d(``),await l.invalidate()}catch(e){h(e.message)}finally{_(!1)}}async function y(e){await fetch(`/api/tokens/${e}`,{method:`DELETE`}),await l.invalidate()}return(0,s.jsxs)(a,{active:`tokens`,title:`API tokens`,description:(0,s.jsxs)(s.Fragment,{children:[`Manage per-client credentials for the HTTP API and CLI. The`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`bootstrap`}),` token from`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/auth.json`}),` remains protected; mint separate credentials for mobile, LAN, and remote clients.`]}),children:[(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Mint a new token`}),(0,s.jsxs)(`form`,{onSubmit:v,className:`mb-3 flex flex-col items-stretch gap-2 sm:flex-row sm:items-end`,children:[(0,s.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Label`,(0,s.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),required:!0,placeholder:`e.g. laptop-tailscale`,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-72`})]}),(0,s.jsx)(`button`,{type:`submit`,disabled:g,className:`rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:g?`creating…`:`create`})]}),f&&(0,s.jsxs)(`div`,{className:`rounded-md border border-warning/25 bg-warning/10 p-3`,children:[(0,s.jsx)(`p`,{className:`text-xs text-warning mb-1`,children:`copy this token now — it is not recoverable later.`}),(0,s.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-all`,children:f})]}),m&&(0,s.jsx)(`p`,{className:`text-sm text-danger`,children:m})]}),(0,s.jsx)(`div`,{children:(0,s.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>{window.location.assign(e.target.checked?`/config/tokens?all=1`:`/config/tokens`)}}),`show revoked`]})}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,s.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{className:`py-2`,children:`label`}),(0,s.jsx)(`th`,{children:`id`}),(0,s.jsx)(`th`,{children:`state`}),(0,s.jsx)(`th`,{children:`created`}),(0,s.jsx)(`th`,{children:`last used`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsxs)(`tbody`,{children:[e.length===0&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:6,className:`py-6 text-center text-muted-foreground italic`,children:`no tokens yet — mint one above`})}),e.map(e=>{let t=e.label===`bootstrap`;return(0,s.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,s.jsxs)(`td`,{className:`py-2`,children:[e.label,t&&(0,s.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth.json`})]}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,s.jsx)(`td`,{children:e.revokedAt?(0,s.jsx)(`span`,{className:`text-muted-foreground`,children:`revoked`}):(0,s.jsx)(`span`,{className:`text-success`,children:`active`})}),(0,s.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:c(e.createdAt)}),(0,s.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.lastUsedAt?c(e.lastUsedAt):`(never)`}),(0,s.jsx)(`td`,{children:!e.revokedAt&&!t&&(0,s.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),className:`rounded-md border px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:`revoke`})})]},e.id)})]})]})})]})}export{l as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{a as i}from"./index-nb2MV8X1.js";import{r as a}from"./Page-CwNuDhWz.js";import{t as o}from"./AgentTabs-R6gSjIj3.js";var s=e(n()),c=t();function l(){let{resolved:e,triggers:t,dispatches:n}=i.useLoaderData(),s=r();async function l(e){await fetch(`/api/triggers/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})}),await s.invalidate()}async function d(e){confirm(`delete this trigger?`)&&(await fetch(`/api/triggers/${e}`,{method:`DELETE`}),await s.invalidate())}return(0,c.jsxs)(a,{children:[(0,c.jsx)(`header`,{className:`mb-6`,children:(0,c.jsx)(`h1`,{children:e.agent.name})}),(0,c.jsx)(o,{agentId:e.agent.id,active:`triggers`,archived:e.agent.status===`archived`}),(0,c.jsx)(u,{agentId:e.agent.id,onAdded:()=>s.invalidate()}),(0,c.jsx)(`h3`,{className:`mb-3 mt-6 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Active triggers`}),t.length===0?(0,c.jsx)(`p`,{className:`muted`,children:`no triggers yet — add one above.`}):(0,c.jsxs)(`table`,{children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`id`}),(0,c.jsx)(`th`,{children:`kind`}),(0,c.jsx)(`th`,{children:`spec`}),(0,c.jsx)(`th`,{children:`message`}),(0,c.jsx)(`th`,{children:`last fired`}),(0,c.jsx)(`th`,{})]})}),(0,c.jsx)(`tbody`,{children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`(never)`;return(0,c.jsxs)(`tr`,{className:e.enabled?``:`opacity-60`,children:[(0,c.jsx)(`td`,{children:(0,c.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`span`,{className:`inline-block rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-[0.8em] text-mocha`,children:e.kind})}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`code`,{children:t})}),(0,c.jsx)(`td`,{children:e.message.length>60?`${e.message.slice(0,60)}…`:e.message}),(0,c.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:n}),(0,c.jsx)(`td`,{children:(0,c.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,c.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>l(e),children:e.enabled?`disable`:`enable`}),(0,c.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>d(e.id),children:`delete`})]})})]},e.id)})})]}),(0,c.jsx)(`h3`,{className:`mb-3 mt-8 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Recent dispatches`}),n.length===0?(0,c.jsx)(`p`,{className:`muted`,children:`no scheduled occurrences yet.`}):(0,c.jsxs)(`table`,{children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`scheduled`}),(0,c.jsx)(`th`,{children:`status`}),(0,c.jsx)(`th`,{children:`attempts`}),(0,c.jsx)(`th`,{children:`error`})]})}),(0,c.jsx)(`tbody`,{children:n.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`text-[0.82em]`,children:new Date(e.scheduledAt).toLocaleString()}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`code`,{children:e.status})}),(0,c.jsx)(`td`,{children:e.attemptCount}),(0,c.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:e.lastError??`—`})]},e.id))})]})]})}function u({agentId:e,onAdded:t}){let[n,r]=(0,s.useState)(`interval`),[i,a]=(0,s.useState)(300),[o,l]=(0,s.useState)(``),[u,d]=(0,s.useState)(``),[f,p]=(0,s.useState)(null),[m,h]=(0,s.useState)(!1);async function g(r){if(r.preventDefault(),p(null),!u.trim()){p(`message is required`);return}if(n===`interval`&&(!Number.isFinite(i)||i<=0)){p(`interval must be a positive number`);return}if(n===`cron`&&!o.trim()){p(`cron expression is required`);return}h(!0);try{let r={kind:n,message:u.trim()};n===`interval`?r.intervalSec=i:r.cronExpr=o.trim();let s=await fetch(`/api/agents/${encodeURIComponent(e)}/triggers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!s.ok){let e=await s.json().catch(()=>null);throw Error(e?.error??s.statusText)}d(``),l(``),a(300),t()}catch(e){p(e.message)}finally{h(!1)}}return(0,c.jsxs)(`form`,{className:`card`,onSubmit:g,children:[(0,c.jsx)(`h3`,{children:`Add trigger`}),(0,c.jsxs)(`div`,{className:`mb-3 flex gap-3`,children:[(0,c.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,c.jsx)(`input`,{type:`radio`,checked:n===`interval`,onChange:()=>r(`interval`)}),`interval (every N seconds)`]}),(0,c.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,c.jsx)(`input`,{type:`radio`,checked:n===`cron`,onChange:()=>r(`cron`)}),`cron (5-field)`]})]}),n===`interval`?(0,c.jsxs)(`label`,{children:[`interval (seconds)`,(0,c.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Number(e.target.value))})]}):(0,c.jsxs)(`label`,{children:[`cron expression (minute hour dom month dow)`,(0,c.jsx)(`input`,{type:`text`,placeholder:`*/15 * * * *`,value:o,onChange:e=>l(e.target.value)})]}),(0,c.jsxs)(`label`,{children:[`message`,(0,c.jsx)(`textarea`,{placeholder:`e.g. check your inbox and act on anything new`,value:u,onChange:e=>d(e.target.value),className:`font-mono text-[0.9em] min-h-[80px]`})]}),(0,c.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,c.jsx)(`button`,{type:`submit`,disabled:m,children:m?`adding…`:`add`}),f&&(0,c.jsx)(`span`,{className:`text-[0.85em] text-danger`,children:f})]})]})}export{l as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-mNuBjNXU.js";import{a as i}from"./index-3nrK5iFr.js";import{r as a}from"./Page-CwNuDhWz.js";import{t as o}from"./AgentTabs-R6gSjIj3.js";var s=e(n()),c=t();function l(){let{resolved:e,triggers:t,dispatches:n}=i.useLoaderData(),s=r();async function l(e){await fetch(`/api/triggers/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})}),await s.invalidate()}async function d(e){confirm(`delete this trigger?`)&&(await fetch(`/api/triggers/${e}`,{method:`DELETE`}),await s.invalidate())}return(0,c.jsxs)(a,{children:[(0,c.jsx)(`header`,{className:`mb-6`,children:(0,c.jsx)(`h1`,{children:e.agent.name})}),(0,c.jsx)(o,{agentId:e.agent.id,active:`triggers`,archived:e.agent.status===`archived`}),(0,c.jsx)(u,{agentId:e.agent.id,onAdded:()=>s.invalidate()}),(0,c.jsx)(`h3`,{className:`mb-3 mt-6 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Active triggers`}),t.length===0?(0,c.jsx)(`p`,{className:`muted`,children:`no triggers yet — add one above.`}):(0,c.jsxs)(`table`,{children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`id`}),(0,c.jsx)(`th`,{children:`kind`}),(0,c.jsx)(`th`,{children:`spec`}),(0,c.jsx)(`th`,{children:`message`}),(0,c.jsx)(`th`,{children:`last fired`}),(0,c.jsx)(`th`,{})]})}),(0,c.jsx)(`tbody`,{children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`(never)`;return(0,c.jsxs)(`tr`,{className:e.enabled?``:`opacity-60`,children:[(0,c.jsx)(`td`,{children:(0,c.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`span`,{className:`inline-block rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-[0.8em] text-mocha`,children:e.kind})}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`code`,{children:t})}),(0,c.jsx)(`td`,{children:e.message.length>60?`${e.message.slice(0,60)}…`:e.message}),(0,c.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:n}),(0,c.jsx)(`td`,{children:(0,c.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,c.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>l(e),children:e.enabled?`disable`:`enable`}),(0,c.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>d(e.id),children:`delete`})]})})]},e.id)})})]}),(0,c.jsx)(`h3`,{className:`mb-3 mt-8 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Recent dispatches`}),n.length===0?(0,c.jsx)(`p`,{className:`muted`,children:`no scheduled occurrences yet.`}):(0,c.jsxs)(`table`,{children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`scheduled`}),(0,c.jsx)(`th`,{children:`status`}),(0,c.jsx)(`th`,{children:`attempts`}),(0,c.jsx)(`th`,{children:`error`})]})}),(0,c.jsx)(`tbody`,{children:n.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`text-[0.82em]`,children:new Date(e.scheduledAt).toLocaleString()}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`code`,{children:e.status})}),(0,c.jsx)(`td`,{children:e.attemptCount}),(0,c.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:e.lastError??`—`})]},e.id))})]})]})}function u({agentId:e,onAdded:t}){let[n,r]=(0,s.useState)(`interval`),[i,a]=(0,s.useState)(300),[o,l]=(0,s.useState)(``),[u,d]=(0,s.useState)(``),[f,p]=(0,s.useState)(null),[m,h]=(0,s.useState)(!1);async function g(r){if(r.preventDefault(),p(null),!u.trim()){p(`message is required`);return}if(n===`interval`&&(!Number.isFinite(i)||i<=0)){p(`interval must be a positive number`);return}if(n===`cron`&&!o.trim()){p(`cron expression is required`);return}h(!0);try{let r={kind:n,message:u.trim()};n===`interval`?r.intervalSec=i:r.cronExpr=o.trim();let s=await fetch(`/api/agents/${encodeURIComponent(e)}/triggers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!s.ok){let e=await s.json().catch(()=>null);throw Error(e?.error??s.statusText)}d(``),l(``),a(300),t()}catch(e){p(e.message)}finally{h(!1)}}return(0,c.jsxs)(`form`,{className:`card`,onSubmit:g,children:[(0,c.jsx)(`h3`,{children:`Add trigger`}),(0,c.jsxs)(`div`,{className:`mb-3 flex gap-3`,children:[(0,c.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,c.jsx)(`input`,{type:`radio`,checked:n===`interval`,onChange:()=>r(`interval`)}),`interval (every N seconds)`]}),(0,c.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,c.jsx)(`input`,{type:`radio`,checked:n===`cron`,onChange:()=>r(`cron`)}),`cron (5-field)`]})]}),n===`interval`?(0,c.jsxs)(`label`,{children:[`interval (seconds)`,(0,c.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Number(e.target.value))})]}):(0,c.jsxs)(`label`,{children:[`cron expression (minute hour dom month dow)`,(0,c.jsx)(`input`,{type:`text`,placeholder:`*/15 * * * *`,value:o,onChange:e=>l(e.target.value)})]}),(0,c.jsxs)(`label`,{children:[`message`,(0,c.jsx)(`textarea`,{placeholder:`e.g. check your inbox and act on anything new`,value:u,onChange:e=>d(e.target.value),className:`font-mono text-[0.9em] min-h-[80px]`})]}),(0,c.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,c.jsx)(`button`,{type:`submit`,disabled:m,children:m?`adding…`:`add`}),f&&(0,c.jsx)(`span`,{className:`text-[0.85em] text-danger`,children:f})]})]})}export{l as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{A as t}from"./index-nb2MV8X1.js";import{i as n,n as r,r as i}from"./Page-CwNuDhWz.js";var a=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),o=e();function s(){return(0,o.jsxs)(i,{size:`narrow`,children:[(0,o.jsx)(r,{eyebrow:`First run`,title:`Welcome to bazilion`,description:`Connect one model provider, then Bazilion will prepare your default Agent template and Team.`}),(0,o.jsxs)(n,{title:`Three steps to your first conversation`,children:[(0,o.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Before you can spawn agents, enable a provider and save at least one concrete model id. Once you do, a `,(0,o.jsx)(`code`,{children:`default`}),` Agent template (and a `,(0,o.jsx)(`code`,{children:`default`}),` team directory) are created automatically and the rest of the app unlocks.`]}),(0,o.jsxs)(`ol`,{className:`my-5 space-y-4`,children:[(0,o.jsxs)(c,{n:1,children:[(0,o.jsx)(`strong`,{children:`Choose a provider.`}),` Head to the`,` `,(0,o.jsx)(`a`,{href:`/config`,children:`providers tab`}),`, pick a provider, and set credentials or a local endpoint if that provider needs one. Local providers like Ollama and LM Studio can use their default loopback URLs.`]}),(0,o.jsxs)(c,{n:2,children:[(0,o.jsx)(`strong`,{children:`Enable it and save a model.`}),` Flip the provider's toggle on, then click a catalog chip or type one exact model id (for example`,` `,(0,o.jsx)(`code`,{children:`claude-opus-4-8`}),`, `,(0,o.jsx)(`code`,{children:`gpt-5.6-luna`}),`, or `,(0,o.jsx)(`code`,{children:`llama3.3`}),`) and press `,(0,o.jsx)(`em`,{children:`save models`}),`.`]}),(0,o.jsxs)(c,{n:3,children:[(0,o.jsx)(`strong`,{children:`Start chatting.`}),` You'll be redirected to the home page automatically, where the `,(0,o.jsx)(`code`,{children:`default`}),` Agent template is ready for your first spawn.`]})]}),(0,o.jsxs)(`a`,{href:`/config`,className:`btn-primary no-underline`,children:[`Configure providers `,(0,o.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})]})]})]})}function c({n:e,children:t}){return(0,o.jsxs)(`li`,{className:`grid grid-cols-[2rem_1fr] gap-3 border-t border-frost pt-3 first:border-t-0 first:pt-0`,children:[(0,o.jsx)(`span`,{className:`text-center font-display text-xl text-sapphire`,children:e}),(0,o.jsx)(`div`,{className:`text-[0.92em] leading-relaxed text-mocha`,children:t})]})}export{s as component};
1
+ import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{A as t}from"./index-3nrK5iFr.js";import{i as n,n as r,r as i}from"./Page-CwNuDhWz.js";var a=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),o=e();function s(){return(0,o.jsxs)(i,{size:`narrow`,children:[(0,o.jsx)(r,{eyebrow:`First run`,title:`Welcome to bazilion`,description:`Connect one model provider, then Bazilion will prepare your default Agent template and Team.`}),(0,o.jsxs)(n,{title:`Three steps to your first conversation`,children:[(0,o.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Before you can spawn agents, enable a provider and save at least one concrete model id. Once you do, a `,(0,o.jsx)(`code`,{children:`default`}),` Agent template (and a `,(0,o.jsx)(`code`,{children:`default`}),` team directory) are created automatically and the rest of the app unlocks.`]}),(0,o.jsxs)(`ol`,{className:`my-5 space-y-4`,children:[(0,o.jsxs)(c,{n:1,children:[(0,o.jsx)(`strong`,{children:`Choose a provider.`}),` Head to the`,` `,(0,o.jsx)(`a`,{href:`/config`,children:`providers tab`}),`, pick a provider, and set credentials or a local endpoint if that provider needs one. Local providers like Ollama and LM Studio can use their default loopback URLs.`]}),(0,o.jsxs)(c,{n:2,children:[(0,o.jsx)(`strong`,{children:`Enable it and save a model.`}),` Flip the provider's toggle on, then click a catalog chip or type one exact model id (for example`,` `,(0,o.jsx)(`code`,{children:`claude-opus-5`}),`, `,(0,o.jsx)(`code`,{children:`gpt-5.6-sol`}),`, or `,(0,o.jsx)(`code`,{children:`llama3.3`}),`) and press `,(0,o.jsx)(`em`,{children:`save models`}),`.`]}),(0,o.jsxs)(c,{n:3,children:[(0,o.jsx)(`strong`,{children:`Start chatting.`}),` You'll be redirected to the home page automatically, where the `,(0,o.jsx)(`code`,{children:`default`}),` Agent template is ready for your first spawn.`]})]}),(0,o.jsxs)(`a`,{href:`/config`,className:`btn-primary no-underline`,children:[`Configure providers `,(0,o.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})]})]})]})}function c({n:e,children:t}){return(0,o.jsxs)(`li`,{className:`grid grid-cols-[2rem_1fr] gap-3 border-t border-frost pt-3 first:border-t-0 first:pt-0`,children:[(0,o.jsx)(`span`,{className:`text-center font-display text-xl text-sapphire`,children:e}),(0,o.jsx)(`div`,{className:`text-[0.92em] leading-relaxed text-mocha`,children:t})]})}export{s as component};