bazilion 0.7.0 → 0.8.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 +80 -17
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +143 -23
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/{TemplatesTabs-Da7mg9FI.js → TemplatesTabs-UM04RMO9.js} +1 -1
- package/dist/web/client/assets/{_id-LT6Ejjr0.js → _id-BNJapCT4.js} +1 -1
- package/dist/web/client/assets/{_id-_6jIt0_-.js → _id-CjGoV8Mr.js} +1 -1
- package/dist/web/client/assets/{_id-BdKmo0gb.js → _id-DehuCHUw.js} +1 -1
- package/dist/web/client/assets/{_id-MR2XjWh0.js → _id-Dz9fjcCM.js} +1 -1
- package/dist/web/client/assets/{agents-0arKbVYG.js → agents-M6omAXcZ.js} +1 -1
- package/dist/web/client/assets/{config-BSAVT-17.js → config-DIuEc5bm.js} +1 -1
- package/dist/web/client/assets/{groups-BqTkhHes.js → groups-DpE2d2zZ.js} +1 -1
- package/dist/web/client/assets/{inbox-ozoCXzr5.js → inbox-BPnLsRNf.js} +1 -1
- package/dist/web/client/assets/{index-iayCEuU2.js → index-MAJuXnie.js} +2 -2
- package/dist/web/client/assets/{login-D8lNr2SX.js → login-CawJX16E.js} +1 -1
- package/dist/web/client/assets/{mcp-BLnngDsj.js → mcp-DIrh9-v_.js} +1 -1
- package/dist/web/client/assets/{memory-D1GQjEvN.js → memory-BpHbdKsd.js} +1 -1
- package/dist/web/client/assets/{profile-groups-C2yJPTaE.js → profile-groups-ByoKak0c.js} +1 -1
- package/dist/web/client/assets/{profiles-BV7AAZjj.js → profiles-BEjv8LGo.js} +1 -1
- package/dist/web/client/assets/{routes-DSHQLA7K.js → routes-D2COHy7v.js} +1 -1
- package/dist/web/client/assets/{services-BbCJe1Du.js → services-D212jSK_.js} +1 -1
- package/dist/web/client/assets/skills-Da0MURjY.js +1 -0
- package/dist/web/client/assets/styles-BgE5bCHA.css +2 -0
- package/dist/web/client/assets/{telegram-gE4j8gte.js → telegram-Czh2MdVm.js} +1 -1
- package/dist/web/client/assets/{tokens-D2_O9ARe.js → tokens-E_JvO5JN.js} +1 -1
- package/dist/web/client/assets/{triggers-WljnfEfJ.js → triggers-BBRZQOm7.js} +1 -1
- package/dist/web/server/assets/{_id-D0ytyXGY.js → _id-BdRiQb2H.js} +42 -5
- package/dist/web/server/assets/{_id-81NrHA5d.js → _id-DUIrFV3G.js} +1 -1
- package/dist/web/server/assets/{_tanstack-start-manifest_v-DBlFH2gg.js → _tanstack-start-manifest_v-D9FLKShQ.js} +23 -23
- package/dist/web/server/assets/{router-BpBZgRwn.js → router-BrDascdO.js} +3 -3
- package/dist/web/server/assets/{skills-dLyBZb3B.js → skills-D89ND2kR.js} +67 -7
- package/dist/web/server/assets/{skills-CpsyR_WA.js → skills-l2cyQ3zS.js} +1 -1
- package/dist/web/server/server.js +2 -2
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
- package/dist/web/client/assets/skills-C6czKR5I.js +0 -1
- package/dist/web/client/assets/styles-C06axZZk.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{a as t}from"./preload-helper-CvnapA2_.js";import{S as n}from"./index-
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{a as t}from"./preload-helper-CvnapA2_.js";import{S as n}from"./index-MAJuXnie.js";var r=e();function i(){let e=n({select:e=>e.location.pathname});return(0,r.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex gap-1 border-b border-frost`,children:[{to:`/profiles`,label:`profiles`,match:e=>e.startsWith(`/profiles`)},{to:`/profile-groups`,label:`profile groups`,match:e=>e.startsWith(`/profile-groups`)}].map(n=>{let i=n.match(e);return(0,r.jsx)(t,{to:n.to,role:`tab`,"aria-selected":i,className:`unstyled cursor-pointer border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${i?`border-sapphire text-sapphire`:`border-transparent text-mocha hover:text-sapphire`}`,children:n.label},n.to)})})}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{d as i}from"./index-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{d as i}from"./index-MAJuXnie.js";var a=e(n()),o=t();function s(){let{loaded:e,modelGroups:t,skills:n}=i.useLoaderData(),[r,s]=(0,a.useState)(`basics`);return(0,o.jsxs)(`div`,{children:[(0,o.jsxs)(`header`,{className:`mb-1`,children:[(0,o.jsx)(`a`,{href:`/profiles`,className:`mb-1 inline-block text-[0.85em] text-mocha-light hover:text-sapphire`,children:`← profiles`}),(0,o.jsx)(`h1`,{children:e.profile.name}),(0,o.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[0.9em] text-mocha-light`,children:[(0,o.jsx)(`code`,{children:e.profile.id}),(0,o.jsx)(`span`,{children:`·`}),(0,o.jsxs)(`span`,{children:[`model: `,(0,o.jsx)(`code`,{children:e.profile.defaultModel})]})]})]}),(0,o.jsxs)(`p`,{className:`muted my-6`,children:[`These settings and files seed every agent spawned from this profile going forward.`,` `,(0,o.jsx)(`strong`,{children:`Existing agents keep their own copies`}),` — edits here don't propagate to already-spawned agents.`]}),(0,o.jsx)(c,{items:[{id:`basics`,label:`1. basics`},{id:`skills`,label:`2. skills`}],active:r,onChange:e=>s(e)}),r===`basics`&&(0,o.jsxs)(`div`,{children:[(0,o.jsx)(p,{profileId:e.profile.id,initialName:e.profile.name,currentModel:e.profile.defaultModel,modelGroups:t}),(0,o.jsx)(d,{profileId:e.profile.id,file:`SOUL.md`,initialContent:e.files.soul,rows:14}),(0,o.jsx)(d,{profileId:e.profile.id,file:`IDENTITY.md`,initialContent:e.files.identity,rows:10}),e.files.bootstrap===null?(0,o.jsxs)(`section`,{className:`file-card`,children:[(0,o.jsx)(`div`,{className:`file-head`,children:(0,o.jsx)(`h3`,{children:`BOOTSTRAP.md`})}),(0,o.jsx)(`p`,{className:`muted`,children:`This profile was created without a bootstrap prompt. Spawned agents won't see a first-run intro message.`})]}):(0,o.jsx)(d,{profileId:e.profile.id,file:`BOOTSTRAP.md`,initialContent:e.files.bootstrap,rows:10}),(0,o.jsx)(f,{profileId:e.profile.id,file:`AGENTS.md`,initialContent:e.files.agents,hint:`Peers and routing notes — who this agent can hand off to.`}),(0,o.jsx)(f,{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.`}),(0,o.jsx)(f,{profileId:e.profile.id,file:`HEARTBEAT.md`,initialContent:e.files.heartbeat,hint:`Tasks the agent should check on scheduled wake-ups. Pair with a trigger whose message is the canned heartbeat prompt.`})]}),r===`skills`&&(0,o.jsx)(m,{profileId:e.profile.id,initialMode:e.profile.skillsMode,initialPicked:new Set(e.defaultSkills),skills:n})]})}function c({items:e,active:t,onChange:n}){return(0,o.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex gap-1 border-b border-frost`,children:e.map(e=>(0,o.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 l(e){return e===`saved`?`text-sapphire`:e===`error`?`text-[#9B3D3D]`:e===`dirty`?`text-mocha`:`text-mocha-light`}function u({title:e,status:t,children:n}){return(0,o.jsxs)(`section`,{className:`file-card mb-5 rounded-[16px] border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,o.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,o.jsx)(`h3`,{className:`m-0 font-mono text-[0.95em] font-semibold normal-case tracking-normal text-chocolate`,children:e}),t&&(0,o.jsx)(`span`,{className:`text-[0.82em] ${l(t.kind)}`,children:t.message})]}),n]})}function d({profileId:e,file:t,initialContent:n,rows:r=10}){let[i,s]=(0,a.useState)(n),[c,l]=(0,a.useState)(n),[d,f]=(0,a.useState)({kind:`idle`,message:``}),p=c!==i&&d.kind!==`saving`&&d.kind!==`error`?{kind:`dirty`,message:`unsaved changes`}:d;async function m(){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:c})});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}s(c),f({kind:`saved`,message:`saved`})}catch(e){f({kind:`error`,message:`error: ${e.message}`})}}function h(){l(i),f({kind:`idle`,message:``})}return(0,o.jsxs)(u,{title:t,status:p,children:[(0,o.jsx)(`textarea`,{rows:r,value:c,onChange:e=>l(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`}),(0,o.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,o.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:m,disabled:d.kind===`saving`,children:`save`}),(0,o.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:h,children:`revert`})]})]})}function f({profileId:e,file:t,initialContent:n,hint:i}){let s=r(),[c,l]=(0,a.useState)(!1),[f,p]=(0,a.useState)({kind:`idle`,message:``});async function m(){l(!0),p({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 s.invalidate()}catch(e){p({kind:`error`,message:`error: ${e.message}`}),l(!1)}}return n===null?(0,o.jsxs)(u,{title:t,status:f,children:[(0,o.jsx)(`p`,{className:`muted my-1`,children:i}),(0,o.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,o.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:m,disabled:c,children:c?`creating…`:`create empty`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`p`,{className:`muted -mb-3 ml-1 mt-2 text-[0.85em]`,children:i}),(0,o.jsx)(d,{profileId:e,file:t,initialContent:n,rows:10})]})}function p({profileId:e,initialName:t,currentModel:n,modelGroups:i}){let s=r(),[c,l]=(0,a.useState)(t),[d,f]=(0,a.useState)(n),[p,m]=(0,a.useState)({kind:`idle`,message:``}),h=!i.flatMap(e=>e.models.map(t=>`${e.provider}:${t}`)).includes(n);async function g(t){t.preventDefault(),m({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:c.trim(),defaultModel:d.trim()})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await s.invalidate(),m({kind:`saved`,message:`saved`})}catch(e){m({kind:`error`,message:`error: ${e.message}`})}}return(0,o.jsx)(u,{title:`settings`,status:p,children:(0,o.jsxs)(`form`,{onSubmit:g,children:[(0,o.jsxs)(`div`,{className:`flex gap-4`,children:[(0,o.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,o.jsx)(`input`,{value:c,onChange:e=>l(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex-1`,children:[`default model`,i.length===0?(0,o.jsx)(`select`,{disabled:!0,children:(0,o.jsx)(`option`,{children:`(no models available — enable on /config)`})}):(0,o.jsxs)(`select`,{value:d,onChange:e=>f(e.target.value),children:[h&&(0,o.jsxs)(`option`,{value:n,children:[n,` (not in enabled list)`]}),i.map(e=>(0,o.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,o.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]})]}),(0,o.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,o.jsx)(`button`,{type:`submit`,disabled:p.kind===`saving`,children:`save settings`})})]})})}function m({profileId:e,initialMode:t,initialPicked:n,skills:i}){let s=r(),[c,l]=(0,a.useState)(t),[d,f]=(0,a.useState)(n),[p,m]=(0,a.useState)({kind:`idle`,message:``});function h(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function g(t){t.preventDefault(),m({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({skillsMode:c,defaultSkills:c===`selected`?Array.from(d):[]})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await s.invalidate(),m({kind:`saved`,message:`saved`})}catch(e){m({kind:`error`,message:`error: ${e.message}`})}}return(0,o.jsxs)(u,{title:`skills`,status:p,children:[(0,o.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,o.jsxs)(`form`,{onSubmit:g,children:[(0,o.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,o.jsx)(`input`,{type:`radio`,checked:c===`all`,onChange:()=>l(`all`)}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`strong`,{children:`allow all skills`}),` — every skill on disk is attached at spawn.`]})]}),(0,o.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,o.jsx)(`input`,{type:`radio`,checked:c===`selected`,onChange:()=>l(`selected`)}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`strong`,{children:`select skills`}),` — attach only the ones ticked below.`]})]}),(0,o.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${c===`all`?`pointer-events-none opacity-50`:``}`,children:i.length===0?(0,o.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,o.jsx)(`a`,{href:`/skills`,children:`/skills`}),`.`]}):i.map(e=>(0,o.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:d.has(e.name),onChange:()=>h(e.name)}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`code`,{children:e.name}),e.description&&(0,o.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,e.description]})]})]},e.name))}),(0,o.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,o.jsx)(`button`,{type:`submit`,disabled:p.kind===`saving`,children:`save skills`})})]})]})}export{s as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{u as i}from"./index-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{u as i}from"./index-MAJuXnie.js";import{t as a}from"./Button-ByiV6fpd.js";import{t as o}from"./MembersEditor-C6UpqDdV.js";var s=e(n()),c=t();function l(e){return{profileId:e.profileId,agentName:e.agentName,modelOverride:e.modelOverride,reasoningLevel:e.reasoningLevel}}function u(){let{detail:e,profiles:t,modelGroups:n}=i.useLoaderData(),a=r(),{group:o}=e;return(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h1`,{children:o.name}),(0,c.jsxs)(`p`,{className:`muted`,children:[(0,c.jsx)(`code`,{children:o.id}),` · `,e.members.length,` member`,e.members.length===1?``:`s`]}),(0,c.jsx)(d,{group:o,onSaved:()=>a.invalidate()}),(0,c.jsx)(f,{groupId:o.id,initialMembers:e.members.map(l),profiles:t,modelGroups:n,onSaved:()=>a.invalidate()})]})}function d({group:e,onSaved:t}){let[n,r]=(0,s.useState)(e.name),[i,o]=(0,s.useState)(e.userMd??``),[l,u]=(0,s.useState)(null),[d,f]=(0,s.useState)(!1);async function p(){u(null),f(!0);try{let r={name:n};r.userMd=i===``?null:i;let a=await fetch(`/api/profile-groups/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.error??a.statusText)}t()}catch(e){u(e.message)}finally{f(!1)}}return(0,c.jsxs)(`div`,{className:`card`,children:[(0,c.jsx)(`h3`,{children:`basics`}),l&&(0,c.jsx)(`div`,{className:`err`,children:l}),(0,c.jsxs)(`label`,{children:[`name`,(0,c.jsx)(`input`,{value:n,onChange:e=>r(e.target.value)})]}),(0,c.jsxs)(`label`,{children:[`starter USER.md (seeded only into freshly-created target groups)`,(0,c.jsx)(`textarea`,{rows:6,value:i,onChange:e=>o(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]}),(0,c.jsx)(a,{variant:`primary`,onClick:p,disabled:d,children:d?`saving…`:`save basics`})]})}function f({groupId:e,initialMembers:t,profiles:n,modelGroups:r,onSaved:i}){let[l,u]=(0,s.useState)(t),[d,f]=(0,s.useState)(null),[p,m]=(0,s.useState)(!1),h=JSON.stringify(l)!==JSON.stringify(t);async function g(){f(null),m(!0);try{let t=await fetch(`/api/profile-groups/${e}/members`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({members:l})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}i()}catch(e){f(e.message)}finally{m(!1)}}return(0,c.jsxs)(`div`,{className:`card`,children:[(0,c.jsx)(`h3`,{children:`members`}),d&&(0,c.jsx)(`div`,{className:`err`,children:d}),(0,c.jsxs)(`p`,{className:`muted`,children:[`Each member becomes one agent at spawn time. Duplicate agent-names within a template are fine — the spawn op auto-suffixes collisions with `,(0,c.jsx)(`code`,{children:`-2`}),`, `,(0,c.jsx)(`code`,{children:`-3`}),`, …`]}),(0,c.jsx)(o,{members:l,onChange:u,profiles:n,modelGroups:r}),(0,c.jsx)(`div`,{className:`mt-3`,children:(0,c.jsx)(a,{variant:`primary`,onClick:g,disabled:p||!h,children:p?`saving…`:`save members`})})]})}export{u as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{a as i}from"./index-iayCEuU2.js";import{t as a}from"./AgentTabs-DioGqUVR.js";import{t as o}from"./AgentAvatar-JYijLvZ2.js";import{t as s}from"./ChatPane-DzEgOEqS.js";import{r as c}from"./wire-constants-BkT5-597.js";var l=e(n(),1),u=t();function d({value:e,className:t,ariaLabel:n=`Copy to clipboard`,title:r=`Copy to clipboard`}){let[i,a]=(0,l.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,u.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 f(){let{resolved:e,initialMessages:t,sessionHead:n,groups:c,skills:l,modelGroups:f,telegramConfigured:y}=i.useLoaderData(),b=r();async function x(){confirm(`archive "${e.agent.name}"? (reversible)`)&&(await fetch(`/api/agents/${e.agent.id}/archive`,{method:`POST`}),await b.invalidate())}async function S(){await fetch(`/api/agents/${e.agent.id}/unarchive`,{method:`POST`}),await b.invalidate()}async function C(){let t=`Permanently delete agent "${e.agent.name}"?\n\nThis removes the DB rows (messages, triggers, skill attachments) AND the agent's on-disk directory (memory, templates, state, sessions). This cannot be undone.`;if(!confirm(t))return;let n=await fetch(`/api/agents/${e.agent.id}`,{method:`DELETE`});n.ok||n.status===204?window.location.assign(`/agents`):alert(`failed: ${n.statusText}`)}return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`header`,{className:`mb-8`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(o,{identity:e.agent.identity,size:44}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`mb-0`,children:e.agent.name}),(e.agent.identity?.creature||e.agent.identity?.vibe)&&(0,u.jsx)(`p`,{className:`muted mt-0.5 text-sm`,children:[e.agent.identity?.creature,e.agent.identity?.vibe].filter(Boolean).join(` · `)})]})]}),(0,u.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-5 gap-y-2`,children:[(0,u.jsxs)(m,{children:[(0,u.jsx)(`span`,{className:`px-1.5 font-mono text-[0.95em] text-mocha select-all`,children:e.agent.id}),(0,u.jsx)(d,{value:e.agent.id,ariaLabel:`Copy agent UUID`,title:`Copy UUID to clipboard`})]}),(0,u.jsxs)(m,{children:[`status: `,(0,u.jsx)(`span`,{className:`ml-1`,children:e.agent.status})]}),(0,u.jsxs)(m,{children:[`profile: `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.profile.id})]}),(0,u.jsxs)(m,{children:[`group:`,` `,(0,u.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.group.id)}`,className:`ml-1 bg-transparent px-0 font-mono underline`,children:e.group.id}),` `,`·`,` `,(0,u.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.group.id)}/memory`,className:`ml-0.5 underline`,children:`shared memory →`})]}),(0,u.jsxs)(m,{children:[`model: `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.model})]}),(0,u.jsxs)(m,{children:[`reasoning:`,` `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.reasoningLevel})]})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.agent.status===`archived`?(0,u.jsx)(`button`,{type:`button`,onClick:S,className:`ghost-btn`,children:`unarchive`}):(0,u.jsx)(`button`,{type:`button`,onClick:x,className:`ghost-btn`,children:`archive`}),(0,u.jsx)(`button`,{type:`button`,onClick:C,className:`ghost-btn border-[rgba(196,135,138,0.4)] text-[#9B3D3D] hover:bg-[rgba(196,135,138,0.08)]`,children:`delete permanently`})]}),(0,u.jsx)(h,{agentId:e.agent.id,currentModelOverride:e.agent.modelOverride??null,profileDefaultModel:e.profile.defaultModel,currentReasoning:e.reasoningLevel,modelGroups:f})]}),e.agent.status===`archived`&&(0,u.jsxs)(`div`,{className:`mb-4 rounded-md border border-frost bg-fawn/35 px-4 py-2 text-[0.9em] text-chocolate`,children:[(0,u.jsx)(`strong`,{className:`text-[#7a4e2a]`,children:`This agent is archived.`}),` It's hidden from the default agent list; use `,(0,u.jsx)(`em`,{children:`unarchive`}),` above to bring it back, or`,` `,(0,u.jsx)(`em`,{children:`delete permanently`}),` to remove its data entirely.`]}),(0,u.jsx)(a,{agentId:e.agent.id,active:`chat`,archived:e.agent.status===`archived`}),(0,u.jsx)(p,{children:`Chat`}),(0,u.jsx)(`div`,{className:`h-[70vh]`,children:(0,u.jsx)(s,{agentId:e.agent.id,agentName:e.agent.name,initialMessages:t,initialSessionHead:n})}),(0,u.jsx)(`p`,{className:`mt-2 text-[0.82em] text-mocha-light`,children:`chat history persists in bazilion across navigation and restarts.`}),(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Group`}),(0,u.jsxs)(`p`,{className:`text-[0.9em] text-mocha-light`,children:[`Current group: `,(0,u.jsx)(`code`,{children:e.group.id}),` (`,e.group.name,`) —`,` `,(0,u.jsx)(`code`,{children:e.group.path}),`.`,` `,(0,u.jsx)(`a`,{href:`/groups/${e.group.id}`,children:`view / edit USER.md`})]}),(0,u.jsx)(g,{agentId:e.agent.id,currentGroupId:e.group.id,groups:c})]}),(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Skills`}),(0,u.jsx)(_,{agentId:e.agent.id,attached:new Set(e.skills),all:l})]}),y&&(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Telegram`}),(0,u.jsx)(v,{agent:e.agent})]})]})}function p({children:e}){return(0,u.jsx)(`h3`,{className:`mb-3 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:e})}function m({children:e}){return(0,u.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-frost bg-ivory px-3 py-0.5 text-[0.84em] text-mocha-light`,children:e})}function h({agentId:e,currentModelOverride:t,profileDefaultModel:n,currentReasoning:i,modelGroups:a}){let o=r(),[s,d]=(0,l.useState)(t??``),[f,p]=(0,l.useState)(i),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),b=t!==null&&a.some(e=>e.models.some(n=>`${e.provider}:${n}`===t));async function x(t){t.preventDefault(),h(!0),y(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({modelOverride:s===``?null:s,reasoningLevel:f})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}_(!0),setTimeout(()=>_(!1),1500),await o.invalidate()}catch(e){y(e.message)}finally{h(!1)}}return(0,u.jsxs)(`details`,{className:`mt-3 text-[0.9em]`,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer text-mocha-light`,children:`settings`}),(0,u.jsxs)(`form`,{onSubmit:x,className:`mt-2 flex flex-wrap items-end gap-3 border-t border-dashed border-frost py-3`,children:[(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`model override`,(0,u.jsxs)(`select`,{name:`modelOverride`,value:s,onChange:e=>d(e.target.value),className:`min-w-[16rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:[(0,u.jsxs)(`option`,{value:``,children:[`inherit from profile (`,n,`)`]}),t!==null&&!b&&(0,u.jsxs)(`option`,{value:t,children:[t,` (not in curated list)`]}),a.map(e=>(0,u.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>{let n=`${e.provider}:${t}`;return(0,u.jsx)(`option`,{value:n,children:n},n)})},e.provider))]})]}),(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`reasoning level`,(0,u.jsx)(`select`,{name:`reasoningLevel`,value:f,onChange:e=>p(e.target.value),className:`min-w-[16rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:c.map(e=>(0,u.jsx)(`option`,{value:e,children:e},e))})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:m,children:m?`saving…`:`save`}),g&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#3b7a3b]`,children:`saved ✓`}),v&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#9B3D3D]`,children:v})]})]})}function g({agentId:e,currentGroupId:t,groups:n}){let i=r(),[a,o]=(0,l.useState)(t),[s,c]=(0,l.useState)(!1),[d,f]=(0,l.useState)(null);async function p(n){if(n.preventDefault(),a!==t){c(!0),f(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/group`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({groupId:a})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await i.invalidate()}catch(e){f(e.message)}finally{c(!1)}}}return(0,u.jsxs)(`form`,{onSubmit:p,className:`mt-2 flex flex-wrap items-end gap-2`,children:[(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`move to:`,(0,u.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`min-w-[18rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:n.map(e=>(0,u.jsxs)(`option`,{value:e.id,children:[e.id,` — `,e.path]},e.id))})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:s||a===t,children:s?`moving…`:`move`}),d&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#9B3D3D]`,children:d})]})}function _({agentId:e,attached:t,all:n}){let i=r(),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(null);async function d(t){o(t),c(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e)}/skills`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({skill:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await i.invalidate()}catch(e){c(e.message)}finally{o(null)}}async function f(t){o(t),c(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 i.invalidate()}catch(e){c(e.message)}finally{o(null)}}return n.length===0?(0,u.jsx)(`p`,{className:`text-[0.9em] text-mocha-light`,children:`no skills installed`}):(0,u.jsxs)(u.Fragment,{children:[s&&(0,u.jsx)(`p`,{className:`mb-2 text-[0.85em] text-[#9B3D3D]`,children:s}),(0,u.jsxs)(`table`,{children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`name`}),(0,u.jsx)(`th`,{children:`description`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsx)(`tbody`,{children:n.map(e=>{let n=t.has(e.name),r=a===e.name;return(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:e.name})}),(0,u.jsx)(`td`,{children:e.description||(0,u.jsx)(`span`,{className:`text-mocha-light`,children:`—`})}),(0,u.jsx)(`td`,{children:n?(0,u.jsx)(`button`,{type:`button`,className:`ghost-btn`,disabled:r,onClick:()=>f(e.name),children:r?`…`:`detach`}):(0,u.jsx)(`button`,{type:`button`,className:`ghost-btn`,disabled:r,onClick:()=>d(e.name),children:r?`…`:`attach`})})]},e.name)})})]})]})}function v({agent:e}){let t=r(),[n,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(e.telegramMirrorMode),[d,f]=(0,l.useState)(e.telegramIconEmoji??``),p=e.telegramTopicId!==null;async function m(){i(!0),o(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){o(e.message)}finally{i(!1)}}async function h(){if(confirm(`Unbind this agent from its Telegram topic? The topic stays in Telegram as an orphan.`)){i(!0),o(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}/telegram/binding`,{method:`DELETE`});if(!n.ok)throw Error(n.statusText);await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}}async function g(n){c(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){c(e.telegramMirrorMode),o(t.message)}}async function _(){o(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({telegramIconEmoji:d.trim()||null})});if(!n.ok)throw Error(n.statusText);await t.invalidate()}catch(e){o(e.message)}}return(0,u.jsxs)(`div`,{className:`text-[0.9em]`,children:[(0,u.jsx)(`div`,{className:`mb-3 flex items-center gap-3`,children:p?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`rounded-full bg-emerald-100 px-2 py-0.5 text-xs font-semibold text-emerald-800`,children:`bound`}),(0,u.jsxs)(`span`,{className:`font-mono text-mocha`,children:[`topic #`,e.telegramTopicId]}),(0,u.jsx)(`button`,{type:`button`,onClick:m,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,u.jsx)(`button`,{type:`button`,onClick:h,disabled:n,className:`ghost-btn border-[rgba(196,135,138,0.4)] text-[#9B3D3D] hover:bg-[rgba(196,135,138,0.08)]`,children:`unbind`})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-800`,children:`unbound`}),(0,u.jsx)(`button`,{type:`button`,onClick:m,disabled:n,className:`ghost-btn`,title:`Create a Telegram topic for this agent`,children:n?`binding…`:`bind a topic`})]})}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`label`,{htmlFor:`mirror-mode`,className:`text-mocha-light`,children:`mirror mode:`}),(0,u.jsxs)(`select`,{id:`mirror-mode`,value:s,onChange:e=>void g(e.target.value),className:`rounded-md border bg-background px-2 py-1 font-mono text-sm`,disabled:n,children:[(0,u.jsx)(`option`,{value:`minimal`,children:`minimal — assistant messages only`}),(0,u.jsx)(`option`,{value:`verbose`,children:`verbose — also tool calls`})]})]}),(0,u.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,u.jsx)(`label`,{htmlFor:`topic-icon`,className:`text-mocha-light`,children:`topic icon:`}),(0,u.jsx)(`input`,{id:`topic-icon`,value:d,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,u.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:n||d===(e.telegramIconEmoji??``),className:`ghost-btn`,children:`save icon`})]}),a&&(0,u.jsx)(`p`,{className:`mt-2 text-sm text-rose-700`,children:a}),(0,u.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.`})]})}export{f as component};
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{a as i}from"./index-MAJuXnie.js";import{t as a}from"./AgentTabs-DioGqUVR.js";import{t as o}from"./AgentAvatar-JYijLvZ2.js";import{t as s}from"./ChatPane-DzEgOEqS.js";import{r as c}from"./wire-constants-BkT5-597.js";var l=e(n(),1),u=t();function d({value:e,className:t,ariaLabel:n=`Copy to clipboard`,title:r=`Copy to clipboard`}){let[i,a]=(0,l.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,u.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 f(){let{resolved:e,initialMessages:t,sessionHead:n,groups:c,skills:l,modelGroups:f,telegramConfigured:v}=i.useLoaderData(),b=r();async function x(){confirm(`archive "${e.agent.name}"? (reversible)`)&&(await fetch(`/api/agents/${e.agent.id}/archive`,{method:`POST`}),await b.invalidate())}async function S(){await fetch(`/api/agents/${e.agent.id}/unarchive`,{method:`POST`}),await b.invalidate()}async function C(){let t=`Permanently delete agent "${e.agent.name}"?\n\nThis removes the DB rows (messages, triggers, skill attachments) AND the agent's on-disk directory (memory, templates, state, sessions). This cannot be undone.`;if(!confirm(t))return;let n=await fetch(`/api/agents/${e.agent.id}`,{method:`DELETE`});n.ok||n.status===204?window.location.assign(`/agents`):alert(`failed: ${n.statusText}`)}return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`header`,{className:`mb-8`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(o,{identity:e.agent.identity,size:44}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`mb-0`,children:e.agent.name}),(e.agent.identity?.creature||e.agent.identity?.vibe)&&(0,u.jsx)(`p`,{className:`muted mt-0.5 text-sm`,children:[e.agent.identity?.creature,e.agent.identity?.vibe].filter(Boolean).join(` · `)})]})]}),(0,u.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-5 gap-y-2`,children:[(0,u.jsxs)(m,{children:[(0,u.jsx)(`span`,{className:`px-1.5 font-mono text-[0.95em] text-mocha select-all`,children:e.agent.id}),(0,u.jsx)(d,{value:e.agent.id,ariaLabel:`Copy agent UUID`,title:`Copy UUID to clipboard`})]}),(0,u.jsxs)(m,{children:[`status: `,(0,u.jsx)(`span`,{className:`ml-1`,children:e.agent.status})]}),(0,u.jsxs)(m,{children:[`profile: `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.profile.id})]}),(0,u.jsxs)(m,{children:[`group:`,` `,(0,u.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.group.id)}`,className:`ml-1 bg-transparent px-0 font-mono underline`,children:e.group.id}),` `,`·`,` `,(0,u.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.group.id)}/memory`,className:`ml-0.5 underline`,children:`shared memory →`})]}),(0,u.jsxs)(m,{children:[`model: `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.model})]}),(0,u.jsxs)(m,{children:[`reasoning:`,` `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.reasoningLevel})]})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.agent.status===`archived`?(0,u.jsx)(`button`,{type:`button`,onClick:S,className:`ghost-btn`,children:`unarchive`}):(0,u.jsx)(`button`,{type:`button`,onClick:x,className:`ghost-btn`,children:`archive`}),(0,u.jsx)(`button`,{type:`button`,onClick:C,className:`ghost-btn border-[rgba(196,135,138,0.4)] text-[#9B3D3D] hover:bg-[rgba(196,135,138,0.08)]`,children:`delete permanently`})]}),(0,u.jsx)(h,{agentId:e.agent.id,currentModelOverride:e.agent.modelOverride??null,profileDefaultModel:e.profile.defaultModel,currentReasoning:e.reasoningLevel,modelGroups:f})]}),e.agent.status===`archived`&&(0,u.jsxs)(`div`,{className:`mb-4 rounded-md border border-frost bg-fawn/35 px-4 py-2 text-[0.9em] text-chocolate`,children:[(0,u.jsx)(`strong`,{className:`text-[#7a4e2a]`,children:`This agent is archived.`}),` It's hidden from the default agent list; use `,(0,u.jsx)(`em`,{children:`unarchive`}),` above to bring it back, or`,` `,(0,u.jsx)(`em`,{children:`delete permanently`}),` to remove its data entirely.`]}),(0,u.jsx)(a,{agentId:e.agent.id,active:`chat`,archived:e.agent.status===`archived`}),(0,u.jsx)(p,{children:`Chat`}),(0,u.jsx)(`div`,{className:`h-[70vh]`,children:(0,u.jsx)(s,{agentId:e.agent.id,agentName:e.agent.name,initialMessages:t,initialSessionHead:n})}),(0,u.jsx)(`p`,{className:`mt-2 text-[0.82em] text-mocha-light`,children:`chat history persists in bazilion across navigation and restarts.`}),(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Group`}),(0,u.jsxs)(`p`,{className:`text-[0.9em] text-mocha-light`,children:[`Current group: `,(0,u.jsx)(`code`,{children:e.group.id}),` (`,e.group.name,`) —`,` `,(0,u.jsx)(`code`,{children:e.group.path}),`.`,` `,(0,u.jsx)(`a`,{href:`/groups/${e.group.id}`,children:`view / edit USER.md`})]}),(0,u.jsx)(g,{agentId:e.agent.id,currentGroupId:e.group.id,groups:c})]}),(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Skills`}),(0,u.jsx)(_,{agentId:e.agent.id,attached:new Set(e.skills),all:l})]}),v&&(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Telegram`}),(0,u.jsx)(y,{agent:e.agent})]})]})}function p({children:e}){return(0,u.jsx)(`h3`,{className:`mb-3 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:e})}function m({children:e}){return(0,u.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-frost bg-ivory px-3 py-0.5 text-[0.84em] text-mocha-light`,children:e})}function h({agentId:e,currentModelOverride:t,profileDefaultModel:n,currentReasoning:i,modelGroups:a}){let o=r(),[s,d]=(0,l.useState)(t??``),[f,p]=(0,l.useState)(i),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),b=t!==null&&a.some(e=>e.models.some(n=>`${e.provider}:${n}`===t));async function x(t){t.preventDefault(),h(!0),y(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({modelOverride:s===``?null:s,reasoningLevel:f})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}_(!0),setTimeout(()=>_(!1),1500),await o.invalidate()}catch(e){y(e.message)}finally{h(!1)}}return(0,u.jsxs)(`details`,{className:`mt-3 text-[0.9em]`,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer text-mocha-light`,children:`settings`}),(0,u.jsxs)(`form`,{onSubmit:x,className:`mt-2 flex flex-wrap items-end gap-3 border-t border-dashed border-frost py-3`,children:[(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`model override`,(0,u.jsxs)(`select`,{name:`modelOverride`,value:s,onChange:e=>d(e.target.value),className:`min-w-[16rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:[(0,u.jsxs)(`option`,{value:``,children:[`inherit from profile (`,n,`)`]}),t!==null&&!b&&(0,u.jsxs)(`option`,{value:t,children:[t,` (not in curated list)`]}),a.map(e=>(0,u.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>{let n=`${e.provider}:${t}`;return(0,u.jsx)(`option`,{value:n,children:n},n)})},e.provider))]})]}),(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`reasoning level`,(0,u.jsx)(`select`,{name:`reasoningLevel`,value:f,onChange:e=>p(e.target.value),className:`min-w-[16rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:c.map(e=>(0,u.jsx)(`option`,{value:e,children:e},e))})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:m,children:m?`saving…`:`save`}),g&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#3b7a3b]`,children:`saved ✓`}),v&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#9B3D3D]`,children:v})]})]})}function g({agentId:e,currentGroupId:t,groups:n}){let i=r(),[a,o]=(0,l.useState)(t),[s,c]=(0,l.useState)(!1),[d,f]=(0,l.useState)(null);async function p(n){if(n.preventDefault(),a!==t){c(!0),f(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/group`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({groupId:a})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await i.invalidate()}catch(e){f(e.message)}finally{c(!1)}}}return(0,u.jsxs)(`form`,{onSubmit:p,className:`mt-2 flex flex-wrap items-end gap-2`,children:[(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`move to:`,(0,u.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`min-w-[18rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:n.map(e=>(0,u.jsxs)(`option`,{value:e.id,children:[e.id,` — `,e.path]},e.id))})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:s||a===t,children:s?`moving…`:`move`}),d&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#9B3D3D]`,children:d})]})}function _({agentId:e,attached:t,all:n}){let i=r(),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(null);async function d(t){let n=t.scanFindings??[];if(n.length===0||confirm(`Skill "${t.name}" has ${n.length} scan finding${n.length===1?``:`s`}. Attach it anyway?`)){o(t.name),c(null);try{let r=await fetch(`/api/agents/${encodeURIComponent(e)}/skills`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({skill:t.name,allowFindings:n.length>0})});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??r.statusText)}await i.invalidate()}catch(e){c(e.message)}finally{o(null)}}}async function f(t){o(t),c(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 i.invalidate()}catch(e){c(e.message)}finally{o(null)}}return n.length===0?(0,u.jsx)(`p`,{className:`text-[0.9em] text-mocha-light`,children:`no skills installed`}):(0,u.jsxs)(u.Fragment,{children:[s&&(0,u.jsx)(`p`,{className:`mb-2 text-[0.85em] text-[#9B3D3D]`,children:s}),(0,u.jsxs)(`table`,{children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`name`}),(0,u.jsx)(`th`,{children:`description`}),(0,u.jsx)(`th`,{children:`scan`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsx)(`tbody`,{children:n.map(e=>{let n=t.has(e.name),r=a===e.name;return(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:e.name})}),(0,u.jsx)(`td`,{children:e.description||(0,u.jsx)(`span`,{className:`text-mocha-light`,children:`—`})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(v,{findings:e.scanFindings??[]})}),(0,u.jsx)(`td`,{children:n?(0,u.jsx)(`button`,{type:`button`,className:`ghost-btn`,disabled:r,onClick:()=>f(e.name),children:r?`…`:`detach`}):(0,u.jsx)(`button`,{type:`button`,className:`ghost-btn`,disabled:r,onClick:()=>d(e),children:r?`…`:`attach`})})]},e.name)})})]})]})}function v({findings:e}){return e.length===0?(0,u.jsx)(`span`,{className:`text-mocha-light`,children:`clean`}):(0,u.jsxs)(`details`,{className:`text-[0.82em]`,children:[(0,u.jsxs)(`summary`,{className:e.some(e=>e.severity===`danger`)?`cursor-pointer text-[#9B3D3D]`:`cursor-pointer text-mocha`,children:[e.length,` finding`,e.length===1?``:`s`]}),(0,u.jsx)(`ul`,{className:`m-0 list-disc pl-4`,children:e.map((e,t)=>(0,u.jsxs)(`li`,{children:[(0,u.jsx)(`span`,{className:`font-mono`,children:e.severity}),`: `,e.code,e.line?` line ${e.line}`:``,` - `,e.message]},`${e.code}-${e.line??0}-${t}`))})]})}function y({agent:e}){let t=r(),[n,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(e.telegramMirrorMode),[d,f]=(0,l.useState)(e.telegramIconEmoji??``),p=e.telegramTopicId!==null;async function m(){i(!0),o(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){o(e.message)}finally{i(!1)}}async function h(){if(confirm(`Unbind this agent from its Telegram topic? The topic stays in Telegram as an orphan.`)){i(!0),o(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}/telegram/binding`,{method:`DELETE`});if(!n.ok)throw Error(n.statusText);await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}}async function g(n){c(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){c(e.telegramMirrorMode),o(t.message)}}async function _(){o(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({telegramIconEmoji:d.trim()||null})});if(!n.ok)throw Error(n.statusText);await t.invalidate()}catch(e){o(e.message)}}return(0,u.jsxs)(`div`,{className:`text-[0.9em]`,children:[(0,u.jsx)(`div`,{className:`mb-3 flex items-center gap-3`,children:p?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`rounded-full bg-emerald-100 px-2 py-0.5 text-xs font-semibold text-emerald-800`,children:`bound`}),(0,u.jsxs)(`span`,{className:`font-mono text-mocha`,children:[`topic #`,e.telegramTopicId]}),(0,u.jsx)(`button`,{type:`button`,onClick:m,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,u.jsx)(`button`,{type:`button`,onClick:h,disabled:n,className:`ghost-btn border-[rgba(196,135,138,0.4)] text-[#9B3D3D] hover:bg-[rgba(196,135,138,0.08)]`,children:`unbind`})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-800`,children:`unbound`}),(0,u.jsx)(`button`,{type:`button`,onClick:m,disabled:n,className:`ghost-btn`,title:`Create a Telegram topic for this agent`,children:n?`binding…`:`bind a topic`})]})}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`label`,{htmlFor:`mirror-mode`,className:`text-mocha-light`,children:`mirror mode:`}),(0,u.jsxs)(`select`,{id:`mirror-mode`,value:s,onChange:e=>void g(e.target.value),className:`rounded-md border bg-background px-2 py-1 font-mono text-sm`,disabled:n,children:[(0,u.jsx)(`option`,{value:`minimal`,children:`minimal — assistant messages only`}),(0,u.jsx)(`option`,{value:`verbose`,children:`verbose — also tool calls`})]})]}),(0,u.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,u.jsx)(`label`,{htmlFor:`topic-icon`,className:`text-mocha-light`,children:`topic icon:`}),(0,u.jsx)(`input`,{id:`topic-icon`,value:d,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,u.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:n||d===(e.telegramIconEmoji??``),className:`ghost-btn`,children:`save icon`})]}),a&&(0,u.jsx)(`p`,{className:`mt-2 text-sm text-rose-700`,children:a}),(0,u.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.`})]})}export{f as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{o as i}from"./index-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{o as i}from"./index-MAJuXnie.js";import{t as a}from"./Button-ByiV6fpd.js";var o=e(n()),s=t();function c(){let{group:e,members:t,profileGroups:n}=i.useLoaderData(),c=r(),[d,f]=(0,o.useState)(e.userMd),[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(null),[_,v]=(0,o.useState)(null);async function y(){m(!0),g(null);try{let t=await fetch(`/api/groups/${encodeURIComponent(e.id)}/user-md`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({userMd:d})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`${t.status} ${t.statusText}`)}v(Date.now()),await c.invalidate()}catch(e){g(e.message)}finally{m(!1)}}return(0,s.jsxs)(`main`,{className:`mx-auto max-w-3xl px-6 py-8`,children:[(0,s.jsxs)(`h1`,{className:`font-serif text-3xl text-foreground`,children:[e.name,` `,(0,s.jsxs)(`span`,{className:`text-muted-foreground text-base`,children:[`(`,e.id,`)`]})]}),(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-6 mt-1`,children:[(0,s.jsx)(`code`,{className:`font-mono`,children:e.path}),` · `,t.length,` `,`member`,t.length===1?``:`s`,` ·`,` `,(0,s.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.id)}/memory`,className:`text-primary underline`,children:`shared memory →`})]}),(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`USER.md`}),(0,s.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,s.jsx)(`textarea`,{value:d,onChange:e=>f(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 group context…`}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mt-3`,children:[(0,s.jsx)(a,{variant:`primary`,onClick:y,disabled:p||d===e.userMd,children:p?`saving…`:`save`}),(0,s.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[d.length,` / 12000 chars`]}),_&&(0,s.jsx)(`span`,{className:`text-xs text-emerald-700`,children:`✓ saved`}),h&&(0,s.jsx)(`span`,{className:`text-xs text-rose-700`,children:h})]})]}),(0,s.jsx)(l,{group:e,sampleAgent:t[0]?.name??`researcher`,onSaved:()=>c.invalidate()}),t.length===0&&(0,s.jsx)(u,{groupId:e.id,profileGroups:n,onSpawned:()=>c.invalidate()}),(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`members`}),t.length===0?(0,s.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No agents in this group yet.`}):(0,s.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,s.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{className:`py-2`,children:`name`}),(0,s.jsx)(`th`,{children:`status`}),(0,s.jsx)(`th`,{children:`profile`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsx)(`tbody`,{children:t.map(e=>(0,s.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,s.jsx)(`td`,{className:`py-2`,children:(0,s.jsx)(`a`,{href:`/agents/${e.id}`,className:`text-primary underline`,children:e.name})}),(0,s.jsx)(`td`,{children:e.status}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`code`,{className:`font-mono text-xs`,children:e.profileId})}),(0,s.jsx)(`td`,{children:(0,s.jsxs)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:[e.id.slice(0,8),`…`]})})]},e.id))})]})]})]})}function l({group:e,sampleAgent:t,onSaved:n}){let[r,i]=(0,o.useState)(e.telegramTopicNameFormat??``),[c,l]=(0,o.useState)(!1),[u,d]=(0,o.useState)(null),[f,p]=(0,o.useState)(null),m=r.trim(),h=m?m.replaceAll(`{agent.name}`,t).replaceAll(`{group.name}`,e.name).replaceAll(`{group.slug}`,e.id):e.id==="default"?t:`${e.id} › ${t}`,g=(e.telegramTopicNameFormat??``)!==r;async function _(t){l(!0),d(null);try{let a=await fetch(`/api/groups/${encodeURIComponent(e.id)}/topic-format`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({format:t?null:r})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error??`${a.status} ${a.statusText}`)}t&&i(``),p(Date.now()),n()}catch(e){d(e.message)}finally{l(!1)}}return(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`Telegram topic names`}),(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:[`Template for this group's Telegram forum-topic titles. Leave empty for built-in naming. Tokens: `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{agent.name}`}),` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{group.name}`}),` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{group.slug}`}),` — must include`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{agent.name}`}),`. Saving renames existing topics that you haven't manually renamed in Telegram.`]}),(0,s.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`{group.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,s.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`preview: `,(0,s.jsx)(`span`,{className:`font-mono text-foreground`,children:h})]}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mt-3`,children:[(0,s.jsx)(a,{variant:`primary`,onClick:()=>_(!1),disabled:c||!g||m.length===0,children:c?`saving…`:`save`}),e.telegramTopicNameFormat&&(0,s.jsx)(a,{variant:`ghost`,onClick:()=>_(!0),disabled:c,children:`clear`}),f&&(0,s.jsx)(`span`,{className:`text-xs text-emerald-700`,children:`✓ saved`}),u&&(0,s.jsx)(`span`,{className:`text-xs text-rose-700`,children:u})]})]})}function u({groupId:e,profileGroups:t,onSpawned:n}){let r=t.filter(e=>e.memberCount>0),[i,c]=(0,o.useState)(r[0]?.id??``),[l,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(null);async function p(){if(i){u(!0),f(null);try{let t=await fetch(`/api/profile-groups/${encodeURIComponent(i)}/spawn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({groupSlug:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`${t.status} ${t.statusText}`)}let r=await t.json();r.orphanAgentIds&&r.orphanAgentIds.length>0&&alert(`Spawn completed with warnings: ${r.orphanAgentIds.length} orphan agent dir(s) left on disk.`),n()}catch(e){f(e.message)}finally{u(!1)}}}return(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`spawn a team into this group`}),(0,s.jsx)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:`This group is empty. Pick a profile group template to spawn its entire roster into it in one transactional call.`}),r.length===0?(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`No profile groups with members yet. Build one on`,` `,(0,s.jsx)(`a`,{href:`/profile-groups`,className:`text-primary underline`,children:`/profile-groups`}),` `,`first.`]}):(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`select`,{value:i,onChange:e=>c(e.target.value),className:`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,s.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.memberCount,` member`,e.memberCount===1?``:`s`,`)`]},e.id))}),(0,s.jsx)(a,{variant:`primary`,onClick:p,disabled:l||!i,children:l?`spawning…`:`spawn team`}),d&&(0,s.jsx)(`span`,{className:`text-xs text-rose-700`,children:d})]})]})}export{c as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{f as i}from"./index-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{f as i}from"./index-MAJuXnie.js";import{t as a}from"./AgentAvatar-JYijLvZ2.js";var o=e(n()),s=t();function c(){let{agents:e,profiles:t,groups:n,modelGroups:o}=i.useLoaderData(),{all:c}=i.useSearch(),u=c===`1`,d=r();async function f(e){confirm(`archive this agent? (reversible)`)&&(await fetch(`/api/agents/${e}/archive`,{method:`POST`}),await d.invalidate())}async function p(e){await fetch(`/api/agents/${e}/unarchive`,{method:`POST`}),await d.invalidate()}async function m(e){confirm(`permanently delete this agent and all its data?`)&&(await fetch(`/api/agents/${e}`,{method:`DELETE`}),await d.invalidate())}return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{children:`agents`}),(0,s.jsx)(l,{profiles:t,groups:n,modelGroups:o,onSpawned:d.invalidate}),(0,s.jsx)(`p`,{children:(0,s.jsx)(`a`,{href:u?`/agents`:`/agents?all=1`,children:u?`hide archived`:`show archived`})}),(0,s.jsxs)(`table`,{children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`id`}),(0,s.jsx)(`th`,{children:`name`}),(0,s.jsx)(`th`,{children:`profile`}),(0,s.jsx)(`th`,{children:`status`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsxs)(`tbody`,{children:[e.length===0&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:5,className:`muted`,children:`no agents yet`})}),e.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{children:(0,s.jsx)(`a`,{href:`/agents/${e.id}`,title:e.id,children:(0,s.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})})}),(0,s.jsx)(`td`,{children:(0,s.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,s.jsx)(a,{identity:e.identity,size:26}),(0,s.jsxs)(`div`,{className:`leading-tight`,children:[(0,s.jsx)(`div`,{children:e.name}),(e.identity?.creature||e.identity?.vibe)&&(0,s.jsx)(`div`,{className:`muted text-[0.8em]`,children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)})]})]})}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`code`,{children:e.profileId})}),(0,s.jsx)(`td`,{children:e.status}),(0,s.jsx)(`td`,{children:(0,s.jsxs)(`div`,{className:`flex gap-1.5`,children:[e.status===`archived`?(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>p(e.id),children:`unarchive`}):(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>f(e.id),children:`archive`}),(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,style:{color:`var(--color-rose-baziu)`},onClick:()=>m(e.id),children:`delete`})]})})]},e.id))]})]})]})}function l({profiles:e,groups:t,modelGroups:n,onSpawned:r}){let[i,a]=(0,o.useState)(``),[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(t.find(e=>e.id==="default")?.id??``),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(null);async function v(e){if(e.preventDefault(),!i){_(`profile is required`);return}h(!0),_(null);try{let e={profile:i};c&&(e.name=c),u&&(e.model=u),f&&(e.groupId=f);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)}l(``),d(``),r()}catch(e){_(e.message)}finally{h(!1)}}return(0,s.jsxs)(`form`,{className:`card`,onSubmit:v,children:[(0,s.jsx)(`h3`,{children:`spawn agent`}),g&&(0,s.jsx)(`div`,{className:`err`,children:g}),(0,s.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:`Skills come from the profile's defaults at spawn time. Tweak per-agent skills after the fact from the agent detail page.`}),(0,s.jsxs)(`div`,{className:`flex gap-4`,children:[(0,s.jsxs)(`label`,{className:`flex-1`,children:[`profile`,(0,s.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),required:!0,children:[(0,s.jsx)(`option`,{value:``,children:`--`}),e.map(e=>(0,s.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),(0,s.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,s.jsx)(`input`,{value:c,onChange:e=>l(e.target.value)})]})]}),(0,s.jsxs)(`label`,{children:[`model override`,n.length===0?(0,s.jsx)(`input`,{value:``,disabled:!0,placeholder:`(uses profile default — enable models on /config)`}):(0,s.jsxs)(`select`,{value:u,onChange:e=>d(e.target.value),children:[(0,s.jsx)(`option`,{value:``,children:`(uses profile default)`}),n.map(e=>(0,s.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,s.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]}),(0,s.jsxs)(`label`,{children:[`group`,t.length===0?(0,s.jsx)(`select`,{disabled:!0,children:(0,s.jsx)(`option`,{children:`(no groups — register one on /groups)`})}):(0,s.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),children:t.map(e=>(0,s.jsxs)(`option`,{value:e.id,children:[e.id,` (`,e.name,`)`]},e.id))})]}),(0,s.jsx)(`button`,{type:`submit`,disabled:m,children:m?`spawning…`:`spawn`})]})}export{c as component};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{p as i}from"./index-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{p as i}from"./index-MAJuXnie.js";import{t as a}from"./ConfigTabs-pY-V0Rie.js";import{t as o}from"./FieldRow-CNKma5LE.js";var s=e(n()),c=t();function l(){let{providers:e,openaiCodex:t}=i.useLoaderData(),n=e.some(e=>e.enabled&&e.curated.length>0);return(0,c.jsxs)(`main`,{className:`mx-auto max-w-5xl px-6 py-8`,children:[(0,c.jsx)(`h1`,{className:`font-serif text-3xl text-foreground mb-2`,children:`config`}),(0,c.jsx)(a,{active:`providers`}),!n&&(0,c.jsx)(u,{providers:e,openaiCodex:t}),(0,c.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-6`,children:[`Each card configures one LLM provider end to end: credentials (encrypted in the`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`secrets`}),` table), URLs and IDs (plaintext in the`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`config`}),` table), and the curated model list that powers profile / agent dropdowns.`]}),e.map(e=>(0,c.jsx)(d,{p:e,openaiCodexStatus:e.id===`openai-codex`?t:void 0},e.id))]})}function u({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,c.jsxs)(`div`,{className:`rounded-md border-2 border-amber-400 bg-amber-50 px-4 py-3 mb-4 text-sm`,children:[(0,c.jsx)(`div`,{className:`font-semibold text-amber-900 mb-1`,children:`First-run setup is not complete`}),(0,c.jsxs)(`p`,{className:`text-amber-900 mb-2`,children:[`The rest of the app stays on the Welcome screen until at least one provider is`,` `,(0,c.jsx)(`strong`,{children:`enabled`}),` and has `,(0,c.jsx)(`strong`,{children:`at least one curated model`}),`. Use a catalog chip when one is available, or paste the exact model id from your local/server provider.`]}),n.length>0?(0,c.jsx)(`ul`,{className:`list-disc pl-5 text-amber-900 space-y-0.5`,children:n.map(e=>(0,c.jsx)(`li`,{children:e},e))}):r===0?(0,c.jsx)(`p`,{className:`text-amber-900`,children:`No providers are enabled yet — pick one below, flip the toggle on, set credentials, and save at least one model name.`}):null]})}function d({p:e,openaiCodexStatus:t}){let n=r(),[i,a]=(0,s.useState)(e.enabled),[l,u]=(0,s.useState)(e.curated.join(`
|
|
2
2
|
`)),[d,h]=(0,s.useState)(!1),[g,_]=(0,s.useState)(null);async function v(t){a(t);try{await fetch(`/api/config/providers/${encodeURIComponent(e.id)}/enabled`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:t})}),await n.invalidate()}catch{a(!t)}}async function y(t){t.preventDefault(),h(!0),_(null);try{let t=l.split(/\r?\n/).map(e=>e.trim()).filter(Boolean),r=await fetch(`/api/config/providers/${encodeURIComponent(e.id)}/models`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({models:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`${r.status} ${r.statusText}`)}_(`saved ✓`),await n.invalidate()}catch(e){_(`error: ${e.message}`)}finally{h(!1)}}return(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card mb-3 overflow-hidden`,children:[(0,c.jsxs)(`header`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,c.jsx)(`span`,{className:`font-mono font-semibold`,children:e.id}),(0,c.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[`· `,e.displayName]}),(0,c.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs uppercase tracking-wide font-semibold cursor-pointer`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>v(e.target.checked),className:`size-4`}),(0,c.jsx)(`span`,{className:i?`text-emerald-700`:`text-muted-foreground`,children:i?`enabled`:`disabled`})]}),(0,c.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[e.curated.length>0&&(0,c.jsxs)(`span`,{children:[e.curated.length,` curated`]}),e.catalog.length>0&&(0,c.jsxs)(`span`,{children:[` · `,e.catalog.length,` catalog`]}),e.live&&!e.live.error&&(0,c.jsxs)(`span`,{children:[` · `,e.live.models.length,` live`]})]})]}),i&&(0,c.jsxs)(`div`,{className:`border-t border-dashed px-4 py-3`,children:[e.hint&&(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.id===`openai-codex`&&t&&(0,c.jsx)(m,{status:t}),e.fields.length===0&&e.envHint&&e.id!==`openai-codex`&&(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Credentials come from the process env: `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.envHint})]}),e.fields.map(e=>(0,c.jsx)(o,{field:e},e.envVar)),(0,c.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`curated models (one per line)`}),e.curated.length===0&&(0,c.jsxs)(`p`,{className:`mb-2 text-xs font-medium text-amber-700`,children:[`First-run setup needs at least one model name here — type one (e.g.`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:f(e.id)}),`) and click`,` `,(0,c.jsx)(`em`,{children:`save models`}),`. Catalog chips below are the safest source when available.`]}),(0,c.jsxs)(`form`,{onSubmit:y,children:[(0,c.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:Math.max(3,Math.min(8,l.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,c.jsxs)(`div`,{className:`flex items-center gap-3 mt-2`,children:[(0,c.jsx)(`button`,{type:`submit`,disabled:d,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:`save models`}),g&&(0,c.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g})]})]}),e.catalog.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`catalog`}),(0,c.jsx)(p,{items:e.catalog,onPick:e=>u(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live&&!e.live.error&&e.live.models.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`live`}),(0,c.jsx)(p,{items:e.live.models,onPick:e=>u(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live?.error&&(0,c.jsxs)(`p`,{className:`text-xs text-rose-700 mt-2`,children:[`could not fetch: `,e.live.error]})]})]})}function f(e){switch(e){case`openai-codex`:return`gpt-5.3-codex-spark`;case`openai`:return`gpt-5.5`;case`anthropic`:return`claude-opus-4-8`;case`google`:return`gemini-3-pro-preview`;case`google-vertex`:return`gemini-3.1-pro-preview`;case`xai`:return`grok-4.3`;case`groq`:return`llama-3.3-70b-versatile`;case`cerebras`:return`zai-glm-4.7`;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-4.8`;case`vercel-ai-gateway`:return`anthropic/claude-opus-4.8`;case`deepseek`:return`deepseek-v4-pro`;case`fireworks`:return`accounts/fireworks/models/kimi-k2p7-code`;case`together`:return`Qwen/Qwen3.7-Max`;case`moonshotai`:return`kimi-k2.7-code`;case`moonshotai-cn`:return`kimi-k2.7-code`;case`kimi-coding`:return`kimi-for-coding`;case`minimax`:return`MiniMax-M2.7`;case`minimax-cn`:return`MiniMax-M3`;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-4-7`;case`github-copilot`:return`claude-opus-4.7`;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-4-8`;case`opencode-go`:return`kimi-k2.7-code`;case`zai-coding-cn`:return`glm-5.2`;case`azure-openai`:return`gpt-5.5`;case`bedrock`:return`anthropic.claude-opus-4-8`;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 p({items:e,onPick:t}){return(0,c.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,c.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`rounded border bg-card px-2 py-0.5 font-mono text-xs hover:border-primary hover:bg-accent`,children:e},e))})}function m({status:e}){let t=r(),[n,i]=(0,s.useState)(!1),[a,o]=(0,s.useState)(null);async function l(){i(!0),o(null);try{let e=await fetch(`/api/auth/openai/login`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}async function u(){i(!0),o(null);try{await fetch(`/api/auth/openai`,{method:`DELETE`}),await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}return(0,c.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 mb-3`,children:[e.connected?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2 items-center mb-2`,children:[(0,c.jsx)(`span`,{className:`rounded-full bg-emerald-100 text-emerald-800 px-2 py-0.5 text-xs font-semibold uppercase`,children:`connected`}),e.accountId&&(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`account `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.accountId})]}),e.expiresAt&&(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`token expires`,` `,new Date(e.expiresAt).toISOString().replace(/\.\d+Z$/,`Z`)]})]}),(0,c.jsx)(`button`,{type:`button`,onClick:u,disabled:n,className:`rounded-md border px-3 py-1.5 text-sm text-rose-700 hover:bg-rose-50 disabled:opacity-50`,children:`disconnect`})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.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,c.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, run `,(0,c.jsx)(`code`,{className:`font-mono`,children:`bazilion auth openai login`}),` on the client.`]}),(0,c.jsx)(`button`,{type:`button`,onClick:l,disabled:n,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:n?`opening browser…`:`Connect ChatGPT →`})]}),a&&(0,c.jsx)(`p`,{className:`text-sm text-rose-700 mt-2`,children:a})]})}export{l as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{m as i}from"./index-
|
|
1
|
+
import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{Q as n,u as r}from"./preload-helper-CvnapA2_.js";import{m as i}from"./index-MAJuXnie.js";var a=e(n()),o=t();function s(){let{groups:e,memberCounts:t}=i.useLoaderData(),n=r();async function a(e){if(!confirm(`remove this group registration?`))return;let t=await fetch(`/api/groups/${e}`,{method:`DELETE`});if(!t.ok&&t.status!==204){alert(t.statusText);return}await n.invalidate()}return(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{children:`groups`}),(0,o.jsx)(`p`,{className:`muted`,children:`A group is a collaboration context: one filesystem root, one USER.md, one roster. Every agent belongs to exactly one group.`}),(0,o.jsx)(c,{onRegistered:()=>n.invalidate()}),(0,o.jsxs)(`table`,{children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:`id`}),(0,o.jsx)(`th`,{children:`name`}),(0,o.jsx)(`th`,{children:`path`}),(0,o.jsx)(`th`,{children:`members`}),(0,o.jsx)(`th`,{children:`USER.md`}),(0,o.jsx)(`th`,{})]})}),(0,o.jsxs)(`tbody`,{children:[e.length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:6,className:`muted`,children:`no groups registered`})}),e.map(e=>{let n=t[e.id]??0,r=e.userMd.length;return(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:e.id})}),(0,o.jsx)(`td`,{children:e.name}),(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:e.path})}),(0,o.jsx)(`td`,{children:n}),(0,o.jsx)(`td`,{children:(0,o.jsx)(`a`,{href:`/groups/${e.id}`,children:r>0?`${r} chars`:`empty`})}),(0,o.jsx)(`td`,{children:n===0?(0,o.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>a(e.id),children:`remove`}):(0,o.jsx)(`span`,{className:`muted`,title:`${n} agent(s) belong to this group`,children:`in use`})})]},e.id)})]})]})]})}function c({onRegistered:e}){let[t,n]=(0,a.useState)(``),[r,i]=(0,a.useState)(``),[s,c]=(0,a.useState)(``),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(!1);async function p(a){if(a.preventDefault(),u(null),!t.trim()){u(`id is required`);return}f(!0);try{let a=await fetch(`/api/groups`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:t.trim(),name:r.trim()||void 0,link:s.trim()||void 0})});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.error??a.statusText)}n(``),i(``),c(``),e()}catch(e){u(e.message)}finally{f(!1)}}return(0,o.jsxs)(`form`,{className:`card`,onSubmit:p,children:[(0,o.jsx)(`h3`,{children:`register group`}),l&&(0,o.jsx)(`div`,{className:`err`,children:l}),(0,o.jsxs)(`p`,{className:`muted`,children:[`Groups always live under `,(0,o.jsx)(`code`,{children:`~/.bazilion/groups/<slug>/`}),`. Leave the link target blank to create a fresh directory; supply an absolute path to materialize the slot as a symlink to your existing project tree instead.`]}),(0,o.jsxs)(`div`,{className:`flex gap-4`,children:[(0,o.jsxs)(`label`,{className:`flex-1`,children:[`id (slug)`,(0,o.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),required:!0,placeholder:`myproject`})]}),(0,o.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,o.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`My Project`})]})]}),(0,o.jsxs)(`label`,{children:[`link target (optional, absolute path)`,(0,o.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`/home/user/projects/myproject`})]}),(0,o.jsx)(`button`,{type:`submit`,disabled:d,children:d?`registering…`:`register`})]})}export{s as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{t}from"./index-
|
|
1
|
+
import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{t}from"./index-MAJuXnie.js";import{t as n}from"./AgentTabs-DioGqUVR.js";var r=e();function i(e){try{let t=JSON.parse(e);if(typeof t.text==`string`)return t.text}catch{}return e}function a(){let{resolved:e,messages:a,unreadCount:o,selected:s,agentNames:c}=t.useLoaderData(),l=t.useSearch().unread===`1`,u=!!(s&&s.toAgentId!==e.agent.id);function d(e){let t=c[e];return t?`${t} (${e.slice(0,8)})`:e.slice(0,8)}return(0,r.jsxs)(`main`,{className:`mx-auto max-w-5xl px-6 py-8`,children:[(0,r.jsx)(`h1`,{className:`font-serif text-3xl text-foreground mb-1`,children:e.agent.name}),(0,r.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-6`,children:[(0,r.jsxs)(`code`,{className:`font-mono`,children:[e.agent.id.slice(0,8),`…`]}),` · unread: `,o]}),(0,r.jsx)(n,{agentId:e.agent.id,active:`inbox`,archived:e.agent.status===`archived`}),(0,r.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[360px_1fr] gap-6`,children:[(0,r.jsxs)(`div`,{children:[(0,r.jsxs)(`div`,{className:`flex gap-1 border-b mb-3`,children:[(0,r.jsx)(`a`,{href:`/agents/${e.agent.id}/inbox`,className:`px-3 py-1.5 text-sm border-b-2 -mb-px ${l?`border-transparent text-muted-foreground`:`border-primary text-primary font-semibold`}`,children:`all`}),(0,r.jsx)(`a`,{href:`/agents/${e.agent.id}/inbox?unread=1`,className:`px-3 py-1.5 text-sm border-b-2 -mb-px ${l?`border-primary text-primary font-semibold`:`border-transparent text-muted-foreground`}`,children:`unread`})]}),(0,r.jsx)(`div`,{className:`rounded-lg border bg-card max-h-[640px] overflow-y-auto`,children:a.length===0?(0,r.jsx)(`div`,{className:`p-6 text-center text-muted-foreground italic`,children:l?`no unread messages`:`inbox empty`}):a.map(t=>{let n=i(t.payload),a=n.length>80?`${n.slice(0,80)}…`:n,o=new Date(t.createdAt).toLocaleString(),c=s?.id===t.id,u=t.readAt===null,f=l?`?unread=1&id=${t.id}`:`?id=${t.id}`;return(0,r.jsxs)(`a`,{href:`/agents/${e.agent.id}/inbox${f}`,className:`block border-b last:border-0 px-3 py-2 text-sm hover:bg-accent/30 ${c?`bg-accent/40`:``} ${u?`font-medium`:``}`,children:[(0,r.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,r.jsxs)(`span`,{className:`font-mono`,children:[u&&(0,r.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-primary mr-1.5 align-middle`}),`from `,d(t.fromAgentId)]}),(0,r.jsx)(`span`,{className:`font-mono`,children:o})]}),(0,r.jsx)(`div`,{className:`text-foreground mt-0.5 truncate`,children:a})]},t.id)})})]}),(0,r.jsxs)(`div`,{children:[s&&!u&&(0,r.jsxs)(`div`,{className:`rounded-lg border bg-card p-5 mb-4`,children:[(0,r.jsxs)(`div`,{className:`font-mono text-xs text-muted-foreground mb-2 space-y-0.5`,children:[(0,r.jsxs)(`div`,{children:[`id: `,(0,r.jsx)(`code`,{children:s.id})]}),(0,r.jsxs)(`div`,{children:[`from: `,(0,r.jsx)(`code`,{children:d(s.fromAgentId)})]}),(0,r.jsxs)(`div`,{children:[`received: `,new Date(s.createdAt).toLocaleString()]}),(0,r.jsxs)(`div`,{children:[`read:`,` `,s.readAt?new Date(s.readAt).toLocaleString():`(unread)`]}),s.replyTo&&(0,r.jsxs)(`div`,{children:[`reply to: `,(0,r.jsx)(`code`,{children:s.replyTo})]})]}),(0,r.jsx)(`div`,{className:`border-t pt-3 font-mono text-sm whitespace-pre-wrap break-words`,children:i(s.payload)})]}),u&&(0,r.jsx)(`div`,{className:`rounded-lg border bg-card p-5 mb-4 text-muted-foreground`,children:`message is not addressed to this agent`}),(0,r.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Agents exchange messages automatically via their`,` `,(0,r.jsx)(`code`,{className:`font-mono`,children:`send_message`}),` tool. An idle recipient's scheduler tick drains unread mail.`]})]})]})]})}export{a as component};
|