bazilion 0.26.0 → 0.26.1

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 (61) hide show
  1. package/dist/cli.js +5 -4
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +37 -4
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/{ChatPane-BgW59Bvn.js → ChatPane-DOV_HJg-.js} +1 -1
  6. package/dist/web/client/assets/{ConfigPage-BcjKer-E.js → ConfigPage-Dfu9DzFX.js} +1 -1
  7. package/dist/web/client/assets/{ConfirmDialog-B5BLql5H.js → ConfirmDialog-536ziJ5P.js} +1 -1
  8. package/dist/web/client/assets/{FieldRow-Dr1dDiQ6.js → FieldRow-z1JqCdqn.js} +1 -1
  9. package/dist/web/client/assets/{ResultCard-CDLhGze2.js → ResultCard-X4nTbjYY.js} +1 -1
  10. package/dist/web/client/assets/{SkillFindings-BPmVzjOa.js → SkillFindings-8LX6bYf_.js} +1 -1
  11. package/dist/web/client/assets/{SpawnDialog-CWvaYWBr.js → SpawnDialog-DoZl-yes.js} +1 -1
  12. package/dist/web/client/assets/{SpawnTeamModal-DxU7QH0e.js → SpawnTeamModal-C638hEoN.js} +1 -1
  13. package/dist/web/client/assets/{TeamForm-Bxl3s8yF.js → TeamForm-C-WzvOl4.js} +1 -1
  14. package/dist/web/client/assets/{TeamPolicyEditor-B-ikYl3V.js → TeamPolicyEditor-CSKBx0oK.js} +1 -1
  15. package/dist/web/client/assets/{UnsavedChangesGuard-CmeIPiXp.js → UnsavedChangesGuard-GC-vzw7h.js} +1 -1
  16. package/dist/web/client/assets/{_id-iXED17f-.js → _id-BKLynswT.js} +1 -1
  17. package/dist/web/client/assets/{_id-CNN1ila9.js → _id-BYM_NORr.js} +1 -1
  18. package/dist/web/client/assets/{_id-B-Vo1VkF.js → _id-Cxa98a9m.js} +1 -1
  19. package/dist/web/client/assets/{_id-CrGDqaFa.js → _id-D4hV1U1t.js} +1 -1
  20. package/dist/web/client/assets/{agent-actions-CmkRSxQg.js → agent-actions-CXQCoxKO.js} +1 -1
  21. package/dist/web/client/assets/{agents-KnMSeucP.js → agents-BxPS1_Bp.js} +1 -1
  22. package/dist/web/client/assets/{agents-DwDcKOif.js → agents-GozAWW-l.js} +1 -1
  23. package/dist/web/client/assets/{attention-CLQIHUF6.js → attention-Cz9rZcrr.js} +1 -1
  24. package/dist/web/client/assets/chevron-right-CPAb1zac.js +1 -0
  25. package/dist/web/client/assets/{config-B483VUYj.js → config-9vv9Lipb.js} +2 -2
  26. package/dist/web/client/assets/{inbox-DIXsxGV8.js → inbox-DHLArXxl.js} +1 -1
  27. package/dist/web/client/assets/{index-CKJ3uVR4.js → index-1YXquAq8.js} +2 -2
  28. package/dist/web/client/assets/{learning-DDTz_N6N.js → learning-PvtXm8Ne.js} +1 -1
  29. package/dist/web/client/assets/{login-6S3kA9Yb.js → login-DIJpNQFo.js} +1 -1
  30. package/dist/web/client/assets/{mcp-Dm4DfYI9.js → mcp-pKBL0xIf.js} +1 -1
  31. package/dist/web/client/assets/{members-CD93Kya7.js → members-DHWsgsEs.js} +1 -1
  32. package/dist/web/client/assets/{memory-M28_uFOH.js → memory-CEVppPyU.js} +1 -1
  33. package/dist/web/client/assets/plus-BaIRdB10.js +1 -0
  34. package/dist/web/client/assets/{policy-IKYNTvWX.js → policy-DEh4BLSw.js} +1 -1
  35. package/dist/web/client/assets/{results-CGNpUJ11.js → results-DgJPjEZF.js} +1 -1
  36. package/dist/web/client/assets/{review-BN6V988m.js → review-BbshafTQ.js} +1 -1
  37. package/dist/web/client/assets/{route-DUIeAVZz.js → route-Ccb8v41z.js} +1 -1
  38. package/dist/web/client/assets/{route-V5VM1ufA.js → route-D1d6kCEV.js} +1 -1
  39. package/dist/web/client/assets/{routes-CInZFLoI.js → routes-g7V4ru7T.js} +1 -1
  40. package/dist/web/client/assets/{services-CeB7gfY5.js → services-B2f7e5jV.js} +1 -1
  41. package/dist/web/client/assets/{settings-BWonPTKi.js → settings-B6elpcYm.js} +1 -1
  42. package/dist/web/client/assets/{skills-CgrXwmh8.js → skills-CngE7TF8.js} +1 -1
  43. package/dist/web/client/assets/styles-xUnZ-ep_.css +2 -0
  44. package/dist/web/client/assets/{teams-D-g74z8r.js → teams-BdJZXOan.js} +1 -1
  45. package/dist/web/client/assets/{teams-C98Ww6Xu.js → teams-c496ISsT.js} +1 -1
  46. package/dist/web/client/assets/{telegram-Cc8NJ4Tc.js → telegram-B_-hK6EC.js} +1 -1
  47. package/dist/web/client/assets/{tokens-ZTSxCsD_.js → tokens-CKz8gx4-.js} +1 -1
  48. package/dist/web/client/assets/{triggers-Br8Wk4Yk.js → triggers-DCEPciGW.js} +1 -1
  49. package/dist/web/client/assets/{welcome-C-hJvXWG.js → welcome-D-zVOLGA.js} +1 -1
  50. package/dist/web/client/baziu.svg +176 -7
  51. package/dist/web/server/assets/{_tanstack-start-manifest_v-BUFDfU9j.js → _tanstack-start-manifest_v-B8u80HjK.js} +72 -72
  52. package/dist/web/server/assets/{config-C0lOmAcs.js → config-BNEgu7WG.js} +5 -6
  53. package/dist/web/server/assets/{config-D7Z2wgbk.js → config-C1VB28se.js} +1 -1
  54. package/dist/web/server/assets/{router-vAv1HkV1.js → router-BI9gmY3S.js} +2 -2
  55. package/dist/web/server/server.js +2 -2
  56. package/dist/worker.js +7 -1
  57. package/dist/worker.js.map +1 -1
  58. package/package.json +4 -4
  59. package/dist/web/client/assets/chevron-right-DZFmP-cr.js +0 -1
  60. package/dist/web/client/assets/plus-xCBcVxeD.js +0 -1
  61. package/dist/web/client/assets/styles-d9JiV6N4.css +0 -2
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,f as i}from"./preload-helper-eUUcpe2S.js";import{t as a}from"./UnsavedChangesGuard-CmeIPiXp.js";import{N as o,_t as s,ht as c,j as l,p as u,pt as d}from"./index-CKJ3uVR4.js";import{t as f}from"./SpawnTeamModal-DxU7QH0e.js";var p=e(t(),1),m=n();function h(e,t){return{image:e.trim()||null,cwd:t.trim()||`.`}}function g({teamId:e}){let[t,n]=(0,p.useState)(null),[r,i]=(0,p.useState)(``),[a,c]=(0,p.useState)(`.`),[u,d]=(0,p.useState)(``),[f,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(!1),y=`/api/teams/${encodeURIComponent(e)}/coding-environment`;function b(e){n(e),i(e.image??``),c(e.cwd)}(0,p.useEffect)(()=>{let e=new AbortController;return l(y,{signal:e.signal}).then(b).catch(t=>{e.signal.aborted||d(o(t))}),()=>e.abort()},[y]);async function x(e){e.preventDefault(),v(!0),d(``),g(!1);try{b(await l(y,{method:`PUT`,body:h(r,a)})),g(!0)}catch(e){d(o(e))}finally{v(!1)}}return(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:`Docker sandbox defaults`}),(0,m.jsxs)(`p`,{className:`my-3 text-sm text-muted-foreground`,children:[`Image and working directory for this Team's bash commands when BAZILION_BASH_SANDBOX is docker`,t?` (currently ${t.sandboxMode})`:``,`. The image must already exist locally; Bazilion never pulls it.`]}),u&&(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:u}),t&&(0,m.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>void x(e),children:[(0,m.jsxs)(`label`,{children:[`Local Docker image`,(0,m.jsx)(`input`,{value:r,placeholder:`${t.defaultImage} (installation default)`,onChange:e=>i(e.target.value)})]}),(0,m.jsxs)(`label`,{children:[`Working directory inside the Team`,(0,m.jsx)(`input`,{required:!0,value:a,onChange:e=>c(e.target.value)})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsx)(s,{type:`submit`,variant:`primary`,disabled:_,children:_?`Saving…`:`Save defaults`}),f&&(0,m.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`})]})]})]})}var _=r(`/teams/$id`);function v(){let e=_.useLoaderData(),{members:t,templates:n}=u.useLoaderData(),r=i(),[o,s]=(0,p.useState)(!1),[l,f]=(0,p.useState)(!1);return(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsx)(a,{when:o||l,subject:`Team context`}),(0,m.jsx)(y,{team:e,onDirtyChange:s,onSaved:()=>r.invalidate()}),(0,m.jsx)(d,{children:(0,m.jsx)(g,{teamId:e.id})}),(0,m.jsx)(b,{team:e,sampleAgent:t[0]?.name??`researcher`,onSaved:()=>r.invalidate(),onDirtyChange:f}),t.length===0&&(0,m.jsx)(x,{team:e,templates:n,onSpawned:()=>r.invalidate()}),(0,m.jsx)(d,{title:`Members`,actions:(0,m.jsxs)(c,{variant:t.length>0?`success`:`neutral`,children:[t.length,` member`,t.length===1?``:`s`]}),children:(0,m.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.id)}/members`,className:`ghost-btn`,children:`Show Team members`})})]})}function y({team:e,onDirtyChange:t,onSaved:n}){let[r,i]=(0,p.useState)(e.userMd),[a,c]=(0,p.useState)(!1),[u,f]=(0,p.useState)(null),[h,g]=(0,p.useState)(!1),_=r!==e.userMd;(0,p.useEffect)(()=>t(_),[_,t]);async function v(){c(!0),f(null);try{await l(`/api/teams/${encodeURIComponent(e.id)}/user-md`,{method:`PUT`,body:{userMd:r}}),g(!0),await n()}catch(e){f(o(e))}finally{c(!1)}}return(0,m.jsxs)(d,{title:`USER.md`,description:`Context about you, added to every member's system prompt (12 KB at most). Only you can edit it; Agents cannot.`,children:[(0,m.jsx)(`textarea`,{"aria-label":`USER.md Team context`,value:r,onChange:e=>i(e.target.value),rows:16,className:`font-mono text-sm`,placeholder:`What the agents should know about you in this Team…`}),(0,m.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,m.jsx)(s,{variant:`primary`,onClick:()=>void v(),disabled:a||!_,children:a?`Saving…`:`Save`}),(0,m.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[r.length,` / 12000 chars`]}),h&&!_&&(0,m.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`}),u&&(0,m.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:u})]})]})}function b({team:e,sampleAgent:t,onSaved:n,onDirtyChange:r}){let[i,a]=(0,p.useState)(e.telegramTopicNameFormat??``),[c,u]=(0,p.useState)(!1),[f,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(!1),v=i.trim(),y=(e.telegramTopicNameFormat??``)!==i,b=v?v.replaceAll(`{agent.name}`,t).replaceAll(`{team.name}`,e.name).replaceAll(`{team.slug}`,e.id):e.id==="default"?t:`${e.id} › ${t}`;(0,p.useEffect)(()=>(r(y),()=>r(!1)),[y,r]);async function x(t){u(!0),h(null);try{await l(`/api/teams/${encodeURIComponent(e.id)}/topic-format`,{method:`PUT`,body:{format:t?null:i}}),t&&a(``),_(!0),n()}catch(e){h(o(e))}finally{u(!1)}}return(0,m.jsxs)(d,{title:`Telegram topic names`,description:(0,m.jsxs)(m.Fragment,{children:[`The title of each member's Telegram forum topic; leave empty for the built-in naming. Tokens: `,(0,m.jsx)(`code`,{children:`{agent.name}`}),` (required), `,(0,m.jsx)(`code`,{children:`{team.name}`}),`,`,` `,(0,m.jsx)(`code`,{children:`{team.slug}`}),`. Saving renames the existing topics you have not renamed in Telegram.`]}),children:[(0,m.jsx)(`input`,{"aria-label":`Telegram topic name format`,value:i,onChange:e=>a(e.target.value),placeholder:`{team.name} / {agent.name}`,className:`font-mono text-sm`}),(0,m.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`preview: `,(0,m.jsx)(`span`,{className:`font-mono text-foreground`,children:b})]}),(0,m.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,m.jsx)(s,{variant:`primary`,onClick:()=>void x(!1),disabled:c||!y||v.length===0,children:c?`Saving…`:`Save`}),e.telegramTopicNameFormat&&(0,m.jsx)(s,{variant:`ghost`,onClick:()=>void x(!0),disabled:c,children:`Clear`}),g&&!y&&(0,m.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`}),f&&(0,m.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:f})]})]})}function x({team:e,templates:t,onSpawned:n}){let r=t.filter(e=>e.slots.length>0),[i,a]=(0,p.useState)(r[0]?.id??``),[o,c]=(0,p.useState)(!1),l=r.find(e=>e.id===i);return(0,m.jsxs)(d,{title:`Spawn from a Team template`,description:`This Team has no members. A Team template spawns its Agents and allow edges here.`,children:[r.length===0?(0,m.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No Team template has members yet. Build one under`,` `,(0,m.jsx)(`a`,{href:`/templates/teams`,children:`Team templates`}),` first.`]}):(0,m.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,m.jsxs)(`label`,{className:`m-0 min-w-0 flex-1`,children:[`Team template`,(0,m.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:r.map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.slots.length,` slot`,e.slots.length===1?``:`s`,`)`]},e.id))})]}),(0,m.jsx)(s,{variant:`primary`,onClick:()=>c(!0),disabled:!l,children:`Spawn team…`})]}),o&&l&&(0,m.jsx)(f,{template:l,teams:[e],initialTeamId:e.id,onClose:()=>c(!1),onSpawned:()=>{c(!1),n()}})]})}export{v as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,f as i}from"./preload-helper-eUUcpe2S.js";import{t as a}from"./UnsavedChangesGuard-GC-vzw7h.js";import{N as o,_t as s,ht as c,j as l,p as u,pt as d}from"./index-1YXquAq8.js";import{t as f}from"./SpawnTeamModal-C638hEoN.js";var p=e(t(),1),m=n();function h(e,t){return{image:e.trim()||null,cwd:t.trim()||`.`}}function g({teamId:e}){let[t,n]=(0,p.useState)(null),[r,i]=(0,p.useState)(``),[a,c]=(0,p.useState)(`.`),[u,d]=(0,p.useState)(``),[f,g]=(0,p.useState)(!1),[_,v]=(0,p.useState)(!1),y=`/api/teams/${encodeURIComponent(e)}/coding-environment`;function b(e){n(e),i(e.image??``),c(e.cwd)}(0,p.useEffect)(()=>{let e=new AbortController;return l(y,{signal:e.signal}).then(b).catch(t=>{e.signal.aborted||d(o(t))}),()=>e.abort()},[y]);async function x(e){e.preventDefault(),v(!0),d(``),g(!1);try{b(await l(y,{method:`PUT`,body:h(r,a)})),g(!0)}catch(e){d(o(e))}finally{v(!1)}}return(0,m.jsxs)(`details`,{children:[(0,m.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:`Docker sandbox defaults`}),(0,m.jsxs)(`p`,{className:`my-3 text-sm text-muted-foreground`,children:[`Image and working directory for this Team's bash commands when BAZILION_BASH_SANDBOX is docker`,t?` (currently ${t.sandboxMode})`:``,`. The image must already exist locally; Bazilion never pulls it.`]}),u&&(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:u}),t&&(0,m.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>void x(e),children:[(0,m.jsxs)(`label`,{children:[`Local Docker image`,(0,m.jsx)(`input`,{value:r,placeholder:`${t.defaultImage} (installation default)`,onChange:e=>i(e.target.value)})]}),(0,m.jsxs)(`label`,{children:[`Working directory inside the Team`,(0,m.jsx)(`input`,{required:!0,value:a,onChange:e=>c(e.target.value)})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsx)(s,{type:`submit`,variant:`primary`,disabled:_,children:_?`Saving…`:`Save defaults`}),f&&(0,m.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`})]})]})]})}var _=r(`/teams/$id`);function v(){let e=_.useLoaderData(),{members:t,templates:n}=u.useLoaderData(),r=i(),[o,s]=(0,p.useState)(!1),[l,f]=(0,p.useState)(!1);return(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsx)(a,{when:o||l,subject:`Team context`}),(0,m.jsx)(y,{team:e,onDirtyChange:s,onSaved:()=>r.invalidate()}),(0,m.jsx)(d,{children:(0,m.jsx)(g,{teamId:e.id})}),(0,m.jsx)(b,{team:e,sampleAgent:t[0]?.name??`researcher`,onSaved:()=>r.invalidate(),onDirtyChange:f}),t.length===0&&(0,m.jsx)(x,{team:e,templates:n,onSpawned:()=>r.invalidate()}),(0,m.jsx)(d,{title:`Members`,actions:(0,m.jsxs)(c,{variant:t.length>0?`success`:`neutral`,children:[t.length,` member`,t.length===1?``:`s`]}),children:(0,m.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.id)}/members`,className:`ghost-btn`,children:`Show Team members`})})]})}function y({team:e,onDirtyChange:t,onSaved:n}){let[r,i]=(0,p.useState)(e.userMd),[a,c]=(0,p.useState)(!1),[u,f]=(0,p.useState)(null),[h,g]=(0,p.useState)(!1),_=r!==e.userMd;(0,p.useEffect)(()=>t(_),[_,t]);async function v(){c(!0),f(null);try{await l(`/api/teams/${encodeURIComponent(e.id)}/user-md`,{method:`PUT`,body:{userMd:r}}),g(!0),await n()}catch(e){f(o(e))}finally{c(!1)}}return(0,m.jsxs)(d,{title:`USER.md`,description:`Context about you, added to every member's system prompt (12 KB at most). Only you can edit it; Agents cannot.`,children:[(0,m.jsx)(`textarea`,{"aria-label":`USER.md Team context`,value:r,onChange:e=>i(e.target.value),rows:16,className:`font-mono text-sm`,placeholder:`What the agents should know about you in this Team…`}),(0,m.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,m.jsx)(s,{variant:`primary`,onClick:()=>void v(),disabled:a||!_,children:a?`Saving…`:`Save`}),(0,m.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[r.length,` / 12000 chars`]}),h&&!_&&(0,m.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`}),u&&(0,m.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:u})]})]})}function b({team:e,sampleAgent:t,onSaved:n,onDirtyChange:r}){let[i,a]=(0,p.useState)(e.telegramTopicNameFormat??``),[c,u]=(0,p.useState)(!1),[f,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(!1),v=i.trim(),y=(e.telegramTopicNameFormat??``)!==i,b=v?v.replaceAll(`{agent.name}`,t).replaceAll(`{team.name}`,e.name).replaceAll(`{team.slug}`,e.id):e.id==="default"?t:`${e.id} › ${t}`;(0,p.useEffect)(()=>(r(y),()=>r(!1)),[y,r]);async function x(t){u(!0),h(null);try{await l(`/api/teams/${encodeURIComponent(e.id)}/topic-format`,{method:`PUT`,body:{format:t?null:i}}),t&&a(``),_(!0),n()}catch(e){h(o(e))}finally{u(!1)}}return(0,m.jsxs)(d,{title:`Telegram topic names`,description:(0,m.jsxs)(m.Fragment,{children:[`The title of each member's Telegram forum topic; leave empty for the built-in naming. Tokens: `,(0,m.jsx)(`code`,{children:`{agent.name}`}),` (required), `,(0,m.jsx)(`code`,{children:`{team.name}`}),`,`,` `,(0,m.jsx)(`code`,{children:`{team.slug}`}),`. Saving renames the existing topics you have not renamed in Telegram.`]}),children:[(0,m.jsx)(`input`,{"aria-label":`Telegram topic name format`,value:i,onChange:e=>a(e.target.value),placeholder:`{team.name} / {agent.name}`,className:`font-mono text-sm`}),(0,m.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`preview: `,(0,m.jsx)(`span`,{className:`font-mono text-foreground`,children:b})]}),(0,m.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,m.jsx)(s,{variant:`primary`,onClick:()=>void x(!1),disabled:c||!y||v.length===0,children:c?`Saving…`:`Save`}),e.telegramTopicNameFormat&&(0,m.jsx)(s,{variant:`ghost`,onClick:()=>void x(!0),disabled:c,children:`Clear`}),g&&!y&&(0,m.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`}),f&&(0,m.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:f})]})]})}function x({team:e,templates:t,onSpawned:n}){let r=t.filter(e=>e.slots.length>0),[i,a]=(0,p.useState)(r[0]?.id??``),[o,c]=(0,p.useState)(!1),l=r.find(e=>e.id===i);return(0,m.jsxs)(d,{title:`Spawn from a Team template`,description:`This Team has no members. A Team template spawns its Agents and allow edges here.`,children:[r.length===0?(0,m.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No Team template has members yet. Build one under`,` `,(0,m.jsx)(`a`,{href:`/templates/teams`,children:`Team templates`}),` first.`]}):(0,m.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,m.jsxs)(`label`,{className:`m-0 min-w-0 flex-1`,children:[`Team template`,(0,m.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:r.map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.slots.length,` slot`,e.slots.length===1?``:`s`,`)`]},e.id))})]}),(0,m.jsx)(s,{variant:`primary`,onClick:()=>c(!0),disabled:!l,children:`Spawn team…`})]}),o&&l&&(0,m.jsx)(f,{template:l,teams:[e],initialTeamId:e.id,onClose:()=>c(!1),onSpawned:()=>{c(!1),n()}})]})}export{v as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{a as t}from"./preload-helper-eUUcpe2S.js";import{s as n}from"./index-CKJ3uVR4.js";import{t as r}from"./ChatPane-BgW59Bvn.js";var i=e(),a=t(`/agents/$id`);function o(){let{agent:e}=a.useLoaderData(),{messages:t,head:o}=n.useLoaderData(),{conversation:s}=n.useSearch();return(0,i.jsx)(`div`,{className:`h-[70vh]`,children:(0,i.jsx)(r,{agentId:e.id,agentName:e.name,initialMessages:t,initialSessionHead:o,openConversationId:s})})}export{o as component};
1
+ import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{a as t}from"./preload-helper-eUUcpe2S.js";import{s as n}from"./index-1YXquAq8.js";import{t as r}from"./ChatPane-DOV_HJg-.js";var i=e(),a=t(`/agents/$id`);function o(){let{agent:e}=a.useLoaderData(),{messages:t,head:o}=n.useLoaderData(),{conversation:s}=n.useSearch();return(0,i.jsx)(`div`,{className:`h-[70vh]`,children:(0,i.jsx)(r,{agentId:e.id,agentName:e.name,initialMessages:t,initialSessionHead:o,openConversationId:s})})}export{o as component};
@@ -1 +1 @@
1
- import{j as e}from"./index-CKJ3uVR4.js";var t=e=>`/api/agents/${encodeURIComponent(e)}`;function n(n){return e(`${t(n)}/archive`,{method:`POST`})}function r(n){return e(`${t(n)}/unarchive`,{method:`POST`})}function i(n){return e(t(n),{method:`DELETE`})}function a(n,r){return e(t(n),{method:`PATCH`,body:{name:r}})}export{r as i,i as n,a as r,n as t};
1
+ import{j as e}from"./index-1YXquAq8.js";var t=e=>`/api/agents/${encodeURIComponent(e)}`;function n(n){return e(`${t(n)}/archive`,{method:`POST`})}function r(n){return e(`${t(n)}/unarchive`,{method:`POST`})}function i(n){return e(t(n),{method:`DELETE`})}function a(n,r){return e(t(n),{method:`PATCH`,body:{name:r}})}export{r as i,i as n,a as r,n as t};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{f as r}from"./preload-helper-eUUcpe2S.js";import{t as i}from"./UnsavedChangesGuard-CmeIPiXp.js";import{t as a}from"./ConfirmDialog-B5BLql5H.js";import{N as o,_t as s,dt as c,ft as l,h as u,ht as d,j as f,lt as p,pt as m,ut as h}from"./index-CKJ3uVR4.js";import{a as g,r as _}from"./SectionTabs-DXHzXmmb.js";import{n as v}from"./ModelSelect-CvOHjUyB.js";import{t as y}from"./Tabs-D0LgBNIk.js";import{t as b}from"./SkillsPicker-Cr87y_W-.js";var x=e(t()),S=n();function C(){let{profiles:e,modelGroups:t,skills:n,templates:i}=u.useLoaderData(),o=r(),[v,y]=(0,x.useState)(null);return(0,S.jsxs)(l,{size:`wide`,children:[(0,S.jsx)(c,{eyebrow:`Templates`,title:`Agent templates`,description:`Reusable identity, model and skills for newly spawned agents.`}),(0,S.jsx)(_,{label:`Template kinds`,base:`/templates`,tabs:g}),(0,S.jsx)(T,{modelGroups:t,skills:n,templates:i,onCreated:()=>o.invalidate()}),(0,S.jsx)(m,{title:`Templates`,children:e.length===0?(0,S.jsx)(`p`,{className:`muted`,children:`No Agent templates yet.`}):(0,S.jsx)(p,{children:e.map(e=>(0,S.jsx)(h,{title:(0,S.jsx)(`a`,{href:`/templates/agents/${encodeURIComponent(e.id)}`,children:e.name}),meta:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{children:e.id}),(0,S.jsx)(`code`,{children:e.defaultModel}),(0,S.jsxs)(`span`,{children:[e.agentCount,` agent`,e.agentCount===1?``:`s`]}),(0,S.jsxs)(`span`,{children:[`skills:`,` `,e.skillsMode===`all`?`all`:e.defaultSkills.join(`, `)||`none`]})]}),actions:e.agentCount===0?(0,S.jsx)(s,{variant:`danger`,onClick:()=>y(e),children:`Delete`}):(0,S.jsx)(d,{title:`${e.agentCount} agent(s) use this template`,children:`In use`})},e.id))})}),(0,S.jsx)(a,{open:v!==null,title:`Delete Agent template ${v?.name??``}?`,description:(0,S.jsxs)(`p`,{children:[`This permanently deletes `,(0,S.jsx)(`code`,{className:`font-mono`,children:v?.id}),` and its files. Existing Agents keep their own copies.`]}),confirmLabel:`Delete Agent template`,onConfirm:async()=>{v&&(await f(`/api/profiles/${encodeURIComponent(v.id)}`,{method:`DELETE`}),await o.invalidate())},onOpenChange:e=>{e||y(null)}})]})}var w=[{key:`soul`,label:`SOUL.md`,hint:`Persona, values and operating principles. Part of every session.`,rows:16,optional:!1},{key:`identity`,label:`IDENTITY.md`,hint:`Name, creature, vibe, emoji, avatar: filled in during the first-run ritual.`,rows:12,optional:!1},{key:`bootstrap`,label:`BOOTSTRAP.md`,hint:`The first-run ritual; the agent retires it once introductions are done.`,rows:16,optional:!0},{key:`agents`,label:`AGENTS.md`,hint:`The workspace operating manual: memory discipline, red lines, channel etiquette.`,rows:16,optional:!0},{key:`tools`,label:`TOOLS.md`,hint:`Agent-specific tool notes and environment facts beyond the tool descriptions.`,rows:14,optional:!0}];function T({modelGroups:e,skills:t,templates:n,onCreated:r}){let a=()=>({soul:n.soul,identity:n.identity,bootstrap:n.bootstrap,agents:n.agents,tools:n.tools}),[c,l]=(0,x.useState)(`basics`),[u,d]=(0,x.useState)(``),[p,h]=(0,x.useState)(``),[g,_]=(0,x.useState)(``),[C,T]=(0,x.useState)(a),[E,D]=(0,x.useState)({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),[O,k]=(0,x.useState)(`all`),[A,j]=(0,x.useState)(new Set),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1),I=a(),L=u.length>0||p.length>0||g.length>0||w.some(e=>C[e.key]!==I[e.key]||!E[e.key])||O!==`all`||A.size>0;function R(e,t){D(n=>({...n,[e]:t})),!t&&c===e&&l(`basics`)}async function z(e){e.preventDefault(),N(null),F(!0);try{await f(`/api/profiles`,{body:{id:u.trim(),name:p.trim()||void 0,defaultModel:g,skillsMode:O,defaultSkills:O===`selected`?Array.from(A):[],soul:C.soul,identity:C.identity,bootstrap:E.bootstrap?C.bootstrap:null,agents:E.agents?C.agents:null,tools:E.tools?C.tools:null}}),d(``),h(``),_(``),T(a()),D({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),j(new Set),k(`all`),l(`basics`),await r()}catch(e){N(o(e))}finally{F(!1)}}let B=w.find(e=>e.key===c);return(0,S.jsx)(m,{title:`Create an Agent template`,children:(0,S.jsxs)(`form`,{onSubmit:e=>void z(e),children:[(0,S.jsx)(i,{when:L&&!P,subject:`Agent template draft`}),M&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:M}),(0,S.jsx)(y,{items:[{id:`basics`,label:`Basics`},...w.map(e=>({id:e.key,label:e.label.replace(`.md`,``),disabled:!E[e.key]})),{id:`skills`,label:`Skills`}],active:c,onChange:l}),(0,S.jsxs)(`fieldset`,{className:`mb-5 rounded-md border border-frost p-3`,children:[(0,S.jsx)(`legend`,{className:`px-1 text-[0.85em] font-medium text-mocha`,children:`Files to include`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2 text-[0.9em]`,children:w.map(e=>(0,S.jsxs)(`label`,{className:`m-0 inline-flex items-center gap-1.5 ${e.optional?`cursor-pointer`:`opacity-60`}`,title:e.optional?void 0:`always included`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:E[e.key],disabled:!e.optional,onChange:t=>R(e.key,t.target.checked)}),e.label]},e.key))}),(0,S.jsx)(`p`,{className:`muted mt-2 text-[0.8em]`,children:`Each spawned agent gets its own copy of the included files.`})]}),c===`basics`&&(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`label`,{children:[`ID (slug)`,(0,S.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),required:!0})]}),(0,S.jsxs)(`label`,{children:[`Name`,(0,S.jsx)(`input`,{value:p,onChange:e=>h(e.target.value)})]})]}),(0,S.jsx)(v,{label:`Default model`,value:g,onChange:_,groups:e,required:!0}),e.length===0&&(0,S.jsxs)(`p`,{className:`muted text-[0.85em]`,children:[`Enable a provider and curate its models under `,(0,S.jsx)(`a`,{href:`/config`,children:`Setup`}),` first.`]})]}),B&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:B.hint}),(0,S.jsxs)(`label`,{children:[B.label,(0,S.jsx)(`textarea`,{rows:B.rows,value:C[B.key],onChange:e=>T(t=>({...t,[B.key]:e.target.value})),className:`font-mono text-[0.88em] leading-[1.55]`})]})]}),c===`skills`&&(0,S.jsx)(b,{mode:O,onModeChange:k,picked:A,onPickedChange:j,skills:t}),(0,S.jsx)(`div`,{className:`mt-5`,children:(0,S.jsx)(s,{variant:`primary`,type:`submit`,disabled:P||!u.trim()||!g,children:P?`Creating…`:`Create`})})]})})}export{C as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{f as r}from"./preload-helper-eUUcpe2S.js";import{t as i}from"./UnsavedChangesGuard-GC-vzw7h.js";import{t as a}from"./ConfirmDialog-536ziJ5P.js";import{N as o,_t as s,dt as c,ft as l,h as u,ht as d,j as f,lt as p,pt as m,ut as h}from"./index-1YXquAq8.js";import{a as g,r as _}from"./SectionTabs-DXHzXmmb.js";import{n as v}from"./ModelSelect-CvOHjUyB.js";import{t as y}from"./Tabs-D0LgBNIk.js";import{t as b}from"./SkillsPicker-Cr87y_W-.js";var x=e(t()),S=n();function C(){let{profiles:e,modelGroups:t,skills:n,templates:i}=u.useLoaderData(),o=r(),[v,y]=(0,x.useState)(null);return(0,S.jsxs)(l,{size:`wide`,children:[(0,S.jsx)(c,{eyebrow:`Templates`,title:`Agent templates`,description:`Reusable identity, model and skills for newly spawned agents.`}),(0,S.jsx)(_,{label:`Template kinds`,base:`/templates`,tabs:g}),(0,S.jsx)(T,{modelGroups:t,skills:n,templates:i,onCreated:()=>o.invalidate()}),(0,S.jsx)(m,{title:`Templates`,children:e.length===0?(0,S.jsx)(`p`,{className:`muted`,children:`No Agent templates yet.`}):(0,S.jsx)(p,{children:e.map(e=>(0,S.jsx)(h,{title:(0,S.jsx)(`a`,{href:`/templates/agents/${encodeURIComponent(e.id)}`,children:e.name}),meta:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`code`,{children:e.id}),(0,S.jsx)(`code`,{children:e.defaultModel}),(0,S.jsxs)(`span`,{children:[e.agentCount,` agent`,e.agentCount===1?``:`s`]}),(0,S.jsxs)(`span`,{children:[`skills:`,` `,e.skillsMode===`all`?`all`:e.defaultSkills.join(`, `)||`none`]})]}),actions:e.agentCount===0?(0,S.jsx)(s,{variant:`danger`,onClick:()=>y(e),children:`Delete`}):(0,S.jsx)(d,{title:`${e.agentCount} agent(s) use this template`,children:`In use`})},e.id))})}),(0,S.jsx)(a,{open:v!==null,title:`Delete Agent template ${v?.name??``}?`,description:(0,S.jsxs)(`p`,{children:[`This permanently deletes `,(0,S.jsx)(`code`,{className:`font-mono`,children:v?.id}),` and its files. Existing Agents keep their own copies.`]}),confirmLabel:`Delete Agent template`,onConfirm:async()=>{v&&(await f(`/api/profiles/${encodeURIComponent(v.id)}`,{method:`DELETE`}),await o.invalidate())},onOpenChange:e=>{e||y(null)}})]})}var w=[{key:`soul`,label:`SOUL.md`,hint:`Persona, values and operating principles. Part of every session.`,rows:16,optional:!1},{key:`identity`,label:`IDENTITY.md`,hint:`Name, creature, vibe, emoji, avatar: filled in during the first-run ritual.`,rows:12,optional:!1},{key:`bootstrap`,label:`BOOTSTRAP.md`,hint:`The first-run ritual; the agent retires it once introductions are done.`,rows:16,optional:!0},{key:`agents`,label:`AGENTS.md`,hint:`The workspace operating manual: memory discipline, red lines, channel etiquette.`,rows:16,optional:!0},{key:`tools`,label:`TOOLS.md`,hint:`Agent-specific tool notes and environment facts beyond the tool descriptions.`,rows:14,optional:!0}];function T({modelGroups:e,skills:t,templates:n,onCreated:r}){let a=()=>({soul:n.soul,identity:n.identity,bootstrap:n.bootstrap,agents:n.agents,tools:n.tools}),[c,l]=(0,x.useState)(`basics`),[u,d]=(0,x.useState)(``),[p,h]=(0,x.useState)(``),[g,_]=(0,x.useState)(``),[C,T]=(0,x.useState)(a),[E,D]=(0,x.useState)({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),[O,k]=(0,x.useState)(`all`),[A,j]=(0,x.useState)(new Set),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(!1),I=a(),L=u.length>0||p.length>0||g.length>0||w.some(e=>C[e.key]!==I[e.key]||!E[e.key])||O!==`all`||A.size>0;function R(e,t){D(n=>({...n,[e]:t})),!t&&c===e&&l(`basics`)}async function z(e){e.preventDefault(),N(null),F(!0);try{await f(`/api/profiles`,{body:{id:u.trim(),name:p.trim()||void 0,defaultModel:g,skillsMode:O,defaultSkills:O===`selected`?Array.from(A):[],soul:C.soul,identity:C.identity,bootstrap:E.bootstrap?C.bootstrap:null,agents:E.agents?C.agents:null,tools:E.tools?C.tools:null}}),d(``),h(``),_(``),T(a()),D({soul:!0,identity:!0,bootstrap:!0,agents:!0,tools:!0}),j(new Set),k(`all`),l(`basics`),await r()}catch(e){N(o(e))}finally{F(!1)}}let B=w.find(e=>e.key===c);return(0,S.jsx)(m,{title:`Create an Agent template`,children:(0,S.jsxs)(`form`,{onSubmit:e=>void z(e),children:[(0,S.jsx)(i,{when:L&&!P,subject:`Agent template draft`}),M&&(0,S.jsx)(`p`,{role:`alert`,className:`err`,children:M}),(0,S.jsx)(y,{items:[{id:`basics`,label:`Basics`},...w.map(e=>({id:e.key,label:e.label.replace(`.md`,``),disabled:!E[e.key]})),{id:`skills`,label:`Skills`}],active:c,onChange:l}),(0,S.jsxs)(`fieldset`,{className:`mb-5 rounded-md border border-frost p-3`,children:[(0,S.jsx)(`legend`,{className:`px-1 text-[0.85em] font-medium text-mocha`,children:`Files to include`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2 text-[0.9em]`,children:w.map(e=>(0,S.jsxs)(`label`,{className:`m-0 inline-flex items-center gap-1.5 ${e.optional?`cursor-pointer`:`opacity-60`}`,title:e.optional?void 0:`always included`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:E[e.key],disabled:!e.optional,onChange:t=>R(e.key,t.target.checked)}),e.label]},e.key))}),(0,S.jsx)(`p`,{className:`muted mt-2 text-[0.8em]`,children:`Each spawned agent gets its own copy of the included files.`})]}),c===`basics`&&(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,S.jsxs)(`label`,{children:[`ID (slug)`,(0,S.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),required:!0})]}),(0,S.jsxs)(`label`,{children:[`Name`,(0,S.jsx)(`input`,{value:p,onChange:e=>h(e.target.value)})]})]}),(0,S.jsx)(v,{label:`Default model`,value:g,onChange:_,groups:e,required:!0}),e.length===0&&(0,S.jsxs)(`p`,{className:`muted text-[0.85em]`,children:[`Enable a provider and curate its models under `,(0,S.jsx)(`a`,{href:`/config`,children:`Setup`}),` first.`]})]}),B&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:B.hint}),(0,S.jsxs)(`label`,{children:[B.label,(0,S.jsx)(`textarea`,{rows:B.rows,value:C[B.key],onChange:e=>T(t=>({...t,[B.key]:e.target.value})),className:`font-mono text-[0.88em] leading-[1.55]`})]})]}),c===`skills`&&(0,S.jsx)(b,{mode:O,onModeChange:k,picked:A,onPickedChange:j,skills:t}),(0,S.jsx)(`div`,{className:`mt-5`,children:(0,S.jsx)(s,{variant:`primary`,type:`submit`,disabled:P||!u.trim()||!g,children:P?`Creating…`:`Create`})})]})})}export{C as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{f as r}from"./preload-helper-eUUcpe2S.js";import{t as i}from"./ConfirmDialog-B5BLql5H.js";import{N as a,S as o,_t as s,ct as c,dt as l,ft as u,ht as d,lt as f,pt as p,ut as m}from"./index-CKJ3uVR4.js";import{t as h}from"./AgentAvatar-DWx-bM6n.js";import{i as g,n as _,t as v}from"./agent-actions-CmkRSxQg.js";import{t as y}from"./SpawnDialog-CWvaYWBr.js";var b=e(t()),x=n();function S(){let{agents:e,profiles:t,teams:n}=o.useLoaderData(),S=o.useSearch().all===1,C=r(),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(null);async function A(e){k(null);try{await g(e.id),await C.invalidate()}catch(e){k(a(e))}}return(0,x.jsxs)(u,{size:`wide`,children:[(0,x.jsx)(l,{eyebrow:`Workspace`,title:`Agents`,description:`Spawn, inspect, archive and restore the agents that work across your teams. Skills come from the Agent template at spawn; adjust them later on an Agent's settings.`,actions:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`a`,{className:`ghost-btn`,href:S?`/agents`:`/agents?all=1`,children:S?`Hide archived`:`Show archived`}),(0,x.jsx)(s,{variant:`primary`,disabled:t.length===0,onClick:()=>T(!0),children:`Spawn agent`})]})}),O&&(0,x.jsx)(`p`,{role:`alert`,className:`err`,children:O}),(0,x.jsx)(p,{title:S?`All agents`:`Current agents`,description:S?`Active and archived agents are shown together.`:`Archived agents stay hidden until you choose to show them.`,children:e.length===0?(0,x.jsx)(c,{title:S?`No agents yet`:`No current agents`,description:`Spawn an agent to give a team its first working member.`}):(0,x.jsx)(f,{children:e.map(e=>(0,x.jsx)(m,{title:(0,x.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,x.jsx)(h,{identity:e.identity,size:26}),(0,x.jsx)(`a`,{href:`/agents/${e.id}`,className:`truncate`,children:e.name}),(0,x.jsx)(d,{variant:e.status===`archived`?`warning`:`success`,children:e.status})]}),meta:(0,x.jsxs)(x.Fragment,{children:[(e.identity?.creature||e.identity?.vibe)&&(0,x.jsx)(`span`,{children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)}),(0,x.jsxs)(`span`,{children:[`template `,(0,x.jsx)(`code`,{children:e.profileId})]}),(0,x.jsxs)(`span`,{children:[`team `,(0,x.jsx)(`code`,{children:e.teamId})]}),(0,x.jsx)(`code`,{title:e.id,children:e.id.slice(0,8)})]}),actions:(0,x.jsxs)(x.Fragment,{children:[e.status===`archived`?(0,x.jsx)(s,{variant:`ghost`,onClick:()=>void A(e),children:`Restore`}):(0,x.jsx)(s,{variant:`ghost`,onClick:()=>D({kind:`archive`,agent:e}),children:`Archive`}),(0,x.jsx)(s,{variant:`danger`,onClick:()=>D({kind:`delete`,agent:e}),children:`Delete`})]})},e.id))})}),w&&(0,x.jsx)(y,{profiles:t,teams:n,onClose:()=>T(!1)}),(0,x.jsx)(i,{open:E!==null,onOpenChange:e=>{e||D(null)},title:E?.kind===`delete`?`Delete ${E.agent.name} permanently?`:`Archive ${E?.agent.name??`agent`}?`,description:E?.kind===`delete`?(0,x.jsx)(`p`,{children:`This permanently removes the Agent, its messages, triggers, skill attachments, sessions, and private on-disk directory. This cannot be undone.`}):(0,x.jsx)(`p`,{children:`The Agent will stop appearing in current lists and cannot receive normal work. You can restore it later from “Show archived”.`}),confirmLabel:E?.kind===`delete`?`Delete permanently`:`Archive agent`,confirmVariant:E?.kind===`delete`?`danger`:`primary`,onConfirm:async()=>{E&&(E.kind===`delete`?await _(E.agent.id):await v(E.agent.id),await C.invalidate())}})]})}export{S as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{f as r}from"./preload-helper-eUUcpe2S.js";import{t as i}from"./ConfirmDialog-536ziJ5P.js";import{N as a,S as o,_t as s,ct as c,dt as l,ft as u,ht as d,lt as f,pt as p,ut as m}from"./index-1YXquAq8.js";import{t as h}from"./AgentAvatar-DWx-bM6n.js";import{i as g,n as _,t as v}from"./agent-actions-CXQCoxKO.js";import{t as y}from"./SpawnDialog-DoZl-yes.js";var b=e(t()),x=n();function S(){let{agents:e,profiles:t,teams:n}=o.useLoaderData(),S=o.useSearch().all===1,C=r(),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(null);async function A(e){k(null);try{await g(e.id),await C.invalidate()}catch(e){k(a(e))}}return(0,x.jsxs)(u,{size:`wide`,children:[(0,x.jsx)(l,{eyebrow:`Workspace`,title:`Agents`,description:`Spawn, inspect, archive and restore the agents that work across your teams. Skills come from the Agent template at spawn; adjust them later on an Agent's settings.`,actions:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`a`,{className:`ghost-btn`,href:S?`/agents`:`/agents?all=1`,children:S?`Hide archived`:`Show archived`}),(0,x.jsx)(s,{variant:`primary`,disabled:t.length===0,onClick:()=>T(!0),children:`Spawn agent`})]})}),O&&(0,x.jsx)(`p`,{role:`alert`,className:`err`,children:O}),(0,x.jsx)(p,{title:S?`All agents`:`Current agents`,description:S?`Active and archived agents are shown together.`:`Archived agents stay hidden until you choose to show them.`,children:e.length===0?(0,x.jsx)(c,{title:S?`No agents yet`:`No current agents`,description:`Spawn an agent to give a team its first working member.`}):(0,x.jsx)(f,{children:e.map(e=>(0,x.jsx)(m,{title:(0,x.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,x.jsx)(h,{identity:e.identity,size:26}),(0,x.jsx)(`a`,{href:`/agents/${e.id}`,className:`truncate`,children:e.name}),(0,x.jsx)(d,{variant:e.status===`archived`?`warning`:`success`,children:e.status})]}),meta:(0,x.jsxs)(x.Fragment,{children:[(e.identity?.creature||e.identity?.vibe)&&(0,x.jsx)(`span`,{children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)}),(0,x.jsxs)(`span`,{children:[`template `,(0,x.jsx)(`code`,{children:e.profileId})]}),(0,x.jsxs)(`span`,{children:[`team `,(0,x.jsx)(`code`,{children:e.teamId})]}),(0,x.jsx)(`code`,{title:e.id,children:e.id.slice(0,8)})]}),actions:(0,x.jsxs)(x.Fragment,{children:[e.status===`archived`?(0,x.jsx)(s,{variant:`ghost`,onClick:()=>void A(e),children:`Restore`}):(0,x.jsx)(s,{variant:`ghost`,onClick:()=>D({kind:`archive`,agent:e}),children:`Archive`}),(0,x.jsx)(s,{variant:`danger`,onClick:()=>D({kind:`delete`,agent:e}),children:`Delete`})]})},e.id))})}),w&&(0,x.jsx)(y,{profiles:t,teams:n,onClose:()=>T(!1)}),(0,x.jsx)(i,{open:E!==null,onOpenChange:e=>{e||D(null)},title:E?.kind===`delete`?`Delete ${E.agent.name} permanently?`:`Archive ${E?.agent.name??`agent`}?`,description:E?.kind===`delete`?(0,x.jsx)(`p`,{children:`This permanently removes the Agent, its messages, triggers, skill attachments, sessions, and private on-disk directory. This cannot be undone.`}):(0,x.jsx)(`p`,{children:`The Agent will stop appearing in current lists and cannot receive normal work. You can restore it later from “Show archived”.`}),confirmLabel:E?.kind===`delete`?`Delete permanently`:`Archive agent`,confirmVariant:E?.kind===`delete`?`danger`:`primary`,onConfirm:async()=>{E&&(E.kind===`delete`?await _(E.agent.id):await v(E.agent.id),await C.invalidate())}})]})}export{S as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{o as r}from"./preload-helper-eUUcpe2S.js";import{C as i,N as a,_t as o,ct as s,dt as c,ft as l,ht as u,j as d,lt as f,mt as p,pt as m,ut as h}from"./index-CKJ3uVR4.js";var g=e(t()),_=n(),v=`/api/attention?state=all&limit=200`,y=`/api/attention/summary`,b={action_required:`warning`,error:`danger`,warning:`info`};function x(){let e=i.useLoaderData(),[t,n]=(0,g.useState)(e.list),[x,S]=(0,g.useState)(e.summary),[C,w]=(0,g.useState)(`open`),[T,E]=(0,g.useState)(`all`),[D,O]=(0,g.useState)(`all`),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=t.items.filter(e=>(C===`all`||(C===`open`?e.acknowledgedAt===null:e.acknowledgedAt!==null))&&(T===`all`||e.kind===T)&&(D===`all`||e.severity===D)),P=[...new Set([...t.degraded,...x.degraded].map(e=>e.kind))];async function F(){let[e,t]=await Promise.all([d(v),d(y)]);n(e),S(t)}async function I(e,t){A(e),M(null);try{M(await t())}catch(e){M(a(e))}finally{await F().catch(()=>{}),A(null)}}let L=(e,t)=>I(e.key,async()=>{let n=`/api/attention/${encodeURIComponent(e.key)}`;return await d(t?`${n}/acknowledge`:`${n}/acknowledgement`,{method:t?`POST`:`DELETE`}),null}),R=()=>I(`all`,async()=>{let{acknowledged:e}=await d(`/api/attention/acknowledge-all`,{method:`POST`});return`Acknowledged ${e} informational item(s). Lesson proposals and paused queues stay open.`});return(0,_.jsxs)(l,{size:`wide`,children:[(0,_.jsx)(c,{eyebrow:`Operations`,title:`Attention`,description:`Decisions waiting for you and failures worth a look. Act on an item at its source; acknowledge informational ones here.`,actions:(0,_.jsx)(o,{variant:`ghost`,disabled:k!==null,onClick:()=>void R(),children:`Acknowledge all informational items`})}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,_.jsx)(p,{label:`Open`,value:x.openTotal}),(0,_.jsx)(p,{label:`Action required`,value:x.bySeverity.action_required}),(0,_.jsx)(p,{label:`Errors and warnings`,value:x.bySeverity.error+x.bySeverity.warning})]}),P.length>0&&(0,_.jsxs)(`div`,{role:`alert`,className:`rounded-lg border border-danger/40 bg-danger/10 p-4 text-sm`,children:[(0,_.jsx)(`strong`,{children:`Partial results.`}),` `,P.join(`, `),` could not be loaded.`]}),j&&(0,_.jsx)(`p`,{role:`status`,className:`rounded-lg bg-muted px-4 py-3 text-sm`,children:j}),(0,_.jsx)(m,{title:`Queue`,description:`${N.length} matching item${N.length===1?``:`s`}`,actions:(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,_.jsxs)(`select`,{"aria-label":`Queue state`,value:C,onChange:e=>w(e.target.value),children:[(0,_.jsx)(`option`,{value:`open`,children:`Open`}),(0,_.jsx)(`option`,{value:`acknowledged`,children:`History`}),(0,_.jsx)(`option`,{value:`all`,children:`All`})]}),(0,_.jsxs)(`select`,{"aria-label":`Severity`,value:D,onChange:e=>O(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All severities`}),(0,_.jsx)(`option`,{value:`action_required`,children:`Action required`}),(0,_.jsx)(`option`,{value:`error`,children:`Errors`}),(0,_.jsx)(`option`,{value:`warning`,children:`Warnings`})]}),(0,_.jsxs)(`select`,{"aria-label":`Kind`,value:T,onChange:e=>E(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All kinds`}),(0,_.jsx)(`option`,{value:`lesson_proposal`,children:`Lessons`}),(0,_.jsx)(`option`,{value:`review_failure`,children:`Review failures`}),(0,_.jsx)(`option`,{value:`trigger_failure`,children:`Trigger failures`}),(0,_.jsx)(`option`,{value:`agent_loop_break`,children:`Loop breaks`}),(0,_.jsx)(`option`,{value:`queue_interrupted`,children:`Paused queues`})]})]}),children:N.length===0?(0,_.jsx)(s,{title:C===`open`?`Nothing needs attention`:`No matching history`,description:`Items come from learning reviews, triggers, follow-up queues and loop breaks.`}):(0,_.jsx)(f,{children:N.map(e=>(0,_.jsx)(h,{title:e.title,meta:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{variant:b[e.severity],children:e.severity.replace(`_`,` `)}),(0,_.jsx)(`span`,{children:e.kind.replaceAll(`_`,` `)}),(0,_.jsx)(`span`,{children:[e.agentName,e.teamName].filter(Boolean).join(` · `)||`System`}),(0,_.jsx)(`time`,{dateTime:new Date(e.occurredAt).toISOString(),children:new Date(e.occurredAt).toLocaleString()})]}),actions:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(r,{to:e.href,className:`btn-primary`,children:e.kind===`lesson_proposal`?`Review lesson`:`Inspect source`}),e.acknowledgeable&&(0,_.jsx)(o,{variant:`ghost`,disabled:k===e.key,onClick:()=>void L(e,e.acknowledgedAt===null),children:e.acknowledgedAt===null?`Acknowledge`:`Restore to open`})]}),children:(0,_.jsx)(`p`,{className:`mb-0 mt-1 text-sm text-muted-foreground`,children:e.diagnostic})},e.key))})})]})}export{x as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{o as r}from"./preload-helper-eUUcpe2S.js";import{C as i,N as a,_t as o,ct as s,dt as c,ft as l,ht as u,j as d,lt as f,mt as p,pt as m,ut as h}from"./index-1YXquAq8.js";var g=e(t()),_=n(),v=`/api/attention?state=all&limit=200`,y=`/api/attention/summary`,b={action_required:`warning`,error:`danger`,warning:`info`};function x(){let e=i.useLoaderData(),[t,n]=(0,g.useState)(e.list),[x,S]=(0,g.useState)(e.summary),[C,w]=(0,g.useState)(`open`),[T,E]=(0,g.useState)(`all`),[D,O]=(0,g.useState)(`all`),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=t.items.filter(e=>(C===`all`||(C===`open`?e.acknowledgedAt===null:e.acknowledgedAt!==null))&&(T===`all`||e.kind===T)&&(D===`all`||e.severity===D)),P=[...new Set([...t.degraded,...x.degraded].map(e=>e.kind))];async function F(){let[e,t]=await Promise.all([d(v),d(y)]);n(e),S(t)}async function I(e,t){A(e),M(null);try{M(await t())}catch(e){M(a(e))}finally{await F().catch(()=>{}),A(null)}}let L=(e,t)=>I(e.key,async()=>{let n=`/api/attention/${encodeURIComponent(e.key)}`;return await d(t?`${n}/acknowledge`:`${n}/acknowledgement`,{method:t?`POST`:`DELETE`}),null}),R=()=>I(`all`,async()=>{let{acknowledged:e}=await d(`/api/attention/acknowledge-all`,{method:`POST`});return`Acknowledged ${e} informational item(s). Lesson proposals and paused queues stay open.`});return(0,_.jsxs)(l,{size:`wide`,children:[(0,_.jsx)(c,{eyebrow:`Operations`,title:`Attention`,description:`Decisions waiting for you and failures worth a look. Act on an item at its source; acknowledge informational ones here.`,actions:(0,_.jsx)(o,{variant:`ghost`,disabled:k!==null,onClick:()=>void R(),children:`Acknowledge all informational items`})}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,_.jsx)(p,{label:`Open`,value:x.openTotal}),(0,_.jsx)(p,{label:`Action required`,value:x.bySeverity.action_required}),(0,_.jsx)(p,{label:`Errors and warnings`,value:x.bySeverity.error+x.bySeverity.warning})]}),P.length>0&&(0,_.jsxs)(`div`,{role:`alert`,className:`rounded-lg border border-danger/40 bg-danger/10 p-4 text-sm`,children:[(0,_.jsx)(`strong`,{children:`Partial results.`}),` `,P.join(`, `),` could not be loaded.`]}),j&&(0,_.jsx)(`p`,{role:`status`,className:`rounded-lg bg-muted px-4 py-3 text-sm`,children:j}),(0,_.jsx)(m,{title:`Queue`,description:`${N.length} matching item${N.length===1?``:`s`}`,actions:(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,_.jsxs)(`select`,{"aria-label":`Queue state`,value:C,onChange:e=>w(e.target.value),children:[(0,_.jsx)(`option`,{value:`open`,children:`Open`}),(0,_.jsx)(`option`,{value:`acknowledged`,children:`History`}),(0,_.jsx)(`option`,{value:`all`,children:`All`})]}),(0,_.jsxs)(`select`,{"aria-label":`Severity`,value:D,onChange:e=>O(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All severities`}),(0,_.jsx)(`option`,{value:`action_required`,children:`Action required`}),(0,_.jsx)(`option`,{value:`error`,children:`Errors`}),(0,_.jsx)(`option`,{value:`warning`,children:`Warnings`})]}),(0,_.jsxs)(`select`,{"aria-label":`Kind`,value:T,onChange:e=>E(e.target.value),children:[(0,_.jsx)(`option`,{value:`all`,children:`All kinds`}),(0,_.jsx)(`option`,{value:`lesson_proposal`,children:`Lessons`}),(0,_.jsx)(`option`,{value:`review_failure`,children:`Review failures`}),(0,_.jsx)(`option`,{value:`trigger_failure`,children:`Trigger failures`}),(0,_.jsx)(`option`,{value:`agent_loop_break`,children:`Loop breaks`}),(0,_.jsx)(`option`,{value:`queue_interrupted`,children:`Paused queues`})]})]}),children:N.length===0?(0,_.jsx)(s,{title:C===`open`?`Nothing needs attention`:`No matching history`,description:`Items come from learning reviews, triggers, follow-up queues and loop breaks.`}):(0,_.jsx)(f,{children:N.map(e=>(0,_.jsx)(h,{title:e.title,meta:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{variant:b[e.severity],children:e.severity.replace(`_`,` `)}),(0,_.jsx)(`span`,{children:e.kind.replaceAll(`_`,` `)}),(0,_.jsx)(`span`,{children:[e.agentName,e.teamName].filter(Boolean).join(` · `)||`System`}),(0,_.jsx)(`time`,{dateTime:new Date(e.occurredAt).toISOString(),children:new Date(e.occurredAt).toLocaleString()})]}),actions:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(r,{to:e.href,className:`btn-primary`,children:e.kind===`lesson_proposal`?`Review lesson`:`Inspect source`}),e.acknowledgeable&&(0,_.jsx)(o,{variant:`ghost`,disabled:k===e.key,onClick:()=>void L(e,e.acknowledgedAt===null),children:e.acknowledgedAt===null?`Acknowledge`:`Restore to open`})]}),children:(0,_.jsx)(`p`,{className:`mb-0 mt-1 text-sm text-muted-foreground`,children:e.diagnostic})},e.key))})})]})}export{x as component};
@@ -0,0 +1 @@
1
+ import{at as e}from"./index-1YXquAq8.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
@@ -1,3 +1,3 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{f as r}from"./preload-helper-eUUcpe2S.js";import{t as i}from"./chevron-right-DZFmP-cr.js";import{t as a}from"./ConfirmDialog-B5BLql5H.js";import{N as o,_t as s,at as c,ct as l,ht as u,j as d,mt as f,rt as p,w as m}from"./index-CKJ3uVR4.js";import{t as h}from"./ConfigPage-BcjKer-E.js";import{t as g}from"./FieldRow-Dr1dDiQ6.js";var _=c(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),v=c(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),y=c(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),b=e(t()),x=n();function S(){return(0,x.jsxs)(`section`,{"aria-label":`Backup`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsx)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Backup`})}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 p-4 text-sm sm:px-5`,children:[(0,x.jsxs)(`p`,{className:`m-0 max-w-prose text-muted-foreground`,children:[`A tar.gz of the Bazilion home. It is not encrypted and holds every stored credential; for an encrypted copy run `,(0,x.jsx)(`code`,{children:`bazilion backup create --recipient <age1…>`}),`. Restore with `,(0,x.jsx)(`code`,{children:`bazilion backup restore`}),` while the daemon is stopped.`]}),(0,x.jsx)(`a`,{href:`/api/backup`,download:!0,className:`btn-primary no-underline`,children:`Download backup`})]})]})}function C({report:e}){return(0,x.jsxs)(`section`,{"aria-label":`Installation health`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsx)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Installation health`})}),(0,x.jsxs)(`dl`,{className:`p-4 sm:px-5`,children:[(0,x.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Installation health`}),(0,x.jsx)(`dd`,{className:`mt-1 font-semibold ${e.ok?`text-success`:`text-warning`}`,children:e.ok?`Healthy`:`Issues found`}),(0,x.jsx)(`dd`,{className:`mt-1 text-xs text-muted-foreground`,children:`Run bazilion doctor for the details.`})]})]})}function w({shell:e}){return(0,x.jsxs)(`section`,{"aria-label":`Agent runtime`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsxs)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:[(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Agent runtime`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Applies to every turn: chat, Telegram, schedules and inbox. Unattended turns auto-deny dangerous commands.`})]}),e.ok?(0,x.jsxs)(`dl`,{className:`divide-y divide-border px-4 text-sm sm:px-5`,children:[(0,x.jsx)(T,{label:`Sandbox`,value:e.sandboxMode===`docker`?`Docker (${e.sandboxImage}) — bash in a network-disabled container`:`Off — bash and file tools run on the host, unisolated`}),e.docker&&(0,x.jsx)(T,{label:`Docker`,value:e.docker.ready?`Ready`:`Unavailable — ${e.docker.reason}`,ok:e.docker.ready}),e.docker?.remediation&&(0,x.jsx)(T,{label:`Remediation`,value:e.docker.remediation}),(0,x.jsx)(T,{label:`Dangerous-command approval`,value:e.approvalMode===`dangerous`?`On — chat can allow once; unattended turns auto-deny`:`Off`})]}):(0,x.jsxs)(`p`,{role:`alert`,className:`px-4 py-3 text-sm text-warning sm:px-5`,children:[`Invalid shell-security configuration: `,e.error]})]})}function T({label:e,value:t,ok:n}){return(0,x.jsxs)(`div`,{className:`grid gap-1 py-3 sm:grid-cols-[14rem_1fr] sm:gap-4`,children:[(0,x.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,x.jsx)(`dd`,{className:n===void 0?`font-medium`:n?`text-success`:`text-warning`,children:t})]})}var E=new Set([`openai-codex`,`openai`,`anthropic`,`google`]),D=new Set([`ollama`,`lmstudio`,`llamacpp`]);function O(e){return e.enabled||e.curated.length>0||e.fields.some(e=>e.set)}function k(e,t){let n=t.trim().toLocaleLowerCase();return n?[e.id,e.displayName,e.hint??``,...e.fields.flatMap(e=>[e.label,e.envVar]),...e.curated,...e.catalog].some(e=>e.toLocaleLowerCase().includes(n)):!0}function A(e,t=``){let n=e.filter(e=>k(e,t)),r=n.filter(O),i=new Set(r.map(e=>e.id)),a=n.filter(e=>!i.has(e.id));return[{key:`configured`,title:`Configured`,description:`Providers you enabled, added models to, or saved credentials for.`,providers:r},{key:`recommended`,title:`Recommended starting points`,description:`The simplest hosted options for a first Bazilion conversation.`,providers:a.filter(e=>E.has(e.id))},{key:`local`,title:`Local models`,description:`Use a model server on the same machine without exposing the daemon.`,providers:a.filter(e=>D.has(e.id))},{key:`more`,title:`More providers`,description:`Specialist, regional, enterprise, and subscription endpoints.`,providers:a.filter(e=>!E.has(e.id)&&!D.has(e.id))}].filter(e=>e.providers.length>0)}function j(e){return e.enabled?e.curated.length===0?{label:`Needs a model`,tone:`warning`}:{label:`Enabled`,tone:`neutral`}:O(e)?{label:`Saved, disabled`,tone:`neutral`}:{label:`Not configured`,tone:`neutral`}}function M(){let{providers:e,openaiCodex:t,runtime:n,readiness:r}=m.useLoaderData(),a=e.some(e=>e.enabled&&e.curated.length>0),o=(0,b.useRef)(a),[c,u]=(0,b.useState)(!1),[d,g]=(0,b.useState)(``),T=(0,b.useMemo)(()=>A(e,d),[e,d]),E=e.filter(O).length,D=e.filter(e=>e.enabled).length;return(0,b.useEffect)(()=>{!o.current&&a&&u(!0)},[a]),(0,x.jsxs)(h,{title:`Providers`,description:(0,x.jsx)(x.Fragment,{children:`Connect the model services your agents may use. Credentials stay encrypted; advanced endpoint and environment names remain available inside each provider.`}),children:[(0,x.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,x.jsx)(f,{label:`Configured`,value:E,detail:`credentials, models, or toggle`}),(0,x.jsx)(f,{label:`Enabled`,value:D,detail:`available to agents`}),(0,x.jsx)(f,{label:`Selected models`,value:e.reduce((e,t)=>e+(t.enabled?t.curated.length:0),0),detail:`across enabled providers`})]}),(0,x.jsx)(C,{report:r}),(0,x.jsx)(S,{}),(0,x.jsx)(w,{shell:n}),!a&&(0,x.jsx)(N,{providers:e,openaiCodex:t}),c&&(0,x.jsx)(`section`,{role:`status`,className:`rounded-2xl border border-success/30 bg-success/10 p-5 text-sm`,children:(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(_,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`h2`,{className:`m-0 font-body text-base font-semibold text-foreground`,children:`Your default workspace is ready`}),(0,x.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Bazilion created the default Agent template and Team. Test the selected model below before relying on it, or continue to spawn your first agent.`}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,x.jsxs)(`a`,{href:`/agents`,className:`btn-primary no-underline`,children:[`Spawn your first agent`,(0,x.jsx)(i,{className:`size-4`,"aria-hidden":`true`})]}),(0,x.jsx)(s,{variant:`ghost`,onClick:()=>u(!1),children:`Keep configuring`})]})]})]})}),(0,x.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-4 shadow-baziu-sm sm:p-5`,children:[(0,x.jsx)(`label`,{htmlFor:`provider-search`,className:`m-0 text-sm font-semibold text-foreground`,children:`Find a provider`}),(0,x.jsxs)(`div`,{className:`relative mt-2`,children:[(0,x.jsx)(v,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,x.jsx)(`input`,{id:`provider-search`,type:`search`,value:d,onChange:e=>g(e.target.value),placeholder:`Search by service, model, or advanced key`,className:`pl-9`})]}),(0,x.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:`Start with one provider. Everything else stays collapsed until you need it.`})]}),T.length===0?(0,x.jsx)(l,{icon:(0,x.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),title:`No providers match`,description:`Try another search instead of “${d}”.`,actions:(0,x.jsx)(s,{variant:`ghost`,onClick:()=>g(``),children:`Clear search`})}):(0,x.jsx)(`div`,{className:`space-y-4`,children:T.map(e=>(0,x.jsxs)(`details`,{open:!!d||e.key===`configured`||!a&&e.key===`recommended`,className:`group/providers overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-4 marker:hidden sm:px-5`,children:[(0,x.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent text-accent-foreground`,children:(0,x.jsx)(y,{className:`size-4`,"aria-hidden":`true`})}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block text-sm font-semibold text-foreground`,children:e.title}),(0,x.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:e.description})]}),(0,x.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground`,children:e.providers.length}),(0,x.jsx)(p,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/providers:rotate-180`,"aria-hidden":`true`})]}),(0,x.jsx)(`div`,{className:`space-y-2 border-t border-border bg-muted/20 p-2 sm:p-3`,children:e.providers.map(e=>(0,x.jsx)(P,{p:e,initiallyOpen:e.enabled||!!d||!a&&e.id===`openai-codex`,openaiCodexStatus:e.id===`openai-codex`?t:void 0},e.id))})]},`${e.key}:${d}`))})]})}function N({providers:e,openaiCodex:t}){let n=[];for(let r of e)r.enabled&&(r.id===`openai-codex`&&!t.connected&&n.push(`${r.id}: enabled but ChatGPT is not connected — click "Connect ChatGPT" below`),r.curated.length===0&&n.push(`${r.id}: enabled but no curated models — add at least one name in the "curated models" box below and save`));let r=e.filter(e=>e.enabled).length;return(0,x.jsxs)(`div`,{role:`status`,className:`rounded-2xl border border-warning/30 bg-warning/10 p-5 text-sm`,children:[(0,x.jsx)(`div`,{className:`font-semibold text-foreground mb-1`,children:`Finish your first provider`}),(0,x.jsx)(`p`,{className:`text-muted-foreground mb-2`,children:`Enable one provider, save at least one exact model id, then send the small test request. Saving the model creates your default resources; a successful test confirms that the credential and model actually work.`}),n.length>0?(0,x.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-warning`,children:n.map(e=>(0,x.jsx)(`li`,{children:e},e))}):r===0?(0,x.jsx)(`p`,{className:`text-warning`,children:`No provider is enabled. Open a recommended option below and follow its steps.`}):null]})}function P({p:e,openaiCodexStatus:t,initiallyOpen:n}){let a=r(),[c,l]=(0,b.useState)(e.enabled),[f,p]=(0,b.useState)(n),[m,h]=(0,b.useState)(e.curated.join(`
2
- `)),[_,v]=(0,b.useState)(!1),[y,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(null),[T,E]=(0,b.useState)(e.curated[0]??``),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(null),M=j({...e,enabled:c}),N=`/api/config/providers/${encodeURIComponent(e.id)}`;async function P(e){l(e),w(null);try{await d(`${N}/enabled`,{method:`PUT`,body:{enabled:e}}),e&&p(!0),await a.invalidate()}catch(t){l(!e),w(o(t))}}async function L(e){e.preventDefault(),v(!0),S(null);try{let e=m.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);await d(`${N}/models`,{method:`PUT`,body:{models:e}}),S({kind:`success`,message:`Models saved.`}),E(e[0]??``),A(null),await a.invalidate()}catch(e){S({kind:`error`,message:o(e)})}finally{v(!1)}}async function R(){if(T){O(!0),A(null);try{await d(`/api/providers/test`,{body:{model:`${e.id}:${T}`,message:`Reply with exactly: Bazilion connection verified.`}}),A({kind:`success`,message:`Verified ${e.displayName} with ${T}.`}),await a.invalidate()}catch(e){A({kind:`error`,message:o(e)})}finally{O(!1)}}}return(0,x.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,x.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`unstyled flex min-w-0 flex-1 items-center gap-2 rounded-lg text-left`,"aria-expanded":f,"aria-controls":`provider-${e.id}`,onClick:()=>p(e=>!e),children:[(0,x.jsx)(i,{className:`size-4 shrink-0 text-muted-foreground transition-transform ${f?`rotate-90`:``}`,"aria-hidden":`true`}),(0,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.displayName}),(0,x.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.id})]})]}),(0,x.jsx)(u,{variant:M.tone,children:M.label}),(0,x.jsxs)(`label`,{className:`m-0 flex cursor-pointer items-center gap-1.5 rounded-lg px-1 text-xs font-semibold`,children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>P(e.target.checked),className:`size-4`,"aria-label":`${c?`Disable`:`Enable`} ${e.displayName}`}),(0,x.jsx)(`span`,{className:c?`text-success`:`text-muted-foreground`,children:c?`enabled`:`disabled`})]}),(0,x.jsxs)(`span`,{className:`w-full pl-6 text-xs text-muted-foreground sm:w-auto sm:pl-0`,children:[e.curated.length>0&&(0,x.jsxs)(`span`,{children:[e.curated.length,` curated`]}),e.catalog.length>0&&(0,x.jsxs)(`span`,{children:[` · `,e.catalog.length,` catalog`]}),e.live&&!e.live.error&&(0,x.jsxs)(`span`,{children:[` · `,e.live.models.length,` live`]})]})]}),C&&(0,x.jsx)(`p`,{role:`alert`,className:`mx-4 mb-3 text-sm text-danger`,children:C}),f&&(0,x.jsxs)(`div`,{id:`provider-${e.id}`,className:`border-t border-dashed px-3 py-4 sm:px-4`,children:[e.hint&&(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.id===`openai-codex`&&t&&(0,x.jsx)(I,{status:t}),e.fields.map(e=>(0,x.jsx)(g,{field:e},e.envVar)),(0,x.jsx)(`h4`,{id:`provider-${e.id}-models-label`,className:`mt-4 mb-1 font-body text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Models available to agents`}),e.curated.length===0&&(0,x.jsxs)(`p`,{className:`mb-2 text-xs font-medium text-warning`,children:[`First-run setup needs at least one model name here — type one (e.g.`,` `,(0,x.jsx)(`code`,{className:`font-mono`,children:e.catalog[0]??e.live?.models[0]??`model-name`}),`) and click `,(0,x.jsx)(`em`,{children:`save models`}),`. Catalog chips below are the safest source when available.`]}),(0,x.jsxs)(`form`,{onSubmit:L,children:[(0,x.jsx)(`textarea`,{id:`provider-${e.id}-models`,"aria-labelledby":`provider-${e.id}-models-label`,value:m,onChange:e=>h(e.target.value),rows:Math.max(3,Math.min(8,m.split(`
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{f as r}from"./preload-helper-eUUcpe2S.js";import{t as i}from"./chevron-right-CPAb1zac.js";import{t as a}from"./ConfirmDialog-536ziJ5P.js";import{N as o,_t as s,at as c,ct as l,ht as u,j as d,mt as f,rt as p,w as m}from"./index-1YXquAq8.js";import{t as h}from"./ConfigPage-Dfu9DzFX.js";import{t as g}from"./FieldRow-z1JqCdqn.js";var _=c(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),v=c(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),y=c(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),b=e(t()),x=n();function S(){return(0,x.jsxs)(`section`,{"aria-label":`Backup`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsx)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Backup`})}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 p-4 text-sm sm:px-5`,children:[(0,x.jsxs)(`p`,{className:`m-0 max-w-prose text-muted-foreground`,children:[`A tar.gz of the Bazilion home. It is not encrypted and holds every stored credential; for an encrypted copy run `,(0,x.jsx)(`code`,{children:`bazilion backup create --recipient <age1…>`}),`. Restore with `,(0,x.jsx)(`code`,{children:`bazilion backup restore`}),` while the daemon is stopped.`]}),(0,x.jsx)(`a`,{href:`/api/backup`,download:!0,className:`btn-primary no-underline`,children:`Download backup`})]})]})}function C({report:e}){return(0,x.jsxs)(`section`,{"aria-label":`Installation health`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsx)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Installation health`})}),(0,x.jsxs)(`dl`,{className:`p-4 sm:px-5`,children:[(0,x.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Installation health`}),(0,x.jsx)(`dd`,{className:`mt-1 font-semibold ${e.ok?`text-success`:`text-warning`}`,children:e.ok?`Healthy`:`Issues found`}),(0,x.jsx)(`dd`,{className:`mt-1 text-xs text-muted-foreground`,children:`Run bazilion doctor for the details.`})]})]})}function w({shell:e}){return(0,x.jsxs)(`section`,{"aria-label":`Agent runtime`,className:`overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsxs)(`header`,{className:`border-b border-border px-4 py-3 sm:px-5`,children:[(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:`Agent runtime`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Applies to every turn: chat, Telegram, schedules and inbox. Unattended turns auto-deny dangerous commands.`})]}),e.ok?(0,x.jsxs)(`dl`,{className:`divide-y divide-border px-4 text-sm sm:px-5`,children:[(0,x.jsx)(T,{label:`Sandbox`,value:e.sandboxMode===`docker`?`Docker (${e.sandboxImage}) — bash in a network-disabled container`:`Off — bash and file tools run on the host, unisolated`}),e.docker&&(0,x.jsx)(T,{label:`Docker`,value:e.docker.ready?`Ready`:`Unavailable — ${e.docker.reason}`,ok:e.docker.ready}),e.docker?.remediation&&(0,x.jsx)(T,{label:`Remediation`,value:e.docker.remediation}),(0,x.jsx)(T,{label:`Dangerous-command approval`,value:e.approvalMode===`dangerous`?`On — chat can allow once; unattended turns auto-deny`:`Off`})]}):(0,x.jsxs)(`p`,{role:`alert`,className:`px-4 py-3 text-sm text-warning sm:px-5`,children:[`Invalid shell-security configuration: `,e.error]})]})}function T({label:e,value:t,ok:n}){return(0,x.jsxs)(`div`,{className:`grid gap-1 py-3 sm:grid-cols-[14rem_1fr] sm:gap-4`,children:[(0,x.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,x.jsx)(`dd`,{className:n===void 0?`font-medium`:n?`text-success`:`text-warning`,children:t})]})}var E=new Set([`openai-codex`,`openai`,`anthropic`,`google`]),D=new Set([`ollama`,`lmstudio`,`llamacpp`]);function O(e){return e.enabled||e.curated.length>0||e.fields.some(e=>e.set)}function k(e,t){let n=t.trim().toLocaleLowerCase();return n?[e.id,e.displayName,e.hint??``,...e.fields.flatMap(e=>[e.label,e.envVar]),...e.curated,...e.catalog].some(e=>e.toLocaleLowerCase().includes(n)):!0}function A(e,t=``){let n=e.filter(e=>k(e,t)),r=n.filter(O),i=new Set(r.map(e=>e.id)),a=n.filter(e=>!i.has(e.id));return[{key:`configured`,title:`Configured`,description:`Providers you enabled, added models to, or saved credentials for.`,providers:r},{key:`recommended`,title:`Recommended starting points`,description:`The simplest hosted options for a first Bazilion conversation.`,providers:a.filter(e=>E.has(e.id))},{key:`local`,title:`Local models`,description:`Use a model server on the same machine without exposing the daemon.`,providers:a.filter(e=>D.has(e.id))},{key:`more`,title:`More providers`,description:`Specialist, regional, enterprise, and subscription endpoints.`,providers:a.filter(e=>!E.has(e.id)&&!D.has(e.id))}].filter(e=>e.providers.length>0)}function j(e){return e.enabled?e.curated.length===0?{label:`Needs a model`,tone:`warning`}:{label:`Enabled`,tone:`neutral`}:O(e)?{label:`Saved, disabled`,tone:`neutral`}:{label:`Not configured`,tone:`neutral`}}function M(){let{providers:e,openaiCodex:t,runtime:n,readiness:r}=m.useLoaderData(),a=e.some(e=>e.enabled&&e.curated.length>0),o=(0,b.useRef)(a),[c,u]=(0,b.useState)(!1),[d,g]=(0,b.useState)(``),T=(0,b.useMemo)(()=>A(e,d),[e,d]),E=e.filter(O).length,D=e.filter(e=>e.enabled).length;return(0,b.useEffect)(()=>{!o.current&&a&&u(!0)},[a]),(0,x.jsxs)(h,{title:`Providers`,description:(0,x.jsx)(x.Fragment,{children:`Connect the model services your agents may use. Credentials stay encrypted; advanced endpoint and environment names remain available inside each provider.`}),children:[(0,x.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,x.jsx)(f,{label:`Configured`,value:E,detail:`credentials, models, or toggle`}),(0,x.jsx)(f,{label:`Enabled`,value:D,detail:`available to agents`}),(0,x.jsx)(f,{label:`Selected models`,value:e.reduce((e,t)=>e+(t.enabled?t.curated.length:0),0),detail:`across enabled providers`})]}),(0,x.jsx)(C,{report:r}),(0,x.jsx)(S,{}),(0,x.jsx)(w,{shell:n}),!a&&(0,x.jsx)(N,{providers:e,openaiCodex:t}),c&&(0,x.jsx)(`section`,{role:`status`,className:`rounded-2xl border border-success/30 bg-success/10 p-5 text-sm`,children:(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(_,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`h2`,{className:`m-0 font-body text-base font-semibold text-foreground`,children:`Your default workspace is ready`}),(0,x.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Bazilion created the default Agent template and Team. Test the selected model below before relying on it, or continue to spawn your first agent.`}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,x.jsxs)(`a`,{href:`/agents`,className:`btn-primary no-underline`,children:[`Spawn your first agent`,(0,x.jsx)(i,{className:`size-4`,"aria-hidden":`true`})]}),(0,x.jsx)(s,{variant:`ghost`,onClick:()=>u(!1),children:`Keep configuring`})]})]})]})}),(0,x.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-4 shadow-baziu-sm sm:p-5`,children:[(0,x.jsx)(`label`,{htmlFor:`provider-search`,className:`m-0 text-sm font-semibold text-foreground`,children:`Find a provider`}),(0,x.jsxs)(`div`,{className:`relative mt-2`,children:[(0,x.jsx)(v,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,x.jsx)(`input`,{id:`provider-search`,type:`search`,value:d,onChange:e=>g(e.target.value),placeholder:`Search by service, model, or advanced key`,className:`pl-9`})]}),(0,x.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:`Start with one provider. Everything else stays collapsed until you need it.`})]}),T.length===0?(0,x.jsx)(l,{icon:(0,x.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),title:`No providers match`,description:`Try another search instead of “${d}”.`,actions:(0,x.jsx)(s,{variant:`ghost`,onClick:()=>g(``),children:`Clear search`})}):(0,x.jsx)(`div`,{className:`space-y-4`,children:T.map(e=>(0,x.jsxs)(`details`,{open:!!d||e.key===`configured`||!a&&e.key===`recommended`,className:`group/providers overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,x.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-4 marker:hidden sm:px-5`,children:[(0,x.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent text-accent-foreground`,children:(0,x.jsx)(y,{className:`size-4`,"aria-hidden":`true`})}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block text-sm font-semibold text-foreground`,children:e.title}),(0,x.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:e.description})]}),(0,x.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground`,children:e.providers.length}),(0,x.jsx)(p,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/providers:rotate-180`,"aria-hidden":`true`})]}),(0,x.jsx)(`div`,{className:`space-y-2 border-t border-border bg-muted/20 p-2 sm:p-3`,children:e.providers.map(e=>(0,x.jsx)(P,{p:e,initiallyOpen:e.enabled||!!d||!a&&e.id===`openai-codex`,openaiCodexStatus:e.id===`openai-codex`?t:void 0},e.id))})]},`${e.key}:${d}`))})]})}function N({providers:e,openaiCodex:t}){let n=[];for(let r of e)r.enabled&&(r.id===`openai-codex`&&!t.connected&&n.push(`${r.id}: enabled but ChatGPT is not connected — click "Connect ChatGPT" below`),r.curated.length===0&&n.push(`${r.id}: enabled but no curated models — add at least one name in the "curated models" box below and save`));let r=e.filter(e=>e.enabled).length;return(0,x.jsxs)(`div`,{role:`status`,className:`rounded-2xl border border-warning/30 bg-warning/10 p-5 text-sm`,children:[(0,x.jsx)(`div`,{className:`font-semibold text-foreground mb-1`,children:`Finish your first provider`}),(0,x.jsx)(`p`,{className:`text-muted-foreground mb-2`,children:`Enable one provider, save at least one exact model id, then send the small test request. Saving the model creates your default resources; a successful test confirms that the credential and model actually work.`}),n.length>0?(0,x.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-warning`,children:n.map(e=>(0,x.jsx)(`li`,{children:e},e))}):r===0?(0,x.jsx)(`p`,{className:`text-warning`,children:`No provider is enabled. Open a recommended option below and follow its steps.`}):null]})}function P({p:e,openaiCodexStatus:t,initiallyOpen:n}){let a=r(),[c,l]=(0,b.useState)(e.enabled),[f,p]=(0,b.useState)(n),[m,h]=(0,b.useState)(e.curated.join(`
2
+ `)),[_,v]=(0,b.useState)(!1),[y,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(null),[T,E]=(0,b.useState)(e.curated[0]??``),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(null),M=j({...e,enabled:c}),N=`/api/config/providers/${encodeURIComponent(e.id)}`;async function P(e){l(e),w(null);try{await d(`${N}/enabled`,{method:`PUT`,body:{enabled:e}}),e&&p(!0),await a.invalidate()}catch(t){l(!e),w(o(t))}}async function L(e){e.preventDefault(),v(!0),S(null);try{let e=m.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);S({kind:`success`,message:[`Models saved.`,...(await d(`${N}/models`,{method:`PUT`,body:{models:e}})).movedTemplates.map(e=>`Template ${e.name} now uses ${e.model}.`)].join(` `)}),E(e[0]??``),A(null),await a.invalidate()}catch(e){S({kind:`error`,message:o(e)})}finally{v(!1)}}async function R(){if(T){O(!0),A(null);try{await d(`/api/providers/test`,{body:{model:`${e.id}:${T}`,message:`Reply with exactly: Bazilion connection verified.`}}),A({kind:`success`,message:`Verified ${e.displayName} with ${T}.`}),await a.invalidate()}catch(e){A({kind:`error`,message:o(e)})}finally{O(!1)}}}return(0,x.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,x.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`unstyled flex min-w-0 flex-1 items-center gap-2 rounded-lg text-left`,"aria-expanded":f,"aria-controls":`provider-${e.id}`,onClick:()=>p(e=>!e),children:[(0,x.jsx)(i,{className:`size-4 shrink-0 text-muted-foreground transition-transform ${f?`rotate-90`:``}`,"aria-hidden":`true`}),(0,x.jsxs)(`span`,{className:`min-w-0`,children:[(0,x.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.displayName}),(0,x.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.id})]})]}),(0,x.jsx)(u,{variant:M.tone,children:M.label}),(0,x.jsxs)(`label`,{className:`m-0 flex cursor-pointer items-center gap-1.5 rounded-lg px-1 text-xs font-semibold`,children:[(0,x.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>P(e.target.checked),className:`size-4`,"aria-label":`${c?`Disable`:`Enable`} ${e.displayName}`}),(0,x.jsx)(`span`,{className:c?`text-success`:`text-muted-foreground`,children:c?`enabled`:`disabled`})]}),(0,x.jsxs)(`span`,{className:`w-full pl-6 text-xs text-muted-foreground sm:w-auto sm:pl-0`,children:[e.curated.length>0&&(0,x.jsxs)(`span`,{children:[e.curated.length,` curated`]}),e.catalog.length>0&&(0,x.jsxs)(`span`,{children:[` · `,e.catalog.length,` catalog`]}),e.live&&!e.live.error&&(0,x.jsxs)(`span`,{children:[` · `,e.live.models.length,` live`]})]})]}),C&&(0,x.jsx)(`p`,{role:`alert`,className:`mx-4 mb-3 text-sm text-danger`,children:C}),f&&(0,x.jsxs)(`div`,{id:`provider-${e.id}`,className:`border-t border-dashed px-3 py-4 sm:px-4`,children:[e.hint&&(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.id===`openai-codex`&&t&&(0,x.jsx)(I,{status:t}),e.fields.map(e=>(0,x.jsx)(g,{field:e},e.envVar)),(0,x.jsx)(`h4`,{id:`provider-${e.id}-models-label`,className:`mt-4 mb-1 font-body text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Models available to agents`}),e.curated.length===0&&(0,x.jsxs)(`p`,{className:`mb-2 text-xs font-medium text-warning`,children:[`First-run setup needs at least one model name here — type one (e.g.`,` `,(0,x.jsx)(`code`,{className:`font-mono`,children:e.catalog[0]??e.live?.models[0]??`model-name`}),`) and click `,(0,x.jsx)(`em`,{children:`save models`}),`. Catalog chips below are the safest source when available.`]}),(0,x.jsxs)(`form`,{onSubmit:L,children:[(0,x.jsx)(`textarea`,{id:`provider-${e.id}-models`,"aria-labelledby":`provider-${e.id}-models-label`,value:m,onChange:e=>h(e.target.value),rows:Math.max(3,Math.min(8,m.split(`
3
3
  `).length)),className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,placeholder:e.catalog.length===0&&!e.live?`Type model names one per line, e.g. qwen3-coder-30b`:`Click catalog chips below, or type names one per line`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3 mt-2`,children:[(0,x.jsx)(`button`,{type:`submit`,disabled:_,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:_?`Saving…`:`Save models`}),y&&(0,x.jsx)(`span`,{role:y.kind===`error`?`alert`:`status`,className:`text-xs ${y.kind===`error`?`text-danger`:`text-success`}`,children:y.message})]})]}),e.catalog.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`catalog`}),(0,x.jsx)(F,{items:e.catalog,onPick:e=>h(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live&&!e.live.error&&e.live.models.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`live`}),(0,x.jsx)(F,{items:e.live.models,onPick:e=>h(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live?.error&&(0,x.jsxs)(`p`,{role:`alert`,className:`text-xs text-danger mt-2`,children:[`Could not fetch live models: `,e.live.error]}),c&&e.curated.length>0&&(0,x.jsxs)(`div`,{className:`mt-4 rounded-xl border border-border bg-muted/30 p-3`,children:[(0,x.jsx)(`h4`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:`Test the connection`}),(0,x.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Sends one short real request. Your provider may charge its normal token cost.`}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-end`,children:[(0,x.jsxs)(`label`,{className:`m-0 min-w-0 flex-1 text-xs font-semibold text-foreground`,children:[`Model`,(0,x.jsx)(`select`,{className:`mt-1`,value:T,onChange:e=>E(e.target.value),children:e.curated.map(e=>(0,x.jsx)(`option`,{value:e,children:e},e))})]}),(0,x.jsx)(s,{variant:`ghost`,disabled:D||!T,onClick:()=>void R(),children:D?`Testing…`:`Send test request`})]}),k&&(0,x.jsx)(`p`,{role:k.kind===`error`?`alert`:`status`,className:`mt-3 rounded-lg px-3 py-2 text-sm ${k.kind===`error`?`bg-danger/10 text-danger`:`bg-success/10 text-success`}`,children:k.message})]})]})]})}function F({items:e,onPick:t}){return(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1.5 max-h-40 overflow-y-auto rounded-md border bg-background p-1.5`,children:e.map(e=>(0,x.jsx)(`button`,{type:`button`,onClick:()=>t(e),"aria-label":`Add ${e} to selected models`,className:`rounded border bg-card px-2 py-0.5 font-mono text-xs hover:border-primary hover:bg-accent`,children:e},e))})}function I({status:e}){let t=r(),[n,i]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),[u,f]=(0,b.useState)(!1),p=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>{p.current?.abort()},[]);async function m(){p.current?.abort();let e=new AbortController;p.current=e,i(!0),l(null);try{if(await d(`/api/auth/openai/login`,{method:`POST`,signal:e.signal}),e.signal.aborted)return;await t.invalidate()}catch(t){if(e.signal.aborted)return;l(o(t))}finally{p.current===e&&(p.current=null,e.signal.aborted||i(!1))}}async function h(){i(!0),l(null);try{await d(`/api/auth/openai`,{method:`DELETE`}),await t.invalidate()}catch(e){throw l(o(e)),e}finally{i(!1)}}return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 mb-3`,children:[e.connected?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2 items-center mb-2`,children:[(0,x.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-2 py-0.5 text-xs font-semibold uppercase`,children:`connected`}),e.accountId&&(0,x.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`account `,(0,x.jsx)(`code`,{className:`font-mono`,children:e.accountId})]}),e.expiresAt&&(0,x.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`token expires `,new Date(e.expiresAt).toISOString().replace(/\.\d+Z$/,`Z`)]})]}),(0,x.jsx)(s,{variant:`danger`,onClick:()=>f(!0),disabled:n,children:`Disconnect ChatGPT`})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:[`Sign in with your ChatGPT account — the OAuth flow opens a new browser tab. The loopback callback at `,(0,x.jsx)(`code`,{className:`font-mono`,children:`localhost:1455`}),` only works when you're using the web UI on the same machine as the daemon. For remote setups or callback trouble, run`,` `,(0,x.jsx)(`code`,{className:`font-mono`,children:`bazilion auth openai login --device-code`}),` on the client. From a source checkout, run`,` `,(0,x.jsx)(`code`,{className:`font-mono`,children:`pnpm tsx apps/cli/src/index.ts auth openai login --device-code`}),` `,`from the repository root.`]}),(0,x.jsx)(s,{variant:`primary`,onClick:m,disabled:n,children:n?`opening browser…`:`Connect ChatGPT →`})]}),c&&(0,x.jsx)(`p`,{role:`alert`,className:`text-sm text-danger mt-2`,children:c})]}),(0,x.jsx)(a,{open:u,onOpenChange:f,title:`Disconnect ChatGPT?`,description:(0,x.jsxs)(`p`,{children:[`This removes the saved OpenAI Codex OAuth credentials. Agents using an`,` `,(0,x.jsx)(`code`,{children:`openai-codex`}),` model will stop working until you connect again.`]}),confirmLabel:`Disconnect ChatGPT`,onConfirm:h})]})}export{M as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,f as i}from"./preload-helper-eUUcpe2S.js";import{N as a,_t as o,j as s,r as c}from"./index-CKJ3uVR4.js";var l=e(t()),u=n(),d=r(`/agents/$id`);function f(e){try{let t=JSON.parse(e);if(typeof t.text==`string`)return t.text}catch{}return e}function p(){let{agent:e}=d.useLoaderData(),{messages:t,unreadCount:n,selected:r,agentNames:p,senders:h,loopBreaks:g}=c.useLoaderData(),_=i(),[v,y]=(0,l.useState)(null),b=c.useSearch().unread===1,x=!!(r&&r.toAgentId!==e.id),S=`/agents/${encodeURIComponent(e.id)}/inbox`,C=e=>p[e]?`${p[e]} (${e.slice(0,8)})`:e.slice(0,8),w=e=>`-mb-px border-b-2 px-3 py-1.5 text-sm ${e?`border-primary font-semibold text-primary`:`border-transparent text-muted-foreground`}`;return(0,u.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-[360px_1fr]`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-1 border-b`,children:[(0,u.jsx)(`a`,{href:S,className:w(!b),children:`all`}),(0,u.jsx)(`a`,{href:`${S}?unread=1`,className:w(b),children:`unread`}),(0,u.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[`unread: `,n]})]}),(0,u.jsx)(`div`,{className:`max-h-[640px] overflow-y-auto rounded-lg border bg-card`,children:t.length===0?(0,u.jsx)(`div`,{className:`p-6 text-center italic text-muted-foreground`,children:b?`no unread messages`:`inbox empty`}):t.map(e=>{let t=f(e.payload),n=e.readAt===null;return(0,u.jsxs)(`a`,{href:`${S}${b?`?unread=1&id=${e.id}`:`?id=${e.id}`}`,className:`block border-b px-3 py-2 text-sm last:border-0 hover:bg-accent/30 ${r?.id===e.id?`bg-accent/40`:``} ${n?`font-medium`:``}`,children:[(0,u.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,u.jsxs)(`span`,{className:`font-mono`,children:[n&&(0,u.jsx)(`span`,{className:`mr-1.5 inline-block h-1.5 w-1.5 rounded-full bg-primary align-middle`}),`from `,C(e.fromAgentId)]}),(0,u.jsx)(`span`,{className:`font-mono`,children:new Date(e.createdAt).toLocaleString()})]}),(0,u.jsx)(`div`,{className:`mt-0.5 truncate text-foreground`,children:t.length>80?`${t.slice(0,80)}…`:t})]},e.id)})})]}),(0,u.jsxs)(`div`,{children:[r&&!x&&(0,u.jsxs)(`div`,{className:`mb-4 rounded-lg border bg-card p-5`,children:[(0,u.jsxs)(`div`,{className:`mb-2 space-y-0.5 font-mono text-xs text-muted-foreground`,children:[(0,u.jsxs)(`div`,{children:[`id: `,(0,u.jsx)(`code`,{children:r.id})]}),(0,u.jsxs)(`div`,{children:[`from: `,(0,u.jsx)(`code`,{children:C(r.fromAgentId)})]}),(0,u.jsxs)(`div`,{children:[`received: `,new Date(r.createdAt).toLocaleString()]}),(0,u.jsxs)(`div`,{children:[`read: `,r.readAt?new Date(r.readAt).toLocaleString():`(unread)`,!r.readAt&&(0,u.jsx)(o,{variant:`ghost`,className:`ml-2`,onClick:async()=>{y(null);try{await s(`/api/messages/${encodeURIComponent(r.id)}`,{method:`PATCH`,body:{read:!0}}),await _.invalidate()}catch(e){y(a(e))}},children:`Mark read`}),v&&(0,u.jsx)(`span`,{role:`alert`,className:`ml-2 text-danger`,children:v})]}),r.replyTo&&(0,u.jsxs)(`div`,{children:[`reply to: `,(0,u.jsx)(`code`,{children:r.replyTo})]})]}),(0,u.jsx)(`div`,{className:`whitespace-pre-wrap break-words border-t pt-3 font-mono text-sm`,children:f(r.payload)})]}),x&&(0,u.jsx)(`div`,{className:`mb-4 rounded-lg border bg-card p-5 text-muted-foreground`,children:`This message is not addressed to this Agent.`}),(0,u.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Agents exchange messages with their `,(0,u.jsx)(`code`,{className:`font-mono`,children:`send_message`}),` tool; an idle recipient picks up unread mail on the next scheduler tick.`]}),(0,u.jsx)(m,{agentId:e.id,senders:h,onSent:()=>_.invalidate()}),(0,u.jsxs)(`div`,{className:`mt-6 rounded-lg border bg-card p-4`,children:[(0,u.jsx)(`h2`,{className:`mb-2 font-serif text-lg text-foreground`,children:`Loop circuit breaker`}),g.length===0?(0,u.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No agent-message chains stopped.`}):(0,u.jsx)(`div`,{className:`space-y-3`,children:g.map(e=>(0,u.jsxs)(`div`,{className:`border-t pt-3 text-xs first:border-0 first:pt-0`,children:[(0,u.jsxs)(`div`,{className:`font-mono text-foreground`,children:[C(e.fromAgentId),` → `,C(e.toAgentId)]}),(0,u.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`stopped hop `,e.attemptedHop,` at limit `,e.maxHops,` · chain`,` `,(0,u.jsx)(`code`,{children:e.causalChainId.slice(0,8)}),` ·`,` `,new Date(e.createdAt).toLocaleString()]})]},e.id))})]})]})]})}function m({agentId:e,senders:t,onSent:n}){let[r,i]=(0,l.useState)(t[0]?.id??``),[c,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1);if(t.length===0)return null;async function g(t){t.preventDefault(),p(null),h(!0);try{let t={from:r,payload:{text:c}};await s(`/api/agents/${encodeURIComponent(e)}/messages`,{body:t}),d(``),n()}catch(e){p(a(e))}finally{h(!1)}}return(0,u.jsxs)(`form`,{onSubmit:e=>void g(e),className:`mt-6 rounded-lg border bg-card p-4`,children:[(0,u.jsx)(`h2`,{className:`mb-2 font-serif text-lg text-foreground`,children:`Send a message to this Agent`}),(0,u.jsxs)(`label`,{children:[`From`,(0,u.jsx)(`select`,{value:r,onChange:e=>i(e.target.value),children:t.map(e=>(0,u.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.id.slice(0,8),`)`]},e.id))})]}),(0,u.jsxs)(`label`,{children:[`Message`,(0,u.jsx)(`textarea`,{required:!0,value:c,onChange:e=>d(e.target.value),className:`min-h-[80px] font-mono text-[0.9em]`})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,u.jsx)(o,{variant:`primary`,type:`submit`,disabled:m,children:m?`Sending…`:`Send`}),f&&(0,u.jsx)(`span`,{role:`alert`,className:`text-[0.85em] text-danger`,children:f})]})]})}export{p as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{a as r,f as i}from"./preload-helper-eUUcpe2S.js";import{N as a,_t as o,j as s,r as c}from"./index-1YXquAq8.js";var l=e(t()),u=n(),d=r(`/agents/$id`);function f(e){try{let t=JSON.parse(e);if(typeof t.text==`string`)return t.text}catch{}return e}function p(){let{agent:e}=d.useLoaderData(),{messages:t,unreadCount:n,selected:r,agentNames:p,senders:h,loopBreaks:g}=c.useLoaderData(),_=i(),[v,y]=(0,l.useState)(null),b=c.useSearch().unread===1,x=!!(r&&r.toAgentId!==e.id),S=`/agents/${encodeURIComponent(e.id)}/inbox`,C=e=>p[e]?`${p[e]} (${e.slice(0,8)})`:e.slice(0,8),w=e=>`-mb-px border-b-2 px-3 py-1.5 text-sm ${e?`border-primary font-semibold text-primary`:`border-transparent text-muted-foreground`}`;return(0,u.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-[360px_1fr]`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`div`,{className:`mb-3 flex items-center gap-1 border-b`,children:[(0,u.jsx)(`a`,{href:S,className:w(!b),children:`all`}),(0,u.jsx)(`a`,{href:`${S}?unread=1`,className:w(b),children:`unread`}),(0,u.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[`unread: `,n]})]}),(0,u.jsx)(`div`,{className:`max-h-[640px] overflow-y-auto rounded-lg border bg-card`,children:t.length===0?(0,u.jsx)(`div`,{className:`p-6 text-center italic text-muted-foreground`,children:b?`no unread messages`:`inbox empty`}):t.map(e=>{let t=f(e.payload),n=e.readAt===null;return(0,u.jsxs)(`a`,{href:`${S}${b?`?unread=1&id=${e.id}`:`?id=${e.id}`}`,className:`block border-b px-3 py-2 text-sm last:border-0 hover:bg-accent/30 ${r?.id===e.id?`bg-accent/40`:``} ${n?`font-medium`:``}`,children:[(0,u.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,u.jsxs)(`span`,{className:`font-mono`,children:[n&&(0,u.jsx)(`span`,{className:`mr-1.5 inline-block h-1.5 w-1.5 rounded-full bg-primary align-middle`}),`from `,C(e.fromAgentId)]}),(0,u.jsx)(`span`,{className:`font-mono`,children:new Date(e.createdAt).toLocaleString()})]}),(0,u.jsx)(`div`,{className:`mt-0.5 truncate text-foreground`,children:t.length>80?`${t.slice(0,80)}…`:t})]},e.id)})})]}),(0,u.jsxs)(`div`,{children:[r&&!x&&(0,u.jsxs)(`div`,{className:`mb-4 rounded-lg border bg-card p-5`,children:[(0,u.jsxs)(`div`,{className:`mb-2 space-y-0.5 font-mono text-xs text-muted-foreground`,children:[(0,u.jsxs)(`div`,{children:[`id: `,(0,u.jsx)(`code`,{children:r.id})]}),(0,u.jsxs)(`div`,{children:[`from: `,(0,u.jsx)(`code`,{children:C(r.fromAgentId)})]}),(0,u.jsxs)(`div`,{children:[`received: `,new Date(r.createdAt).toLocaleString()]}),(0,u.jsxs)(`div`,{children:[`read: `,r.readAt?new Date(r.readAt).toLocaleString():`(unread)`,!r.readAt&&(0,u.jsx)(o,{variant:`ghost`,className:`ml-2`,onClick:async()=>{y(null);try{await s(`/api/messages/${encodeURIComponent(r.id)}`,{method:`PATCH`,body:{read:!0}}),await _.invalidate()}catch(e){y(a(e))}},children:`Mark read`}),v&&(0,u.jsx)(`span`,{role:`alert`,className:`ml-2 text-danger`,children:v})]}),r.replyTo&&(0,u.jsxs)(`div`,{children:[`reply to: `,(0,u.jsx)(`code`,{children:r.replyTo})]})]}),(0,u.jsx)(`div`,{className:`whitespace-pre-wrap break-words border-t pt-3 font-mono text-sm`,children:f(r.payload)})]}),x&&(0,u.jsx)(`div`,{className:`mb-4 rounded-lg border bg-card p-5 text-muted-foreground`,children:`This message is not addressed to this Agent.`}),(0,u.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Agents exchange messages with their `,(0,u.jsx)(`code`,{className:`font-mono`,children:`send_message`}),` tool; an idle recipient picks up unread mail on the next scheduler tick.`]}),(0,u.jsx)(m,{agentId:e.id,senders:h,onSent:()=>_.invalidate()}),(0,u.jsxs)(`div`,{className:`mt-6 rounded-lg border bg-card p-4`,children:[(0,u.jsx)(`h2`,{className:`mb-2 font-serif text-lg text-foreground`,children:`Loop circuit breaker`}),g.length===0?(0,u.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No agent-message chains stopped.`}):(0,u.jsx)(`div`,{className:`space-y-3`,children:g.map(e=>(0,u.jsxs)(`div`,{className:`border-t pt-3 text-xs first:border-0 first:pt-0`,children:[(0,u.jsxs)(`div`,{className:`font-mono text-foreground`,children:[C(e.fromAgentId),` → `,C(e.toAgentId)]}),(0,u.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`stopped hop `,e.attemptedHop,` at limit `,e.maxHops,` · chain`,` `,(0,u.jsx)(`code`,{children:e.causalChainId.slice(0,8)}),` ·`,` `,new Date(e.createdAt).toLocaleString()]})]},e.id))})]})]})]})}function m({agentId:e,senders:t,onSent:n}){let[r,i]=(0,l.useState)(t[0]?.id??``),[c,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1);if(t.length===0)return null;async function g(t){t.preventDefault(),p(null),h(!0);try{let t={from:r,payload:{text:c}};await s(`/api/agents/${encodeURIComponent(e)}/messages`,{body:t}),d(``),n()}catch(e){p(a(e))}finally{h(!1)}}return(0,u.jsxs)(`form`,{onSubmit:e=>void g(e),className:`mt-6 rounded-lg border bg-card p-4`,children:[(0,u.jsx)(`h2`,{className:`mb-2 font-serif text-lg text-foreground`,children:`Send a message to this Agent`}),(0,u.jsxs)(`label`,{children:[`From`,(0,u.jsx)(`select`,{value:r,onChange:e=>i(e.target.value),children:t.map(e=>(0,u.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.id.slice(0,8),`)`]},e.id))})]}),(0,u.jsxs)(`label`,{children:[`Message`,(0,u.jsx)(`textarea`,{required:!0,value:c,onChange:e=>d(e.target.value),className:`min-h-[80px] font-mono text-[0.9em]`})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,u.jsx)(o,{variant:`primary`,type:`submit`,disabled:m,children:m?`Sending…`:`Send`}),f&&(0,u.jsx)(`span`,{role:`alert`,className:`text-[0.85em] text-danger`,children:f})]})]})}export{p as component};