bazilion 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/cli.js +672 -87
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +3759 -432
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/migrations/0001_init.sql +169 -0
  6. package/dist/web/client/assets/ChatPane-CAYS_fIQ.js +76 -0
  7. package/dist/web/client/assets/ConfirmDialog-BzIiABOP.js +1 -0
  8. package/dist/web/client/assets/{FieldRow-DJ2Gx4Du.js → FieldRow-W_54rw5c.js} +1 -1
  9. package/dist/web/client/assets/ProductionTeamPolicyEditor-DNXVX8Lz.js +7 -0
  10. package/dist/web/client/assets/ProfileCommunicationEditor-DN0fOzqn.js +1 -0
  11. package/dist/web/client/assets/{ResultSourceConversation-CtzJ8QA-.js → ResultSourceConversation-DoU4tOWc.js} +1 -1
  12. package/dist/web/client/assets/TeamTabs-BmTZRI4T.js +1 -0
  13. package/dist/web/client/assets/TemplatesTabs-Bs_OXKwx.js +1 -0
  14. package/dist/web/client/assets/{UnsavedChangesGuard-BCsLw-mU.js → UnsavedChangesGuard-CPRtFReU.js} +1 -1
  15. package/dist/web/client/assets/{_id-DxopIW-y.js → _id-CxAB4TDr.js} +1 -1
  16. package/dist/web/client/assets/_id-DL4tJFQB.js +1 -0
  17. package/dist/web/client/assets/{_id-BEDmIXVf.js → _id-DR9eFC17.js} +1 -1
  18. package/dist/web/client/assets/{_id-BFM_tn_s.js → _id-Dbmei5tg.js} +1 -1
  19. package/dist/web/client/assets/{_id-B5Ov7cdO.js → _id-ybF-pqmr.js} +1 -1
  20. package/dist/web/client/assets/activity-oUyy77jD.js +1 -0
  21. package/dist/web/client/assets/{agents-CMPOFcs-.js → agents-D_TrEqAg.js} +1 -1
  22. package/dist/web/client/assets/{agents-O4soKZND.js → agents-DkjJp7JP.js} +1 -1
  23. package/dist/web/client/assets/{approvals-CwDu_lrA.js → approvals-DhOerWdt.js} +1 -1
  24. package/dist/web/client/assets/{attention-BY8MMuM_.js → attention-DGwiF-Jy.js} +1 -1
  25. package/dist/web/client/assets/chevron-right-DSa4xPTs.js +1 -0
  26. package/dist/web/client/assets/config-BJ2ZzHPR.js +3 -0
  27. package/dist/web/client/assets/createServerFn-Dzfjt7mA.js +3 -0
  28. package/dist/web/client/assets/git-review-presentation-CzHQulDk.js +1 -0
  29. package/dist/web/client/assets/{inbox-CWXql0K3.js → inbox-BUElnGep.js} +1 -1
  30. package/dist/web/client/assets/index-Bi-HxcPG.js +50 -0
  31. package/dist/web/client/assets/{learning-DAm4dyyc.js → learning-BiTHNwB3.js} +1 -1
  32. package/dist/web/client/assets/login-BmcZvAH2.js +1 -0
  33. package/dist/web/client/assets/{mcp-loLB0wuh.js → mcp-Cwk9V82W.js} +1 -1
  34. package/dist/web/client/assets/{members-BJ0ikkTl.js → members-CHDNabFh.js} +1 -1
  35. package/dist/web/client/assets/{memory-Drn9Gv53.js → memory-Cx_Fpd4e.js} +1 -1
  36. package/dist/web/client/assets/policy-C0nMdwcG.js +1 -0
  37. package/dist/web/client/assets/{results-9exU6f7m.js → results-Bz3jASs-.js} +1 -1
  38. package/dist/web/client/assets/review-AK9WGmpv.js +1 -0
  39. package/dist/web/client/assets/routes-DsMY_6oy.js +1 -0
  40. package/dist/web/client/assets/{services-BLso1BhA.js → services-DItA6fJ7.js} +1 -1
  41. package/dist/web/client/assets/{skills-BodqX3OI.js → skills-DbNV2vgL.js} +1 -1
  42. package/dist/web/client/assets/{styles-d1yjBpud.css → styles-C6br2xxl.css} +1 -1
  43. package/dist/web/client/assets/{teams-ByQedXZi.js → teams-D83scDxw.js} +1 -1
  44. package/dist/web/client/assets/{teams-SYsF1bOR.js → teams-DAny1ypN.js} +1 -1
  45. package/dist/web/client/assets/{telegram-DC9PLFbB.js → telegram-BOmf9vUh.js} +1 -1
  46. package/dist/web/client/assets/{tokens-DGy8Ijpo.js → tokens-DBGH6Bw5.js} +1 -1
  47. package/dist/web/client/assets/{triggers-BXpVmHDG.js → triggers-D1_pseI3.js} +1 -1
  48. package/dist/web/client/assets/verifications-CBTo-FyV.js +2 -0
  49. package/dist/web/client/assets/welcome-DAfPOm15.js +1 -0
  50. package/dist/web/client/assets/x-CWY-gUaM.js +1 -0
  51. package/dist/web/server/assets/{ChatPane-CS5oI7ef.js → ChatPane-DybH39WK.js} +301 -14
  52. package/dist/web/server/assets/{ResultSourceConversation-BpVWBRYq.js → ResultSourceConversation-BmXTcEOA.js} +1 -1
  53. package/dist/web/server/assets/{TeamTabs-TCKjCvMA.js → TeamTabs-Dg4v6x0-.js} +8 -0
  54. package/dist/web/server/assets/{_id-DtIYuJJX.js → _id--onriuvj.js} +1 -1
  55. package/dist/web/server/assets/{_id-DOnInzLb.js → _id--zoh1vv7.js} +1 -1
  56. package/dist/web/server/assets/{_id-CeyHEsCZ.js → _id-6p-mDmI8.js} +1 -1
  57. package/dist/web/server/assets/{_id-5pgKoid8.js → _id-BN1BPEDI.js} +1 -1
  58. package/dist/web/server/assets/{_id-DFHB9JFQ.js → _id-BYKpT2Tu.js} +1 -1
  59. package/dist/web/server/assets/{_id-B_-CDHOi2.js → _id-BqWTB8Wl.js} +1 -1
  60. package/dist/web/server/assets/{_id-BnqodC1c2.js → _id-C_2er0_G.js} +3 -3
  61. package/dist/web/server/assets/{_id-BG2nkGxa.js → _id-DptBl3X8.js} +1 -1
  62. package/dist/web/server/assets/{_id-DwZXhLlL.js → _id-EAjRXNbD.js} +2 -2
  63. package/dist/web/server/assets/{_id-DrB9uR1b.js → _id-dUnXL-My2.js} +1 -1
  64. package/dist/web/server/assets/{_tanstack-start-manifest_v-D7gKv6m6.js → _tanstack-start-manifest_v-B3M-dfRO.js} +108 -84
  65. package/dist/web/server/assets/{activity-0VUkStOu.js → activity-C5jpoEQI.js} +1 -1
  66. package/dist/web/server/assets/{activity-C88qrNqv.js → activity-Cu7zKPGD.js} +1 -1
  67. package/dist/web/server/assets/{activity-5fWKPDxj.js → activity-Dn50vkQP.js} +2 -2
  68. package/dist/web/server/assets/{agents-CSXLaM2W.js → agents-RE6aYOb-.js} +1 -1
  69. package/dist/web/server/assets/{agents-C86K6HvS.js → agents-nAOx_H7s.js} +1 -1
  70. package/dist/web/server/assets/{approvals-C3MysI6l.js → approvals-DhHxIDrL.js} +1 -1
  71. package/dist/web/server/assets/{attention-DLeLCKah.js → attention-CBWzWRni.js} +1 -1
  72. package/dist/web/server/assets/{auth-CDZp9aEk.js → auth-tB3i6cFd.js} +1 -1
  73. package/dist/web/server/assets/{config-BVTHvljR.js → config-D1k_tTAw.js} +1 -1
  74. package/dist/web/server/assets/{daemon-client-xWyYKAcx.js → daemon-client-C7qjQ2iO.js} +45 -0
  75. package/dist/web/server/assets/git-review-BB3M9nYg.js +26 -0
  76. package/dist/web/server/assets/git-review-Bf5ABFJg.js +179 -0
  77. package/dist/web/server/assets/git-review-presentation-TJiHJhen.js +81 -0
  78. package/dist/web/server/assets/{inbox-PQTrjtOw.js → inbox-Dw4pTevh.js} +1 -1
  79. package/dist/web/server/assets/{learning-K0cmDsZR.js → learning-CF8ZzFVD.js} +1 -1
  80. package/dist/web/server/assets/{mcp-Rtraochg.js → mcp-D5dmBT82.js} +1 -1
  81. package/dist/web/server/assets/{members-CD3GiTfF.js → members-Bd0OtiTr.js} +1 -1
  82. package/dist/web/server/assets/{members-grAKFWgv.js → members-CvwEN9pm.js} +1 -1
  83. package/dist/web/server/assets/{members-cc5SeEaW.js → members-xSXoYUOd.js} +2 -2
  84. package/dist/web/server/assets/{memory-egFpBD1g.js → memory-CcPK7um7.js} +1 -1
  85. package/dist/web/server/assets/{memory-C5i_GxlY.js → memory-UP6AsRkO.js} +2 -2
  86. package/dist/web/server/assets/{memory-CVqnyUaM.js → memory-lo2vHRNw.js} +1 -1
  87. package/dist/web/server/assets/{policy-bLKwvnja.js → policy-B62WXIFo.js} +1 -1
  88. package/dist/web/server/assets/{policy-Dgjb0_gK.js → policy-Bze9Krhg.js} +2 -2
  89. package/dist/web/server/assets/{policy-ooSBgiDS.js → policy-Dh6wd2wN.js} +1 -1
  90. package/dist/web/server/assets/{results-N-kP4iFT.js → results-BFqs2iOu.js} +1 -1
  91. package/dist/web/server/assets/{results-DXdYtHaq.js → results-BWnu3gXP.js} +1 -1
  92. package/dist/web/server/assets/{results-CfNsFncJ.js → results-CzZk50Fu.js} +3 -3
  93. package/dist/web/server/assets/review-DUe3vHPU.js +393 -0
  94. package/dist/web/server/assets/review-c_-cFi7H.js +14 -0
  95. package/dist/web/server/assets/{router-B6g_s7W3.js → router-Deq94UJQ.js} +41 -27
  96. package/dist/web/server/assets/{routes-pcRy_Sf8.js → routes-B6x3pEW8.js} +1 -1
  97. package/dist/web/server/assets/{routes-BqSaZvlu.js → routes-CVKkvFVv.js} +1 -1
  98. package/dist/web/server/assets/{routes-Dsh8F_7i.js → routes-DsUzzxk4.js} +2 -2
  99. package/dist/web/server/assets/{services-DlZA8fRL.js → services-CEr61xb5.js} +1 -1
  100. package/dist/web/server/assets/{skills-i2duvgW-.js → skills-BImC3LTO.js} +1 -1
  101. package/dist/web/server/assets/{teams-6RYIj1Xm.js → teams-8zEIo08E.js} +1 -1
  102. package/dist/web/server/assets/{teams-B1AI3NfN.js → teams-D-yaAWLV.js} +1 -1
  103. package/dist/web/server/assets/{telegram-C4q0YTVn.js → telegram-CGl_LFtJ.js} +1 -1
  104. package/dist/web/server/assets/{tokens-RFquA2Bx.js → tokens-cB-uf7qm.js} +1 -1
  105. package/dist/web/server/assets/{triggers-DVD-iE-N.js → triggers-CtSj79L0.js} +1 -1
  106. package/dist/web/server/assets/verification-B5QjcpIo.js +97 -0
  107. package/dist/web/server/assets/verifications-BfQsfwSE.js +268 -0
  108. package/dist/web/server/assets/verifications-CUq_6ZqL.js +26 -0
  109. package/dist/web/server/server.js +72 -28
  110. package/dist/worker.js +470 -79
  111. package/dist/worker.js.map +1 -1
  112. package/package.json +3 -3
  113. package/dist/web/client/assets/ChatPane-CQZzxOir.js +0 -76
  114. package/dist/web/client/assets/ConfirmDialog-MicTTwdy.js +0 -1
  115. package/dist/web/client/assets/ProductionTeamPolicyEditor-DqUnN_ce.js +0 -7
  116. package/dist/web/client/assets/ProfileCommunicationEditor-DArXub0b.js +0 -1
  117. package/dist/web/client/assets/TeamTabs-DbIk5vvT.js +0 -1
  118. package/dist/web/client/assets/TemplatesTabs-CatJIjGi.js +0 -1
  119. package/dist/web/client/assets/_id-CrnEVcw8.js +0 -1
  120. package/dist/web/client/assets/activity-CrG8Bg60.js +0 -1
  121. package/dist/web/client/assets/chevron-right-Cf6vKeLq.js +0 -1
  122. package/dist/web/client/assets/config-Cn4iBJFz.js +0 -3
  123. package/dist/web/client/assets/index-Bq2zrG2_.js +0 -52
  124. package/dist/web/client/assets/login-BsABI8Ux.js +0 -1
  125. package/dist/web/client/assets/policy-pQadZyk0.js +0 -1
  126. package/dist/web/client/assets/routes-jw1PuqiR.js +0 -1
  127. package/dist/web/client/assets/welcome-BKsnsCxJ.js +0 -1
  128. package/dist/web/client/assets/x-BK4xNCzS.js +0 -1
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{D as t,G as n,O as r,X as i,Y as a,Z as o}from"./index-Bq2zrG2_.js";var s=a(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),c=a(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),l=e();function u(){let{error:e,resultId:a}=t.useSearch();return(0,l.jsxs)(`main`,{className:`relative flex min-h-dvh items-center overflow-hidden bg-cream px-5 py-16 sm:px-8`,children:[(0,l.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,style:{background:`radial-gradient(circle at 16% 12%, rgba(61,120,153,0.18), transparent 36rem), radial-gradient(circle at 88% 84%, rgba(196,135,138,0.13), transparent 32rem)`}}),(0,l.jsx)(`div`,{className:`absolute right-4 top-4 z-10 sm:right-6 sm:top-6`,children:(0,l.jsx)(r,{})}),(0,l.jsxs)(`div`,{className:`relative mx-auto grid w-full max-w-5xl items-center gap-10 lg:grid-cols-[minmax(0,1fr)_25rem] lg:gap-20`,children:[(0,l.jsxs)(`section`,{className:`hidden lg:block`,children:[(0,l.jsxs)(`div`,{className:`mb-8 flex items-center gap-3`,children:[(0,l.jsx)(o,{className:`h-12 w-12`}),(0,l.jsx)(`span`,{className:`font-display text-3xl tracking-[-0.03em] text-charcoal`,children:`bazilion`})]}),(0,l.jsx)(`h1`,{className:`max-w-xl text-[3.4rem] leading-[0.98] tracking-[-0.035em]`,children:`Your agents, working as one thoughtful team.`}),(0,l.jsx)(`p`,{className:`mt-6 max-w-lg text-base leading-7 text-mocha`,children:`A private workspace for long-lived agents, shared context, and communication policies you can actually see and control.`}),(0,l.jsxs)(`div`,{className:`mt-8 grid max-w-lg gap-3 sm:grid-cols-2`,children:[(0,l.jsx)(d,{icon:(0,l.jsx)(c,{className:`h-4 w-4`}),label:`Persistent conversations`}),(0,l.jsx)(d,{icon:(0,l.jsx)(n,{className:`h-4 w-4`}),label:`Team-owned context`})]})]}),(0,l.jsxs)(`section`,{className:`w-full rounded-[24px] border border-frost bg-snow/95 p-7 shadow-baziu-lg backdrop-blur sm:p-9`,children:[(0,l.jsxs)(`div`,{className:`mb-6 flex items-center gap-3 lg:hidden`,children:[(0,l.jsx)(o,{className:`h-10 w-10`}),(0,l.jsx)(`span`,{className:`font-display text-2xl text-charcoal`,children:`bazilion`})]}),(0,l.jsx)(`div`,{className:`mb-6 flex h-10 w-10 items-center justify-center rounded-xl bg-sapphire-glow text-sapphire`,children:(0,l.jsx)(s,{className:`h-5 w-5`,"aria-hidden":`true`})}),(0,l.jsx)(`h2`,{className:`font-display text-3xl text-charcoal`,children:`Open Bazilion`}),(0,l.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-mocha-light`,children:`Use the fresh-install credential once, then a named device token for future sign-ins.`}),e===`token`&&(0,l.jsxs)(`div`,{className:`err mt-5`,role:`alert`,children:[`That credential was not accepted. On first run, use the bootstrap token from`,` `,(0,l.jsx)(`code`,{children:`auth.json`}),`; afterward, use a named device token.`]}),e===`origin`&&(0,l.jsx)(`div`,{className:`err mt-5`,role:`alert`,children:`Bazilion blocked the sign-in request because its browser origin was hidden. Reload this page and try again from the configured Bazilion address.`}),(0,l.jsxs)(`form`,{method:`POST`,action:`/api/login`,className:`mt-6 text-left`,children:[a&&(0,l.jsx)(`input`,{type:`hidden`,name:`resultId`,value:a}),(0,l.jsx)(`label`,{htmlFor:`token`,className:`block text-[0.85em] font-semibold text-mocha`,children:`Access token`}),(0,l.jsx)(`input`,{type:`password`,id:`token`,name:`token`,autoFocus:!0,required:!0,placeholder:`Paste your token`,className:`mb-4`}),(0,l.jsx)(`button`,{type:`submit`,className:`w-full`,children:`Open Bazilion`})]}),(0,l.jsxs)(`p`,{className:`mt-5 rounded-xl bg-ivory px-3 py-2.5 text-[0.78em] leading-relaxed text-mocha-light`,children:[`Fresh install? Paste the bootstrap token from `,(0,l.jsx)(`code`,{children:`auth.json`}),`; it is accepted only until provider setup is complete and is exchanged for a bounded session. For later sign-ins, run `,(0,l.jsx)(`code`,{children:`bazilion token create browser`}),` on the server.`]})]})]}),(0,l.jsxs)(`footer`,{className:`absolute bottom-4 left-0 right-0 text-center text-xs text-mocha-light`,children:[`dedicated to Baziu`,(0,l.jsx)(i,{className:`ml-1 inline-block h-3 w-3 align-[-1px] opacity-40`})]})]})}function d({icon:e,label:t}){return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border border-frost bg-snow/70 px-3 py-2.5 text-sm font-semibold text-mocha shadow-baziu-sm`,children:[(0,l.jsx)(`span`,{className:`text-sapphire`,children:e}),t]})}export{u as component};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{n as r,t as i}from"./ProductionTeamPolicyEditor-DqUnN_ce.js";import{Y as a,u as o}from"./index-Bq2zrG2_.js";import{r as s}from"./Page-NV96O47A.js";import{t as c}from"./Button-ByiV6fpd.js";import{t as l}from"./RecoveryState-QfMSuwy3.js";import{t as u}from"./TeamTabs-DbIk5vvT.js";var d=a(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),f=a(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),p=e(n(),1),m=t();function h({teamId:e,detail:t,templates:n}){let[i,a]=(0,p.useState)(null),[o,s]=(0,p.useState)(null),[l,u]=(0,p.useState)(!1),[h,v]=(0,p.useState)(`${e}-snapshot`),[y,b]=(0,p.useState)(`${e} snapshot`),x=(0,p.useMemo)(()=>new Set(t.bindings.map(e=>e.agentId)),[t.bindings]),S=t.members.filter(e=>!x.has(e.id)),C=async()=>{let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/diff`);if(!t.ok)throw Error((await t.json().catch(()=>null))?.error??`Could not load source comparison`);a(await t.json())};return(0,p.useEffect)(()=>{C().catch(e=>s(e instanceof Error?e.message:String(e)))},[e]),(0,m.jsxs)(`section`,{className:`card space-y-4`,"aria-labelledby":`source-workflows`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,m.jsx)(d,{className:`mt-1 h-5 w-5 text-sapphire`}),(0,m.jsxs)(`div`,{className:`mr-auto`,children:[(0,m.jsx)(`h2`,{id:`source-workflows`,className:`m-0 text-lg`,children:`Baseline and source`}),(0,m.jsx)(`p`,{className:`muted mt-1 text-sm`,children:`Lineage is retained for comparison; source edits never auto-propagate.`})]}),(0,m.jsxs)(c,{variant:`ghost`,onClick:()=>void C(),children:[(0,m.jsx)(f,{className:`h-4 w-4`}),`Refresh comparison`]})]}),i?(0,m.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,m.jsx)(g,{label:`Baseline`,value:i.baseline?`${i.baseline.templateId} r${i.baseline.templateRevision}`:`None`}),(0,m.jsx)(g,{label:`Live changes`,value:`+${i.comparison.addedSinceBaseline.length} / −${i.comparison.removedSinceBaseline.length} edges`}),(0,m.jsx)(g,{label:`Source slots`,value:`+${i.comparison.currentSourceAddedSlotIds.length} / −${i.comparison.currentSourceRemovedSlotIds.length}`}),(0,m.jsx)(g,{label:`Source state`,value:i.currentSource?i.sourceDiverged?`Diverged — rebaseline required`:`Aligned`:`Missing/tombstoned`,warning:i.sourceDiverged||!i.currentSource})]}):(0,m.jsx)(`p`,{className:`muted`,children:`Loading comparison…`}),i?.sourceDiverged&&(0,m.jsx)(`div`,{role:`alert`,className:`rounded-md border border-warning/25 bg-warning/10 p-3 text-sm text-warning`,children:`The source has changed since this Team retained its baseline. Both versions remain intact. Update-source is disabled; compare and explicitly rebaseline instead.`}),i?.currentSource&&!i.sourceDiverged&&(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,m.jsxs)(`p`,{className:`mr-auto text-sm`,children:[`Promote the current live policy to `,(0,m.jsx)(`strong`,{children:i.currentSource.template.name}),`, including `,S.length,` live-only Agent`,S.length===1?``:`s`,`.`]}),(0,m.jsx)(c,{variant:`ghost`,disabled:l,onClick:async()=>{if(!(!i?.currentSource||i.sourceDiverged)){u(!0),s(null);try{let n=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/update-source`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({teamExpectedRevision:t.teamPolicy.revision,templateExpectedRevision:i.currentSource.template.currentRevision,includeAgentIds:S.map(e=>e.id)})});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??`Update failed (${n.status})`);window.location.reload()}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}},children:`Update source after review`})]}),(0,m.jsxs)(`div`,{className:`grid gap-3 border-t border-frost pt-4 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,m.jsxs)(`label`,{className:`text-xs`,children:[`New template ID`,(0,m.jsx)(`input`,{value:h,onChange:e=>v(e.target.value)})]}),(0,m.jsxs)(`label`,{className:`text-xs`,children:[`New template name`,(0,m.jsx)(`input`,{value:y,onChange:e=>b(e.target.value)})]}),(0,m.jsxs)(c,{variant:`primary`,disabled:l||!h.trim()||!y.trim(),onClick:async()=>{u(!0),s(null);try{let n=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/save-as-template`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({expectedRevision:t.teamPolicy.revision,id:h,name:y})});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??`Save failed (${n.status})`);let r=await n.json();window.location.assign(`/templates/teams/${encodeURIComponent(r.template.id)}`)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}},children:[(0,m.jsx)(r,{className:`h-4 w-4`}),`Save independent Team template`]})]}),o&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:o}),(0,m.jsx)(_,{teamId:e,detail:t,templates:n})]})}function g({label:e,value:t,warning:n=!1}){return(0,m.jsxs)(`div`,{className:`rounded-md border p-3 ${n?`border-warning/25 bg-warning/10 dark:bg-amber-950/30`:`border-frost bg-ivory`}`,children:[(0,m.jsx)(`dt`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:e}),(0,m.jsx)(`dd`,{className:`mt-1 break-words text-sm font-semibold`,children:t})]})}function _({teamId:e,detail:t,templates:n}){let[r,i]=(0,p.useState)(n.find(e=>!e.deletedAt)?.id??``),[a,o]=(0,p.useState)(null),[s,l]=(0,p.useState)({}),[u,d]=(0,p.useState)({}),[f,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),v=async()=>{_(null),h(null);let e=await fetch(`/api/team-templates/${encodeURIComponent(r)}`);if(!e.ok){_(`Could not load Team (${e.status})`);return}let n=await e.json();o(n);let i={};n.slots.forEach((e,n)=>{let r=t.members[n];r&&(i[e.slotId]=r.id)}),l(i);let a=new Set(Object.values(i));d(Object.fromEntries(t.members.filter(e=>!a.has(e.id)).map(e=>[e.id,`isolated`])))},y=()=>({teamExpectedRevision:t.teamPolicy.revision,templateId:a?.template.id,templateExpectedRevision:a?.template.currentRevision,slotMappings:a?.slots.map(e=>({slotId:e.slotId,agentId:s[e.slotId]}))??[],remainingPlacements:t.members.filter(e=>!Object.values(s).includes(e.id)).map(e=>({agentId:e.id,placement:u[e.id]??`isolated`}))});return(0,m.jsxs)(`div`,{className:`space-y-4 border-t border-frost pt-5`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h3`,{className:`m-0 text-base`,children:`Adopt or rebaseline from Team Template`}),(0,m.jsx)(`p`,{className:`muted mt-1 text-sm`,children:`Map every stable source slot to one current Agent, choose placement for remaining Agents, then review the daemon-resolved edge set.`})]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,m.jsxs)(`label`,{className:`min-w-52 flex-1 text-xs`,children:[`Team Template`,(0,m.jsx)(`select`,{value:r,onChange:e=>{i(e.target.value),o(null),h(null)},children:n.filter(e=>!e.deletedAt).map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.name,` · r`,e.currentRevision]},e.id))})]}),(0,m.jsx)(c,{variant:`ghost`,onClick:v,children:`Configure mapping`})]}),a&&(0,m.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Stable slots`}),a.slots.map(e=>(0,m.jsxs)(`label`,{className:`block text-xs`,children:[(0,m.jsxs)(`span`,{className:`block truncate`,title:e.slotId,children:[e.agentName,` · slot `,(0,m.jsx)(`code`,{children:e.slotId.slice(0,8)})]}),(0,m.jsxs)(`select`,{value:s[e.slotId]??``,onChange:t=>{l(n=>({...n,[e.slotId]:t.target.value})),h(null)},children:[(0,m.jsx)(`option`,{value:``,children:`Select Agent…`}),t.members.map(t=>(0,m.jsxs)(`option`,{value:t.id,disabled:Object.entries(s).some(([n,r])=>n!==e.slotId&&r===t.id),children:[t.name,t.status===`archived`?` (archived)`:``]},t.id))]})]},e.slotId))]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(`p`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:`Remaining live Agents`}),t.members.filter(e=>!Object.values(s).includes(e.id)).map(e=>(0,m.jsxs)(`label`,{className:`block text-xs`,children:[e.name,(0,m.jsxs)(`select`,{value:u[e.id]??`isolated`,onChange:t=>{d(n=>({...n,[e.id]:t.target.value})),h(null)},children:[(0,m.jsx)(`option`,{value:`isolated`,children:`Isolated`}),(0,m.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`})]})]},e.id))]})]}),a&&(0,m.jsx)(c,{variant:`ghost`,onClick:async()=>{if(!a||a.slots.some(e=>!s[e.slotId])||new Set(Object.values(s)).size!==a.slots.length){_(`Map every stable slot to a distinct current Agent.`);return}let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/adopt-template/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(y())}),n=await t.json().catch(()=>null);if(!t.ok){_(n?.error??`Preview failed (${t.status})`);return}h(n.edges)},children:`Review exact resulting policy`}),f&&(0,m.jsxs)(`div`,{className:`rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,m.jsxs)(`p`,{children:[`The daemon resolved `,(0,m.jsx)(`strong`,{children:f.length}),` directed allow edges. This preview is submitted unchanged and recomputed transactionally at commit.`]}),(0,m.jsx)(`div`,{className:`mt-2 max-h-40 overflow-auto`,children:(0,m.jsx)(`ul`,{children:f.map((e,t)=>(0,m.jsx)(`li`,{children:(0,m.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))})}),(0,m.jsx)(c,{variant:`primary`,className:`mt-3`,onClick:async()=>{if(!f)return;let t=await fetch(`/api/teams/${encodeURIComponent(e)}/policy/adopt-template`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...y(),previewEdges:f})}),n=await t.json().catch(()=>null);if(!t.ok){_(n?.error??`Rebaseline failed (${t.status})`);return}window.location.reload()},children:`Commit reviewed rebaseline`})]}),g&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:g})]})}function v(){let e=o.useLoaderData();if(!e.ok)return(0,m.jsx)(l,{title:`Team policy unavailable`,error:Error(e.error),reset:()=>window.location.reload(),fallbackHref:`/teams`});let{detail:t,profiles:n,templates:r}=e.value,{id:a}=o.useParams(),c=o.useSearch(),d=t.baseline;return(0,m.jsxs)(s,{size:`wide`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h1`,{children:`Team policy`}),(0,m.jsxs)(`p`,{className:`muted`,children:[`The sole effective live communication policy for `,(0,m.jsx)(`code`,{children:a}),`.`]})]}),(0,m.jsx)(u,{teamId:a}),(0,m.jsxs)(`section`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,"aria-label":`Policy status`,children:[(0,m.jsx)(y,{label:`Revision`,value:t.teamPolicy.revision}),(0,m.jsx)(y,{label:`Allow edges`,value:t.edges.length}),(0,m.jsx)(y,{label:`Baseline`,value:d?`${d.templateId} r${d.templateRevision}`:`Not initialized`})]}),(0,m.jsx)(i,{source:{kind:`live`,teamId:a,detail:t},profiles:n,initialUi:{view:c.view,selectedId:c.selected,viewport:{x:c.vx,y:c.vy,zoom:c.vz}}}),(0,m.jsx)(h,{teamId:a,detail:t,templates:r})]})}function y({label:e,value:t}){return(0,m.jsxs)(`div`,{className:`card`,children:[(0,m.jsx)(`dt`,{className:`muted text-xs`,children:e}),(0,m.jsx)(`dd`,{className:`break-words font-semibold`,children:t})]})}export{v as component};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{a as r,d as i,o as a}from"./preload-helper-bztXdkDj.js";import{t as o}from"./chevron-right-Cf6vKeLq.js";import{n as s,t as c}from"./x-BK4xNCzS.js";import{a as l,c as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./ConfirmDialog-MicTTwdy.js";import{E as _,G as v,H as y,J as b,Y as x,q as S}from"./index-Bq2zrG2_.js";import{n as C,t as w}from"./utils-B6KiDbIe.js";import{t as T}from"./Button-ByiV6fpd.js";import{t as E}from"./ChatPane-CQZzxOir.js";import"./wire-constants-CBD-lTaa.js";var D=x(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),O=x(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),k=x(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),A=e(n(),1),j=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,M=C,N=(e,t)=>n=>{if(t?.variants==null)return M(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=j(t)||j(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return M(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},P=t(),F=N(`team/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-team]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-team]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-team]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-team]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function I({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,P.jsx)(r?y:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:w(F({variant:t,size:n,className:e})),...i})}function L({...e}){return(0,P.jsx)(f,{"data-slot":`dialog`,...e})}function R({...e}){return(0,P.jsx)(h,{"data-slot":`dialog-portal`,...e})}function z({className:e,...t}){return(0,P.jsx)(p,{"data-slot":`dialog-overlay`,className:w(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function B({className:e,children:t,showCloseButton:n=!0,...r}){return(0,P.jsxs)(R,{children:[(0,P.jsx)(z,{}),(0,P.jsxs)(d,{"data-slot":`dialog-content`,className:w(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,P.jsx)(m,{"data-slot":`dialog-close`,asChild:!0,children:(0,P.jsxs)(I,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,P.jsx)(c,{}),(0,P.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function V({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`dialog-header`,className:w(`flex flex-col gap-2`,e),...t})}function H({className:e,showCloseButton:t=!1,children:n,...r}){return(0,P.jsxs)(`div`,{"data-slot":`dialog-footer`,className:w(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(I,{variant:`outline`,children:`Close`})})]})}function U({className:e,...t}){return(0,P.jsx)(u,{"data-slot":`dialog-title`,className:w(`font-heading text-base leading-none font-medium`,e),...t})}function W({className:e,...t}){return(0,P.jsx)(l,{"data-slot":`dialog-description`,className:w(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function G({onClose:e}){let t=i(),[n,r]=(0,A.useState)(``),[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(``),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(null);async function p(r){if(r.preventDefault(),f(null),!n.trim()){f(`id is required`);return}u(!0);try{let r={id:n.trim()};a.trim()&&(r.name=a.trim()),s.trim()&&(r.link=s.trim());let i=await fetch(`/api/teams`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??`${i.status} ${i.statusText}`)}e(),await t.invalidate()}catch(e){f(e.message),u(!1)}}return(0,P.jsx)(L,{open:!0,onOpenChange:t=>{!t&&!l&&e()},children:(0,P.jsx)(B,{showCloseButton:!l,className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,onEscapeKeyDown:e=>{l&&e.preventDefault()},onPointerDownOutside:e=>{l&&e.preventDefault()},children:(0,P.jsxs)(`form`,{onSubmit:p,children:[(0,P.jsxs)(V,{children:[(0,P.jsx)(U,{className:`font-serif text-2xl text-foreground`,children:`Create a team`}),(0,P.jsxs)(W,{children:[`A team is a collaboration context — one filesystem root, one USER.md, one roster. The slot lives at `,(0,P.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/teams/<slug>/`}),`.`]})]}),(0,P.jsxs)(`div`,{className:`mb-3 mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`label`,{className:`block text-sm`,children:[`ID (slug)`,(0,P.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),required:!0,pattern:`[a-z0-9][a-z0-9_-]*`,placeholder:`myproject`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]}),(0,P.jsxs)(`label`,{className:`block text-sm`,children:[`Name `,(0,P.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`}),(0,P.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]})]}),(0,P.jsxs)(`label`,{className:`mb-3 block text-sm`,children:[`Link target`,` `,(0,P.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional, absolute path)`}),(0,P.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`/home/you/projects/myrepo`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`}),(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Leave blank to create a fresh directory. Supply an absolute path to materialize the slot as a symlink to your existing project tree.`})]}),d&&(0,P.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:d}),(0,P.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,P.jsx)(T,{variant:`ghost`,disabled:l,onClick:e,children:`Cancel`}),(0,P.jsx)(T,{variant:`primary`,type:`submit`,disabled:l,children:l?`Creating…`:`Create team`})]})]})})})}function K({profileId:e,teamHint:t,teams:n,onClose:r}){let i=a(),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(t??n.find(e=>e.id==="default")?.id??n[0]?.id??``),[u,d]=(0,A.useState)(`profile_defaults`),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(null),[g,_]=(0,A.useState)(null);async function v(){let t=await fetch(`/api/teams/${encodeURIComponent(c)}/policy`);if(!t.ok)throw Error(`The selected Team policy is unavailable. Reload and try again.`);let n=await t.json();return{current:n,body:{profileId:e,teamId:c,teamExpectedRevision:n.teamPolicy.revision,placement:u}}}async function y(){h(null),p(!0);try{let{body:e}=await v(),t=await fetch(`/api/agents/placement-preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`Preview failed (${t.status})`)}_(await t.json())}catch(e){h(e.message)}finally{p(!1)}}async function b(t){t.preventDefault(),h(null),p(!0);try{if(!g){await y();return}let t={profile:e,teamExpectedRevision:g.currentRevision,placement:u};o.trim()&&(t.name=o.trim()),c&&(t.teamId=c);let n=await fetch(`/api/agents`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}let a=(await n.json()).agent;r(),await i({to:`/`,search:{agent:a.id}})}catch(e){h(e.message),p(!1)}}return(0,P.jsx)(L,{open:!0,onOpenChange:e=>{!e&&!f&&r()},children:(0,P.jsx)(B,{showCloseButton:!f,className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,onEscapeKeyDown:e=>{f&&e.preventDefault()},onPointerDownOutside:e=>{f&&e.preventDefault()},children:(0,P.jsxs)(`form`,{onSubmit:b,children:[(0,P.jsxs)(V,{children:[(0,P.jsx)(U,{className:`font-serif text-xl text-foreground`,children:`Spawn a new agent`}),(0,P.jsxs)(W,{children:[`Create an agent from profile `,(0,P.jsx)(`code`,{className:`font-mono`,children:e}),`, then review its exact Team policy placement before committing.`]})]}),(0,P.jsxs)(`label`,{className:`mb-3 mt-4 block text-sm text-foreground`,children:[`Agent name`,` `,(0,P.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional — defaults to the profile's name)`}),(0,P.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`})]}),(0,P.jsxs)(`label`,{className:`mb-3 block text-sm text-foreground`,children:[`Initial policy placement`,(0,P.jsxs)(`select`,{value:u,onChange:e=>{d(e.target.value),_(null)},className:`mt-1 block w-full rounded-md border bg-background px-3 py-2`,children:[(0,P.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`}),(0,P.jsx)(`option`,{value:`isolated`,children:`Isolated`})]}),(0,P.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`The current Team revision is checked again when you submit.`})]}),(0,P.jsxs)(`label`,{className:`mb-3 block text-sm text-foreground`,children:[`Team`,(0,P.jsx)(`select`,{value:c,onChange:e=>{l(e.target.value),_(null)},className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 outline-none focus:ring-2 focus:ring-ring/30`,children:n.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.name,e.id==="default"?` (default)`:``]},e.id))})]}),m&&(0,P.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:m}),g&&(0,P.jsxs)(`div`,{role:`status`,className:`mt-3 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,P.jsxs)(`p`,{children:[`Creating this Agent advances Team revision `,g.currentRevision,` →`,` `,(0,P.jsx)(`strong`,{children:g.resultingRevision}),` and adds`,` `,(0,P.jsx)(`strong`,{children:g.addedEdges.length}),` directed edges to the existing`,` `,g.existingEdges.length,`.`]}),(0,P.jsx)(`ul`,{className:`mt-2 max-h-36 overflow-auto`,children:g.addedEdges.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))}),g.addedEdges.length===0&&(0,P.jsx)(`p`,{className:`mt-2`,children:`The new Agent starts isolated.`})]}),(0,P.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,P.jsx)(T,{variant:`ghost`,disabled:f,onClick:r,children:`Cancel`}),(0,P.jsx)(T,{variant:`primary`,type:`submit`,disabled:f,children:f?`Working…`:g?`Commit reviewed creation`:`Review exact policy`})]})]})})})}function q({profileGroup:e,teams:t,onClose:n,onSpawned:r}){let[i,a]=(0,A.useState)(``),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(null),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(null);async function m(){let n=i.trim();if(!n)throw Error(`Target Team slug is required`);let r=t.find(e=>e.id===n),a;if(r){let e=await fetch(`/api/teams/${encodeURIComponent(n)}/policy`);if(!e.ok)throw Error(`The target Team policy is unavailable.`);a=(await e.json()).teamPolicy.revision}return{target:n,body:{templateExpectedRevision:e.currentRevision,teamId:n,...a?{teamExpectedRevision:a}:{},mode:r?`append`:`initialize`,...o?{userMd:o}:{}}}}async function h(){d(!0),l(null),p(null);try{let{body:t}=await m(),n=await fetch(`/api/team-templates/${encodeURIComponent(e.id)}/spawn/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error((await n.json().catch(()=>null))?.error??n.statusText);p(await n.json())}catch(e){l(e.message)}finally{d(!1)}}async function g(){let t=i.trim();if(!t){l(`Target Team slug is required`);return}d(!0),l(null);try{let{body:n}=await m(),i=await fetch(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!i.ok)throw Error((await i.json().catch(()=>null))?.error??i.statusText);r(t)}catch(e){l(e.message)}finally{d(!1)}}return(0,P.jsx)(L,{open:!0,onOpenChange:e=>{!e&&!u&&n()},children:(0,P.jsxs)(B,{showCloseButton:!u,className:`max-h-[calc(100dvh-2rem)] w-full max-w-lg overflow-y-auto rounded-3xl border border-frost bg-card p-6 shadow-baziu-lg sm:p-7`,onEscapeKeyDown:e=>{u&&e.preventDefault()},onPointerDownOutside:e=>{u&&e.preventDefault()},children:[(0,P.jsxs)(V,{children:[(0,P.jsxs)(U,{className:`font-serif text-xl text-foreground`,children:[`Spawn team — `,e.name]}),(0,P.jsxs)(W,{children:[`Uses immutable Team revision `,e.currentRevision,`. Existing Teams append at their current reviewed revision; a new Team initializes at revision 1. Conflicts never overwrite newer state.`]})]}),c&&(0,P.jsx)(`div`,{role:`alert`,className:`err`,children:c}),(0,P.jsxs)(`label`,{children:[`Target Team slug`,(0,P.jsx)(`input`,{value:i,onChange:e=>{a(e.target.value),p(null)},list:`canonical-teams`,required:!0}),(0,P.jsx)(`datalist`,{id:`canonical-teams`,children:t.map(e=>(0,P.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,P.jsxs)(`label`,{children:[`Starter USER.md (new Team only)`,(0,P.jsx)(`textarea`,{rows:3,value:o,onChange:e=>{s(e.target.value),p(null)},className:`font-mono text-[0.88em] leading-[1.55]`})]}),f&&(0,P.jsxs)(`div`,{role:`status`,className:`mt-4 rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,P.jsxs)(`p`,{children:[(0,P.jsx)(`strong`,{children:f.mode===`initialize`?`Initialize`:`Append`}),` produces Team revision `,f.resultingRevision,`, adds `,f.newMembers.length,` Agents, and results in `,f.edges.length,` directed allow edges.`]}),(0,P.jsx)(`ul`,{className:`mt-2 max-h-40 overflow-auto`,children:f.newMembers.map(e=>(0,P.jsxs)(`li`,{children:[e.agentName,` · stable source slot `,(0,P.jsx)(`code`,{children:e.slotId})]},e.slotId))}),(0,P.jsxs)(`details`,{className:`mt-2`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer`,children:`Review exact edge topology`}),(0,P.jsx)(`ul`,{className:`mt-2 max-h-40 overflow-auto`,children:f.edges.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`code`,{children:[e.sourceKind,e.sourceId?`:${e.sourceId}`:``,` → `,e.targetKind,e.targetId?`:${e.targetId}`:``]})},`${e.sourceKind}:${e.sourceId??``}>${e.targetKind}:${e.targetId??``}:${t}`))})]})]}),(0,P.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,P.jsx)(T,{variant:`ghost`,disabled:u,onClick:n,children:`Cancel`}),f?(0,P.jsx)(T,{variant:`primary`,onClick:g,disabled:u,children:u?`Spawning…`:`Commit ${f.mode}`}):(0,P.jsx)(T,{variant:`primary`,onClick:h,disabled:u||e.slotCount===0,children:u?`Reviewing…`:`Review exact result`})]})]})})}var J=`bz_sidebar_open_groups`;function Y(e){if(typeof document>`u`)return;let t=encodeURIComponent(JSON.stringify(e));document.cookie=`${J}=${t}; Path=/; Max-Age=31536000; SameSite=Lax`}function X({agents:e,teams:t,profiles:n,profileGroups:a,selectedAgentId:c,initialOpenGroups:l}){let u=i(),[d,f]=(0,A.useState)(null),[p,m]=(0,A.useState)(null),[h,_]=(0,A.useState)(!1),[y,x]=(0,A.useState)(!1),[C,w]=(0,A.useState)(null),[T,E]=(0,A.useState)(null),[j,M]=(0,A.useState)(null),N=(0,A.useRef)(null),F=(0,A.useRef)(null),I=()=>window.requestAnimationFrame(()=>N.current?.focus()),[L,R]=(0,A.useState)(()=>l??{});(0,A.useEffect)(()=>{if(!y)return;let e=F.current;window.requestAnimationFrame(()=>{e?.querySelector(`[role="menuitem"]:not([disabled])`)?.focus()});let t=t=>{e?.contains(t.target)||N.current?.contains(t.target)||(x(!1),I())},n=e=>{e.key===`Escape`&&(e.preventDefault(),x(!1),I())};return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[y]);function z(e){if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="menuitem"]:not([disabled])`));if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(n+1+t.length)%t.length:(n-1+t.length)%t.length]?.focus()}async function B(e,t){let n=t.trim();if(!n||n===e.name)return;let r=await fetch(`/api/agents/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:n})});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`Could not rename agent (${r.status})`)}await u.invalidate()}async function V(e){let t=await fetch(`/api/agents/${e.id}/archive`,{method:`POST`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??`Could not archive agent (${t.status})`)}await u.invalidate()}let H=[...n].sort((e,t)=>e.id==="default"?-1:+(t.id==="default")),U=[...t].sort((e,t)=>e.id==="default"?-1:+(t.id==="default")),W=new Map;for(let t of e){let e=W.get(t.teamId)??[];e.push(t),W.set(t.teamId,e)}let J=e.find(e=>e.id===c)?.teamId??null;return(0,P.jsxs)(`aside`,{className:`flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,P.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-border bg-muted/30 px-3 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[(0,P.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-lg bg-accent text-accent-foreground`,children:(0,P.jsx)(b,{className:`size-4`,"aria-hidden":`true`})}),(0,P.jsx)(`span`,{children:`Agents`})]}),(0,P.jsxs)(`p`,{className:`mt-0.5 truncate pl-9 text-xs text-muted-foreground`,children:[e.length,` agent`,e.length===1?``:`s`,` across `,t.length,` team`,t.length===1?``:`s`]})]}),(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsxs)(`button`,{ref:N,id:`sidebar-new-menu-button`,type:`button`,onClick:()=>x(e=>!e),"aria-label":`Create a new Agent or Team`,"aria-controls":y?`sidebar-new-menu`:void 0,"aria-expanded":y,"aria-haspopup":`menu`,className:`unstyled inline-flex h-8 items-center gap-1 rounded-lg border border-border bg-card px-2.5 text-xs font-semibold text-foreground shadow-baziu-sm transition-colors hover:border-primary/30 hover:bg-accent hover:text-accent-foreground`,children:[(0,P.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}),`New`,(0,P.jsx)(S,{className:`size-3.5 text-muted-foreground transition-transform ${y?`rotate-180`:``}`,"aria-hidden":`true`})]}),y&&(0,P.jsxs)(`div`,{ref:F,id:`sidebar-new-menu`,role:`menu`,"aria-labelledby":`sidebar-new-menu-button`,className:`absolute right-0 top-[calc(100%+0.4rem)] z-20 w-60 overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg`,onKeyDown:z,children:[n.length===0?(0,P.jsxs)(`div`,{className:`rounded-lg bg-muted/40 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[`No Agent templates yet.`,` `,(0,P.jsx)(`a`,{href:`/templates/agents`,role:`menuitem`,className:`text-primary underline`,children:`Create one to spawn agents.`})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,P.jsx)(b,{className:`size-3`,"aria-hidden":`true`}),`Agent templates`]}),H.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{x(!1),f({profileId:e.id})},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,P.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,P.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),e.id==="default"&&(0,P.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground`,children:`Default`})]},e.id))]}),(0,P.jsx)(`div`,{className:`my-1.5 h-px bg-border`}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,P.jsx)(v,{className:`size-3`,"aria-hidden":`true`}),`Team templates`]}),a.length===0?(0,P.jsxs)(`div`,{className:`rounded-lg bg-muted/40 px-3 py-2 text-xs leading-5 text-muted-foreground`,children:[`No team templates yet.`,` `,(0,P.jsx)(`a`,{href:`/templates/teams`,role:`menuitem`,className:`text-primary underline`,children:`Create one`}),`.`]}):a.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.slotCount===0,title:e.slotCount===0?`Add at least one member before spawning`:void 0,onClick:()=>{x(!1),m(e)},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`,children:[(0,P.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,P.jsx)(v,{className:`size-3.5`,"aria-hidden":`true`})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),(0,P.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-xs text-muted-foreground`,children:e.slotCount})]},e.id)),(0,P.jsx)(`div`,{className:`my-1.5 h-px bg-border`}),(0,P.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{x(!1),_(!0)},className:`unstyled flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground`,children:[(0,P.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}),`Create a team`]})]})]})]}),j&&(0,P.jsx)(`p`,{role:`alert`,className:`m-2 rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger`,children:j}),(0,P.jsx)(`nav`,{className:`flex-1 overflow-y-auto p-1.5`,"aria-label":`Teams and agents`,children:e.length===0?(0,P.jsxs)(`div`,{className:`m-1 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center`,children:[(0,P.jsx)(`span`,{className:`mb-2 flex size-9 items-center justify-center rounded-full bg-accent text-accent-foreground`,children:(0,P.jsx)(b,{className:`size-4`,"aria-hidden":`true`})}),(0,P.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`No agents yet`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:`Your default Team is ready. Spawn the first agent to start a conversation.`}),H[0]?(0,P.jsxs)(`button`,{type:`button`,onClick:()=>f({profileId:H[0]?.id??`default`}),className:`unstyled mt-3 inline-flex min-h-9 items-center gap-1 rounded-lg bg-primary px-3 text-xs font-semibold text-primary-foreground hover:bg-primary/90`,children:[`Spawn first agent`,(0,P.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})]}):(0,P.jsxs)(`a`,{href:`/templates/agents`,className:`mt-3 inline-flex items-center gap-1 text-xs font-semibold text-primary hover:text-primary/80`,children:[`Create an Agent template`,(0,P.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})]})]}):U.map(e=>{let t=W.get(e.id)??[],n=J===e.id,i=L[e.id];return(0,P.jsxs)(`details`,{open:i===void 0?n||e.id==="default":i,onToggle:t=>{let n=t.currentTarget.open;if(L[e.id]===n)return;let r={...L,[e.id]:n};Y(r),R(r),u.invalidate()},className:`team/details mb-1 last:mb-0`,children:[(0,P.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${n?`bg-muted/60 text-foreground`:`text-muted-foreground`}`,children:[(0,P.jsx)(o,{className:`size-3.5 shrink-0 transition-transform team-open/details:rotate-90`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,P.jsx)(v,{className:`size-3`,"aria-hidden":`true`})}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),e.id==="default"&&(0,P.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Default`}),(0,P.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center rounded-full border border-border bg-card px-1.5 font-mono text-xs text-muted-foreground`,children:t.length})]}),t.length===0?(0,P.jsx)(`div`,{className:`py-2 pl-12 pr-2 text-xs text-muted-foreground`,children:`No agents in this team`}):(0,P.jsx)(`div`,{className:`space-y-0.5 py-0.5 pl-2`,children:t.map(e=>(0,P.jsxs)(`div`,{className:`team/row relative rounded-lg`,children:[(0,P.jsxs)(r,{to:`/`,search:{agent:e.id},"aria-current":e.id===c?`page`:void 0,className:`block min-h-11 rounded-lg border border-transparent py-1.5 pl-2.5 pr-[4.6rem] transition-colors hover:bg-accent/70 ${e.id===c?`border-primary/20 bg-accent text-accent-foreground shadow-baziu-sm`:`text-foreground`}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,P.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${e.id===c?`bg-primary`:`bg-border`}`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.telegramTopicId!==null&&(0,P.jsx)(`span`,{className:`shrink-0 text-primary`,title:`Telegram topic #${e.telegramTopicId}`,"aria-label":`Bound to Telegram topic ${e.telegramTopicId}`,children:(0,P.jsx)(k,{className:`size-3`,"aria-hidden":`true`})})]}),(0,P.jsxs)(`div`,{className:`mt-0.5 flex gap-2 pl-3 font-mono text-xs text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:`uppercase tracking-wide`,children:e.status}),(0,P.jsx)(`span`,{children:e.id.slice(0,8)})]})]}),(0,P.jsxs)(`div`,{className:`absolute right-1 top-1/2 z-10 flex -translate-y-1/2 gap-0.5`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>w(e),title:`Rename`,"aria-label":`Rename ${e.name}`,className:`unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-card hover:text-primary focus-visible:bg-card`,children:(0,P.jsx)(O,{className:`size-3.5`,"aria-hidden":`true`})}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>E(e),title:`Archive`,"aria-label":`Archive ${e.name}`,className:`unstyled flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive`,children:(0,P.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})})]})]},e.id))})]},e.id)})}),d&&(0,P.jsx)(K,{profileId:d.profileId,teamHint:d.teamHint,teams:U,onClose:()=>{f(null),I()}}),p&&(0,P.jsx)(q,{profileGroup:p,teams:U,onClose:()=>{m(null),I()},onSpawned:e=>{m(null),u.navigate({to:`/teams/$id`,params:{id:e}})}}),h&&(0,P.jsx)(G,{onClose:()=>{_(!1),I()}}),(0,P.jsx)(Z,{agent:C,onOpenChange:e=>{e||w(null)},onRename:async(e,t)=>{M(null);try{await B(e,t)}catch(e){throw M(e instanceof Error?e.message:String(e)),e}}}),(0,P.jsx)(g,{open:T!==null,onOpenChange:e=>{e||E(null)},title:`Archive ${T?.name??`agent`}?`,description:(0,P.jsx)(`p`,{children:`The Agent will stop appearing in this sidebar and cannot receive normal work. You can restore it later from the Agents page with “Show archived”.`}),confirmLabel:`Archive agent`,confirmVariant:`primary`,onConfirm:async()=>{if(T){M(null);try{await V(T)}catch(e){throw M(e instanceof Error?e.message:String(e)),e}}}})]})}function Z({agent:e,onOpenChange:t,onRename:n}){let[r,i]=(0,A.useState)(``),[a,o]=(0,A.useState)(!1),[s,c]=(0,A.useState)(null);function l(n){!n&&a||(n&&e&&i(e.name),n||(i(``),c(null),o(!1)),t(n))}async function u(t){if(t.preventDefault(),!(!e||!r.trim()||r.trim()===e.name)){o(!0),c(null);try{await n(e,r),l(!1)}catch(e){c(e instanceof Error?e.message:String(e)),o(!1)}}}return(0,P.jsx)(L,{open:e!==null,onOpenChange:l,children:(0,P.jsx)(B,{showCloseButton:!a,children:(0,P.jsxs)(`form`,{onSubmit:e=>void u(e),children:[(0,P.jsxs)(V,{children:[(0,P.jsxs)(U,{children:[`Rename `,e?.name??`agent`]}),(0,P.jsx)(W,{children:`This changes the display name only; the Agent ID and history stay the same.`})]}),(0,P.jsxs)(`label`,{className:`mt-4 block text-sm font-semibold text-foreground`,children:[`Agent name`,(0,P.jsx)(`input`,{autoFocus:!0,className:`mt-1`,value:r||e?.name||``,onChange:e=>i(e.target.value),maxLength:120})]}),s&&(0,P.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:s}),(0,P.jsxs)(H,{className:`mt-4`,children:[(0,P.jsx)(T,{variant:`ghost`,disabled:a,onClick:()=>l(!1),children:`Cancel`}),(0,P.jsx)(T,{variant:`primary`,type:`submit`,disabled:a||!r.trim()||r.trim()===e?.name,children:a?`Renaming…`:`Rename agent`})]})]})})})}function Q(){let e=_.useLoaderData(),t=e.selected?.resolved.agent.id??null;return(0,P.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 gap-3 py-3 lg:grid-cols-[18rem_minmax(0,1fr)]`,children:[(0,P.jsx)(`div`,{className:`min-h-0 ${e.selected?`hidden lg:block`:``}`,children:(0,P.jsx)(X,{agents:e.agents,teams:e.teams,profiles:e.profiles,profileGroups:e.profileGroups,selectedAgentId:t,initialOpenGroups:e.initialOpenGroups})}),(0,P.jsx)(`section`,{className:`min-h-0 overflow-hidden ${e.selected?``:`hidden lg:block`}`,children:e.selected?(0,P.jsx)(E,{agentId:e.selected.resolved.agent.id,agentName:e.selected.resolved.agent.name,initialMessages:e.selected.initialMessages,initialSessionHead:e.selected.sessionHead}):(0,P.jsx)(`div`,{className:`flex h-full items-center justify-center rounded-2xl border border-dashed bg-card px-6 text-center text-muted-foreground`,children:(0,P.jsxs)(`div`,{className:`max-w-sm`,children:[(0,P.jsx)(`h1`,{className:`m-0 font-body text-lg font-semibold text-foreground`,children:e.agents.length===0?`Start your first conversation`:`Choose an agent`}),(0,P.jsx)(`p`,{className:`mt-2 text-sm leading-6`,children:e.agents.length===0?`Your default Team and Agent template are ready. Use “Spawn first agent” on the left to create a working member.`:`Pick an agent in the Team list to open its persistent conversation.`}),e.agents.length===0&&(0,P.jsx)(`a`,{href:`/agents`,className:`btn-primary mt-4 no-underline`,children:`Open agent setup`})]})})})]})}export{Q as component};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{Y as t}from"./index-Bq2zrG2_.js";import{i as n,n as r,r as i}from"./Page-NV96O47A.js";var a=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),o=e();function s(){return(0,o.jsxs)(i,{size:`narrow`,children:[(0,o.jsx)(r,{eyebrow:`First run`,title:`Welcome to bazilion`,description:`Configure one model provider to prepare your defaults, then test it before the first conversation.`}),(0,o.jsxs)(n,{title:`Three steps to your first conversation`,children:[(0,o.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Before you can spawn agents, enable a provider and save at least one concrete model id. Bazilion then creates a `,(0,o.jsx)(`code`,{children:`default`}),` Agent template and `,(0,o.jsx)(`code`,{children:`default`}),` Team. Send the small connection test before relying on that model.`]}),(0,o.jsxs)(`ol`,{className:`my-5 space-y-4`,children:[(0,o.jsxs)(c,{n:1,children:[(0,o.jsx)(`strong`,{children:`Choose a provider.`}),` Head to the`,` `,(0,o.jsx)(`a`,{href:`/config`,children:`providers tab`}),`, pick a provider, and set credentials or a local endpoint if that provider needs one. Local providers like Ollama and LM Studio can use their default loopback URLs.`]}),(0,o.jsxs)(c,{n:2,children:[(0,o.jsx)(`strong`,{children:`Enable it and save a model.`}),` Flip the provider's toggle on, then click a catalog chip or type one exact model id (for example`,` `,(0,o.jsx)(`code`,{children:`claude-opus-5`}),`, `,(0,o.jsx)(`code`,{children:`gpt-6-astra`}),`, or `,(0,o.jsx)(`code`,{children:`llama3.3`}),`) and press `,(0,o.jsx)(`em`,{children:`save models`}),`.`]}),(0,o.jsxs)(c,{n:3,children:[(0,o.jsx)(`strong`,{children:`Verify and spawn.`}),` Send the short real-model test. When setup is configured, the page gives you a direct action to spawn the first agent from the`,` `,(0,o.jsx)(`code`,{children:`default`}),` template.`]})]}),(0,o.jsxs)(`a`,{href:`/config`,className:`btn-primary no-underline`,children:[`Configure providers `,(0,o.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})]})]})]})}function c({n:e,children:t}){return(0,o.jsxs)(`li`,{className:`grid grid-cols-[2rem_1fr] gap-3 border-t border-frost pt-3 first:border-t-0 first:pt-0`,children:[(0,o.jsx)(`span`,{className:`text-center font-display text-xl text-sapphire`,children:e}),(0,o.jsx)(`div`,{className:`text-[0.92em] leading-relaxed text-mocha`,children:t})]})}export{s as component};
@@ -1 +0,0 @@
1
- import{Y as e}from"./index-Bq2zrG2_.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),n=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t as n,n as t};