bazilion 0.14.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1752 -825
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +16624 -9803
- package/dist/daemon.js.map +1 -1
- package/dist/migrations/0001_init.sql +218 -3
- package/dist/web/client/assets/ChatPane-CQZzxOir.js +76 -0
- package/dist/web/client/assets/{ConfirmDialog-_bmG-wVG.js → ConfirmDialog-MicTTwdy.js} +1 -1
- package/dist/web/client/assets/{FieldRow-Do1cBkRc.js → FieldRow-DJ2Gx4Du.js} +1 -1
- package/dist/web/client/assets/{ProductionTeamPolicyEditor-XP-QJul4.js → ProductionTeamPolicyEditor-DqUnN_ce.js} +1 -1
- package/dist/web/client/assets/{ProfileCommunicationEditor-CwdFPdpk.js → ProfileCommunicationEditor-DArXub0b.js} +1 -1
- package/dist/web/client/assets/ResultCard-Cps_lXVN.js +1 -0
- package/dist/web/client/assets/ResultSourceConversation-CtzJ8QA-.js +1 -0
- package/dist/web/client/assets/TeamTabs-DbIk5vvT.js +1 -0
- package/dist/web/client/assets/{TemplatesTabs-D4WHvs6b.js → TemplatesTabs-CatJIjGi.js} +1 -1
- package/dist/web/client/assets/{UnsavedChangesGuard-B1aLqiK5.js → UnsavedChangesGuard-BCsLw-mU.js} +1 -1
- package/dist/web/client/assets/_id-B5Ov7cdO.js +1 -0
- package/dist/web/client/assets/{_id-BH3v_vI_.js → _id-BEDmIXVf.js} +1 -1
- package/dist/web/client/assets/_id-BFM_tn_s.js +1 -0
- package/dist/web/client/assets/_id-CrnEVcw8.js +1 -0
- package/dist/web/client/assets/{_id-3w4PFfma.js → _id-DxopIW-y.js} +1 -1
- package/dist/web/client/assets/{activity-A_HrG1Tv.js → activity-CrG8Bg60.js} +1 -1
- package/dist/web/client/assets/{agents-C8OVKq3N.js → agents-CMPOFcs-.js} +1 -1
- package/dist/web/client/assets/{agents-BeeFCt2c.js → agents-O4soKZND.js} +1 -1
- package/dist/web/client/assets/{approvals-BIdZ9BSn.js → approvals-CwDu_lrA.js} +1 -1
- package/dist/web/client/assets/{attention-B9bUrxiU.js → attention-BY8MMuM_.js} +1 -1
- package/dist/web/client/assets/chevron-right-Cf6vKeLq.js +1 -0
- package/dist/web/client/assets/{config-By86S7k-.js → config-Cn4iBJFz.js} +1 -1
- package/dist/web/client/assets/{inbox-DlXQCJLe.js → inbox-CWXql0K3.js} +1 -1
- package/dist/web/client/assets/{index-CLdmsmiN.js → index-Bq2zrG2_.js} +2 -2
- package/dist/web/client/assets/{learning-BqZIw2nA.js → learning-DAm4dyyc.js} +1 -1
- package/dist/web/client/assets/login-BsABI8Ux.js +1 -0
- package/dist/web/client/assets/{mcp-DKSY2yVa.js → mcp-loLB0wuh.js} +1 -1
- package/dist/web/client/assets/{members-9GuOiq6J.js → members-BJ0ikkTl.js} +1 -1
- package/dist/web/client/assets/{memory-DiGMI6FC.js → memory-Drn9Gv53.js} +1 -1
- package/dist/web/client/assets/{policy-TBGQffw5.js → policy-pQadZyk0.js} +1 -1
- package/dist/web/client/assets/results-9exU6f7m.js +1 -0
- package/dist/web/client/assets/routes-jw1PuqiR.js +1 -0
- package/dist/web/client/assets/{services-1Z398CES.js → services-BLso1BhA.js} +1 -1
- package/dist/web/client/assets/{skills-BP2gciFt.js → skills-BodqX3OI.js} +1 -1
- package/dist/web/client/assets/styles-d1yjBpud.css +2 -0
- package/dist/web/client/assets/{teams-DBIivGT7.js → teams-ByQedXZi.js} +1 -1
- package/dist/web/client/assets/{teams-tNoMDJ_M.js → teams-SYsF1bOR.js} +1 -1
- package/dist/web/client/assets/telegram-DC9PLFbB.js +1 -0
- package/dist/web/client/assets/{tokens-eDWCGQQ2.js → tokens-DGy8Ijpo.js} +1 -1
- package/dist/web/client/assets/{triggers-DZME3IcK.js → triggers-BXpVmHDG.js} +1 -1
- package/dist/web/client/assets/{welcome-B49sh_uf.js → welcome-BKsnsCxJ.js} +1 -1
- package/dist/web/client/assets/wire-constants-CBD-lTaa.js +1 -0
- package/dist/web/client/assets/{x-CHc7_-TH.js → x-BK4xNCzS.js} +1 -1
- package/dist/web/server/assets/ChatPane-CS5oI7ef.js +2666 -0
- package/dist/web/server/assets/ResultCard-B3zD9N0t.js +143 -0
- package/dist/web/server/assets/ResultSourceConversation-BpVWBRYq.js +64 -0
- package/dist/web/server/assets/{TeamTabs-Co3n2exj.js → TeamTabs-TCKjCvMA.js} +4 -0
- package/dist/web/server/assets/{_id-sNu5aXZt.js → _id-5pgKoid8.js} +2 -1
- package/dist/web/server/assets/_id-BDEpe6k0.js +6 -0
- package/dist/web/server/assets/{_id-DxCnEFpm.js → _id-BG2nkGxa.js} +3 -4
- package/dist/web/server/assets/{_id-BqWTB8Wl.js → _id-B_-CDHOi2.js} +1 -1
- package/dist/web/server/assets/{_id-BeKhPKw3.js → _id-BnqodC1c2.js} +7 -3
- package/dist/web/server/assets/{_id-DvlDkk04.js → _id-CeyHEsCZ.js} +1 -1
- package/dist/web/server/assets/{_id-BYKpT2Tu.js → _id-DFHB9JFQ.js} +1 -1
- package/dist/web/server/assets/{_id-DYU6uIBx.js → _id-DOnInzLb.js} +1 -1
- package/dist/web/server/assets/{_id-HMy7jM3P.js → _id-DrB9uR1b.js} +1 -1
- package/dist/web/server/assets/{_id-BAA9KJBU.js → _id-DtIYuJJX.js} +1 -1
- package/dist/web/server/assets/_id-DwZXhLlL.js +779 -0
- package/dist/web/server/assets/_id-wyjrf0JG.js +17 -0
- package/dist/web/server/assets/{_tanstack-start-manifest_v-Duhf0z7H.js → _tanstack-start-manifest_v-D7gKv6m6.js} +97 -70
- package/dist/web/server/assets/{activity-9VP6QDTH.js → activity-0VUkStOu.js} +1 -1
- package/dist/web/server/assets/{activity-BWv1goK6.js → activity-5fWKPDxj.js} +2 -2
- package/dist/web/server/assets/{activity-LjpblbDL.js → activity-C88qrNqv.js} +1 -1
- package/dist/web/server/assets/{agents-DjyQk94u.js → agents-C86K6HvS.js} +1 -1
- package/dist/web/server/assets/{agents-BJAv919x.js → agents-CSXLaM2W.js} +1 -1
- package/dist/web/server/assets/{approvals-BYi84gwl.js → approvals-C3MysI6l.js} +1 -1
- package/dist/web/server/assets/{approvals-7JOoBchn.js → approvals-DTdrltyk.js} +1 -1
- package/dist/web/server/assets/{approvals-Bz123liE.js → approvals-DXoN-T57.js} +15 -1
- package/dist/web/server/assets/{attention-UhqPK_Ro.js → attention-DLeLCKah.js} +1 -1
- package/dist/web/server/assets/{auth-7BHTH-KS.js → auth-CDZp9aEk.js} +1 -1
- package/dist/web/server/assets/{config-BMiajTZP.js → config-BVTHvljR.js} +1 -1
- package/dist/web/server/assets/{daemon-client-CI5NHwNC.js → daemon-client-xWyYKAcx.js} +59 -0
- package/dist/web/server/assets/{inbox-Dv55rGYq.js → inbox-PQTrjtOw.js} +1 -1
- package/dist/web/server/assets/{learning-C2upa1CE.js → learning-K0cmDsZR.js} +1 -1
- package/dist/web/server/assets/{login-BNj3U6ok.js → login-B_-9L8TU.js} +7 -2
- package/dist/web/server/assets/{login-Be8eP4Jp.js → login-rDox7PRD.js} +5 -2
- package/dist/web/server/assets/{mcp-BvnvlVFd.js → mcp-Rtraochg.js} +1 -1
- package/dist/web/server/assets/{members-DiYtr-zm.js → members-CD3GiTfF.js} +1 -1
- package/dist/web/server/assets/{members-DHYTVgwb.js → members-cc5SeEaW.js} +2 -2
- package/dist/web/server/assets/{members-BP3UTqu1.js → members-grAKFWgv.js} +1 -1
- package/dist/web/server/assets/{memory-CkXUgf5s.js → memory-C5i_GxlY.js} +2 -2
- package/dist/web/server/assets/{memory-DTFEmfF3.js → memory-CVqnyUaM.js} +1 -1
- package/dist/web/server/assets/{memory-BqV-Afy1.js → memory-egFpBD1g.js} +1 -1
- package/dist/web/server/assets/{policy-Bvvav8fh.js → policy-Dgjb0_gK.js} +2 -2
- package/dist/web/server/assets/{policy-BddK4xom.js → policy-bLKwvnja.js} +1 -1
- package/dist/web/server/assets/{policy-18fdTFO4.js → policy-ooSBgiDS.js} +1 -1
- package/dist/web/server/assets/results-CfNsFncJ.js +173 -0
- package/dist/web/server/assets/results-DXdYtHaq.js +12 -0
- package/dist/web/server/assets/results-N-kP4iFT.js +12 -0
- package/dist/web/server/assets/{router-CY_pCgP1.js → router-B6g_s7W3.js} +60 -43
- package/dist/web/server/assets/{routes-COtkyZG1.js → routes-BqSaZvlu.js} +3 -3
- package/dist/web/server/assets/{routes-BgHisAxH.js → routes-Dsh8F_7i.js} +2 -2
- package/dist/web/server/assets/{routes-DAU2g7Uz.js → routes-pcRy_Sf8.js} +1 -1
- package/dist/web/server/assets/{services-DozuJtzX.js → services-DlZA8fRL.js} +1 -1
- package/dist/web/server/assets/{skills-DfGSJTCB.js → skills-i2duvgW-.js} +1 -1
- package/dist/web/server/assets/{teams-be05ci17.js → teams-6RYIj1Xm.js} +1 -1
- package/dist/web/server/assets/{teams-DPnAX4wD.js → teams-B1AI3NfN.js} +1 -1
- package/dist/web/server/assets/{telegram-1AWL6lFw.js → telegram-C4q0YTVn.js} +1 -1
- package/dist/web/server/assets/{telegram-Dj4Wwhd6.js → telegram-CoNeOgqZ.js} +465 -1
- package/dist/web/server/assets/{telegram-DbOFpTFm.js → telegram-Zd1rIZxg.js} +1 -1
- package/dist/web/server/assets/{tokens-DjM8GsgS.js → tokens-RFquA2Bx.js} +1 -1
- package/dist/web/server/assets/{triggers-Nezfw-Bd.js → triggers-DVD-iE-N.js} +1 -1
- package/dist/web/server/server.js +31 -27
- package/dist/worker.js +1765 -710
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
- package/dist/web/client/assets/TeamTabs-DIRiKcqx.js +0 -1
- package/dist/web/client/assets/_id-Cx7o4Zmf.js +0 -1
- package/dist/web/client/assets/_id-DIiVVxBl.js +0 -1
- package/dist/web/client/assets/chevron-right-VWrk_dTX.js +0 -1
- package/dist/web/client/assets/login-CCMPXiny.js +0 -1
- package/dist/web/client/assets/routes-g3yUOhCb.js +0 -1
- package/dist/web/client/assets/styles-B5vcgXln.css +0 -2
- package/dist/web/client/assets/telegram-CJG_DFdI.js +0 -1
- package/dist/web/client/assets/wire-constants-zZ7Wjb9C.js +0 -74
- package/dist/web/server/assets/ChatPane-CgSe7tsy.js +0 -1429
- package/dist/web/server/assets/_id-ndxFHx0t.js +0 -381
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{Y as t}from"./index-Bq2zrG2_.js";var n=t(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),r=t(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),i=t(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),a=t(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),o=e(),s=[{value:`inherit_team_policy`,label:`Inherit teamPolicy`,description:`Keep peer edges created by the selected teamPolicy preset.`},{value:`allow_all`,label:`Allow all peers`,description:`Add inbound and outbound edges to every current member.`},{value:`deny_all`,label:`Deny all peers`,description:`Remove every peer edge incident to this profile slot.`}];function c({value:e,onChange:t,compact:c=!1}){let l=(n,r)=>t({...e,[n]:r});return(0,o.jsxs)(`div`,{className:c?`space-y-3`:`space-y-4`,children:[(0,o.jsx)(`div`,{className:c?`space-y-1`:`grid gap-2 sm:grid-cols-2`,children:[{key:`userInput`,label:`User input`,detail:`Humans may send directly through web, CLI, or Telegram.`,icon:n},{key:`userOutput`,label:`User output`,detail:`Replies and proactive notifications may reach a human.`,icon:r},{key:`outsideTeamInput`,label:`Other-team input`,detail:`Agents in other local teams may send to this agent.`,icon:a},{key:`outsideTeamOutput`,label:`Other-team output`,detail:`This agent may send to agents in other local teams.`,icon:i}].map(t=>{let n=t.icon;return(0,o.jsxs)(`label`,{className:`m-0 flex cursor-pointer items-start gap-3 rounded-md border border-frost bg-ivory px-3 py-2.5 transition-colors hover:border-sapphire-light`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:e[t.key],onChange:e=>l(t.key,e.target.checked),className:`mt-1`}),(0,o.jsx)(n,{className:`mt-0.5 h-4 w-4 flex-none text-sapphire`,"aria-hidden":`true`}),(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`span`,{className:`block text-sm font-semibold text-chocolate`,children:t.label}),!c&&(0,o.jsx)(`span`,{className:`block text-xs leading-5 text-mocha-light`,children:t.detail})]})]},t.key)})}),(0,o.jsxs)(`label`,{className:`m-0 block`,children:[(0,o.jsx)(`span`,{className:`mb-1 block text-sm font-semibold text-chocolate`,children:`Peer posture`}),(0,o.jsx)(`select`,{value:e.peerDefault,onChange:e=>l(`peerDefault`,e.target.value),children:s.map(e=>(0,o.jsx)(`option`,{value:e.value,children:e.label},e.value))}),!c&&(0,o.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-mocha-light`,children:s.find(t=>t.value===e.peerDefault)?.description})]})]})}export{c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{t as r}from"./Button-ByiV6fpd.js";var i=e(n(),1),a=t();function o({resultId:e,showPreview:t=!1}){let[n,o]=(0,i.useState)(null),[s,c]=(0,i.useState)(``),[l,u]=(0,i.useState)(!0),[d,f]=(0,i.useState)(null),[p,m]=(0,i.useState)(null),h=(0,i.useRef)(null);(0,i.useEffect)(()=>{let t=new AbortController;return h.current=t,u(!0),o(null),m(null),c(``),f(null),fetch(`/api/results/${encodeURIComponent(e)}`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`This result is unavailable or has not been released.`);let n=await e.json();t.signal.aborted||o(n.result)}).catch(e=>{t.signal.aborted||c(e.message)}).finally(()=>{t.signal.aborted||u(!1)}),()=>t.abort()},[e]);async function g(){let t=h.current;if(!(!t||t.signal.aborted)){f(`preview`),c(``);try{let n=await fetch(`/api/results/${encodeURIComponent(e)}/preview`,{signal:t.signal});if(!n.ok){let e=await n.json();throw Error(e.error??`Preview unavailable.`)}if(n.headers.get(`content-type`)?.startsWith(`image/`)){let e=await n.blob(),r=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(Error(`Could not read the image preview.`)),r.readAsDataURL(e)});t.signal.aborted||m({image:r})}else{let e=await n.text();t.signal.aborted||m({text:e})}}catch(e){t.signal.aborted||c(e instanceof Error?e.message:`Preview unavailable.`)}finally{t.signal.aborted||f(null)}}}async function _(){let t=h.current;if(!(!n||!t||t.signal.aborted)){f(`download`),c(``);try{let r=await fetch(`/api/results/${encodeURIComponent(e)}/download`,{signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`Download failed. Try again.`)}let i=await r.blob();if(t.signal.aborted)return;let a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=n.name,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){t.signal.aborted||c(e instanceof Error?e.message:`Download failed.`)}finally{t.signal.aborted||f(null)}}}return(0,a.jsxs)(`section`,{className:`my-3 rounded-lg border border-fawn bg-ivory p-3 text-chocolate`,"aria-label":`Saved result`,"aria-busy":l||d!==null,children:[l?(0,a.jsx)(`p`,{role:`status`,children:`Loading saved result…`}):n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`p`,{className:`m-0 break-all font-semibold`,children:n.name}),(0,a.jsxs)(`p`,{className:`my-1 text-sm text-mocha-light`,children:[n.byteLength<1024?`${n.byteLength} B`:`${(n.byteLength/1024).toFixed(1)} KiB`,` · `,n.mimeType]}),n.deletedAt===null?(0,a.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,a.jsx)(r,{variant:`ghost`,onClick:_,disabled:d!==null,children:d===`download`?`Downloading…`:`Download`}),t&&(0,a.jsx)(r,{variant:`ghost`,onClick:()=>p?m(null):void g(),disabled:d!==null,children:d===`preview`?`Loading preview…`:p?`Close preview`:`Preview`})]}):(0,a.jsx)(`p`,{role:`status`,children:`This result was deleted.`}),t&&n.deletedAt===null&&(0,a.jsxs)(a.Fragment,{children:[p?.text!==void 0&&(0,a.jsx)(`pre`,{className:`mt-3 max-h-80 overflow-auto whitespace-pre-wrap break-words text-sm`,children:p.text}),p?.image&&(0,a.jsx)(`img`,{src:p.image,alt:n.name,className:`mt-3 max-h-80 max-w-full object-contain`,onError:()=>{m(null),c(`Could not display this image. Use Download.`)}})]})]}):null,s&&(0,a.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:s})]})}export{o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{t as r}from"./Button-ByiV6fpd.js";import{n as i}from"./ChatPane-CQZzxOir.js";var a=e(n(),1),o=t();function s({resultId:e,agentId:t}){let[n,r]=(0,a.useState)(null);return(0,a.useEffect)(()=>{let t=new AbortController;return r(null),fetch(`/api/results/${encodeURIComponent(e)}/source`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`Unavailable`);let n=await e.json();t.signal.aborted||r(n)}).catch(()=>{t.signal.aborted||r({available:!1})}),()=>t.abort()},[e]),(0,o.jsxs)(`section`,{children:[(0,o.jsx)(`h2`,{children:`Source conversation`}),n?n.available&&n.agentId===t?(0,o.jsx)(i,{messages:n.messages}):(0,o.jsx)(`p`,{role:`status`,children:`The originating conversation is unavailable. Its history may be missing or the Agent may have been removed.`}):(0,o.jsx)(`p`,{role:`status`,children:`Loading source conversation…`}),(0,o.jsx)(`a`,{className:`ghost-btn`,href:`/agents/${encodeURIComponent(t)}`,children:`Open current conversation`})]})}function c({resultId:e,agentId:t}){let[n,i]=(0,a.useState)(``),[s,c]=(0,a.useState)(!1);return(0,o.jsxs)(`span`,{children:[(0,o.jsx)(r,{variant:`ghost`,disabled:s,onClick:async()=>{c(!0),i(``);try{let n=await fetch(`/api/results/${encodeURIComponent(e)}/source`);if(!n.ok||!(await n.json()).available)throw Error(`Source conversation is unavailable.`);window.location.assign(`/agents/${encodeURIComponent(t)}?resultSource=${encodeURIComponent(e)}`)}catch(e){i(e instanceof Error?e.message:`Source conversation is unavailable.`)}finally{c(!1)}},children:`Source conversation`}),n&&(0,o.jsx)(`span`,{role:`status`,className:`block text-sm`,children:n})]})}export{c as n,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{a as t}from"./preload-helper-bztXdkDj.js";import{Q as n}from"./index-Bq2zrG2_.js";import{n as r,t as i}from"./SectionTabs-4kCQXuFY.js";var a=e(),o=[{suffix:``,label:`Context`,exact:!0},{suffix:`/members`,label:`Members`},{suffix:`/policy`,label:`Policy`},{suffix:`/memory`,label:`Memory`},{suffix:`/results`,label:`Results`},{suffix:`/activity`,label:`Activity`}];function s({teamId:e}){let s=n({select:e=>e.location.pathname}),c=`/teams/${encodeURIComponent(e)}`;return(0,a.jsx)(`nav`,{"aria-label":`Team sections`,className:i,children:o.map(e=>{let n=`${c}${e.suffix}`,i=`exact`in e&&e.exact?s===c||s===`${c}/`:s.startsWith(n);return(0,a.jsx)(t,{to:n,"aria-current":i?`page`:void 0,className:r(i),children:e.label},e.label)})})}export{s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{a as t}from"./preload-helper-bztXdkDj.js";import{
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{a as t}from"./preload-helper-bztXdkDj.js";import{Q as n}from"./index-Bq2zrG2_.js";import{n as r,t as i}from"./SectionTabs-4kCQXuFY.js";var a=e();function o(){let e=n({select:e=>e.location.pathname});return(0,a.jsx)(`nav`,{role:`tablist`,className:i,children:[{to:`/templates/agents`,label:`Agent templates`,match:e=>e.startsWith(`/templates/agents`)},{to:`/templates/teams`,label:`Team templates`,match:e=>e.startsWith(`/templates/teams`)}].map(n=>{let i=n.match(e);return(0,a.jsx)(t,{to:n.to,role:`tab`,"aria-selected":i,className:r(i),children:n.label},n.to)})})}export{o as t};
|
package/dist/web/client/assets/{UnsavedChangesGuard-B1aLqiK5.js → UnsavedChangesGuard-BCsLw-mU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-MicTTwdy.js";var a=e(n(),1);function o(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function s(e,t){let{shouldBlockFn:n,enableBeforeUnload:i=!0,disabled:s=!1,withResolver:c=!1}=o(e,t),l=r(),{history:u}=l,[d,f]=a.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return a.useEffect(()=>s?void 0:u.block({blockerFn:async e=>{function t(e){let t=l.parseLocation(e),n=l.getMatchedRoutes(t.pathname);return n.foundRoute===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n.routeParams,search:l.options.parseSearch(e.search)}:{routeId:n.foundRoute.id,fullPath:n.foundRoute.fullPath,pathname:t.pathname,params:n.routeParams,search:l.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let a=await n({action:e.action,current:r,next:i});if(!c)return a;if(!a)return!1;let o=await new Promise(t=>{f({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return f({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),o},enableBeforeUnload:i}),[n,i,s,c,u,l]),d}var c=t();function l({when:e,subject:t=`changes`}){let n=(0,a.useRef)(!1),r=s({shouldBlockFn:(0,a.useCallback)(()=>e,[e]),enableBeforeUnload:e,disabled:!e,withResolver:!0}),o=r.status===`blocked`?r.next.pathname:``;return(0,c.jsx)(i,{open:r.status===`blocked`,title:`Discard unsaved ${t}?`,description:(0,c.jsxs)(`p`,{children:[`Leaving this page for `,(0,c.jsx)(`code`,{className:`font-mono`,children:o}),` will permanently discard the unsaved `,t,` on this page.`]}),confirmLabel:`discard and leave`,onConfirm:()=>{n.current=!0,r.proceed?.()},onOpenChange:e=>{!e&&!n.current&&r.reset?.(),e||(n.current=!1)}})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./UnsavedChangesGuard-BCsLw-mU.js";import{p as a}from"./index-Bq2zrG2_.js";import{a as o,i as s,r as c}from"./Page-NV96O47A.js";import{t as l}from"./Button-ByiV6fpd.js";import{t as u}from"./TeamTabs-DbIk5vvT.js";var d=e(n(),1),f=t();function p({teamId:e}){let[t,n]=(0,d.useState)(null),[r,i]=(0,d.useState)(``),[a,o]=(0,d.useState)(`.`),[s,c]=(0,d.useState)(``),[u,p]=(0,d.useState)(!1),m=`/api/teams/${encodeURIComponent(e)}/coding-environment`;return(0,d.useEffect)(()=>{let e=!0;return fetch(m).then(async e=>{if(!e.ok)throw Error(`Defaults unavailable`);return e.json()}).then(t=>{e&&(n(t),i(t.environment?.config.image??t.image),o(t.environment?.config.cwd??`.`))}).catch(t=>{e&&c(t.message)}),()=>{e=!1}},[m]),(0,f.jsxs)(`details`,{className:`border-t mt-4 pt-4`,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:`Optional protected runtime defaults`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground my-3`,children:`Agents discover commands during the task. Override the installation image only if this repository needs a different prepared toolchain. Host turns do not use these Docker defaults.`}),s&&(0,f.jsx)(`p`,{role:`alert`,children:s}),t&&(0,f.jsxs)(`form`,{className:`space-y-3`,onSubmit:async e=>{e.preventDefault(),p(!0),c(``);try{let e=await fetch(m,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({expectedRevision:t.environment?.revision??0,config:{image:r,cwd:a,env:t.environment?.config.env??{}}})}),i=await e.json();if(!e.ok)throw Error(i.error);n({...t,environment:i,image:r})}catch(e){c(e instanceof Error?e.message:`Save failed`)}finally{p(!1)}},children:[(0,f.jsxs)(`label`,{className:`block text-sm`,children:[`Local Docker image`,(0,f.jsx)(`input`,{required:!0,value:r,onChange:e=>i(e.target.value),className:`block w-full rounded border p-2 mt-1`})]}),(0,f.jsxs)(`label`,{className:`block text-sm`,children:[`Default directory`,(0,f.jsx)(`input`,{required:!0,value:a,onChange:e=>o(e.target.value),className:`block w-full rounded border p-2 mt-1`})]}),(0,f.jsx)(l,{type:`submit`,variant:`primary`,disabled:u,children:u?`Saving…`:`Save defaults`})]})]})}function m({teamId:e}){let[t,n]=(0,d.useState)(``),[r,i]=(0,d.useState)(null),[a,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null),u=(0,d.useRef)(0),p=r?.report,m=p?[...new Map([...p.instructions.issues,...p.commands.issues,...p.git.issues].map(e=>[JSON.stringify([e.path,e.message]),e])).values()]:[];async function h(){let n=++u.current,r=t||`.`;o(!0),c(null);try{let t=await fetch(`/api/teams/${encodeURIComponent(e)}/repository-context?target=${encodeURIComponent(r)}`,{cache:`no-store`});if(!t.ok)throw Error(`Repository context could not be loaded. Refresh to try again.`);let a=await t.json();u.current===n&&i({report:a,target:r})}catch(e){u.current===n&&c(e instanceof Error?e.message:`Inspection failed`)}finally{u.current===n&&o(!1)}}return(0,d.useEffect)(()=>(h(),()=>{u.current++}),[e]),(0,f.jsxs)(`section`,{className:`min-w-0`,"aria-labelledby":`repository-context-heading`,children:[(0,f.jsx)(`h2`,{id:`repository-context-heading`,className:`font-serif text-xl mb-1`,children:`Explore the repository`}),(0,f.jsx)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:`See the instructions and commands for the part of the project you’re working on.`}),(0,f.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h()},className:`flex flex-wrap gap-2 items-end mb-3`,children:[(0,f.jsxs)(`label`,{className:`flex-1 min-w-[12rem] m-0 text-sm`,children:[`Project path`,(0,f.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),placeholder:`. (Team root)`,maxLength:4096,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 font-mono text-sm`})]}),(0,f.jsx)(l,{type:`submit`,variant:`primary`,disabled:a,children:a?`Inspecting…`:p?`Refresh context`:`Inspect repository`})]}),s&&(0,f.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger mb-3`,children:[s,` `,p?`The report below is the previous capture.`:``]}),p&&r&&(0,f.jsxs)(`div`,{className:`space-y-3 text-sm min-w-0`,"aria-live":`polite`,children:[(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground break-words`,children:[(0,f.jsx)(`code`,{children:r.target===`.`?`Team root`:r.target}),` · Inspected`,` `,(0,f.jsx)(`time`,{dateTime:new Date(p.capturedAt).toISOString(),children:new Date(p.capturedAt).toLocaleString()}),`. Read-only inspection.`]}),m.length>0&&(0,f.jsxs)(`div`,{role:`status`,className:`border-l-2 border-primary bg-muted/40 px-3 py-2`,children:[(0,f.jsx)(`h3`,{className:`font-sans text-sm font-semibold`,children:`Some context is unavailable`}),(0,f.jsx)(`ul`,{className:`mt-1 space-y-1`,children:m.map((e,t)=>(0,f.jsxs)(`li`,{className:`break-words`,children:[e.path?`${e.path}: `:``,e.message]},t))})]}),(0,f.jsxs)(`div`,{className:`rounded-md bg-muted/40 px-3 py-2`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,f.jsx)(`h3`,{className:`font-sans text-sm font-semibold`,children:p.git.state===`available`?`Working tree`:p.git.state===`not_repository`?`No Git repository`:`Git unavailable`}),p.git.state===`available`&&(0,f.jsxs)(`p`,{className:`min-w-0 break-all`,children:[(0,f.jsx)(`span`,{className:`font-mono`,children:p.git.branch??`Detached HEAD`}),(0,f.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`· `,p.git.head?.slice(0,8)??`No commits yet`]})]})]}),p.git.state===`available`&&(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[p.git.staged,` staged · `,p.git.unstaged,` unstaged · `,p.git.untracked,` `,`untracked · `,p.git.conflicted,` conflicted`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h3`,{className:`font-sans text-sm font-semibold`,children:[`Instructions`,` `,(0,f.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,p.instructions.files.length,` files`,p.instructions.state===`complete`?``:` · incomplete`]})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Listed from broadest to most specific. Operator instructions and runtime policy take priority.`}),p.instructions.files.length===0&&(0,f.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:p.instructions.state===`complete`?`No applicable AGENTS.md files found.`:`Instructions for this scope could not be prepared.`}),(0,f.jsx)(`div`,{className:`mt-2 divide-y`,children:p.instructions.files.map(e=>(0,f.jsxs)(`details`,{className:`py-2 min-w-0`,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer break-words font-mono text-sm`,children:e.path}),(0,f.jsx)(`pre`,{className:`mt-2 rounded-md bg-muted/40 p-3 whitespace-pre-wrap break-words text-xs max-h-80 overflow-auto`,children:e.content})]},e.path))})]}),(0,f.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,f.jsx)(`h3`,{className:`font-sans text-sm font-semibold`,children:`Suggested commands`}),(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Source suggestions for Agent investigation; inspection never executes commands.`}),p.commands.candidates.length===0&&(0,f.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:`No command suggestions available for this scope.`}),(0,f.jsx)(`ul`,{className:`mt-1 divide-y`,children:p.commands.candidates.map((e,t)=>(0,f.jsxs)(`li`,{className:`py-2 min-w-0`,children:[(0,f.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:(0,f.jsx)(`code`,{className:`block bg-transparent p-0 whitespace-pre-wrap break-words min-w-0`,children:e.command})}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1 break-words`,children:[e.source,` · `,e.location,` · cwd `,e.cwd,e.kind===`script`?` · ${e.packageManager??`package manager unknown`}`:` · documentation excerpt`]})]},`${e.source}:${t}`))})]}),(0,f.jsxs)(`details`,{className:`border-t pt-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer`,children:`Source details and fingerprints`}),(0,f.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,f.jsx)(`p`,{children:`Deeper repository instructions apply within their own subtree. Private Agent instructions are managed on each Agent.`}),(0,f.jsxs)(`p`,{className:`break-all`,children:[`Snapshot SHA-256: `,p.fingerprint]}),p.git.head&&(0,f.jsxs)(`p`,{className:`break-all`,children:[`Git commit: `,p.git.head]}),p.instructions.files.map(e=>(0,f.jsxs)(`p`,{className:`break-all`,children:[(0,f.jsx)(`span`,{className:`font-mono`,children:e.path}),` · Scope: `,e.scope,` · Precedence:`,` `,e.precedence,(0,f.jsx)(`br`,{}),`SHA-256: `,e.sha256]},e.path)),p.commands.sources.map(e=>(0,f.jsxs)(`p`,{className:`break-all`,children:[(0,f.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,f.jsx)(`br`,{}),`SHA-256: `,e.sha256]},e.path))]})]})]})]})}function h(){let{team:e,members:t,profileGroups:n}=a.useLoaderData(),h=r(),[v,y]=(0,d.useState)(e.userMd),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(null),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(!1),O=v!==e.userMd||E;async function k(){x(!0),C(null);try{let t=await fetch(`/api/teams/${encodeURIComponent(e.id)}/user-md`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({userMd:v})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`${t.status} ${t.statusText}`)}T(Date.now()),await h.invalidate()}catch(e){C(e.message)}finally{x(!1)}}return(0,f.jsxs)(c,{children:[(0,f.jsx)(i,{when:O,subject:`Team context`}),(0,f.jsxs)(`h1`,{className:`font-serif text-3xl text-foreground`,children:[e.name,` `,(0,f.jsxs)(`span`,{className:`text-muted-foreground text-base`,children:[`(`,e.id,`)`]})]}),(0,f.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-6 mt-1`,children:[(0,f.jsx)(`code`,{className:`font-mono`,children:e.path}),` · `,t.length,` `,`member`,t.length===1?``:`s`,` ·`,` `,(0,f.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.id)}/memory`,className:`text-primary underline`,children:`shared memory →`})]}),(0,f.jsx)(u,{teamId:e.id}),(0,f.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,f.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`USER.md`}),(0,f.jsx)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:`Read-only context about the human, injected into every member agent's system prompt. 12 KB cap. Agents cannot edit this file — only you can.`}),(0,f.jsx)(`label`,{htmlFor:`team-user-context`,className:`sr-only`,children:`USER.md Team context`}),(0,f.jsx)(`textarea`,{id:`team-user-context`,value:v,onChange:e=>y(e.target.value),rows:16,className:`w-full rounded-md border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,placeholder:`What the agent should know about you in this team context…`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-3`,children:[(0,f.jsx)(l,{variant:`primary`,onClick:k,disabled:b||v===e.userMd,children:b?`saving…`:`save`}),(0,f.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[v.length,` / 12000 chars`]}),w&&(0,f.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`}),S&&(0,f.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:S})]})]}),(0,f.jsxs)(`details`,{className:`mb-6 rounded-lg border bg-card p-4`,children:[(0,f.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:`Advanced repository diagnostics`}),(0,f.jsx)(m,{teamId:e.id},e.id),(0,f.jsx)(p,{teamId:e.id})]}),(0,f.jsx)(g,{team:e,sampleAgent:t[0]?.name??`researcher`,onSaved:()=>h.invalidate(),onDirtyChange:D}),t.length===0&&(0,f.jsx)(_,{teamId:e.id,profileGroups:n,onSpawned:()=>h.invalidate()}),(0,f.jsx)(s,{title:`Roster`,description:`Live Team membership has one canonical management view.`,actions:(0,f.jsxs)(o,{variant:t.length>0?`success`:`neutral`,children:[t.length,` member`,t.length===1?``:`s`]}),children:(0,f.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.id)}/members`,className:`ghost-btn`,children:`Manage Team members`})})]})}function g({team:e,sampleAgent:t,onSaved:n,onDirtyChange:r}){let[i,a]=(0,d.useState)(e.telegramTopicNameFormat??``),[o,s]=(0,d.useState)(!1),[c,u]=(0,d.useState)(null),[p,m]=(0,d.useState)(null),h=i.trim(),g=h?h.replaceAll(`{agent.name}`,t).replaceAll(`{team.name}`,e.name).replaceAll(`{team.slug}`,e.id):e.id==="default"?t:`${e.id} › ${t}`,_=(e.telegramTopicNameFormat??``)!==i;(0,d.useEffect)(()=>(r(_),()=>r(!1)),[_,r]);async function v(t){s(!0),u(null);try{let r=await fetch(`/api/teams/${encodeURIComponent(e.id)}/topic-format`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({format:t?null:i})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`${r.status} ${r.statusText}`)}t&&a(``),m(Date.now()),n()}catch(e){u(e.message)}finally{s(!1)}}return(0,f.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,f.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`Telegram topic names`}),(0,f.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:[`Template for this team's Telegram forum-topic titles. Leave empty for built-in naming. Tokens: `,(0,f.jsx)(`code`,{className:`font-mono`,children:`{agent.name}`}),` `,(0,f.jsx)(`code`,{className:`font-mono`,children:`{team.name}`}),` `,(0,f.jsx)(`code`,{className:`font-mono`,children:`{team.slug}`}),` — must include`,` `,(0,f.jsx)(`code`,{className:`font-mono`,children:`{agent.name}`}),`. Saving renames existing topics that you haven't manually renamed in Telegram.`]}),(0,f.jsx)(`label`,{htmlFor:`team-telegram-topic-format`,className:`sr-only`,children:`Telegram topic name format`}),(0,f.jsx)(`input`,{id:`team-telegram-topic-format`,value:i,onChange:e=>a(e.target.value),placeholder:`{team.name} / {agent.name}`,className:`w-full rounded-md border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`preview: `,(0,f.jsx)(`span`,{className:`font-mono text-foreground`,children:g})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mt-3`,children:[(0,f.jsx)(l,{variant:`primary`,onClick:()=>v(!1),disabled:o||!_||h.length===0,children:o?`saving…`:`save`}),e.telegramTopicNameFormat&&(0,f.jsx)(l,{variant:`ghost`,onClick:()=>v(!0),disabled:o,children:`clear`}),p&&(0,f.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`}),c&&(0,f.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:c})]})]})}function _({teamId:e,profileGroups:t,onSpawned:n}){let r=t.filter(e=>e.slotCount>0&&!e.deletedAt),[i,a]=(0,d.useState)(r[0]?.id??``),[o,s]=(0,d.useState)(!1),[c,u]=(0,d.useState)(null);async function p(){if(i){s(!0),u(null);try{let t=r.find(e=>e.id===i);if(!t)throw Error(`Team template is unavailable.`);let a=await fetch(`/api/teams/${encodeURIComponent(e)}/policy`);if(!a.ok)throw Error(`The current Team policy is unavailable.`);let o=await a.json(),s=await fetch(`/api/team-templates/${encodeURIComponent(i)}/spawn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({templateExpectedRevision:t.currentRevision,teamId:e,teamExpectedRevision:o.teamPolicy.revision,mode:`initialize`})});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e.error??`${s.status} ${s.statusText}`)}n()}catch(e){u(e.message)}finally{s(!1)}}}return(0,f.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,f.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`spawn a team into this team`}),(0,f.jsx)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:`This Team is empty. Pick a canonical Team template to initialize its roster and policy at the current reviewed Team and Team revisions.`}),r.length===0?(0,f.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`No Team templates with slots yet. Build one on`,` `,(0,f.jsx)(`a`,{href:`/templates/teams`,className:`text-primary underline`,children:`Team templates`}),` `,`first.`]}):(0,f.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,f.jsxs)(`label`,{className:`m-0 flex min-w-0 flex-1 flex-col gap-1 text-sm text-foreground`,children:[`Team template`,(0,f.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),className:`min-w-0 rounded-md border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring/30`,children:r.map(e=>(0,f.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.slotCount,` slot`,e.slotCount===1?``:`s`,`, r`,e.currentRevision,`)`]},e.id))})]}),(0,f.jsx)(l,{variant:`primary`,onClick:p,disabled:o||!i,children:o?`spawning…`:`spawn team`}),c&&(0,f.jsx)(`span`,{role:`alert`,className:`basis-full text-xs text-danger`,children:c})]})]})}export{h as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./UnsavedChangesGuard-B1aLqiK5.js";import{t as a}from"./ProfileCommunicationEditor-CwdFPdpk.js";import{t as o}from"./index-CLdmsmiN.js";import{r as s}from"./Page-NV96O47A.js";import{t as c}from"./team-policy-D0jpnn2b.js";import{t as l}from"./TemplatesTabs-D4WHvs6b.js";var u=e(n()),d=t();function f(){let{loaded:e,modelGroups:t,skills:n}=o.useLoaderData(),[r,a]=(0,u.useState)(`basics`),[f,p]=(0,u.useState)({}),g=(0,u.useCallback)((e,t)=>{p(n=>n[e]===t?n:{...n,[e]:t})},[]),_=Object.values(f).filter(Boolean).length;return(0,d.jsxs)(s,{children:[(0,d.jsx)(i,{when:_>0,subject:`Agent template changes`}),(0,d.jsx)(l,{}),(0,d.jsxs)(`header`,{className:`mb-1`,children:[(0,d.jsx)(`a`,{href:`/templates/agents`,className:`mb-1 inline-block text-[0.85em] text-mocha-light hover:text-sapphire`,children:`← agent templates`}),(0,d.jsx)(`h1`,{children:e.profile.name}),(0,d.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[0.9em] text-mocha-light`,children:[(0,d.jsx)(`code`,{children:e.profile.id}),(0,d.jsx)(`span`,{children:`·`}),(0,d.jsxs)(`span`,{children:[`model: `,(0,d.jsx)(`code`,{children:e.profile.defaultModel})]})]})]}),(0,d.jsxs)(`p`,{className:`muted my-6`,children:[`These settings and files seed every agent spawned from this Agent template going forward.`,` `,(0,d.jsx)(`strong`,{children:`Existing agents keep their own copies`}),` — edits here don't propagate to already-spawned agents.`]}),(0,d.jsx)(h,{items:[{id:`basics`,label:`1. basics`},{id:`skills`,label:`2. skills`},{id:`communication`,label:`3. communication`}],active:r,onChange:e=>a(e)}),_>0&&(0,d.jsxs)(`p`,{role:`status`,className:`mb-4 text-sm text-warning`,children:[_,` unsaved `,_===1?`section`:`sections`,` — switching tabs keeps the draft, but leaving this page will ask for confirmation.`]}),(0,d.jsxs)(`div`,{hidden:r!==`basics`,children:[(0,d.jsx)(x,{profileId:e.profile.id,initialName:e.profile.name,currentModel:e.profile.defaultModel,modelGroups:t,onDirtyChange:g}),(0,d.jsx)(y,{profileId:e.profile.id,file:`SOUL.md`,initialContent:e.files.soul,rows:14,onDirtyChange:g}),(0,d.jsx)(y,{profileId:e.profile.id,file:`IDENTITY.md`,initialContent:e.files.identity,rows:10,onDirtyChange:g}),e.files.bootstrap===null?(0,d.jsxs)(`section`,{className:`file-card`,children:[(0,d.jsx)(`div`,{className:`file-head`,children:(0,d.jsx)(`h3`,{children:`BOOTSTRAP.md`})}),(0,d.jsx)(`p`,{className:`muted`,children:`This profile was created without a bootstrap prompt. Spawned agents won't see a first-run intro message.`})]}):(0,d.jsx)(y,{profileId:e.profile.id,file:`BOOTSTRAP.md`,initialContent:e.files.bootstrap,rows:10,onDirtyChange:g}),(0,d.jsx)(b,{profileId:e.profile.id,file:`AGENTS.md`,initialContent:e.files.agents,hint:`Peers and routing notes — who this agent can hand off to.`,onDirtyChange:g}),(0,d.jsx)(b,{profileId:e.profile.id,file:`TOOLS.md`,initialContent:e.files.tools,hint:`Tool playbook. Agent-specific usage notes that go beyond the generic tool descriptions.`,onDirtyChange:g})]}),(0,d.jsx)(`div`,{hidden:r!==`skills`,children:(0,d.jsx)(S,{profileId:e.profile.id,initialMode:e.profile.skillsMode,initialPicked:new Set(e.defaultSkills),skills:n,onDirtyChange:g})}),(0,d.jsx)(`div`,{hidden:r!==`communication`,children:(0,d.jsx)(m,{profileId:e.profile.id,initial:e.profile.communicationDefaults??c,onDirtyChange:g})})]})}function p(e,t,n){(0,u.useEffect)(()=>{n(e,t)},[t,n,e])}function m({profileId:e,initial:t,onDirtyChange:n}){let[r,i]=(0,u.useState)(t),[o,s]=(0,u.useState)(t),[c,l]=(0,u.useState)({kind:`idle`,message:``}),f=JSON.stringify(r)!==JSON.stringify(o),m=_(f,c);return p(`communication`,f,n),(0,d.jsxs)(`section`,{className:`rounded-md border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,d.jsx)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:(0,d.jsx)(`h3`,{className:`m-0 font-body text-[0.95rem] font-semibold normal-case text-chocolate`,children:`Communication defaults`})}),(0,d.jsx)(`p`,{className:`muted mb-4`,children:`Materialized into new Team and Team policy snapshots after preset resolution. Existing snapshots never inherit later changes. Stored by the daemon.`}),(0,d.jsx)(a,{value:r,onChange:i}),(0,d.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,d.jsx)(`button`,{type:`button`,className:`btn-primary`,disabled:!f||c.kind===`saving`,onClick:async()=>{l({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({communicationDefaults:r})});if(!t.ok)throw Error((await t.json().catch(()=>null))?.error??t.statusText);s(r),l({kind:`saved`,message:`saved to daemon`})}catch(e){l({kind:`error`,message:`error: ${e instanceof Error?e.message:String(e)}`})}},children:`save communication defaults`}),m.message&&(0,d.jsx)(`span`,{role:m.kind===`error`?`alert`:`status`,className:`text-xs ${g(m.kind)}`,children:m.message})]})]})}function h({items:e,active:t,onChange:n}){return(0,d.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex gap-1 border-b border-frost`,children:e.map(e=>(0,d.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.id,onClick:()=>n(e.id),className:`unstyled cursor-pointer border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${t===e.id?`border-sapphire text-sapphire`:`border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}function g(e){return e===`saved`?`text-sapphire`:e===`error`?`text-danger`:e===`dirty`?`text-mocha`:`text-mocha-light`}function _(e,t){return e&&t.kind!==`saving`&&t.kind!==`error`?{kind:`dirty`,message:`unsaved changes`}:t}function v({title:e,status:t,children:n}){return(0,d.jsxs)(`section`,{className:`file-card mb-5 rounded-[16px] border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,d.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,d.jsx)(`h3`,{className:`m-0 font-mono text-[0.95em] font-semibold normal-case tracking-normal text-chocolate`,children:e}),t&&(0,d.jsx)(`span`,{role:t.kind===`error`?`alert`:t.message?`status`:void 0,className:`text-[0.82em] ${g(t.kind)}`,children:t.message})]}),n]})}function y({profileId:e,file:t,initialContent:n,rows:r=10,onDirtyChange:i}){let[a,o]=(0,u.useState)(n),[s,c]=(0,u.useState)(n),[l,f]=(0,u.useState)({kind:`idle`,message:``}),m=s!==a;p(`file:${t}`,m,i);let h=_(m,l);async function g(){f({kind:`saving`,message:`saving…`});try{let n=await fetch(`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:s})});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}o(s),f({kind:`saved`,message:`saved`})}catch(e){f({kind:`error`,message:`error: ${e.message}`})}}function y(){c(a),f({kind:`idle`,message:``})}return(0,d.jsxs)(v,{title:t,status:h,children:[(0,d.jsx)(`textarea`,{"aria-label":`${t} contents`,rows:r,value:s,onChange:e=>c(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`}),(0,d.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,d.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:g,disabled:l.kind===`saving`,children:`save`}),(0,d.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:y,children:`revert`})]})]})}function b({profileId:e,file:t,initialContent:n,hint:i,onDirtyChange:a}){let o=r(),[s,c]=(0,u.useState)(!1),[l,f]=(0,u.useState)({kind:`idle`,message:``});async function p(){c(!0),f({kind:`saving`,message:`creating…`});try{let n=await fetch(`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:``})});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await o.invalidate()}catch(e){f({kind:`error`,message:`error: ${e.message}`}),c(!1)}}return n===null?(0,d.jsxs)(v,{title:t,status:l,children:[(0,d.jsx)(`p`,{className:`muted my-1`,children:i}),(0,d.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,d.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:p,disabled:s,children:s?`creating…`:`create empty`})})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`p`,{className:`muted -mb-3 ml-1 mt-2 text-[0.85em]`,children:i}),(0,d.jsx)(y,{profileId:e,file:t,initialContent:n,rows:10,onDirtyChange:a})]})}function x({profileId:e,initialName:t,currentModel:n,modelGroups:i,onDirtyChange:a}){let o=r(),[s,c]=(0,u.useState)(t),[l,f]=(0,u.useState)(n),[m,h]=(0,u.useState)(t),[g,y]=(0,u.useState)(n),[b,x]=(0,u.useState)({kind:`idle`,message:``}),S=s!==m||l!==g,C=_(S,b);p(`settings`,S,a);let w=!i.flatMap(e=>e.models.map(t=>`${e.provider}:${t}`)).includes(n);async function T(t){t.preventDefault();let n=s.trim(),r=l.trim();x({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:n,defaultModel:r})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await o.invalidate(),c(n),f(r),h(n),y(r),x({kind:`saved`,message:`saved`})}catch(e){x({kind:`error`,message:`error: ${e.message}`})}}return(0,d.jsx)(v,{title:`settings`,status:C,children:(0,d.jsxs)(`form`,{onSubmit:T,children:[(0,d.jsxs)(`div`,{className:`flex gap-4`,children:[(0,d.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,d.jsx)(`input`,{value:s,onChange:e=>c(e.target.value)})]}),(0,d.jsxs)(`label`,{className:`flex-1`,children:[`default model`,i.length===0?(0,d.jsx)(`select`,{disabled:!0,children:(0,d.jsx)(`option`,{children:`(no models available — enable on /config)`})}):(0,d.jsxs)(`select`,{value:l,onChange:e=>f(e.target.value),children:[w&&(0,d.jsxs)(`option`,{value:n,children:[n,` (not in enabled list)`]}),i.map(e=>(0,d.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,d.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]})]}),(0,d.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,d.jsx)(`button`,{type:`submit`,disabled:!S||b.kind===`saving`,children:`save settings`})})]})})}function S({profileId:e,initialMode:t,initialPicked:n,skills:i,onDirtyChange:a}){let o=r(),[s,c]=(0,u.useState)(t),[l,f]=(0,u.useState)(n),[m,h]=(0,u.useState)(t),[g,y]=(0,u.useState)(n),[b,x]=(0,u.useState)({kind:`idle`,message:``}),S=s!==m||!C(l,g),w=_(S,b);p(`skills`,S,a);function T(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function E(t){t.preventDefault();let n=s===`selected`?new Set(l):new Set;x({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({skillsMode:s,defaultSkills:Array.from(n)})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await o.invalidate(),h(s),f(n),y(n),x({kind:`saved`,message:`saved`})}catch(e){x({kind:`error`,message:`error: ${e.message}`})}}return(0,d.jsxs)(v,{title:`skills`,status:w,children:[(0,d.jsx)(`p`,{className:`muted my-2`,children:`Choose what agents spawned from this profile inherit. Existing agents aren't affected — they keep whatever skills they were spawned with.`}),(0,d.jsxs)(`form`,{onSubmit:E,children:[(0,d.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,d.jsx)(`input`,{type:`radio`,checked:s===`all`,onChange:()=>c(`all`)}),(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`strong`,{children:`allow all skills`}),` — every skill on disk is attached at spawn.`]})]}),(0,d.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,d.jsx)(`input`,{type:`radio`,checked:s===`selected`,onChange:()=>c(`selected`)}),(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`strong`,{children:`select skills`}),` — attach only the ones ticked below.`]})]}),(0,d.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${s===`all`?`pointer-events-none opacity-50`:``}`,children:i.length===0?(0,d.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,d.jsx)(`a`,{href:`/skills`,children:`/skills`}),`.`]}):i.map(e=>(0,d.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:l.has(e.name),onChange:()=>T(e.name)}),(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`code`,{children:e.name}),e.description&&(0,d.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,e.description]})]})]},e.name))}),(0,d.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,d.jsx)(`button`,{type:`submit`,disabled:!S||b.kind===`saving`,children:`save skills`})})]})]})}function C(e,t){return e.size===t.size&&Array.from(e).every(e=>t.has(e))}export{f as component};
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./UnsavedChangesGuard-BCsLw-mU.js";import{t as a}from"./ProfileCommunicationEditor-DArXub0b.js";import{t as o}from"./index-Bq2zrG2_.js";import{r as s}from"./Page-NV96O47A.js";import{t as c}from"./team-policy-D0jpnn2b.js";import{t as l}from"./TemplatesTabs-CatJIjGi.js";var u=e(n()),d=t();function f(){let{loaded:e,modelGroups:t,skills:n}=o.useLoaderData(),[r,a]=(0,u.useState)(`basics`),[f,p]=(0,u.useState)({}),g=(0,u.useCallback)((e,t)=>{p(n=>n[e]===t?n:{...n,[e]:t})},[]),_=Object.values(f).filter(Boolean).length;return(0,d.jsxs)(s,{children:[(0,d.jsx)(i,{when:_>0,subject:`Agent template changes`}),(0,d.jsx)(l,{}),(0,d.jsxs)(`header`,{className:`mb-1`,children:[(0,d.jsx)(`a`,{href:`/templates/agents`,className:`mb-1 inline-block text-[0.85em] text-mocha-light hover:text-sapphire`,children:`← agent templates`}),(0,d.jsx)(`h1`,{children:e.profile.name}),(0,d.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[0.9em] text-mocha-light`,children:[(0,d.jsx)(`code`,{children:e.profile.id}),(0,d.jsx)(`span`,{children:`·`}),(0,d.jsxs)(`span`,{children:[`model: `,(0,d.jsx)(`code`,{children:e.profile.defaultModel})]})]})]}),(0,d.jsxs)(`p`,{className:`muted my-6`,children:[`These settings and files seed every agent spawned from this Agent template going forward.`,` `,(0,d.jsx)(`strong`,{children:`Existing agents keep their own copies`}),` — edits here don't propagate to already-spawned agents.`]}),(0,d.jsx)(h,{items:[{id:`basics`,label:`1. basics`},{id:`skills`,label:`2. skills`},{id:`communication`,label:`3. communication`}],active:r,onChange:e=>a(e)}),_>0&&(0,d.jsxs)(`p`,{role:`status`,className:`mb-4 text-sm text-warning`,children:[_,` unsaved `,_===1?`section`:`sections`,` — switching tabs keeps the draft, but leaving this page will ask for confirmation.`]}),(0,d.jsxs)(`div`,{hidden:r!==`basics`,children:[(0,d.jsx)(x,{profileId:e.profile.id,initialName:e.profile.name,currentModel:e.profile.defaultModel,modelGroups:t,onDirtyChange:g}),(0,d.jsx)(y,{profileId:e.profile.id,file:`SOUL.md`,initialContent:e.files.soul,rows:14,onDirtyChange:g}),(0,d.jsx)(y,{profileId:e.profile.id,file:`IDENTITY.md`,initialContent:e.files.identity,rows:10,onDirtyChange:g}),e.files.bootstrap===null?(0,d.jsxs)(`section`,{className:`file-card`,children:[(0,d.jsx)(`div`,{className:`file-head`,children:(0,d.jsx)(`h3`,{children:`BOOTSTRAP.md`})}),(0,d.jsx)(`p`,{className:`muted`,children:`This profile was created without a bootstrap prompt. Spawned agents won't see a first-run intro message.`})]}):(0,d.jsx)(y,{profileId:e.profile.id,file:`BOOTSTRAP.md`,initialContent:e.files.bootstrap,rows:10,onDirtyChange:g}),(0,d.jsx)(b,{profileId:e.profile.id,file:`AGENTS.md`,initialContent:e.files.agents,hint:`Peers and routing notes — who this agent can hand off to.`,onDirtyChange:g}),(0,d.jsx)(b,{profileId:e.profile.id,file:`TOOLS.md`,initialContent:e.files.tools,hint:`Tool playbook. Agent-specific usage notes that go beyond the generic tool descriptions.`,onDirtyChange:g})]}),(0,d.jsx)(`div`,{hidden:r!==`skills`,children:(0,d.jsx)(S,{profileId:e.profile.id,initialMode:e.profile.skillsMode,initialPicked:new Set(e.defaultSkills),skills:n,onDirtyChange:g})}),(0,d.jsx)(`div`,{hidden:r!==`communication`,children:(0,d.jsx)(m,{profileId:e.profile.id,initial:e.profile.communicationDefaults??c,onDirtyChange:g})})]})}function p(e,t,n){(0,u.useEffect)(()=>{n(e,t)},[t,n,e])}function m({profileId:e,initial:t,onDirtyChange:n}){let[r,i]=(0,u.useState)(t),[o,s]=(0,u.useState)(t),[c,l]=(0,u.useState)({kind:`idle`,message:``}),f=JSON.stringify(r)!==JSON.stringify(o),m=_(f,c);return p(`communication`,f,n),(0,d.jsxs)(`section`,{className:`rounded-md border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,d.jsx)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:(0,d.jsx)(`h3`,{className:`m-0 font-body text-[0.95rem] font-semibold normal-case text-chocolate`,children:`Communication defaults`})}),(0,d.jsx)(`p`,{className:`muted mb-4`,children:`Materialized into new Team and Team policy snapshots after preset resolution. Existing snapshots never inherit later changes. Stored by the daemon.`}),(0,d.jsx)(a,{value:r,onChange:i}),(0,d.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,d.jsx)(`button`,{type:`button`,className:`btn-primary`,disabled:!f||c.kind===`saving`,onClick:async()=>{l({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({communicationDefaults:r})});if(!t.ok)throw Error((await t.json().catch(()=>null))?.error??t.statusText);s(r),l({kind:`saved`,message:`saved to daemon`})}catch(e){l({kind:`error`,message:`error: ${e instanceof Error?e.message:String(e)}`})}},children:`save communication defaults`}),m.message&&(0,d.jsx)(`span`,{role:m.kind===`error`?`alert`:`status`,className:`text-xs ${g(m.kind)}`,children:m.message})]})]})}function h({items:e,active:t,onChange:n}){return(0,d.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex gap-1 border-b border-frost`,children:e.map(e=>(0,d.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.id,onClick:()=>n(e.id),className:`unstyled cursor-pointer border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${t===e.id?`border-sapphire text-sapphire`:`border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}function g(e){return e===`saved`?`text-sapphire`:e===`error`?`text-danger`:e===`dirty`?`text-mocha`:`text-mocha-light`}function _(e,t){return e&&t.kind!==`saving`&&t.kind!==`error`?{kind:`dirty`,message:`unsaved changes`}:t}function v({title:e,status:t,children:n}){return(0,d.jsxs)(`section`,{className:`file-card mb-5 rounded-[16px] border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,d.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,d.jsx)(`h3`,{className:`m-0 font-mono text-[0.95em] font-semibold normal-case tracking-normal text-chocolate`,children:e}),t&&(0,d.jsx)(`span`,{role:t.kind===`error`?`alert`:t.message?`status`:void 0,className:`text-[0.82em] ${g(t.kind)}`,children:t.message})]}),n]})}function y({profileId:e,file:t,initialContent:n,rows:r=10,onDirtyChange:i}){let[a,o]=(0,u.useState)(n),[s,c]=(0,u.useState)(n),[l,f]=(0,u.useState)({kind:`idle`,message:``}),m=s!==a;p(`file:${t}`,m,i);let h=_(m,l);async function g(){f({kind:`saving`,message:`saving…`});try{let n=await fetch(`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:s})});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}o(s),f({kind:`saved`,message:`saved`})}catch(e){f({kind:`error`,message:`error: ${e.message}`})}}function y(){c(a),f({kind:`idle`,message:``})}return(0,d.jsxs)(v,{title:t,status:h,children:[(0,d.jsx)(`textarea`,{"aria-label":`${t} contents`,rows:r,value:s,onChange:e=>c(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`}),(0,d.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,d.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:g,disabled:l.kind===`saving`,children:`save`}),(0,d.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:y,children:`revert`})]})]})}function b({profileId:e,file:t,initialContent:n,hint:i,onDirtyChange:a}){let o=r(),[s,c]=(0,u.useState)(!1),[l,f]=(0,u.useState)({kind:`idle`,message:``});async function p(){c(!0),f({kind:`saving`,message:`creating…`});try{let n=await fetch(`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:``})});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await o.invalidate()}catch(e){f({kind:`error`,message:`error: ${e.message}`}),c(!1)}}return n===null?(0,d.jsxs)(v,{title:t,status:l,children:[(0,d.jsx)(`p`,{className:`muted my-1`,children:i}),(0,d.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,d.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:p,disabled:s,children:s?`creating…`:`create empty`})})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`p`,{className:`muted -mb-3 ml-1 mt-2 text-[0.85em]`,children:i}),(0,d.jsx)(y,{profileId:e,file:t,initialContent:n,rows:10,onDirtyChange:a})]})}function x({profileId:e,initialName:t,currentModel:n,modelGroups:i,onDirtyChange:a}){let o=r(),[s,c]=(0,u.useState)(t),[l,f]=(0,u.useState)(n),[m,h]=(0,u.useState)(t),[g,y]=(0,u.useState)(n),[b,x]=(0,u.useState)({kind:`idle`,message:``}),S=s!==m||l!==g,C=_(S,b);p(`settings`,S,a);let w=!i.flatMap(e=>e.models.map(t=>`${e.provider}:${t}`)).includes(n);async function T(t){t.preventDefault();let n=s.trim(),r=l.trim();x({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:n,defaultModel:r})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await o.invalidate(),c(n),f(r),h(n),y(r),x({kind:`saved`,message:`saved`})}catch(e){x({kind:`error`,message:`error: ${e.message}`})}}return(0,d.jsx)(v,{title:`settings`,status:C,children:(0,d.jsxs)(`form`,{onSubmit:T,children:[(0,d.jsxs)(`div`,{className:`flex gap-4`,children:[(0,d.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,d.jsx)(`input`,{value:s,onChange:e=>c(e.target.value)})]}),(0,d.jsxs)(`label`,{className:`flex-1`,children:[`default model`,i.length===0?(0,d.jsx)(`select`,{disabled:!0,children:(0,d.jsx)(`option`,{children:`(no models available — enable on /config)`})}):(0,d.jsxs)(`select`,{value:l,onChange:e=>f(e.target.value),children:[w&&(0,d.jsxs)(`option`,{value:n,children:[n,` (not in enabled list)`]}),i.map(e=>(0,d.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,d.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]})]}),(0,d.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,d.jsx)(`button`,{type:`submit`,disabled:!S||b.kind===`saving`,children:`save settings`})})]})})}function S({profileId:e,initialMode:t,initialPicked:n,skills:i,onDirtyChange:a}){let o=r(),[s,c]=(0,u.useState)(t),[l,f]=(0,u.useState)(n),[m,h]=(0,u.useState)(t),[g,y]=(0,u.useState)(n),[b,x]=(0,u.useState)({kind:`idle`,message:``}),S=s!==m||!C(l,g),w=_(S,b);p(`skills`,S,a);function T(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function E(t){t.preventDefault();let n=s===`selected`?new Set(l):new Set;x({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({skillsMode:s,defaultSkills:Array.from(n)})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await o.invalidate(),h(s),f(n),y(n),x({kind:`saved`,message:`saved`})}catch(e){x({kind:`error`,message:`error: ${e.message}`})}}return(0,d.jsxs)(v,{title:`skills`,status:w,children:[(0,d.jsx)(`p`,{className:`muted my-2`,children:`Choose what agents spawned from this profile inherit. Existing agents aren't affected — they keep whatever skills they were spawned with.`}),(0,d.jsxs)(`form`,{onSubmit:E,children:[(0,d.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,d.jsx)(`input`,{type:`radio`,checked:s===`all`,onChange:()=>c(`all`)}),(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`strong`,{children:`allow all skills`}),` — every skill on disk is attached at spawn.`]})]}),(0,d.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,d.jsx)(`input`,{type:`radio`,checked:s===`selected`,onChange:()=>c(`selected`)}),(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`strong`,{children:`select skills`}),` — attach only the ones ticked below.`]})]}),(0,d.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${s===`all`?`pointer-events-none opacity-50`:``}`,children:i.length===0?(0,d.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,d.jsx)(`a`,{href:`/skills`,children:`/skills`}),`.`]}):i.map(e=>(0,d.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:l.has(e.name),onChange:()=>T(e.name)}),(0,d.jsxs)(`span`,{children:[(0,d.jsx)(`code`,{children:e.name}),e.description&&(0,d.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,e.description]})]})]},e.name))}),(0,d.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,d.jsx)(`button`,{type:`submit`,disabled:!S||b.kind===`saving`,children:`save skills`})})]})]})}function C(e,t){return e.size===t.size&&Array.from(e).every(e=>t.has(e))}export{f as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{y as t}from"./index-Bq2zrG2_.js";import{r as n}from"./Page-NV96O47A.js";import{t as r}from"./ResultCard-Cps_lXVN.js";var i=e();function a(){let{id:e}=t.useParams();return(0,i.jsxs)(n,{size:`narrow`,children:[(0,i.jsx)(`h1`,{children:`Saved file`}),(0,i.jsx)(r,{resultId:e,showPreview:!0})]})}export{a as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-MicTTwdy.js";import{Y as a,f as o}from"./index-Bq2zrG2_.js";import{i as s,r as c}from"./Page-NV96O47A.js";import{t as l}from"./AgentTabs-BcmmwYJc.js";import{t as u}from"./AgentAvatar-JYijLvZ2.js";import{t as d}from"./Button-ByiV6fpd.js";import{t as f}from"./ChatPane-CQZzxOir.js";import{t as p}from"./ResultSourceConversation-CtzJ8QA-.js";import{r as m}from"./wire-constants-CBD-lTaa.js";var h=a(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),g=e(n(),1),_=t();function v({value:e,className:t,ariaLabel:n=`Copy to clipboard`,title:r=`Copy to clipboard`}){let[i,a]=(0,g.useState)(!1);async function o(){if(!e)return;let t=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),t=!0)}catch{}if(!t){let n=document.createElement(`textarea`);n.value=e,n.setAttribute(`readonly`,``),n.style.position=`fixed`,n.style.opacity=`0`,document.body.appendChild(n),n.select();try{t=document.execCommand(`copy`)}catch{}n.remove()}t&&(a(!0),setTimeout(()=>a(!1),1e3))}return(0,_.jsx)(`button`,{type:`button`,onClick:o,title:r,"aria-label":n,className:`inline-flex h-[1.3rem] w-[1.6rem] items-center justify-center rounded-sm border border-transparent text-mocha-light transition-colors hover:border-frost hover:bg-snow hover:text-mocha ${i?`border-[#bcd9bc] bg-[#eef7ee] text-[#3b7a3b] hover:border-[#bcd9bc] hover:bg-[#eef7ee] hover:text-[#3b7a3b]`:``} ${t??``}`,children:i?`✓`:`⧉`})}function y(){let{resolved:e,initialMessages:t,sessionHead:n,teams:a,skills:m,modelGroups:y,telegramConfigured:T}=o.useLoaderData(),D=o.useSearch(),O=r(),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=D.mode===`settings`;async function P(){let t=await fetch(`/api/agents/${encodeURIComponent(e.agent.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 O.invalidate()}async function F(){M(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e.agent.id)}/unarchive`,{method:`POST`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??`Could not restore Agent (${t.status})`)}await O.invalidate()}catch(e){M(e instanceof Error?e.message:String(e))}}async function I(){let t=await fetch(`/api/teams/${encodeURIComponent(e.team.id)}/policy`);if(!t.ok)throw Error(`The current Team policy is unavailable. Nothing was deleted.`);let n=await t.json(),r=await fetch(`/api/agents/${e.agent.id}?expectedTeamRevision=${n.teamPolicy.revision}`,{method:`DELETE`});if(r.ok||r.status===204)window.location.assign(`/agents`);else{let e=await r.json().catch(()=>null);throw Error(e?.error??`Could not delete Agent (${r.status})`)}}return(0,_.jsxs)(c,{children:[(0,_.jsxs)(`header`,{className:`mb-8`,children:[D.teamPolicy&&(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,_.jsxs)(`a`,{href:`/teams/${encodeURIComponent(D.teamPolicy)}/policy?view=${D.view??`flow`}&selected=${encodeURIComponent(D.selected??``)}&vx=${D.vx??0}&vy=${D.vy??0}&vz=${D.vz??.9}`,className:`ghost-btn`,children:[(0,_.jsx)(h,{className:`h-4 w-4`}),` back to Team policy`]}),(0,_.jsx)(`span`,{className:`text-xs text-mocha-light`,children:`Returns to the same projection, viewport, and selection.`})]}),(0,_.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,_.jsx)(u,{identity:e.agent.identity,size:44}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`h1`,{className:`mb-0 break-words`,children:e.agent.name}),(e.agent.identity?.creature||e.agent.identity?.vibe)&&(0,_.jsx)(`p`,{className:`muted mt-0.5 text-sm`,children:[e.agent.identity?.creature,e.agent.identity?.vibe].filter(Boolean).join(` · `)})]})]}),(0,_.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-5 gap-y-2`,children:[(0,_.jsxs)(x,{children:[(0,_.jsx)(`span`,{className:`min-w-0 break-all px-1.5 font-mono text-[0.95em] text-mocha select-all`,children:e.agent.id}),(0,_.jsx)(v,{value:e.agent.id,ariaLabel:`Copy agent UUID`,title:`Copy UUID to clipboard`})]}),(0,_.jsxs)(x,{children:[`status: `,(0,_.jsx)(`span`,{className:`ml-1`,children:e.agent.status})]}),(0,_.jsxs)(x,{children:[`profile:`,` `,(0,_.jsx)(`code`,{className:`ml-1 min-w-0 break-all bg-transparent px-0`,children:e.profile.id})]}),(0,_.jsxs)(x,{children:[`team:`,` `,(0,_.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.team.id)}`,className:`ml-1 min-w-0 break-all bg-transparent px-0 font-mono underline`,children:e.team.id}),` `,`·`,` `,(0,_.jsx)(`a`,{href:`/teams/${encodeURIComponent(e.team.id)}/memory`,className:`ml-0.5 underline`,children:`shared memory →`})]}),(0,_.jsxs)(x,{children:[`model:`,` `,(0,_.jsx)(`code`,{className:`ml-1 min-w-0 break-all bg-transparent px-0`,children:e.model})]}),(0,_.jsxs)(x,{children:[`reasoning:`,` `,(0,_.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.reasoningLevel})]})]}),(0,_.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.agent.status===`archived`?(0,_.jsx)(d,{variant:`ghost`,onClick:()=>void F(),children:`Restore`}):(0,_.jsx)(d,{variant:`ghost`,onClick:()=>A(`archive`),children:`Archive`}),(0,_.jsx)(d,{variant:`danger`,onClick:()=>A(`delete`),children:`Delete permanently`})]})]}),j&&(0,_.jsx)(`p`,{role:`alert`,className:`err`,children:j}),e.agent.status===`archived`&&(0,_.jsxs)(`div`,{className:`mb-4 rounded-md border border-frost bg-fawn/35 px-4 py-2 text-[0.9em] text-chocolate`,children:[(0,_.jsx)(`strong`,{className:`text-warning`,children:`This agent is archived.`}),` It's hidden from the default agent list; use `,(0,_.jsx)(`em`,{children:`unarchive`}),` above to bring it back, or`,` `,(0,_.jsx)(`em`,{children:`delete permanently`}),` to remove its data entirely.`]}),(0,_.jsx)(l,{agentId:e.agent.id,active:N?`settings`:`chat`,archived:e.agent.status===`archived`}),D.resultSource?(0,_.jsx)(p,{resultId:D.resultSource,agentId:e.agent.id}):N?(0,_.jsxs)(`div`,{className:`space-y-6`,children:[(0,_.jsx)(S,{agentId:e.agent.id,currentModelOverride:e.agent.modelOverride??null,profileDefaultModel:e.profile.defaultModel,currentReasoning:e.reasoningLevel,modelGroups:y}),(0,_.jsxs)(s,{title:`Team`,description:`Move this permanent Agent between Team workspaces with an exact policy preview.`,children:[(0,_.jsx)(b,{children:`Team`}),(0,_.jsxs)(`p`,{className:`text-[0.9em] text-mocha-light`,children:[`Current team: `,(0,_.jsx)(`code`,{children:e.team.id}),` (`,e.team.name,`) —`,` `,(0,_.jsx)(`code`,{children:e.team.path}),`.`,` `,(0,_.jsx)(`a`,{href:`/teams/${e.team.id}`,children:`view / edit USER.md`})]}),(0,_.jsx)(C,{agentId:e.agent.id,currentTeamId:e.team.id,teams:a})]}),(0,_.jsx)(s,{title:`Skills`,description:`Attach or detach prompt skills for this Agent.`,children:(0,_.jsx)(w,{agentId:e.agent.id,attached:new Set(e.skills),all:m})}),T&&(0,_.jsx)(s,{title:`Telegram`,description:`Bind this Agent to its Telegram topic and control mirroring.`,children:(0,_.jsx)(E,{agent:e.agent})})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(b,{children:`Chat`}),(0,_.jsx)(`div`,{className:`h-[70vh]`,children:(0,_.jsx)(f,{agentId:e.agent.id,agentName:e.agent.name,initialMessages:t,initialSessionHead:n})}),(0,_.jsx)(`p`,{className:`mt-2 text-[0.82em] text-mocha-light`,children:`chat history persists in bazilion across navigation and restarts.`})]}),(0,_.jsx)(i,{open:k!==null,onOpenChange:e=>{e||A(null)},title:k===`delete`?`Delete ${e.agent.name} permanently?`:`Archive ${e.agent.name}?`,description:k===`delete`?(0,_.jsx)(`p`,{children:`This permanently removes messages, triggers, skill attachments, sessions, and the Agent's private on-disk directory. This cannot be undone.`}):(0,_.jsx)(`p`,{children:`The Agent will stop receiving normal work and disappear from current lists. You can restore it later from “Show archived”.`}),confirmLabel:k===`delete`?`Delete permanently`:`Archive Agent`,confirmVariant:k===`delete`?`danger`:`primary`,onConfirm:async()=>{M(null);try{k===`delete`?await I():await P()}catch(e){throw M(e instanceof Error?e.message:String(e)),e}}})]})}function b({children:e}){return(0,_.jsx)(`h3`,{className:`mb-3 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:e})}function x({children:e}){return(0,_.jsx)(`span`,{className:`inline-flex max-w-full min-w-0 flex-wrap items-center gap-1 break-all rounded-full border border-frost bg-ivory px-3 py-0.5 text-[0.84em] text-mocha-light`,children:e})}function S({agentId:e,currentModelOverride:t,profileDefaultModel:n,currentReasoning:i,modelGroups:a}){let o=r(),[c,l]=(0,g.useState)(t??``),[u,f]=(0,g.useState)(i),[p,h]=(0,g.useState)(!1),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),S=t!==null&&a.some(e=>e.models.some(n=>`${e.provider}:${n}`===t));async function C(t){t.preventDefault(),h(!0),x(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({modelOverride:c===``?null:c,reasoningLevel:u})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}y(!0),setTimeout(()=>y(!1),1500),await o.invalidate()}catch(e){x(e.message)}finally{h(!1)}}return(0,_.jsx)(s,{title:`Model and reasoning`,description:`Override the Agent template defaults for this Agent only.`,children:(0,_.jsxs)(`form`,{onSubmit:C,className:`grid gap-4 sm:grid-cols-2`,children:[(0,_.jsxs)(`label`,{className:`m-0 flex min-w-0 flex-col gap-1 text-sm text-foreground`,children:[`Model override`,(0,_.jsxs)(`select`,{name:`modelOverride`,value:c,onChange:e=>l(e.target.value),className:`min-w-0`,children:[(0,_.jsxs)(`option`,{value:``,children:[`inherit from profile (`,n,`)`]}),t!==null&&!S&&(0,_.jsxs)(`option`,{value:t,children:[t,` (not in curated list)`]}),a.map(e=>(0,_.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>{let n=`${e.provider}:${t}`;return(0,_.jsx)(`option`,{value:n,children:n},n)})},e.provider))]})]}),(0,_.jsxs)(`label`,{className:`m-0 flex min-w-0 flex-col gap-1 text-sm text-foreground`,children:[`Reasoning level`,(0,_.jsx)(`select`,{name:`reasoningLevel`,value:u,onChange:e=>f(e.target.value),className:`min-w-0`,children:m.map(e=>(0,_.jsx)(`option`,{value:e,children:e},e))})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 sm:col-span-2`,children:[(0,_.jsx)(d,{variant:`primary`,type:`submit`,disabled:p,children:p?`Saving…`:`Save model settings`}),v&&(0,_.jsx)(`span`,{role:`status`,className:`text-sm text-success`,children:`Saved`}),b&&(0,_.jsx)(`span`,{role:`alert`,className:`text-sm text-danger`,children:b})]})]})})}function C({agentId:e,currentTeamId:t,teams:n}){let i=r(),[a,o]=(0,g.useState)(t),[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(`profile_defaults`),[f,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(null);async function v(n){if(n.preventDefault(),a!==t){c(!0),p(null);try{let[n,r]=await Promise.all([fetch(`/api/teams/${encodeURIComponent(t)}/policy`),fetch(`/api/teams/${encodeURIComponent(a)}/policy`)]);if(!n.ok||!r.ok)throw Error(`A Team policy is unavailable. Nothing was moved.`);let o=await n.json(),s=await r.json(),c={teamId:a,sourceExpectedRevision:o.teamPolicy.revision,destinationExpectedRevision:s.teamPolicy.revision,placement:l};if(!m){let t=await fetch(`/api/agents/${encodeURIComponent(e)}/team/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(c)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}h(await t.json());return}let u=await fetch(`/api/agents/${encodeURIComponent(e)}/team`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({...c,sourceExpectedRevision:m.source.currentRevision,destinationExpectedRevision:m.destination.currentRevision})});if(!u.ok){let e=await u.json().catch(()=>null);throw Error(e?.error??u.statusText)}await i.invalidate()}catch(e){p(e.message)}finally{c(!1)}}}return(0,_.jsxs)(`form`,{onSubmit:v,className:`mt-2 flex flex-wrap items-end gap-2`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`move to:`,(0,_.jsx)(`select`,{value:a,onChange:e=>{o(e.target.value),h(null)},className:`w-full min-w-0 rounded-sm border border-frost bg-snow px-2 py-1.5 sm:min-w-[18rem]`,children:n.map(e=>(0,_.jsxs)(`option`,{value:e.id,children:[e.id,` — `,e.path]},e.id))})]}),(0,_.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`destination placement:`,(0,_.jsxs)(`select`,{value:l,onChange:e=>{u(e.target.value),h(null)},className:`rounded-sm border border-frost bg-snow px-2 py-1.5`,children:[(0,_.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`}),(0,_.jsx)(`option`,{value:`isolated`,children:`isolated`})]})]}),(0,_.jsx)(d,{variant:`primary`,type:`submit`,disabled:s||a===t,children:s?`working…`:m?`commit reviewed move`:`review move`}),f&&(0,_.jsx)(`span`,{role:`alert`,className:`basis-full text-[0.85em] text-danger`,children:f}),m&&(0,_.jsxs)(`div`,{className:`basis-full rounded-md border border-sapphire-light bg-sapphire-glow p-3 text-sm`,children:[(0,_.jsxs)(`p`,{children:[`Source revision `,m.source.currentRevision,` → `,(0,_.jsx)(`strong`,{children:m.source.resultingRevision}),`, removing `,m.source.removedEdges.length,` incident edges. Destination revision `,m.destination.currentRevision,` → `,(0,_.jsx)(`strong`,{children:m.destination.resultingRevision}),`, adding `,m.destination.addedEdges.length,` edges to `,m.destination.existingEdges.length,` existing edges.`]}),(0,_.jsx)(`p`,{className:`mt-1 muted`,children:m.lineage})]})]})}function w({agentId:e,attached:t,all:n}){let a=r(),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(null);async function h(t,n=!1){let r=t.scanFindings??[];if(r.length>0&&!n){f(t);return}s(t.name),l(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e)}/skills`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({skill:t.name,allowFindings:r.length>0})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await a.invalidate()}catch(e){throw l(e instanceof Error?e.message:String(e)),e}finally{s(null)}}async function v(t){s(t),l(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await a.invalidate()}catch(e){throw l(e.message),e}finally{s(null)}}return n.length===0?(0,_.jsx)(`p`,{className:`text-[0.9em] text-mocha-light`,children:`no skills installed`}):(0,_.jsxs)(_.Fragment,{children:[c&&(0,_.jsx)(`p`,{role:`alert`,className:`mb-2 text-[0.85em] text-danger`,children:c}),(0,_.jsxs)(`table`,{className:`hidden md:table`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{children:`name`}),(0,_.jsx)(`th`,{children:`description`}),(0,_.jsx)(`th`,{children:`scan`}),(0,_.jsx)(`th`,{})]})}),(0,_.jsx)(`tbody`,{children:n.map(e=>{let n=t.has(e.name),r=o===e.name;return(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`td`,{children:(0,_.jsx)(`code`,{children:e.name})}),(0,_.jsx)(`td`,{children:e.description||(0,_.jsx)(`span`,{className:`text-mocha-light`,children:`—`})}),(0,_.jsx)(`td`,{children:(0,_.jsx)(T,{findings:e.scanFindings??[]})}),(0,_.jsx)(`td`,{children:n?(0,_.jsx)(d,{variant:`ghost`,disabled:r,onClick:()=>m(e.name),children:r?`…`:`detach`}):(0,_.jsx)(d,{variant:`ghost`,disabled:r,onClick:()=>void h(e).catch(()=>{}),children:r?`…`:`attach`})})]},e.name)})})]}),(0,_.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:n.map(e=>{let n=t.has(e.name),r=o===e.name;return(0,_.jsxs)(`article`,{className:`min-w-0 rounded-xl border border-border bg-muted/20 p-4`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,_.jsx)(`code`,{className:`min-w-0 break-all font-mono text-sm`,children:e.name}),(0,_.jsx)(`span`,{className:`shrink-0 text-xs font-semibold ${n?`text-success`:`text-muted-foreground`}`,children:n?`Attached`:`Available`})]}),(0,_.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description||`No description provided.`}),(0,_.jsx)(`div`,{className:`mt-2`,children:(0,_.jsx)(T,{findings:e.scanFindings??[]})}),(0,_.jsx)(`div`,{className:`mt-3`,children:n?(0,_.jsx)(d,{variant:`ghost`,disabled:r,onClick:()=>m(e.name),children:r?`Detaching…`:`Detach`}):(0,_.jsx)(d,{variant:`ghost`,disabled:r,onClick:()=>void h(e).catch(()=>{}),children:r?`Attaching…`:`Attach`})})]},e.name)})}),(0,_.jsx)(i,{open:u!==null,onOpenChange:e=>{e||f(null)},title:`Attach ${u?.name??`skill`} despite scan findings?`,description:(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsxs)(`p`,{children:[`Static scanning found `,u?.scanFindings?.length??0,` potentially unsafe instruction`,u?.scanFindings?.length===1?``:`s`,`. Review the findings before allowing this skill into the Agent's prompt.`]}),(0,_.jsx)(T,{findings:u?.scanFindings??[]})]}),confirmLabel:`Attach despite findings`,onConfirm:async()=>{u&&await h(u,!0)}}),(0,_.jsx)(i,{open:p!==null,onOpenChange:e=>{e||m(null)},title:`Detach ${p??`skill`}?`,description:(0,_.jsx)(`p`,{children:`This removes the skill's instructions from this Agent's future turns. It does not uninstall the skill, and you can attach it again later.`}),confirmLabel:`Detach skill`,onConfirm:async()=>{p&&await v(p)}})]})}function T({findings:e}){return e.length===0?(0,_.jsx)(`span`,{className:`text-mocha-light`,children:`clean`}):(0,_.jsxs)(`details`,{className:`text-[0.82em]`,children:[(0,_.jsxs)(`summary`,{className:e.some(e=>e.severity===`danger`)?`cursor-pointer text-danger`:`cursor-pointer text-mocha`,children:[e.length,` finding`,e.length===1?``:`s`]}),(0,_.jsx)(`ul`,{className:`m-0 list-disc pl-4`,children:e.map((e,t)=>(0,_.jsxs)(`li`,{children:[(0,_.jsx)(`span`,{className:`font-mono`,children:e.severity}),`: `,e.code,e.line?` line ${e.line}`:``,` - `,e.message]},`${e.code}-${e.line??0}-${t}`))})]})}function E({agent:e}){let t=r(),[n,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(e.telegramMirrorMode),[u,f]=(0,g.useState)(e.telegramIconEmoji??``),[p,m]=(0,g.useState)(!1),h=e.telegramTopicId!==null;async function v(){a(!0),s(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}/telegram/bind`,{method:`POST`});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}let r=await n.json();window.open(r.deepLink,`_blank`,`noopener`),await t.invalidate()}catch(e){s(e.message)}finally{a(!1)}}async function y(){a(!0),s(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}/telegram/binding`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??`Could not unbind Telegram topic (${n.status})`)}await t.invalidate()}catch(e){throw s(e instanceof Error?e.message:String(e)),e}finally{a(!1)}}async function b(n){l(n);try{let r=await fetch(`/api/agents/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({telegramMirrorMode:n})});if(!r.ok)throw Error(r.statusText);await t.invalidate()}catch(t){l(e.telegramMirrorMode),s(t.message)}}async function x(){s(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({telegramIconEmoji:u.trim()||null})});if(!n.ok)throw Error(n.statusText);await t.invalidate()}catch(e){s(e.message)}}return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-[0.9em]`,children:[(0,_.jsx)(`div`,{className:`mb-3 flex flex-wrap items-center gap-3`,children:h?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`rounded-full bg-success/10 px-2 py-0.5 text-xs font-semibold text-success`,children:`bound`}),(0,_.jsxs)(`span`,{className:`font-mono text-mocha`,children:[`topic #`,e.telegramTopicId]}),(0,_.jsx)(`button`,{type:`button`,onClick:v,disabled:n,className:`ghost-btn`,title:`Open the topic in Telegram (works on desktop/Android; iOS shows the topic list)`,children:`open in Telegram`}),(0,_.jsx)(d,{variant:`danger`,onClick:()=>m(!0),disabled:n,children:`Unbind`})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`rounded-full bg-warning/10 px-2 py-0.5 text-xs font-semibold text-warning`,children:`unbound`}),(0,_.jsx)(`button`,{type:`button`,onClick:v,disabled:n,className:`ghost-btn`,title:`Create a Telegram topic for this agent`,children:n?`binding…`:`bind a topic`})]})}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[(0,_.jsx)(`label`,{htmlFor:`mirror-mode`,className:`m-0 text-mocha-light`,children:`Mirror mode`}),(0,_.jsxs)(`select`,{id:`mirror-mode`,value:c,onChange:e=>void b(e.target.value),className:`rounded-md border bg-background px-2 py-1 font-mono text-sm`,disabled:n,children:[(0,_.jsx)(`option`,{value:`minimal`,children:`minimal — assistant messages only`}),(0,_.jsx)(`option`,{value:`verbose`,children:`verbose — also tool calls`})]})]}),(0,_.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end gap-2`,children:[(0,_.jsx)(`label`,{htmlFor:`topic-icon`,className:`m-0 text-mocha-light`,children:`Topic icon`}),(0,_.jsx)(`input`,{id:`topic-icon`,value:u,onChange:e=>f(e.target.value),placeholder:`(profile default)`,maxLength:8,className:`w-32 rounded-md border bg-background px-2 py-1 font-mono text-sm`,disabled:n}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:n||u===(e.telegramIconEmoji??``),className:`ghost-btn`,children:`save icon`})]}),o&&(0,_.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o}),(0,_.jsx)(`p`,{className:`mt-3 text-[0.85em] text-mocha-light`,children:`When bound, every assistant turn for this agent gets mirrored to the topic. Typing in the topic triggers a new turn. iOS Telegram clients have a known limitation that prevents inline link deep-links from opening directly into a topic — bound state is still functional; navigate via the topic list manually.`})]}),(0,_.jsx)(i,{open:p,onOpenChange:m,title:`Unbind ${e.name} from Telegram?`,description:(0,_.jsx)(`p`,{children:`Telegram ingress and mirroring stop for this Agent. The existing forum topic remains in Telegram as an orphan until you remove it there.`}),confirmLabel:`Unbind Telegram topic`,onConfirm:y})]})}export{y as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{t}from"./ProductionTeamPolicyEditor-
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{t}from"./ProductionTeamPolicyEditor-DqUnN_ce.js";import{n}from"./index-Bq2zrG2_.js";import{r}from"./Page-NV96O47A.js";import{t as i}from"./RecoveryState-QfMSuwy3.js";import{t as a}from"./TemplatesTabs-CatJIjGi.js";var o=e();function s(){let e=n.useLoaderData();if(!e.ok)return(0,o.jsx)(i,{title:`Team template unavailable`,error:Error(e.error),reset:()=>window.location.reload(),fallbackHref:`/templates/teams`});let{detail:s,profiles:c}=e.value;return(0,o.jsxs)(r,{size:`wide`,children:[(0,o.jsx)(a,{}),(0,o.jsx)(`p`,{children:(0,o.jsx)(`a`,{href:`/templates/teams`,children:`← team templates`})}),s.template.deletedAt&&(0,o.jsx)(`div`,{role:`alert`,className:`err rounded-md border p-3`,children:`Source deleted — lineage is read-only and cannot be edited or spawned.`}),(0,o.jsx)(t,{source:{kind:`template`,detail:s},profiles:c}),(0,o.jsx)(`p`,{className:`muted text-xs`,children:`Stable slot IDs remain distinct from live Agent IDs. Every successful save creates a new immutable revision; the reconciled editor badge is authoritative.`})]})}export{s as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{q as r,s as i}from"./index-Bq2zrG2_.js";import{r as a}from"./Page-NV96O47A.js";import{t as o}from"./Button-ByiV6fpd.js";import{t as s}from"./TeamTabs-DbIk5vvT.js";var c=e(n()),l=t();function u(){let e=i.useLoaderData(),{id:t}=i.useParams(),[n,r]=(0,c.useState)(e),[u,f]=(0,c.useState)(!1),[p,m]=(0,c.useState)(null);return(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{children:`Blocked communication`}),(0,l.jsx)(`p`,{className:`muted`,children:`Durable denial evidence. Diagnostic simulations never create these records.`})]}),(0,l.jsx)(s,{teamId:t}),(0,l.jsxs)(`div`,{className:`space-y-3`,children:[n.blocks.map(e=>(0,l.jsx)(d,{block:e},e.id)),n.blocks.length===0&&(0,l.jsx)(`p`,{className:`card muted`,children:`No blocked communication has been recorded for this team.`})]}),p&&(0,l.jsx)(`p`,{role:`alert`,className:`err`,children:p}),n.nextCursor&&(0,l.jsx)(o,{variant:`ghost`,disabled:u,onClick:async()=>{if(n.nextCursor){f(!0),m(null);try{let e=await fetch(`/api/teams/${encodeURIComponent(t)}/policy/blocks?limit=25&cursor=${encodeURIComponent(n.nextCursor)}`);if(!e.ok)throw Error(`Could not load activity (${e.status})`);let i=await e.json();r({blocks:[...n.blocks,...i.blocks],nextCursor:i.nextCursor})}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:u?`Loading…`:`Load older evidence`})]})}function d({block:e}){return(0,l.jsxs)(`details`,{className:`card team`,children:[(0,l.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-wrap items-center gap-2`,children:[(0,l.jsx)(`strong`,{className:`mr-auto break-all`,children:e.reason_code}),(0,l.jsx)(`time`,{className:`text-xs text-mocha-light`,children:new Date(e.created_at).toLocaleString()}),(0,l.jsx)(r,{className:`h-4 w-4 transition-transform team-open:rotate-180`})]}),(0,l.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,l.jsx)(f,{label:`Path`,value:`${p(e.source_kind,e.source_id)} → ${p(e.target_kind,e.target_id)}`}),(0,l.jsx)(f,{label:`Channel / origin`,value:`${e.channel} · ${e.origin}`}),(0,l.jsx)(f,{label:`Operation`,value:e.operation}),(0,l.jsx)(f,{label:`Attempt identity`,value:`${e.attempt_kind}:${e.attempt_id}`,code:!0}),(0,l.jsx)(f,{label:`Reason`,value:e.reason,wide:!0})]}),(0,l.jsx)(`h3`,{className:`mt-5 text-sm`,children:`Policy revisions`}),(0,l.jsx)(`ul`,{className:`mt-2 text-sm`,children:e.policyRefs.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`code`,{children:e.teamId}),` revision `,e.revision]},`${e.teamId}:${e.revision}`))}),e.componentOutcomes.length>1&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`h3`,{className:`mt-5 text-sm`,children:`Cross-Team consent components`}),(0,l.jsx)(`div`,{className:`mt-2 overflow-x-auto`,children:(0,l.jsxs)(`table`,{children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{children:`Team`}),(0,l.jsx)(`th`,{children:`Required edge`}),(0,l.jsx)(`th`,{children:`Matched`})]})}),(0,l.jsx)(`tbody`,{children:e.componentOutcomes.map(e=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{children:e.teamId})}),(0,l.jsx)(`td`,{className:`break-all`,children:(0,l.jsx)(`code`,{children:e.edge})}),(0,l.jsx)(`td`,{children:e.matched?`yes`:`no`})]},`${e.teamId}:${e.edge}`))})]})})]}),(0,l.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,l.jsx)(f,{label:`Required edges`,value:e.requiredEdgeIds.join(`, `)||`none`,code:!0}),(0,l.jsx)(f,{label:`Matched edges`,value:e.matchedEdgeIds.join(`, `)||`none`,code:!0})]})]})}function f({label:e,value:t,code:n=!1,wide:r=!1}){return(0,l.jsxs)(`div`,{className:r?`sm:col-span-2`:``,children:[(0,l.jsx)(`dt`,{className:`text-xs font-semibold uppercase text-mocha-light`,children:e}),(0,l.jsx)(`dd`,{className:`mt-1 break-words`,children:n?(0,l.jsx)(`code`,{className:`break-all`,children:t}):t})]})}function p(e,t){return t?`${e}:${t}`:e}export{u as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./UnsavedChangesGuard-B1aLqiK5.js";import{t as a}from"./ProfileCommunicationEditor-CwdFPdpk.js";import{t as o}from"./ConfirmDialog-_bmG-wVG.js";import{p as s}from"./index-CLdmsmiN.js";import{n as c,r as l}from"./Page-NV96O47A.js";import{t as u}from"./Button-ByiV6fpd.js";import{t as d}from"./team-policy-D0jpnn2b.js";import{t as f}from"./TemplatesTabs-D4WHvs6b.js";var p=e(n()),m=t();function h(){let{profiles:e,modelGroups:t,skills:n,templates:i}=s.useLoaderData(),a=r(),[d,h]=(0,p.useState)(null),[_,v]=(0,p.useState)(null);async function y(e){let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await a.invalidate()}return(0,m.jsxs)(l,{size:`wide`,children:[(0,m.jsx)(c,{eyebrow:`Templates`,title:`Agent templates`,description:`Define reusable identity, model, skills, and communication defaults for newly spawned agents.`}),_&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:_}),(0,m.jsx)(f,{}),(0,m.jsx)(g,{modelGroups:t,skills:n,templates:i,onCreated:()=>a.invalidate()}),(0,m.jsx)(`div`,{className:`overflow-x-auto`,children:(0,m.jsxs)(`table`,{children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:`id`}),(0,m.jsx)(`th`,{children:`name`}),(0,m.jsx)(`th`,{children:`model`}),(0,m.jsx)(`th`,{children:`agents`}),(0,m.jsx)(`th`,{children:`skills`}),(0,m.jsx)(`th`,{})]})}),(0,m.jsxs)(`tbody`,{children:[e.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:6,className:`muted`,children:`no agent templates yet`})}),e.map(e=>{let t=e.skillsMode===`all`?`all`:e.defaultSkills.length===0?`—`:e.defaultSkills.join(`, `);return(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`a`,{href:`/templates/agents/${e.id}`,children:(0,m.jsx)(`code`,{children:e.id})})}),(0,m.jsx)(`td`,{children:e.name}),(0,m.jsx)(`td`,{children:(0,m.jsx)(`code`,{children:e.defaultModel})}),(0,m.jsx)(`td`,{children:e.agentCount}),(0,m.jsx)(`td`,{className:`text-xs text-mocha-light`,children:t}),(0,m.jsx)(`td`,{children:e.agentCount===0?(0,m.jsx)(u,{variant:`danger`,onClick:()=>{v(null),h(e)},children:`delete`}):(0,m.jsx)(`span`,{className:`muted`,title:`${e.agentCount} agent(s) use this profile`,children:`in use`})})]},e.id)})]})]})}),(0,m.jsx)(o,{open:d!==null,title:`Delete Agent template ${d?.name??``}?`,description:(0,m.jsxs)(`p`,{children:[`This permanently deletes `,(0,m.jsx)(`code`,{className:`font-mono`,children:d?.id}),` and all of its template files. It cannot be restored. Existing Agents keep their own copies.`]}),confirmLabel:`delete Agent template`,onConfirm:async()=>{if(d)try{await y(d.id)}catch(e){throw v(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||h(null)}})]})}function g({modelGroups:e,skills:t,templates:n,onCreated:r}){let[o,s]=(0,p.useState)(`basics`),[c,l]=(0,p.useState)(``),[f,h]=(0,p.useState)(``),[g,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(n.soul),[S,C]=(0,p.useState)(n.identity),[w,T]=(0,p.useState)(n.bootstrap),[E,D]=(0,p.useState)(!0),[O,k]=(0,p.useState)(n.agents),[A,j]=(0,p.useState)(!0),[M,N]=(0,p.useState)(n.tools),[P,F]=(0,p.useState)(!0);function I(e,t,n){t(n),!n&&o===e&&s(`basics`)}let[L,R]=(0,p.useState)(`all`),[z,B]=(0,p.useState)(d),[V,H]=(0,p.useState)(new Set),[U,W]=(0,p.useState)(null),[G,K]=(0,p.useState)(!1),q=c.length>0||f.length>0||g.length>0||b!==n.soul||S!==n.identity||w!==n.bootstrap||!E||O!==n.agents||!A||M!==n.tools||!P||L!==`all`||V.size>0||JSON.stringify(z)!==JSON.stringify(d);function J(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function Y(e){if(e.preventDefault(),W(null),!c.trim()){W(`id is required`);return}if(!g.trim()){W(`default model is required`);return}K(!0);try{let e={id:c.trim(),name:f.trim()||void 0,model:g.trim(),skillsMode:L,defaultSkills:L===`selected`?Array.from(V):[],soul:b,identity:S,bootstrap:E?w:null,agents:A?O:null,tools:P?M:null,communicationDefaults:z},t=await fetch(`/api/profiles`,{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??t.statusText)}l(``),h(``),y(``),x(n.soul),C(n.identity),T(n.bootstrap),D(!0),k(n.agents),j(!0),N(n.tools),F(!0),H(new Set),R(`all`),B(d),s(`basics`),r()}catch(e){W(e.message)}finally{K(!1)}}return(0,m.jsxs)(`form`,{className:`card`,onSubmit:Y,children:[(0,m.jsx)(i,{when:q&&!G,subject:`Agent template draft`}),(0,m.jsx)(`h3`,{children:`create agent template`}),U&&(0,m.jsx)(`div`,{role:`alert`,className:`err`,children:U}),(0,m.jsx)(_,{items:[{id:`basics`,label:`basics`},{id:`soul`,label:`SOUL`},{id:`identity`,label:`IDENTITY`},{id:`bootstrap`,label:`BOOTSTRAP`,disabled:!E},{id:`agents`,label:`AGENTS`,disabled:!A},{id:`tools`,label:`TOOLS`,disabled:!P},{id:`skills`,label:`skills`},{id:`communication`,label:`communication`}],active:o,onChange:e=>s(e)}),(0,m.jsxs)(`fieldset`,{className:`mb-5 rounded-md border border-frost p-3`,children:[(0,m.jsx)(`legend`,{className:`px-1 text-[0.85em] font-medium text-mocha`,children:`templates to include`}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2 text-[0.9em]`,children:[(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 opacity-60`,title:`always included`,children:[(0,m.jsx)(`input`,{type:`checkbox`,defaultChecked:!0,disabled:!0}),` SOUL.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 opacity-60`,title:`always included`,children:[(0,m.jsx)(`input`,{type:`checkbox`,defaultChecked:!0,disabled:!0}),` IDENTITY.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>I(`bootstrap`,D,e.target.checked)}),`BOOTSTRAP.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:A,onChange:e=>I(`agents`,j,e.target.checked)}),`AGENTS.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:P,onChange:e=>I(`tools`,F,e.target.checked)}),`TOOLS.md`]})]}),(0,m.jsx)(`p`,{className:`muted mt-2 text-[0.8em]`,children:`Disabled files aren't created for this Agent template. Each spawned agent gets its own copy of the enabled files at spawn time.`})]}),o===`basics`&&(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`label`,{className:`flex-1`,children:[`id (slug)`,(0,m.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),required:!0})]}),(0,m.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,m.jsx)(`input`,{value:f,onChange:e=>h(e.target.value)})]})]}),(0,m.jsxs)(`label`,{children:[`default model`,e.length===0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`select`,{disabled:!0,children:(0,m.jsx)(`option`,{children:`(no models available)`})}),(0,m.jsxs)(`span`,{className:`muted text-[0.85em]`,children:[`Enable a provider and curate models on `,(0,m.jsx)(`a`,{href:`/config`,children:`/config`}),` first.`]})]}):(0,m.jsxs)(`select`,{value:g,onChange:e=>y(e.target.value),required:!0,children:[(0,m.jsx)(`option`,{value:``,children:`-- pick a model --`}),e.map(e=>(0,m.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,m.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]})]}),o===`soul`&&(0,m.jsx)(v,{label:`SOUL.md`,hint:`Persona, values, and operating principles. Injected into every session.`,value:b,onChange:x,rows:16}),o===`identity`&&(0,m.jsx)(v,{label:`IDENTITY.md`,hint:`Name, creature, vibe, emoji, avatar — filled in during the bootstrap ritual.`,value:S,onChange:C,rows:12}),o===`bootstrap`&&(0,m.jsx)(v,{label:`BOOTSTRAP.md`,hint:`One-time first-run ritual. The agent retires it once introductions are done.`,value:w,onChange:T,rows:16}),o===`agents`&&(0,m.jsx)(v,{label:`AGENTS.md`,hint:`The workspace operating manual — memory discipline, red lines, channel etiquette.`,value:O,onChange:k,rows:16}),o===`tools`&&(0,m.jsx)(v,{label:`TOOLS.md`,hint:`Agent-specific tool notes and environment facts beyond the generic tool descriptions.`,value:M,onChange:N,rows:14}),o===`skills`&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`muted my-2`,children:`Choose which skills agents inherit at spawn time. In both modes each agent can still attach or detach skills individually after it's spawned.`}),(0,m.jsxs)(`label`,{className:`flex items-start gap-2 my-2 cursor-pointer`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`skillsMode`,value:`all`,checked:L===`all`,onChange:()=>R(`all`)}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:`allow all skills`}),` — every skill on disk is attached when an agent is spawned.`]})]}),(0,m.jsxs)(`label`,{className:`flex items-start gap-2 my-2 cursor-pointer`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`skillsMode`,value:`selected`,checked:L===`selected`,onChange:()=>R(`selected`)}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:`select skills`}),` — attach only the ones you pick below.`]})]}),(0,m.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${L===`all`?`opacity-50 pointer-events-none`:``}`,children:t.length===0?(0,m.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,m.jsx)(`a`,{href:`/skills`,children:`/skills`}),`.`]}):t.map(e=>(0,m.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:V.has(e.name),onChange:()=>J(e.name)}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`code`,{children:e.name}),e.description&&(0,m.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,e.description]})]})]},e.name))})]}),o===`communication`&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`mb-3 flex items-center gap-2`,children:(0,m.jsx)(`h4`,{className:`text-sm font-semibold text-chocolate`,children:`Communication defaults`})}),(0,m.jsx)(`p`,{className:`muted mb-4`,children:`Materialized when a Team or live policy snapshot is created. Existing snapshots never inherit later changes.`}),(0,m.jsx)(a,{value:z,onChange:B})]}),(0,m.jsx)(`div`,{className:`mt-5 flex gap-2`,children:(0,m.jsx)(u,{variant:`primary`,type:`submit`,disabled:G,children:G?`creating…`:`create`})})]})}function _({items:e,active:t,onChange:n}){return(0,m.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex flex-wrap gap-1 border-b border-frost`,children:e.map(e=>(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.id,disabled:e.disabled,title:e.disabled?`disabled — enable it in “templates to include”`:void 0,onClick:()=>n(e.id),className:`unstyled border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${e.disabled?`cursor-not-allowed border-transparent text-mocha-light/40`:t===e.id?`cursor-pointer border-sapphire text-sapphire`:`cursor-pointer border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}function v({label:e,hint:t,value:n,onChange:r,rows:i}){return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:t}),(0,m.jsxs)(`label`,{children:[e,(0,m.jsx)(`textarea`,{rows:i,value:n,onChange:e=>r(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]})]})}export{h as component};
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./UnsavedChangesGuard-BCsLw-mU.js";import{t as a}from"./ProfileCommunicationEditor-DArXub0b.js";import{t as o}from"./ConfirmDialog-MicTTwdy.js";import{m as s}from"./index-Bq2zrG2_.js";import{n as c,r as l}from"./Page-NV96O47A.js";import{t as u}from"./Button-ByiV6fpd.js";import{t as d}from"./team-policy-D0jpnn2b.js";import{t as f}from"./TemplatesTabs-CatJIjGi.js";var p=e(n()),m=t();function h(){let{profiles:e,modelGroups:t,skills:n,templates:i}=s.useLoaderData(),a=r(),[d,h]=(0,p.useState)(null),[_,v]=(0,p.useState)(null);async function y(e){let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await a.invalidate()}return(0,m.jsxs)(l,{size:`wide`,children:[(0,m.jsx)(c,{eyebrow:`Templates`,title:`Agent templates`,description:`Define reusable identity, model, skills, and communication defaults for newly spawned agents.`}),_&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:_}),(0,m.jsx)(f,{}),(0,m.jsx)(g,{modelGroups:t,skills:n,templates:i,onCreated:()=>a.invalidate()}),(0,m.jsx)(`div`,{className:`overflow-x-auto`,children:(0,m.jsxs)(`table`,{children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:`id`}),(0,m.jsx)(`th`,{children:`name`}),(0,m.jsx)(`th`,{children:`model`}),(0,m.jsx)(`th`,{children:`agents`}),(0,m.jsx)(`th`,{children:`skills`}),(0,m.jsx)(`th`,{})]})}),(0,m.jsxs)(`tbody`,{children:[e.length===0&&(0,m.jsx)(`tr`,{children:(0,m.jsx)(`td`,{colSpan:6,className:`muted`,children:`no agent templates yet`})}),e.map(e=>{let t=e.skillsMode===`all`?`all`:e.defaultSkills.length===0?`—`:e.defaultSkills.join(`, `);return(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`a`,{href:`/templates/agents/${e.id}`,children:(0,m.jsx)(`code`,{children:e.id})})}),(0,m.jsx)(`td`,{children:e.name}),(0,m.jsx)(`td`,{children:(0,m.jsx)(`code`,{children:e.defaultModel})}),(0,m.jsx)(`td`,{children:e.agentCount}),(0,m.jsx)(`td`,{className:`text-xs text-mocha-light`,children:t}),(0,m.jsx)(`td`,{children:e.agentCount===0?(0,m.jsx)(u,{variant:`danger`,onClick:()=>{v(null),h(e)},children:`delete`}):(0,m.jsx)(`span`,{className:`muted`,title:`${e.agentCount} agent(s) use this profile`,children:`in use`})})]},e.id)})]})]})}),(0,m.jsx)(o,{open:d!==null,title:`Delete Agent template ${d?.name??``}?`,description:(0,m.jsxs)(`p`,{children:[`This permanently deletes `,(0,m.jsx)(`code`,{className:`font-mono`,children:d?.id}),` and all of its template files. It cannot be restored. Existing Agents keep their own copies.`]}),confirmLabel:`delete Agent template`,onConfirm:async()=>{if(d)try{await y(d.id)}catch(e){throw v(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||h(null)}})]})}function g({modelGroups:e,skills:t,templates:n,onCreated:r}){let[o,s]=(0,p.useState)(`basics`),[c,l]=(0,p.useState)(``),[f,h]=(0,p.useState)(``),[g,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(n.soul),[S,C]=(0,p.useState)(n.identity),[w,T]=(0,p.useState)(n.bootstrap),[E,D]=(0,p.useState)(!0),[O,k]=(0,p.useState)(n.agents),[A,j]=(0,p.useState)(!0),[M,N]=(0,p.useState)(n.tools),[P,F]=(0,p.useState)(!0);function I(e,t,n){t(n),!n&&o===e&&s(`basics`)}let[L,R]=(0,p.useState)(`all`),[z,B]=(0,p.useState)(d),[V,H]=(0,p.useState)(new Set),[U,W]=(0,p.useState)(null),[G,K]=(0,p.useState)(!1),q=c.length>0||f.length>0||g.length>0||b!==n.soul||S!==n.identity||w!==n.bootstrap||!E||O!==n.agents||!A||M!==n.tools||!P||L!==`all`||V.size>0||JSON.stringify(z)!==JSON.stringify(d);function J(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function Y(e){if(e.preventDefault(),W(null),!c.trim()){W(`id is required`);return}if(!g.trim()){W(`default model is required`);return}K(!0);try{let e={id:c.trim(),name:f.trim()||void 0,model:g.trim(),skillsMode:L,defaultSkills:L===`selected`?Array.from(V):[],soul:b,identity:S,bootstrap:E?w:null,agents:A?O:null,tools:P?M:null,communicationDefaults:z},t=await fetch(`/api/profiles`,{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??t.statusText)}l(``),h(``),y(``),x(n.soul),C(n.identity),T(n.bootstrap),D(!0),k(n.agents),j(!0),N(n.tools),F(!0),H(new Set),R(`all`),B(d),s(`basics`),r()}catch(e){W(e.message)}finally{K(!1)}}return(0,m.jsxs)(`form`,{className:`card`,onSubmit:Y,children:[(0,m.jsx)(i,{when:q&&!G,subject:`Agent template draft`}),(0,m.jsx)(`h3`,{children:`create agent template`}),U&&(0,m.jsx)(`div`,{role:`alert`,className:`err`,children:U}),(0,m.jsx)(_,{items:[{id:`basics`,label:`basics`},{id:`soul`,label:`SOUL`},{id:`identity`,label:`IDENTITY`},{id:`bootstrap`,label:`BOOTSTRAP`,disabled:!E},{id:`agents`,label:`AGENTS`,disabled:!A},{id:`tools`,label:`TOOLS`,disabled:!P},{id:`skills`,label:`skills`},{id:`communication`,label:`communication`}],active:o,onChange:e=>s(e)}),(0,m.jsxs)(`fieldset`,{className:`mb-5 rounded-md border border-frost p-3`,children:[(0,m.jsx)(`legend`,{className:`px-1 text-[0.85em] font-medium text-mocha`,children:`templates to include`}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2 text-[0.9em]`,children:[(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 opacity-60`,title:`always included`,children:[(0,m.jsx)(`input`,{type:`checkbox`,defaultChecked:!0,disabled:!0}),` SOUL.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-1.5 opacity-60`,title:`always included`,children:[(0,m.jsx)(`input`,{type:`checkbox`,defaultChecked:!0,disabled:!0}),` IDENTITY.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>I(`bootstrap`,D,e.target.checked)}),`BOOTSTRAP.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:A,onChange:e=>I(`agents`,j,e.target.checked)}),`AGENTS.md`]}),(0,m.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:P,onChange:e=>I(`tools`,F,e.target.checked)}),`TOOLS.md`]})]}),(0,m.jsx)(`p`,{className:`muted mt-2 text-[0.8em]`,children:`Disabled files aren't created for this Agent template. Each spawned agent gets its own copy of the enabled files at spawn time.`})]}),o===`basics`&&(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`flex gap-4`,children:[(0,m.jsxs)(`label`,{className:`flex-1`,children:[`id (slug)`,(0,m.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),required:!0})]}),(0,m.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,m.jsx)(`input`,{value:f,onChange:e=>h(e.target.value)})]})]}),(0,m.jsxs)(`label`,{children:[`default model`,e.length===0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`select`,{disabled:!0,children:(0,m.jsx)(`option`,{children:`(no models available)`})}),(0,m.jsxs)(`span`,{className:`muted text-[0.85em]`,children:[`Enable a provider and curate models on `,(0,m.jsx)(`a`,{href:`/config`,children:`/config`}),` first.`]})]}):(0,m.jsxs)(`select`,{value:g,onChange:e=>y(e.target.value),required:!0,children:[(0,m.jsx)(`option`,{value:``,children:`-- pick a model --`}),e.map(e=>(0,m.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,m.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]})]}),o===`soul`&&(0,m.jsx)(v,{label:`SOUL.md`,hint:`Persona, values, and operating principles. Injected into every session.`,value:b,onChange:x,rows:16}),o===`identity`&&(0,m.jsx)(v,{label:`IDENTITY.md`,hint:`Name, creature, vibe, emoji, avatar — filled in during the bootstrap ritual.`,value:S,onChange:C,rows:12}),o===`bootstrap`&&(0,m.jsx)(v,{label:`BOOTSTRAP.md`,hint:`One-time first-run ritual. The agent retires it once introductions are done.`,value:w,onChange:T,rows:16}),o===`agents`&&(0,m.jsx)(v,{label:`AGENTS.md`,hint:`The workspace operating manual — memory discipline, red lines, channel etiquette.`,value:O,onChange:k,rows:16}),o===`tools`&&(0,m.jsx)(v,{label:`TOOLS.md`,hint:`Agent-specific tool notes and environment facts beyond the generic tool descriptions.`,value:M,onChange:N,rows:14}),o===`skills`&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`muted my-2`,children:`Choose which skills agents inherit at spawn time. In both modes each agent can still attach or detach skills individually after it's spawned.`}),(0,m.jsxs)(`label`,{className:`flex items-start gap-2 my-2 cursor-pointer`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`skillsMode`,value:`all`,checked:L===`all`,onChange:()=>R(`all`)}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:`allow all skills`}),` — every skill on disk is attached when an agent is spawned.`]})]}),(0,m.jsxs)(`label`,{className:`flex items-start gap-2 my-2 cursor-pointer`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`skillsMode`,value:`selected`,checked:L===`selected`,onChange:()=>R(`selected`)}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:`select skills`}),` — attach only the ones you pick below.`]})]}),(0,m.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${L===`all`?`opacity-50 pointer-events-none`:``}`,children:t.length===0?(0,m.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,m.jsx)(`a`,{href:`/skills`,children:`/skills`}),`.`]}):t.map(e=>(0,m.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:V.has(e.name),onChange:()=>J(e.name)}),(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`code`,{children:e.name}),e.description&&(0,m.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,e.description]})]})]},e.name))})]}),o===`communication`&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`mb-3 flex items-center gap-2`,children:(0,m.jsx)(`h4`,{className:`text-sm font-semibold text-chocolate`,children:`Communication defaults`})}),(0,m.jsx)(`p`,{className:`muted mb-4`,children:`Materialized when a Team or live policy snapshot is created. Existing snapshots never inherit later changes.`}),(0,m.jsx)(a,{value:z,onChange:B})]}),(0,m.jsx)(`div`,{className:`mt-5 flex gap-2`,children:(0,m.jsx)(u,{variant:`primary`,type:`submit`,disabled:G,children:G?`creating…`:`create`})})]})}function _({items:e,active:t,onChange:n}){return(0,m.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex flex-wrap gap-1 border-b border-frost`,children:e.map(e=>(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.id,disabled:e.disabled,title:e.disabled?`disabled — enable it in “templates to include”`:void 0,onClick:()=>n(e.id),className:`unstyled border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${e.disabled?`cursor-not-allowed border-transparent text-mocha-light/40`:t===e.id?`cursor-pointer border-sapphire text-sapphire`:`cursor-pointer border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}function v({label:e,hint:t,value:n,onChange:r,rows:i}){return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:t}),(0,m.jsxs)(`label`,{children:[e,(0,m.jsx)(`textarea`,{rows:i,value:n,onChange:e=>r(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]})]})}export{h as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-MicTTwdy.js";import{b as a}from"./index-Bq2zrG2_.js";import{a as o,i as s,n as c,r as l,t as u}from"./Page-NV96O47A.js";import{t as d}from"./AgentAvatar-JYijLvZ2.js";import{t as f}from"./Button-ByiV6fpd.js";var p=e(n()),m=t();function h(){let{agents:e,profiles:t,teams:n,modelGroups:h}=a.useLoaderData(),{all:_}=a.useSearch(),v=_===`1`,y=r(),[b,x]=(0,p.useState)(null),[S,C]=(0,p.useState)(null);async function w(e){let t=await fetch(`/api/agents/${encodeURIComponent(e)}/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 y.invalidate()}async function T(e){C(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/unarchive`,{method:`POST`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??`Could not restore agent (${t.status})`)}await y.invalidate()}catch(e){C(e instanceof Error?e.message:String(e))}}async function E(t){let n=e.find(e=>e.id===t);if(!n)throw Error(`The selected agent no longer exists.`);let r=await fetch(`/api/teams/${encodeURIComponent(n.teamId)}/policy`);if(!r.ok)throw Error(`The current Team policy is unavailable. Nothing was deleted.`);let i=await r.json(),a=await fetch(`/api/agents/${encodeURIComponent(t)}?expectedTeamRevision=${i.teamPolicy.revision}`,{method:`DELETE`});if(!a.ok&&a.status!==204){let e=await a.json().catch(()=>null);throw Error(e?.error??`Could not delete agent (${a.status})`)}await y.invalidate()}return(0,m.jsxs)(l,{size:`wide`,children:[(0,m.jsx)(c,{eyebrow:`Workspace`,title:`Agents`,description:`Spawn, inspect, archive, and restore the agents that work across your teams.`,actions:(0,m.jsx)(f,{variant:`ghost`,onClick:()=>window.location.assign(v?`/agents`:`/agents?all=1`),children:v?`Hide archived`:`Show archived`})}),(0,m.jsx)(g,{profiles:t,teams:n,modelGroups:h,onSpawned:y.invalidate}),S&&(0,m.jsx)(`p`,{role:`alert`,className:`err`,children:S}),(0,m.jsx)(s,{title:v?`All agents`:`Current agents`,description:v?`Active and archived agents are shown together.`:`Archived agents stay hidden until you choose to show them.`,children:e.length===0?(0,m.jsx)(u,{title:v?`No agents yet`:`No current agents`,description:`Spawn an agent above to give a team its first working member.`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,m.jsxs)(`table`,{className:`min-w-[760px]`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:`ID`}),(0,m.jsx)(`th`,{children:`Name`}),(0,m.jsx)(`th`,{children:`Agent template`}),(0,m.jsx)(`th`,{children:`Status`}),(0,m.jsx)(`th`,{children:(0,m.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,m.jsx)(`tbody`,{children:e.map(e=>(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{children:(0,m.jsx)(`a`,{href:`/agents/${e.id}`,title:e.id,children:(0,m.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})})}),(0,m.jsx)(`td`,{children:(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(d,{identity:e.identity,size:26}),(0,m.jsxs)(`div`,{className:`leading-tight`,children:[(0,m.jsx)(`div`,{children:e.name}),(e.identity?.creature||e.identity?.vibe)&&(0,m.jsx)(`div`,{className:`muted text-[0.8em]`,children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)})]})]})}),(0,m.jsx)(`td`,{children:(0,m.jsx)(`code`,{children:e.profileId})}),(0,m.jsx)(`td`,{children:(0,m.jsx)(o,{variant:e.status===`archived`?`warning`:`success`,children:e.status})}),(0,m.jsx)(`td`,{children:(0,m.jsxs)(`div`,{className:`flex justify-end gap-1.5`,children:[e.status===`archived`?(0,m.jsx)(f,{variant:`ghost`,onClick:()=>T(e.id),children:`Restore`}):(0,m.jsx)(f,{variant:`ghost`,onClick:()=>x({kind:`archive`,agent:e}),children:`Archive`}),(0,m.jsx)(f,{variant:`danger`,onClick:()=>x({kind:`delete`,agent:e}),children:`Delete`})]})})]},e.id))})]})}),(0,m.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:e.map(e=>(0,m.jsxs)(`article`,{className:`min-w-0 rounded-xl border border-border bg-muted/20 p-4`,children:[(0,m.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,m.jsx)(d,{identity:e.identity,size:36}),(0,m.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,m.jsx)(`a`,{href:`/agents/${e.id}`,className:`block truncate font-semibold text-foreground`,children:e.name}),(0,m.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.identity?.creature||e.identity?.vibe?[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `):`Agent template: ${e.profileId}`})]}),(0,m.jsx)(o,{variant:e.status===`archived`?`warning`:`success`,children:e.status})]}),(0,m.jsxs)(`dl`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,m.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-muted p-2`,children:[(0,m.jsx)(`dt`,{className:`font-semibold text-muted-foreground`,children:`ID`}),(0,m.jsxs)(`dd`,{className:`mt-0.5 truncate font-mono`,title:e.id,children:[e.id.slice(0,12),`…`]})]}),(0,m.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-muted p-2`,children:[(0,m.jsx)(`dt`,{className:`font-semibold text-muted-foreground`,children:`Agent template`}),(0,m.jsx)(`dd`,{className:`mt-0.5 truncate font-mono`,title:e.profileId,children:e.profileId})]})]}),(0,m.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.status===`archived`?(0,m.jsx)(f,{variant:`ghost`,onClick:()=>void T(e.id),children:`Restore`}):(0,m.jsx)(f,{variant:`ghost`,onClick:()=>x({kind:`archive`,agent:e}),children:`Archive`}),(0,m.jsx)(f,{variant:`danger`,onClick:()=>x({kind:`delete`,agent:e}),children:`Delete`})]})]},e.id))})]})}),(0,m.jsx)(i,{open:b!==null,onOpenChange:e=>{e||x(null)},title:b?.kind===`delete`?`Delete ${b.agent.name} permanently?`:`Archive ${b?.agent.name??`agent`}?`,description:b?.kind===`delete`?(0,m.jsx)(`p`,{children:`This permanently removes the Agent, its messages, triggers, skill attachments, sessions, and private on-disk directory. This cannot be undone.`}):(0,m.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:b?.kind===`delete`?`Delete permanently`:`Archive agent`,confirmVariant:b?.kind===`delete`?`danger`:`primary`,onConfirm:async()=>{b&&(b.kind===`delete`?await E(b.agent.id):await w(b.agent.id))}})]})}function g({profiles:e,teams:t,modelGroups:n,onSpawned:r}){let[i,a]=(0,p.useState)(``),[o,c]=(0,p.useState)(``),[l,u]=(0,p.useState)(``),[d,h]=(0,p.useState)(t.find(e=>e.id==="default")?.id??``),[g,_]=(0,p.useState)(`profile_defaults`),[v,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null);async function S(e){if(e.preventDefault(),!i){x(`profile is required`);return}y(!0),x(null);try{let e={profile:i};if(o&&(e.name=o),l&&(e.model=l),d){let t=await fetch(`/api/teams/${encodeURIComponent(d)}/policy`);if(!t.ok)throw Error(`The selected Team policy is unavailable.`);let n=await t.json();e.teamId=d,e.teamExpectedRevision=n.teamPolicy.revision,e.placement=g}let t=await fetch(`/api/agents`,{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??t.statusText)}await t.json(),c(``),u(``),r()}catch(e){x(e.message)}finally{y(!1)}}return(0,m.jsx)(s,{title:`Spawn an agent`,description:`Skills come from the Agent template at spawn time. You can adjust an agent's skills later from its detail page.`,children:(0,m.jsxs)(`form`,{onSubmit:S,children:[b&&(0,m.jsx)(`div`,{role:`alert`,className:`err`,children:b}),(0,m.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,m.jsxs)(`label`,{children:[`Agent template`,(0,m.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),required:!0,children:[(0,m.jsx)(`option`,{value:``,children:`Select a template`}),e.map(e=>(0,m.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),(0,m.jsxs)(`label`,{children:[`Name`,(0,m.jsx)(`input`,{value:o,onChange:e=>c(e.target.value)})]}),(0,m.jsxs)(`label`,{children:[`Model override`,n.length===0?(0,m.jsx)(`input`,{value:``,disabled:!0,placeholder:`Uses the template default — enable models in Config`}):(0,m.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,m.jsx)(`option`,{value:``,children:`Use the template default`}),n.map(e=>(0,m.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,m.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]}),(0,m.jsxs)(`label`,{children:[`Team`,t.length===0?(0,m.jsx)(`select`,{disabled:!0,children:(0,m.jsx)(`option`,{children:`No teams — register one in Teams`})}):(0,m.jsx)(`select`,{value:d,onChange:e=>h(e.target.value),children:t.map(e=>(0,m.jsxs)(`option`,{value:e.id,children:[e.id,` (`,e.name,`)`]},e.id))})]}),(0,m.jsxs)(`label`,{className:`sm:col-span-2`,children:[`Initial policy placement`,(0,m.jsxs)(`select`,{value:g,onChange:e=>_(e.target.value),children:[(0,m.jsx)(`option`,{value:`profile_defaults`,children:`Agent-template defaults`}),(0,m.jsx)(`option`,{value:`isolated`,children:`Isolated`})]}),(0,m.jsx)(`span`,{className:`muted mt-1 block text-xs`,children:`Submission uses the latest displayed Team revision. A concurrent policy change is shown as a conflict and is never overwritten.`})]})]}),(0,m.jsx)(`div`,{className:`mt-4`,children:(0,m.jsx)(f,{variant:`primary`,type:`submit`,disabled:v,children:v?`Spawning…`:`Spawn agent`})})]})})}export{h as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{x as r}from"./index-Bq2zrG2_.js";import{a as i,i as a,n as o,r as s,t as c}from"./Page-NV96O47A.js";import{t as l}from"./Button-ByiV6fpd.js";var u=e(n()),d=t();function f(){let[e,t]=(0,u.useState)(r.useLoaderData().approvals),[n,i]=(0,u.useState)(`pending`),[f,m]=(0,u.useState)(null),[h,v]=(0,u.useState)(!1),[b,x]=(0,u.useState)(null),S=e.filter(e=>n===`all`||e.status===n),C=async()=>{let e=await fetch(`/api/approvals?limit=100`);if(!e.ok)throw Error(`Could not refresh approvals (${e.status})`);t((await e.json()).approvals)},w=async e=>{try{let t=await fetch(`/api/approvals/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Could not load approval (${t.status})`);m(await t.json())}catch(e){x(e instanceof Error?e.message:String(e))}},T=async e=>{if(f){v(!0),x(null);try{let t=await fetch(`/api/approvals/${encodeURIComponent(f.id)}/${e}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({reason:e===`deny`?`Denied by operator`:void 0})}),n=await t.json();if(!t.ok)throw Error(n.error??`Decision failed (${t.status})`);await C(),await w(f.id),x(e===`approve`?`Approved and delivered once.`:`Denied.`)}catch(e){x(e instanceof Error?e.message:String(e)),await C(),await w(f.id)}finally{v(!1)}}};return(0,d.jsxs)(s,{size:`wide`,children:[(0,d.jsx)(o,{eyebrow:`Policy operations`,title:`Communication approvals`,description:`One durable queue for policy-protected attempts. Approval authorizes only the captured attempt.`,actions:(0,d.jsxs)(`label`,{className:`m-0 block w-full text-sm sm:w-52`,children:[`Status`,(0,d.jsxs)(`select`,{value:n,onChange:e=>i(e.target.value),className:`mt-1`,children:[(0,d.jsx)(`option`,{value:`pending`,children:`Pending`}),(0,d.jsx)(`option`,{value:`all`,children:`All history`}),(0,d.jsx)(`option`,{value:`delivered`,children:`Delivered`}),(0,d.jsx)(`option`,{value:`denied`,children:`Denied`}),(0,d.jsx)(`option`,{value:`expired`,children:`Expired`}),(0,d.jsx)(`option`,{value:`cancelled`,children:`Cancelled`}),(0,d.jsx)(`option`,{value:`delivery_failed`,children:`Delivery failed`})]})]})}),(0,d.jsxs)(`div`,{className:`grid min-w-0 gap-5 lg:grid-cols-[minmax(0,1.15fr)_minmax(320px,0.85fr)]`,children:[(0,d.jsx)(a,{title:`Approval queue`,description:`${S.length} matching attempt${S.length===1?``:`s`}`,className:`min-w-0`,children:S.length===0?(0,d.jsx)(c,{title:`No matching approvals`,description:`Try another status filter or return when a protected attempt needs review.`}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,d.jsxs)(`table`,{className:`m-0 min-w-[680px]`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Status`}),(0,d.jsx)(`th`,{children:`Path`}),(0,d.jsx)(`th`,{children:`Origin`}),(0,d.jsx)(`th`,{children:`Expires`}),(0,d.jsx)(`th`,{children:(0,d.jsx)(`span`,{className:`sr-only`,children:`Action`})})]})}),(0,d.jsx)(`tbody`,{children:S.map(e=>(0,d.jsxs)(`tr`,{onClick:()=>void w(e.id),className:`cursor-pointer ${f?.id===e.id?`bg-accent/60`:``}`,children:[(0,d.jsx)(`td`,{children:(0,d.jsx)(p,{value:e.status})}),(0,d.jsxs)(`td`,{className:`min-w-56`,children:[g(e.source),` → `,g(e.target)]}),(0,d.jsx)(`td`,{children:e.origin}),(0,d.jsx)(`td`,{className:`whitespace-nowrap`,children:(0,d.jsx)(`time`,{dateTime:new Date(e.expiresAt).toISOString(),children:y(e.expiresAt)})}),(0,d.jsx)(`td`,{children:(0,d.jsx)(l,{variant:`ghost`,"aria-pressed":f?.id===e.id,onClick:t=>{t.stopPropagation(),w(e.id)},children:`Inspect`})})]},e.id))})]})}),(0,d.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:S.map(e=>(0,d.jsxs)(`button`,{type:`button`,"aria-label":`Inspect ${e.attemptKind} approval`,"aria-pressed":f?.id===e.id,onClick:()=>void w(e.id),className:`unstyled min-w-0 rounded-xl border p-4 text-left ${f?.id===e.id?`border-primary/40 bg-accent/60`:`border-border bg-muted/20`}`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,d.jsx)(p,{value:e.status}),(0,d.jsx)(`time`,{dateTime:new Date(e.expiresAt).toISOString(),className:`text-xs text-muted-foreground`,children:y(e.expiresAt)})]}),(0,d.jsxs)(`div`,{className:`mt-3 break-words text-sm font-semibold text-foreground`,children:[g(e.source),` → `,g(e.target)]}),(0,d.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Origin: `,e.origin]})]},e.id))})]})}),(0,d.jsx)(`aside`,{className:`min-w-0`,"aria-label":`Approval details`,children:(0,d.jsx)(a,{title:`Attempt details`,actions:f?(0,d.jsx)(p,{value:f.status}):void 0,children:f?(0,d.jsxs)(`div`,{className:`space-y-5`,children:[(0,d.jsxs)(`dl`,{className:`grid gap-3 text-sm sm:grid-cols-2 lg:grid-cols-1 xl:grid-cols-2`,children:[f.file&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(_,{label:`File`,value:f.file.name}),(0,d.jsx)(_,{label:`File type`,value:f.file.mimeType}),(0,d.jsx)(_,{label:`Size`,value:`${f.file.byteLength.toLocaleString()} bytes`})]}),(0,d.jsx)(_,{label:`Attempt`,value:`${f.attemptKind}:${f.attemptId}`}),(0,d.jsx)(_,{label:`Operation`,value:f.operation}),(0,d.jsx)(_,{label:`Path`,value:`${g(f.source)} → ${g(f.target)}`}),(0,d.jsx)(_,{label:`Policy`,value:f.policyRefs.map(e=>`${e.teamId}@${e.revision}`).join(`, `)}),(0,d.jsx)(_,{label:`Expires`,value:y(f.expiresAt)})]}),(0,d.jsxs)(`details`,{className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,d.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold`,children:`Sensitive payload`}),(0,d.jsx)(`pre`,{className:`mt-3 max-h-48 overflow-auto rounded-lg bg-background p-3 text-xs`,children:JSON.stringify(f.payload,null,2)})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h3`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:`Audit history`}),(0,d.jsx)(`ol`,{className:`mt-2 divide-y divide-border rounded-lg border border-border text-xs`,children:f.events.map(e=>(0,d.jsxs)(`li`,{className:`px-3 py-2 leading-5`,children:[y(e.createdAt),` · `,e.event,` · `,e.actor]},e.id))})]}),b&&(0,d.jsx)(`p`,{role:`status`,className:`rounded-lg bg-muted px-3 py-2 text-sm`,children:b}),f.status===`pending`&&(0,d.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,d.jsx)(l,{variant:`primary`,disabled:h,onClick:()=>void T(`approve`),children:`Approve once`}),(0,d.jsx)(l,{variant:`danger`,disabled:h,onClick:()=>void T(`deny`),children:`Deny`})]})]}):(0,d.jsx)(c,{title:`No attempt selected`,description:`Select an attempt from the queue to inspect its policy and audit history.`,className:`min-h-56`})})})]})]})}function p({value:e}){return(0,d.jsx)(i,{variant:m(e),children:h(e)})}function m(e){switch(e){case`pending`:return`warning`;case`approved`:case`delivering`:return`info`;case`delivered`:return`success`;case`denied`:case`delivery_failed`:return`danger`;case`expired`:case`cancelled`:return`neutral`}}function h(e){let t=e.replaceAll(`_`,` `);return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function g(e){return e.kind===`agent`?`Agent ${e.id}`:e.kind===`user`?`User`:`Outside ${e.teamId}`}function _({label:e,value:t}){return(0,d.jsxs)(`div`,{className:`rounded-lg bg-muted/40 p-3`,children:[(0,d.jsx)(`dt`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,d.jsx)(`dd`,{className:`mt-1 break-all text-foreground`,children:t})]})}var v=new Intl.DateTimeFormat(`en-GB`,{dateStyle:`medium`,timeStyle:`medium`,timeZone:`UTC`});function y(e){return`${v.format(new Date(e))} UTC`}export{f as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{a as r}from"./preload-helper-bztXdkDj.js";import{
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{a as r}from"./preload-helper-bztXdkDj.js";import{S as i}from"./index-Bq2zrG2_.js";import{a,i as o,n as s,r as c,t as l}from"./Page-NV96O47A.js";import{t as u}from"./Button-ByiV6fpd.js";var d=e(n()),f=t();function p(){let e=i.useLoaderData(),[t,n]=(0,d.useState)(e.list.items),[p,h]=(0,d.useState)(e.list.degraded),[g,_]=(0,d.useState)(e.summary),[v,y]=(0,d.useState)(`open`),[b,x]=(0,d.useState)(`all`),[S,C]=(0,d.useState)(`all`),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(null),O=(0,d.useMemo)(()=>t.filter(e=>(v===`all`||(v===`open`?e.acknowledgedAt===null:e.acknowledgedAt!==null))&&(b===`all`||e.kind===b)&&(S===`all`||e.severity===S)),[t,b,S,v]);async function k(){let[e,t]=await Promise.all([fetch(`/api/attention?state=all&limit=200`),fetch(`/api/attention/summary`)]);if(!e.ok||!t.ok)throw Error(`Could not refresh the Attention Center`);let r=await e.json();n(r.items),h(r.degraded),_(await t.json())}async function A(e,t){T(e.key),D(null);try{let n=await fetch(`/api/attention/${encodeURIComponent(e.key)}/${t?`acknowledge`:`acknowledgement`}`,{method:t?`POST`:`DELETE`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.error??`Update failed (${n.status})`);await k()}catch(e){D(e instanceof Error?e.message:String(e)),await k().catch(()=>{})}finally{T(null)}}async function j(){T(`all`),D(null);try{let e=await fetch(`/api/attention/acknowledge-all`,{method:`POST`}),t=await e.json();if(!e.ok)throw Error(t.error??`Acknowledgement failed`);D(`Acknowledged ${t.acknowledged} informational item(s). Approvals and lessons were left open.`),await k()}catch(e){D(e instanceof Error?e.message:String(e))}finally{T(null)}}return(0,f.jsxs)(c,{size:`wide`,children:[(0,f.jsx)(s,{eyebrow:`Operations`,title:`Attention Center`,description:`One queue for decisions and terminal signals. Resolve action-required work at its canonical source; acknowledge informational failures here.`,actions:(0,f.jsx)(u,{variant:`ghost`,disabled:w!==null,onClick:()=>void j(),children:`Acknowledge all informational items`})}),(0,f.jsxs)(`div`,{className:`mb-5 grid gap-3 sm:grid-cols-3`,children:[(0,f.jsx)(m,{label:`Open`,value:g.openTotal}),(0,f.jsx)(m,{label:`Action required`,value:g.bySeverity.action_required}),(0,f.jsx)(m,{label:`Errors and warnings`,value:g.bySeverity.error+g.bySeverity.warning})]}),(p.length>0||g.degraded.length>0)&&(0,f.jsxs)(`div`,{role:`alert`,className:`mb-5 rounded-lg border border-danger/40 bg-danger/10 p-4 text-sm`,children:[(0,f.jsx)(`strong`,{children:`Partial results.`}),` `,[...new Set([...p,...g.degraded].map(e=>e.kind))].join(`, `),` could not be loaded.`]}),E&&(0,f.jsx)(`p`,{role:`status`,className:`mb-5 rounded-lg bg-muted px-4 py-3 text-sm`,children:E}),(0,f.jsx)(o,{title:`Queue`,description:`${O.length} matching item${O.length===1?``:`s`}`,actions:(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,f.jsxs)(`select`,{"aria-label":`Queue state`,value:v,onChange:e=>y(e.target.value),children:[(0,f.jsx)(`option`,{value:`open`,children:`Open`}),(0,f.jsx)(`option`,{value:`acknowledged`,children:`History`}),(0,f.jsx)(`option`,{value:`all`,children:`All`})]}),(0,f.jsxs)(`select`,{"aria-label":`Severity`,value:S,onChange:e=>C(e.target.value),children:[(0,f.jsx)(`option`,{value:`all`,children:`All severities`}),(0,f.jsx)(`option`,{value:`action_required`,children:`Action required`}),(0,f.jsx)(`option`,{value:`error`,children:`Errors`}),(0,f.jsx)(`option`,{value:`warning`,children:`Warnings`})]}),(0,f.jsxs)(`select`,{"aria-label":`Kind`,value:b,onChange:e=>x(e.target.value),children:[(0,f.jsx)(`option`,{value:`all`,children:`All kinds`}),(0,f.jsx)(`option`,{value:`communication_approval`,children:`Approvals`}),(0,f.jsx)(`option`,{value:`lesson_proposal`,children:`Lessons`}),(0,f.jsx)(`option`,{value:`review_failure`,children:`Review failures`}),(0,f.jsx)(`option`,{value:`trigger_failure`,children:`Trigger failures`}),(0,f.jsx)(`option`,{value:`agent_loop_break`,children:`Loop breaks`})]})]}),children:O.length===0?(0,f.jsx)(l,{title:v===`open`?`Nothing needs attention`:`No matching history`,description:`The queue updates from Bazilion's canonical approvals, learning, triggers, and loop diagnostics.`}):(0,f.jsx)(`div`,{className:`grid gap-3`,children:O.map(e=>(0,f.jsx)(`article`,{className:`rounded-lg border border-border p-4`,children:(0,f.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(a,{variant:e.severity===`action_required`?`warning`:e.severity===`error`?`danger`:`info`,children:e.severity.replace(`_`,` `)}),(0,f.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.kind.replaceAll(`_`,` `)})]}),(0,f.jsx)(`h3`,{className:`mt-2 text-base`,children:e.title}),(0,f.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.diagnostic}),(0,f.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[[e.agentName,e.teamName].filter(Boolean).join(` · `)||`System`,` · `,(0,f.jsx)(`time`,{dateTime:new Date(e.occurredAt).toISOString(),children:new Date(e.occurredAt).toLocaleString()})]})]}),(0,f.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,f.jsx)(r,{to:e.href,className:`btn-primary`,children:e.kind===`communication_approval`?`Review approval`:e.kind===`lesson_proposal`?`Review lesson`:`Inspect source`}),e.acknowledgeable&&(0,f.jsx)(u,{variant:`ghost`,disabled:w===e.key,onClick:()=>void A(e,e.acknowledgedAt===null),children:e.acknowledgedAt===null?`Acknowledge`:`Restore to open`})]})]})},e.key))})})]})}function m({label:e,value:t}){return(0,f.jsxs)(`div`,{className:`card p-4`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:e}),(0,f.jsx)(`div`,{className:`mt-1 text-2xl font-semibold`,children:t})]})}export{p as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as e}from"./index-Bq2zrG2_.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./chevron-right-VWrk_dTX.js";import{t as a}from"./ConfirmDialog-_bmG-wVG.js";import{G as o,W as s,q as c,x as l}from"./index-CLdmsmiN.js";import{a as u,t as d}from"./Page-NV96O47A.js";import{t as f}from"./Button-ByiV6fpd.js";import{t as p}from"./ConfigPage-BCLp-FUC.js";import{t as m}from"./FieldRow-Do1cBkRc.js";var h=c(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),g=c(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),_=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`}]]),v=e(n()),y=t();function b({status:e}){let t=e.configuredOperatorHttp,n=e.protectedUnattendedTurns;return(0,y.jsxs)(`section`,{className:`overflow-hidden rounded-lg border bg-card`,children:[(0,y.jsxs)(`header`,{className:`border-b px-4 py-3`,children:[(0,y.jsx)(`h2`,{className:`font-semibold`,children:`Execution security`}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Operator HTTP requests keep their configured compatibility behavior. Unattended sources use a separate mandatory protected baseline.`})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 p-4 lg:grid-cols-2`,children:[(0,y.jsxs)(`section`,{className:`rounded-md border bg-muted/20 p-3`,children:[(0,y.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,y.jsx)(`h3`,{className:`font-semibold`,children:`Configured operator HTTP`}),(0,y.jsx)(x,{ok:!1,children:`legacy · unprotected`})]}),(0,y.jsxs)(`dl`,{className:`space-y-2 text-sm`,children:[(0,y.jsx)(S,{label:`Coding surface`,value:C(t.codingSurface)}),(0,y.jsx)(S,{label:`Docker image`,value:t.dockerImage,mono:!0}),(0,y.jsx)(S,{label:`Browser`,value:t.browser}),(0,y.jsx)(S,{label:`MCP`,value:t.mcp})]}),(0,y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`This compatibility branch is for operator requests; Telegram and unattended delivery never select it.`})]}),(0,y.jsxs)(`section`,{className:`rounded-md border p-3 ${n.baseRuntimeReady?`border-success/25 bg-success/5`:`border-warning/25 bg-warning/10`}`,children:[(0,y.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,y.jsx)(`h3`,{className:`font-semibold`,children:`Protected unattended turns`}),(0,y.jsx)(x,{ok:n.baseRuntimeReady,children:n.baseRuntimeReady?`base runtime ready`:`base runtime unavailable`})]}),(0,y.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`Telegram, schedules, inbox wake-ups, and approval delivery cannot select the legacy surface.`}),(0,y.jsxs)(`dl`,{className:`space-y-2 text-sm`,children:[(0,y.jsx)(S,{label:`Coding surface`,value:`Docker only`}),(0,y.jsx)(S,{label:`Docker`,value:n.docker.ready?`ready`:`unavailable`,ok:n.docker.ready}),(0,y.jsx)(S,{label:`Docker image`,value:n.docker.image,mono:!0}),n.docker.reason&&(0,y.jsx)(S,{label:`Docker reason`,value:n.docker.reason}),(0,y.jsx)(S,{label:`OpenAI Codex enabled`,value:w(n.openaiCodex.enabled),ok:n.openaiCodex.enabled}),(0,y.jsx)(S,{label:`ChatGPT connected`,value:w(n.openaiCodex.connected),ok:n.openaiCodex.connected}),(0,y.jsx)(S,{label:`OpenAI access`,value:T(n.openaiCodex),ok:n.openaiCodex.accessCurrent||n.openaiCodex.refreshOnNextTurn}),(0,y.jsx)(S,{label:`OpenAI Codex baseline eligible`,value:w(n.openaiCodex.baselineEligible),ok:n.openaiCodex.baselineEligible}),(0,y.jsx)(S,{label:`Browser`,value:n.browser,ok:!0}),(0,y.jsx)(S,{label:`MCP`,value:n.mcp,ok:!0})]}),n.remediation&&(0,y.jsxs)(`p`,{className:`mt-3 rounded-md border border-warning/25 bg-background/60 px-3 py-2 text-xs text-warning`,children:[(0,y.jsx)(`strong`,{children:`Remediation:`}),` `,n.remediation]}),(0,y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Every turn separately validates its selected normal/review model, bound OAuth refresh, and Team/input/memory/skill mounts and paths before execution.`})]})]})]})}function x({ok:e,children:t}){return(0,y.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs font-semibold uppercase ${e?`bg-success/10 text-success`:`bg-warning/10 text-warning`}`,children:t})}function S({label:e,value:t,ok:n,mono:r=!1}){return(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,y.jsx)(`dd`,{className:`${r?`font-mono`:`font-medium`} text-right ${n===void 0?``:n?`text-success`:`text-warning`}`,children:t})]})}function C(e){return e===`host`?`Host tools`:e===`docker`?`Docker only`:`Unavailable`}function w(e){return e?`yes`:`no`}function T(e){return e.accessCurrent?`current`:e.refreshOnNextTurn?`refresh on next turn`:`unavailable`}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.envHint,...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:`Configured, unverified`,tone:`warning`}:O(e)?{label:`Saved, disabled`,tone:`neutral`}:{label:`Not configured`,tone:`neutral`}}function M(){let{providers:e,openaiCodex:t,executionSecurity:n}=l.useLoaderData(),r=e.some(e=>e.enabled&&e.curated.length>0),a=(0,v.useRef)(r),[c,u]=(0,v.useState)(!1),[m,x]=(0,v.useState)(``),S=(0,v.useMemo)(()=>A(e,m),[e,m]),C=e.filter(O).length,w=e.filter(e=>e.enabled).length;return(0,v.useEffect)(()=>{!a.current&&r&&u(!0)},[r]),(0,y.jsxs)(p,{active:`providers`,title:`Providers`,description:(0,y.jsx)(y.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,y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,"aria-label":`Provider summary`,children:[(0,y.jsx)(N,{label:`Configured`,value:C,detail:`credentials, models, or toggle`}),(0,y.jsx)(N,{label:`Enabled`,value:w,detail:`available to agent runtime`}),(0,y.jsx)(N,{label:`Selected models`,value:e.reduce((e,t)=>e+(t.enabled?t.curated.length:0),0),detail:`configured; test connectivity separately`})]}),(0,y.jsxs)(`details`,{className:`rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,y.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center gap-3 px-4 py-3 text-sm font-semibold text-foreground marker:hidden sm:px-5`,children:[(0,y.jsx)(s,{className:`size-4 text-primary`,"aria-hidden":`true`}),`Execution security`,(0,y.jsx)(`span`,{className:`ml-auto text-xs font-normal text-muted-foreground`,children:`Inspect host and protected-turn posture`}),(0,y.jsx)(o,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`})]}),(0,y.jsx)(`div`,{className:`border-t border-border p-3 sm:p-4`,children:(0,y.jsx)(b,{status:n})})]}),!r&&(0,y.jsx)(P,{providers:e,openaiCodex:t}),c&&(0,y.jsx)(`section`,{role:`status`,className:`rounded-2xl border border-success/30 bg-success/10 p-5 text-sm`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(h,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`h2`,{className:`m-0 font-body text-base font-semibold text-foreground`,children:`Your default workspace is ready`}),(0,y.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,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,y.jsxs)(`a`,{href:`/agents`,className:`btn-primary no-underline`,children:[`Spawn your first agent`,(0,y.jsx)(i,{className:`size-4`,"aria-hidden":`true`})]}),(0,y.jsx)(f,{variant:`ghost`,onClick:()=>u(!1),children:`Keep configuring`})]})]})]})}),(0,y.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-4 shadow-baziu-sm sm:p-5`,children:[(0,y.jsx)(`label`,{htmlFor:`provider-search`,className:`m-0 text-sm font-semibold text-foreground`,children:`Find a provider`}),(0,y.jsxs)(`div`,{className:`relative mt-2`,children:[(0,y.jsx)(g,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,y.jsx)(`input`,{id:`provider-search`,type:`search`,value:m,onChange:e=>x(e.target.value),placeholder:`Search by service, model, or advanced key`,className:`pl-9`})]}),(0,y.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.`})]}),S.length===0?(0,y.jsx)(d,{icon:(0,y.jsx)(g,{className:`size-4`,"aria-hidden":`true`}),title:`No providers match`,description:`Try another search instead of “${m}”.`,actions:(0,y.jsx)(f,{variant:`ghost`,onClick:()=>x(``),children:`Clear search`})}):(0,y.jsx)(`div`,{className:`space-y-4`,children:S.map(e=>(0,y.jsxs)(`details`,{open:!!m||e.key===`configured`||!r&&e.key===`recommended`,className:`group/providers overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,y.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-4 marker:hidden sm:px-5`,children:[(0,y.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent text-accent-foreground`,children:(0,y.jsx)(_,{className:`size-4`,"aria-hidden":`true`})}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`span`,{className:`block text-sm font-semibold text-foreground`,children:e.title}),(0,y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:e.description})]}),(0,y.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,y.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/providers:rotate-180`,"aria-hidden":`true`})]}),(0,y.jsx)(`div`,{className:`space-y-2 border-t border-border bg-muted/20 p-2 sm:p-3`,children:e.providers.map(e=>(0,y.jsx)(F,{p:e,initiallyOpen:e.enabled||!!m||!r&&e.id===`openai-codex`,openaiCodexStatus:e.id===`openai-codex`?t:void 0},e.id))})]},`${e.key}:${m}`))})]})}function N({label:e,value:t,detail:n}){return(0,y.jsxs)(`div`,{className:`min-w-0 rounded-2xl border border-border bg-card p-4 shadow-baziu-sm`,children:[(0,y.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,y.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-foreground`,children:t}),(0,y.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:n})]})}function P({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,y.jsxs)(`div`,{role:`status`,className:`rounded-2xl border border-warning/30 bg-warning/10 p-5 text-sm`,children:[(0,y.jsx)(`div`,{className:`font-semibold text-foreground mb-1`,children:`Finish your first provider`}),(0,y.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,y.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-warning`,children:n.map(e=>(0,y.jsx)(`li`,{children:e},e))}):r===0?(0,y.jsx)(`p`,{className:`text-warning`,children:`No provider is enabled. Open a recommended option below and follow its steps.`}):null]})}function F({p:e,openaiCodexStatus:t,initiallyOpen:n}){let a=r(),[o,s]=(0,v.useState)(e.enabled),[c,l]=(0,v.useState)(n),[d,p]=(0,v.useState)(e.curated.join(`
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./chevron-right-Cf6vKeLq.js";import{t as a}from"./ConfirmDialog-MicTTwdy.js";import{C as o,K as s,Y as c,q as l}from"./index-Bq2zrG2_.js";import{a as u,t as d}from"./Page-NV96O47A.js";import{t as f}from"./Button-ByiV6fpd.js";import{t as p}from"./ConfigPage-BCLp-FUC.js";import{t as m}from"./FieldRow-DJ2Gx4Du.js";var h=c(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),g=c(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),_=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`}]]),v=e(n()),y=t();function b({status:e}){let t=e.configuredOperatorHttp,n=e.protectedUnattendedTurns;return(0,y.jsxs)(`section`,{className:`overflow-hidden rounded-lg border bg-card`,children:[(0,y.jsxs)(`header`,{className:`border-b px-4 py-3`,children:[(0,y.jsx)(`h2`,{className:`font-semibold`,children:`Execution security`}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Operator HTTP requests keep their configured compatibility behavior. Unattended sources use a separate mandatory protected baseline.`})]}),(0,y.jsxs)(`div`,{className:`grid gap-4 p-4 lg:grid-cols-2`,children:[(0,y.jsxs)(`section`,{className:`rounded-md border bg-muted/20 p-3`,children:[(0,y.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,y.jsx)(`h3`,{className:`font-semibold`,children:`Configured operator HTTP`}),(0,y.jsx)(x,{ok:!1,children:`legacy · unprotected`})]}),(0,y.jsxs)(`dl`,{className:`space-y-2 text-sm`,children:[(0,y.jsx)(S,{label:`Coding surface`,value:C(t.codingSurface)}),(0,y.jsx)(S,{label:`Docker image`,value:t.dockerImage,mono:!0}),(0,y.jsx)(S,{label:`Browser`,value:t.browser}),(0,y.jsx)(S,{label:`MCP`,value:t.mcp})]}),(0,y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`This compatibility branch is for operator requests; Telegram and unattended delivery never select it.`})]}),(0,y.jsxs)(`section`,{className:`rounded-md border p-3 ${n.baseRuntimeReady?`border-success/25 bg-success/5`:`border-warning/25 bg-warning/10`}`,children:[(0,y.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,y.jsx)(`h3`,{className:`font-semibold`,children:`Protected unattended turns`}),(0,y.jsx)(x,{ok:n.baseRuntimeReady,children:n.baseRuntimeReady?`base runtime ready`:`base runtime unavailable`})]}),(0,y.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`Telegram, schedules, inbox wake-ups, and approval delivery cannot select the legacy surface.`}),(0,y.jsxs)(`dl`,{className:`space-y-2 text-sm`,children:[(0,y.jsx)(S,{label:`Coding surface`,value:`Docker only`}),(0,y.jsx)(S,{label:`Docker`,value:n.docker.ready?`ready`:`unavailable`,ok:n.docker.ready}),(0,y.jsx)(S,{label:`Docker image`,value:n.docker.image,mono:!0}),n.docker.reason&&(0,y.jsx)(S,{label:`Docker reason`,value:n.docker.reason}),(0,y.jsx)(S,{label:`OpenAI Codex enabled`,value:w(n.openaiCodex.enabled),ok:n.openaiCodex.enabled}),(0,y.jsx)(S,{label:`ChatGPT connected`,value:w(n.openaiCodex.connected),ok:n.openaiCodex.connected}),(0,y.jsx)(S,{label:`OpenAI access`,value:T(n.openaiCodex),ok:n.openaiCodex.accessCurrent||n.openaiCodex.refreshOnNextTurn}),(0,y.jsx)(S,{label:`OpenAI Codex baseline eligible`,value:w(n.openaiCodex.baselineEligible),ok:n.openaiCodex.baselineEligible}),(0,y.jsx)(S,{label:`Browser`,value:n.browser,ok:!0}),(0,y.jsx)(S,{label:`MCP`,value:n.mcp,ok:!0})]}),n.remediation&&(0,y.jsxs)(`p`,{className:`mt-3 rounded-md border border-warning/25 bg-background/60 px-3 py-2 text-xs text-warning`,children:[(0,y.jsx)(`strong`,{children:`Remediation:`}),` `,n.remediation]}),(0,y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Every turn separately validates its selected normal/review model, bound OAuth refresh, and Team/input/memory/skill mounts and paths before execution.`})]})]})]})}function x({ok:e,children:t}){return(0,y.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs font-semibold uppercase ${e?`bg-success/10 text-success`:`bg-warning/10 text-warning`}`,children:t})}function S({label:e,value:t,ok:n,mono:r=!1}){return(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,y.jsx)(`dd`,{className:`${r?`font-mono`:`font-medium`} text-right ${n===void 0?``:n?`text-success`:`text-warning`}`,children:t})]})}function C(e){return e===`host`?`Host tools`:e===`docker`?`Docker only`:`Unavailable`}function w(e){return e?`yes`:`no`}function T(e){return e.accessCurrent?`current`:e.refreshOnNextTurn?`refresh on next turn`:`unavailable`}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.envHint,...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:`Configured, unverified`,tone:`warning`}:O(e)?{label:`Saved, disabled`,tone:`neutral`}:{label:`Not configured`,tone:`neutral`}}function M(){let{providers:e,openaiCodex:t,executionSecurity:n}=o.useLoaderData(),r=e.some(e=>e.enabled&&e.curated.length>0),a=(0,v.useRef)(r),[c,u]=(0,v.useState)(!1),[m,x]=(0,v.useState)(``),S=(0,v.useMemo)(()=>A(e,m),[e,m]),C=e.filter(O).length,w=e.filter(e=>e.enabled).length;return(0,v.useEffect)(()=>{!a.current&&r&&u(!0)},[r]),(0,y.jsxs)(p,{active:`providers`,title:`Providers`,description:(0,y.jsx)(y.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,y.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,"aria-label":`Provider summary`,children:[(0,y.jsx)(N,{label:`Configured`,value:C,detail:`credentials, models, or toggle`}),(0,y.jsx)(N,{label:`Enabled`,value:w,detail:`available to agent runtime`}),(0,y.jsx)(N,{label:`Selected models`,value:e.reduce((e,t)=>e+(t.enabled?t.curated.length:0),0),detail:`configured; test connectivity separately`})]}),(0,y.jsxs)(`details`,{className:`rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,y.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center gap-3 px-4 py-3 text-sm font-semibold text-foreground marker:hidden sm:px-5`,children:[(0,y.jsx)(s,{className:`size-4 text-primary`,"aria-hidden":`true`}),`Execution security`,(0,y.jsx)(`span`,{className:`ml-auto text-xs font-normal text-muted-foreground`,children:`Inspect host and protected-turn posture`}),(0,y.jsx)(l,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`})]}),(0,y.jsx)(`div`,{className:`border-t border-border p-3 sm:p-4`,children:(0,y.jsx)(b,{status:n})})]}),!r&&(0,y.jsx)(P,{providers:e,openaiCodex:t}),c&&(0,y.jsx)(`section`,{role:`status`,className:`rounded-2xl border border-success/30 bg-success/10 p-5 text-sm`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(h,{className:`mt-0.5 size-5 shrink-0 text-success`,"aria-hidden":`true`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`h2`,{className:`m-0 font-body text-base font-semibold text-foreground`,children:`Your default workspace is ready`}),(0,y.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,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,y.jsxs)(`a`,{href:`/agents`,className:`btn-primary no-underline`,children:[`Spawn your first agent`,(0,y.jsx)(i,{className:`size-4`,"aria-hidden":`true`})]}),(0,y.jsx)(f,{variant:`ghost`,onClick:()=>u(!1),children:`Keep configuring`})]})]})]})}),(0,y.jsxs)(`div`,{className:`rounded-2xl border border-border bg-card p-4 shadow-baziu-sm sm:p-5`,children:[(0,y.jsx)(`label`,{htmlFor:`provider-search`,className:`m-0 text-sm font-semibold text-foreground`,children:`Find a provider`}),(0,y.jsxs)(`div`,{className:`relative mt-2`,children:[(0,y.jsx)(g,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,y.jsx)(`input`,{id:`provider-search`,type:`search`,value:m,onChange:e=>x(e.target.value),placeholder:`Search by service, model, or advanced key`,className:`pl-9`})]}),(0,y.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.`})]}),S.length===0?(0,y.jsx)(d,{icon:(0,y.jsx)(g,{className:`size-4`,"aria-hidden":`true`}),title:`No providers match`,description:`Try another search instead of “${m}”.`,actions:(0,y.jsx)(f,{variant:`ghost`,onClick:()=>x(``),children:`Clear search`})}):(0,y.jsx)(`div`,{className:`space-y-4`,children:S.map(e=>(0,y.jsxs)(`details`,{open:!!m||e.key===`configured`||!r&&e.key===`recommended`,className:`group/providers overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm`,children:[(0,y.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-3 px-4 py-4 marker:hidden sm:px-5`,children:[(0,y.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent text-accent-foreground`,children:(0,y.jsx)(_,{className:`size-4`,"aria-hidden":`true`})}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`span`,{className:`block text-sm font-semibold text-foreground`,children:e.title}),(0,y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:e.description})]}),(0,y.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,y.jsx)(l,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-open/providers:rotate-180`,"aria-hidden":`true`})]}),(0,y.jsx)(`div`,{className:`space-y-2 border-t border-border bg-muted/20 p-2 sm:p-3`,children:e.providers.map(e=>(0,y.jsx)(F,{p:e,initiallyOpen:e.enabled||!!m||!r&&e.id===`openai-codex`,openaiCodexStatus:e.id===`openai-codex`?t:void 0},e.id))})]},`${e.key}:${m}`))})]})}function N({label:e,value:t,detail:n}){return(0,y.jsxs)(`div`,{className:`min-w-0 rounded-2xl border border-border bg-card p-4 shadow-baziu-sm`,children:[(0,y.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,y.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-foreground`,children:t}),(0,y.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:n})]})}function P({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,y.jsxs)(`div`,{role:`status`,className:`rounded-2xl border border-warning/30 bg-warning/10 p-5 text-sm`,children:[(0,y.jsx)(`div`,{className:`font-semibold text-foreground mb-1`,children:`Finish your first provider`}),(0,y.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,y.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-warning`,children:n.map(e=>(0,y.jsx)(`li`,{children:e},e))}):r===0?(0,y.jsx)(`p`,{className:`text-warning`,children:`No provider is enabled. Open a recommended option below and follow its steps.`}):null]})}function F({p:e,openaiCodexStatus:t,initiallyOpen:n}){let a=r(),[o,s]=(0,v.useState)(e.enabled),[c,l]=(0,v.useState)(n),[d,p]=(0,v.useState)(e.curated.join(`
|
|
2
2
|
`)),[h,g]=(0,v.useState)(!1),[_,b]=(0,v.useState)(null),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(e.curated[0]??``),[T,E]=(0,v.useState)(!1),[D,O]=(0,v.useState)(null),k=j({...e,enabled:o});async function A(t){s(t),S(null);try{let n=await fetch(`/api/config/providers/${encodeURIComponent(e.id)}/enabled`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Could not update provider (${n.status})`)}t&&l(!0),await a.invalidate()}catch(e){s(!t),S(e instanceof Error?e.message:String(e))}}async function M(t){t.preventDefault(),g(!0),b(null);try{let t=d.split(/\r?\n/).map(e=>e.trim()).filter(Boolean),n=await fetch(`/api/config/providers/${encodeURIComponent(e.id)}/models`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({models:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}b({kind:`success`,message:`Models saved. Run the connection test before relying on them.`}),w(t[0]??``),O(null),await a.invalidate()}catch(e){b({kind:`error`,message:e.message})}finally{g(!1)}}async function N(){if(C){E(!0),O(null);try{let t=await fetch(`/api/providers/test`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({model:`${e.id}:${C}`,message:`Reply with exactly: Bazilion connection verified.`})}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error??`Connection test failed (${t.status})`);O({kind:`success`,message:`Verified ${e.displayName} with ${C}.`}),await a.invalidate()}catch(e){O({kind:`error`,message:e instanceof Error?e.message:String(e)})}finally{E(!1)}}}return(0,y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,y.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[(0,y.jsxs)(`button`,{type:`button`,className:`unstyled flex min-w-0 flex-1 items-center gap-2 rounded-lg text-left`,"aria-expanded":c,"aria-controls":`provider-${e.id}`,onClick:()=>l(e=>!e),children:[(0,y.jsx)(i,{className:`size-4 shrink-0 text-muted-foreground transition-transform ${c?`rotate-90`:``}`,"aria-hidden":`true`}),(0,y.jsxs)(`span`,{className:`min-w-0`,children:[(0,y.jsx)(`span`,{className:`block truncate text-sm font-semibold text-foreground`,children:e.displayName}),(0,y.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.id})]})]}),(0,y.jsx)(u,{variant:k.tone===`success`?`success`:k.tone===`warning`?`warning`:`neutral`,children:k.label}),(0,y.jsxs)(`label`,{className:`m-0 flex cursor-pointer items-center gap-1.5 rounded-lg px-1 text-xs font-semibold`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>A(e.target.checked),className:`size-4`,"aria-label":`${o?`Disable`:`Enable`} ${e.displayName}`}),(0,y.jsx)(`span`,{className:o?`text-success`:`text-muted-foreground`,children:o?`enabled`:`disabled`})]}),(0,y.jsxs)(`span`,{className:`w-full pl-6 text-xs text-muted-foreground sm:w-auto sm:pl-0`,children:[e.curated.length>0&&(0,y.jsxs)(`span`,{children:[e.curated.length,` curated`]}),e.catalog.length>0&&(0,y.jsxs)(`span`,{children:[` · `,e.catalog.length,` catalog`]}),e.live&&!e.live.error&&(0,y.jsxs)(`span`,{children:[` · `,e.live.models.length,` live`]})]})]}),x&&(0,y.jsx)(`p`,{role:`alert`,className:`mx-4 mb-3 text-sm text-danger`,children:x}),c&&(0,y.jsxs)(`div`,{id:`provider-${e.id}`,className:`border-t border-dashed px-3 py-4 sm:px-4`,children:[e.hint&&(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.id===`openai-codex`&&t&&(0,y.jsx)(R,{status:t}),e.fields.length===0&&e.envHint&&e.id!==`openai-codex`&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Credentials come from the process env: `,(0,y.jsx)(`code`,{className:`font-mono`,children:e.envHint})]}),e.fields.map(e=>(0,y.jsx)(m,{field:e},e.envVar)),(0,y.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,y.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,y.jsx)(`code`,{className:`font-mono`,children:I(e.id)}),`) and click`,` `,(0,y.jsx)(`em`,{children:`save models`}),`. Catalog chips below are the safest source when available.`]}),(0,y.jsxs)(`form`,{onSubmit:M,children:[(0,y.jsx)(`textarea`,{id:`provider-${e.id}-models`,"aria-labelledby":`provider-${e.id}-models-label`,value:d,onChange:e=>p(e.target.value),rows:Math.max(3,Math.min(8,d.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,y.jsxs)(`div`,{className:`flex items-center gap-3 mt-2`,children:[(0,y.jsx)(`button`,{type:`submit`,disabled:h,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:h?`Saving…`:`Save models`}),_&&(0,y.jsx)(`span`,{role:_.kind===`error`?`alert`:`status`,className:`text-xs ${_.kind===`error`?`text-danger`:`text-success`}`,children:_.message})]})]}),e.catalog.length>0&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`catalog`}),(0,y.jsx)(L,{items:e.catalog,onPick:e=>p(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live&&!e.live.error&&e.live.models.length>0&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`live`}),(0,y.jsx)(L,{items:e.live.models,onPick:e=>p(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live?.error&&(0,y.jsxs)(`p`,{role:`alert`,className:`text-xs text-danger mt-2`,children:[`Could not fetch live models: `,e.live.error]}),o&&e.curated.length>0&&(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-border bg-muted/30 p-3`,children:[(0,y.jsx)(`h4`,{className:`m-0 font-body text-sm font-semibold text-foreground`,children:`Test the connection`}),(0,y.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,y.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-end`,children:[(0,y.jsxs)(`label`,{className:`m-0 min-w-0 flex-1 text-xs font-semibold text-foreground`,children:[`Model`,(0,y.jsx)(`select`,{className:`mt-1`,value:C,onChange:e=>w(e.target.value),children:e.curated.map(e=>(0,y.jsx)(`option`,{value:e,children:e},e))})]}),(0,y.jsx)(f,{variant:`ghost`,disabled:T||!C,onClick:()=>void N(),children:T?`Testing…`:`Send test request`})]}),D&&(0,y.jsx)(`p`,{role:D.kind===`error`?`alert`:`status`,className:`mt-3 rounded-lg px-3 py-2 text-sm ${D.kind===`error`?`bg-danger/10 text-danger`:`bg-success/10 text-success`}`,children:D.message})]})]})]})}function I(e){switch(e){case`openai-codex`:return`gpt-6-astra`;case`openai`:return`gpt-6-astra`;case`anthropic`:return`claude-opus-5`;case`google`:return`gemini-3.6-flash`;case`google-vertex`:return`gemini-3.6-flash`;case`xai`:return`grok-4.5`;case`groq`:return`llama-3.3-70b-versatile`;case`cerebras`:return`gpt-oss-120b`;case`mistral`:return`mistral-large-latest`;case`zai`:return`glm-5.2`;case`huggingface`:return`Qwen/Qwen3.5-397B-A17B`;case`openrouter`:return`anthropic/claude-opus-5`;case`vercel-ai-gateway`:return`anthropic/claude-opus-5`;case`deepseek`:return`deepseek-v4-pro`;case`fireworks`:return`accounts/fireworks/models/kimi-k3`;case`together`:return`moonshotai/Kimi-K3`;case`baseten`:return`moonshotai/Kimi-K3`;case`moonshotai`:return`kimi-k3`;case`moonshotai-cn`:return`kimi-k3`;case`kimi-coding`:return`kimi-for-coding`;case`minimax`:return`MiniMax-M2.7`;case`minimax-cn`:return`MiniMax-M3`;case`qwen-token-plan`:return`qwen3.8-max`;case`qwen-token-plan-cn`:case`qwen-token-plan-individual`:return`qwen3.8-max`;case`ant-ling`:return`Ling-2.6-1T`;case`nvidia`:return`nvidia/nemotron-3-super-120b-a12b`;case`cloudflare-workers-ai`:return`@cf/moonshotai/kimi-k2.6`;case`cloudflare-ai-gateway`:return`claude-opus-5`;case`github-copilot`:return`claude-opus-5`;case`xiaomi`:return`mimo-v2.5`;case`xiaomi-token-plan-ams`:case`xiaomi-token-plan-cn`:case`xiaomi-token-plan-sgp`:return`mimo-v2.5-pro`;case`opencode`:return`claude-opus-5`;case`opencode-go`:return`kimi-k2.7-code`;case`zai-coding-cn`:return`glm-5.2`;case`azure-openai`:return`gpt-5.6-luna`;case`bedrock`:return`global.anthropic.claude-opus-5`;case`ollama`:return`llama3.3`;case`lmstudio`:return`qwen3-coder-30b`;case`llamacpp`:return`unsloth/Qwen3.6-35B-A3B-MTP-GGUF:MXFP4_MOE`;default:return`model-name`}}function L({items:e,onPick:t}){return(0,y.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,y.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 R({status:e}){let t=r(),[n,i]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>{u.current?.abort()},[]);async function d(){u.current?.abort();let e=new AbortController;u.current=e,i(!0),s(null);try{let n=await fetch(`/api/auth/openai/login`,{method:`POST`,signal:e.signal});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}if(e.signal.aborted)return;await t.invalidate()}catch(t){if(e.signal.aborted)return;s(t.message)}finally{u.current===e&&(u.current=null,e.signal.aborted||i(!1))}}async function p(){i(!0),s(null);try{let e=await fetch(`/api/auth/openai`,{method:`DELETE`});if(!e.ok&&e.status!==204){let t=await e.json().catch(()=>null);throw Error(t?.error??`Could not disconnect ChatGPT (${e.status})`)}await t.invalidate()}catch(e){throw s(e instanceof Error?e.message:String(e)),e}finally{i(!1)}}return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 mb-3`,children:[e.connected?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap gap-2 items-center mb-2`,children:[(0,y.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,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`account `,(0,y.jsx)(`code`,{className:`font-mono`,children:e.accountId})]}),e.expiresAt&&(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`token expires`,` `,new Date(e.expiresAt).toISOString().replace(/\.\d+Z$/,`Z`)]})]}),(0,y.jsx)(f,{variant:`danger`,onClick:()=>l(!0),disabled:n,children:`Disconnect ChatGPT`})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.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,y.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,y.jsx)(`code`,{className:`font-mono`,children:`bazilion auth openai login --device-code`}),` on the client. From a source checkout, run`,` `,(0,y.jsx)(`code`,{className:`font-mono`,children:`pnpm tsx apps/cli/src/index.ts auth openai login --device-code`}),` `,`from the repository root.`]}),(0,y.jsx)(f,{variant:`primary`,onClick:d,disabled:n,children:n?`opening browser…`:`Connect ChatGPT →`})]}),o&&(0,y.jsx)(`p`,{role:`alert`,className:`text-sm text-danger mt-2`,children:o})]}),(0,y.jsx)(a,{open:c,onOpenChange:l,title:`Disconnect ChatGPT?`,description:(0,y.jsxs)(`p`,{children:[`This removes the saved OpenAI Codex OAuth credentials. Agents using an`,` `,(0,y.jsx)(`code`,{children:`openai-codex`}),` model will stop working until you connect again.`]}),confirmLabel:`Disconnect ChatGPT`,onConfirm:p})]})}export{M as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{r as t}from"./index-
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{r as t}from"./index-Bq2zrG2_.js";import{r as n}from"./Page-NV96O47A.js";import{t as r}from"./AgentTabs-BcmmwYJc.js";var i=e();function a(e){try{let t=JSON.parse(e);if(typeof t.text==`string`)return t.text}catch{}return e}function o(){let{resolved:e,messages:o,unreadCount:s,selected:c,agentNames:l,loopBreaks:u}=t.useLoaderData(),d=t.useSearch().unread===`1`,f=!!(c&&c.toAgentId!==e.agent.id);function p(e){let t=l[e];return t?`${t} (${e.slice(0,8)})`:e.slice(0,8)}return(0,i.jsxs)(n,{children:[(0,i.jsx)(`h1`,{className:`font-serif text-3xl text-foreground mb-1`,children:e.agent.name}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-6`,children:[(0,i.jsxs)(`code`,{className:`font-mono`,children:[e.agent.id.slice(0,8),`…`]}),` · unread: `,s]}),(0,i.jsx)(r,{agentId:e.agent.id,active:`inbox`,archived:e.agent.status===`archived`}),(0,i.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[360px_1fr] gap-6`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`flex gap-1 border-b mb-3`,children:[(0,i.jsx)(`a`,{href:`/agents/${e.agent.id}/inbox`,className:`px-3 py-1.5 text-sm border-b-2 -mb-px ${d?`border-transparent text-muted-foreground`:`border-primary text-primary font-semibold`}`,children:`all`}),(0,i.jsx)(`a`,{href:`/agents/${e.agent.id}/inbox?unread=1`,className:`px-3 py-1.5 text-sm border-b-2 -mb-px ${d?`border-primary text-primary font-semibold`:`border-transparent text-muted-foreground`}`,children:`unread`})]}),(0,i.jsx)(`div`,{className:`rounded-lg border bg-card max-h-[640px] overflow-y-auto`,children:o.length===0?(0,i.jsx)(`div`,{className:`p-6 text-center text-muted-foreground italic`,children:d?`no unread messages`:`inbox empty`}):o.map(t=>{let n=a(t.payload),r=n.length>80?`${n.slice(0,80)}…`:n,o=new Date(t.createdAt).toLocaleString(),s=c?.id===t.id,l=t.readAt===null,u=d?`?unread=1&id=${t.id}`:`?id=${t.id}`;return(0,i.jsxs)(`a`,{href:`/agents/${e.agent.id}/inbox${u}`,className:`block border-b last:border-0 px-3 py-2 text-sm hover:bg-accent/30 ${s?`bg-accent/40`:``} ${l?`font-medium`:``}`,children:[(0,i.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,i.jsxs)(`span`,{className:`font-mono`,children:[l&&(0,i.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-primary mr-1.5 align-middle`}),`from `,p(t.fromAgentId)]}),(0,i.jsx)(`span`,{className:`font-mono`,children:o})]}),(0,i.jsx)(`div`,{className:`text-foreground mt-0.5 truncate`,children:r})]},t.id)})})]}),(0,i.jsxs)(`div`,{children:[c&&!f&&(0,i.jsxs)(`div`,{className:`rounded-lg border bg-card p-5 mb-4`,children:[(0,i.jsxs)(`div`,{className:`font-mono text-xs text-muted-foreground mb-2 space-y-0.5`,children:[(0,i.jsxs)(`div`,{children:[`id: `,(0,i.jsx)(`code`,{children:c.id})]}),(0,i.jsxs)(`div`,{children:[`from: `,(0,i.jsx)(`code`,{children:p(c.fromAgentId)})]}),(0,i.jsxs)(`div`,{children:[`received: `,new Date(c.createdAt).toLocaleString()]}),(0,i.jsxs)(`div`,{children:[`read:`,` `,c.readAt?new Date(c.readAt).toLocaleString():`(unread)`]}),c.replyTo&&(0,i.jsxs)(`div`,{children:[`reply to: `,(0,i.jsx)(`code`,{children:c.replyTo})]})]}),(0,i.jsx)(`div`,{className:`border-t pt-3 font-mono text-sm whitespace-pre-wrap break-words`,children:a(c.payload)})]}),f&&(0,i.jsx)(`div`,{className:`rounded-lg border bg-card p-5 mb-4 text-muted-foreground`,children:`message is not addressed to this agent`}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Agents exchange messages automatically via their`,` `,(0,i.jsx)(`code`,{className:`font-mono`,children:`send_message`}),` tool. An idle recipient's scheduler tick drains unread mail.`]}),(0,i.jsxs)(`div`,{className:`mt-6 rounded-lg border bg-card p-4`,children:[(0,i.jsx)(`h2`,{className:`mb-2 font-serif text-lg text-foreground`,children:`Loop circuit breaker`}),u.length===0?(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No agent-message chains stopped.`}):(0,i.jsx)(`div`,{className:`space-y-3`,children:u.map(e=>(0,i.jsxs)(`div`,{className:`border-t first:border-0 first:pt-0 pt-3 text-xs`,children:[(0,i.jsxs)(`div`,{className:`font-mono text-foreground`,children:[p(e.fromAgentId),` → `,p(e.toAgentId)]}),(0,i.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`stopped hop `,e.attemptedHop,` at limit `,e.maxHops,` · chain`,` `,(0,i.jsx)(`code`,{children:e.causalChainId.slice(0,8)}),` ·`,` `,new Date(e.createdAt).toLocaleString()]})]},e.id))})]})]})]})]})}export{o as component};
|