hive-am 1.4.0 → 1.6.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/CHANGELOG.md +52 -1
- package/README.md +6 -9
- package/bin/hive-am.mjs +242 -31
- package/bin/run.mjs +135 -0
- package/package.json +1 -1
- package/server/dist/connections/format.js +26 -0
- package/server/dist/connections/index.js +2 -0
- package/server/dist/connections/manager.js +18 -6
- package/server/dist/connections/router.js +43 -13
- package/server/dist/connections/secrets.js +9 -1
- package/server/dist/connections/slack.js +488 -0
- package/server/dist/connections/store.js +2 -0
- package/server/dist/db/migrations.js +80 -0
- package/server/dist/db.js +26 -13
- package/server/dist/dispatches.js +126 -0
- package/server/dist/efforts.js +105 -0
- package/server/dist/http/routes/agents.js +4 -3
- package/server/dist/http/routes/meta.js +12 -0
- package/server/dist/http/routes/notebook.js +10 -2
- package/server/dist/http/routes/orchestration.js +13 -2
- package/server/dist/http/routes/resources.js +3 -0
- package/server/dist/http/routes/types.js +18 -1
- package/server/dist/http/validate.js +27 -4
- package/server/dist/index.js +6 -1
- package/server/dist/instructions.js +11 -3
- package/server/dist/objects/agent-db.js +258 -0
- package/server/dist/objects/database.js +496 -34
- package/server/dist/objects/index.js +16 -8
- package/server/dist/providers/kiro.js +7 -1
- package/server/dist/providers/opencode-server.js +11 -1
- package/server/dist/providers/opencode.js +4 -3
- package/server/dist/providers/spawn.js +38 -4
- package/server/dist/retention.js +52 -0
- package/server/dist/runtime.js +69 -27
- package/server/dist/services/agents.js +53 -1
- package/server/dist/services/connections.js +18 -3
- package/server/dist/services/notebook.js +7 -3
- package/server/dist/skills/defaults.js +41 -5
- package/server/dist/skills/notebook.js +57 -13
- package/server/dist/watch.js +1 -1
- package/server/mcp/dispatch.mjs +116 -5
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/app-build-manifest.json +98 -82
- package/web/.next/app-path-routes-manifest.json +7 -7
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +51 -51
- package/web/.next/server/app/_not-found/page.js +2 -2
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/server/app/_not-found.rsc +3 -3
- package/web/.next/server/app/agents/[id]/page.js +4 -4
- package/web/.next/server/app/agents/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents/page.js +2 -2
- package/web/.next/server/app/agents/page.js.nft.json +1 -1
- package/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents.html +1 -1
- package/web/.next/server/app/agents.rsc +21 -18
- package/web/.next/server/app/chat/page.js +2 -2
- package/web/.next/server/app/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/chat.html +1 -1
- package/web/.next/server/app/chat.rsc +4 -4
- package/web/.next/server/app/connections/page.js +2 -2
- package/web/.next/server/app/connections/page.js.nft.json +1 -1
- package/web/.next/server/app/connections/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/connections.html +1 -1
- package/web/.next/server/app/connections.rsc +4 -4
- package/web/.next/server/app/index.html +1 -1
- package/web/.next/server/app/index.rsc +4 -4
- package/web/.next/server/app/page.js +2 -2
- package/web/.next/server/app/page.js.nft.json +1 -1
- package/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/relations/page.js +2 -2
- package/web/.next/server/app/relations/page.js.nft.json +1 -1
- package/web/.next/server/app/relations/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/relations.html +1 -1
- package/web/.next/server/app/relations.rsc +4 -4
- package/web/.next/server/app/resources/[id]/page.js +2 -2
- package/web/.next/server/app/resources/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/resources/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/resources/page.js +2 -2
- package/web/.next/server/app/resources/page.js.nft.json +1 -1
- package/web/.next/server/app/resources/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/resources.html +1 -1
- package/web/.next/server/app/resources.rsc +4 -4
- package/web/.next/server/app/schedules/page.js +2 -2
- package/web/.next/server/app/schedules/page.js.nft.json +1 -1
- package/web/.next/server/app/schedules/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/schedules.html +1 -1
- package/web/.next/server/app/schedules.rsc +4 -4
- package/web/.next/server/app/sessions/page.js +2 -2
- package/web/.next/server/app/sessions/page.js.nft.json +1 -1
- package/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/sessions.html +1 -1
- package/web/.next/server/app/sessions.rsc +4 -4
- package/web/.next/server/app/skills/page.js +2 -2
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills.html +1 -1
- package/web/.next/server/app/skills.rsc +4 -4
- package/web/.next/server/app/types/page.js +2 -2
- package/web/.next/server/app/types/page.js.nft.json +1 -1
- package/web/.next/server/app/types/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/types.html +1 -1
- package/web/.next/server/app/types.rsc +4 -4
- package/web/.next/server/app-paths-manifest.json +7 -7
- package/web/.next/server/chunks/{505.js → 111.js} +1 -1
- package/web/.next/server/chunks/143.js +1 -1
- package/web/.next/server/chunks/213.js +1 -1
- package/web/.next/server/chunks/368.js +1 -1
- package/web/.next/server/chunks/403.js +1 -1
- package/web/.next/server/chunks/612.js +1 -1
- package/web/.next/server/chunks/741.js +2 -0
- package/web/.next/server/chunks/837.js +1 -0
- package/web/.next/server/chunks/{435.js → 939.js} +3 -3
- package/web/.next/server/pages/404.html +1 -1
- package/web/.next/server/pages/500.html +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/static/chunks/162-68ba190086f5ad39.js +1 -0
- package/web/.next/static/chunks/214-35b88db02113ae02.js +1 -0
- package/web/.next/static/chunks/281-4506bc98b7111729.js +1 -0
- package/web/.next/static/chunks/491-196bcb3dd11bb460.js +1 -0
- package/web/.next/static/chunks/517-8f2db464d10a4624.js +1 -0
- package/web/.next/static/chunks/{586-f7017d585a84738d.js → 586-4f67b823df060b46.js} +1 -1
- package/web/.next/static/chunks/587-3c53d91a1c4f99d6.js +1 -0
- package/web/.next/static/chunks/606-14fb5aaa4d0ff22d.js +1 -0
- package/web/.next/static/chunks/642-dc874c8caf203ee1.js +1 -0
- package/web/.next/static/chunks/{705-f81face97b1bb1af.js → 705-ce86175dea00e6a9.js} +1 -1
- package/web/.next/static/chunks/757-03361e7a97a605a2.js +1 -0
- package/web/.next/static/chunks/771-db19da9b1a24820c.js +1 -0
- package/web/.next/static/chunks/app/agents/[id]/page-803d53aedd10c8e5.js +1 -0
- package/web/.next/static/chunks/app/agents/layout-71dd98d696935e29.js +1 -0
- package/web/.next/static/chunks/app/agents/page-9da499db6d22731f.js +1 -0
- package/web/.next/static/chunks/app/chat/{page-5261b12b7d50f5d1.js → page-383bc24e72dab7fa.js} +1 -1
- package/web/.next/static/chunks/app/connections/page-b0ea2eae62cef74e.js +1 -0
- package/web/.next/static/chunks/app/layout-cb5af29b0742c513.js +1 -0
- package/web/.next/static/chunks/app/page-5e547e87de23d9fa.js +1 -0
- package/web/.next/static/chunks/app/relations/page-02710fe1f8a670a9.js +1 -0
- package/web/.next/static/chunks/app/resources/[id]/page-1e2afddcb1f04884.js +1 -0
- package/web/.next/static/chunks/app/resources/{page-61cccd8fdcc2f6c8.js → page-195b0af83b8ace0d.js} +1 -1
- package/web/.next/static/chunks/app/sessions/page-85638705fdc18174.js +1 -0
- package/web/.next/static/chunks/app/types/page-c4c2b2217c4667e8.js +1 -0
- package/web/.next/static/css/c7faf690373117bb.css +1 -0
- package/web/.next/trace +30 -30
- package/web/.next/types/routes.d.ts +2 -1
- package/web/.next/types/validator.ts +9 -0
- package/web/.next/server/chunks/274.js +0 -1
- package/web/.next/static/chunks/281-113274e705940a55.js +0 -1
- package/web/.next/static/chunks/316-26da9cc233ba7557.js +0 -1
- package/web/.next/static/chunks/391-18768499e741112e.js +0 -1
- package/web/.next/static/chunks/517-373a80c8ba432bdc.js +0 -1
- package/web/.next/static/chunks/562-7c2e33d838e869bf.js +0 -1
- package/web/.next/static/chunks/587-8e4d2be01ba7d48f.js +0 -1
- package/web/.next/static/chunks/606-c9a19918b02a98d0.js +0 -1
- package/web/.next/static/chunks/656-f537149fe28f79aa.js +0 -1
- package/web/.next/static/chunks/app/agents/[id]/page-6ed6edb3e74b0ebe.js +0 -1
- package/web/.next/static/chunks/app/agents/page-9bb8cba69776c719.js +0 -1
- package/web/.next/static/chunks/app/connections/page-eb11cfb1ffeab3ca.js +0 -1
- package/web/.next/static/chunks/app/layout-fad968a635f9a4b3.js +0 -1
- package/web/.next/static/chunks/app/page-99e0351e6ccaa384.js +0 -1
- package/web/.next/static/chunks/app/relations/page-a44fd515a3b0525e.js +0 -1
- package/web/.next/static/chunks/app/resources/[id]/page-fc494e85b01e8cb7.js +0 -1
- package/web/.next/static/chunks/app/sessions/page-a7534ebd90e982d6.js +0 -1
- package/web/.next/static/chunks/app/types/page-ebd37e220f77c1f3.js +0 -1
- package/web/.next/static/css/582723fcea1f9887.css +0 -1
- /package/web/.next/static/{YT6HM6qmegMJaBMX5QvuP → tdnUXVa01m25EjOobxVd1}/_buildManifest.js +0 -0
- /package/web/.next/static/{YT6HM6qmegMJaBMX5QvuP → tdnUXVa01m25EjOobxVd1}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{6261:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]])},15151:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_4dc837",variable:"__variable_4dc837"}},15223:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]])},19431:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},21169:()=>{},26701:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},29416:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("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"}]])},33974:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]])},39856:e=>{e.exports={style:{fontFamily:"'Bricolage Grotesque', 'Bricolage Grotesque Fallback'",fontStyle:"normal"},className:"__className_23d1a5",variable:"__variable_23d1a5"}},42162:(e,t,n)=>{"use strict";n.d(t,{$:()=>u,n:()=>o});var a=n(94799),l=n(34023),s=n(3749),r=n(69654);let i=(0,l.createContext)(null),o=()=>{let e=(0,l.useContext)(i);if(!e)throw Error("DockProvider missing");return e},c="hive-am.dock",d=e=>Math.max(140,Math.min(e,Math.round(.8*window.innerHeight)));function u(e){let{children:t}=e,{t:n}=(0,r.s9)(),[o,u]=(0,l.useState)(!1),[h,m]=(0,l.useState)(320),[v,k]=(0,l.useState)([]),[y,p]=(0,l.useState)(null),[b,x]=(0,l.useState)(!0),[g,f]=(0,l.useState)(""),j=(0,l.useRef)(!1);(0,l.useEffect)(()=>{try{var e;let t=JSON.parse(null!=(e=localStorage.getItem(c))?e:"{}");"number"==typeof t.height&&m(d(t.height)),t.open&&u(!0),"string"==typeof t.active&&p(t.active)}catch(e){}s.FH.get("/terminals").then(e=>{x(e.enabled),k(t=>[...e.terminals.map(e=>({key:"t:".concat(e.id),kind:"term",id:e.id,title:e.title,cwd:e.cwd,ended:e.alive?void 0:e.exitCode})),...t.filter(e=>"logs"===e.kind)]),p(t=>t&&e.terminals.some(e=>"t:".concat(e.id)===t)?t:e.terminals[0]?"t:".concat(e.terminals[0].id):t)}).catch(()=>void 0).finally(()=>{j.current=!0})},[]),(0,l.useEffect)(()=>{if(j.current)try{localStorage.setItem(c,JSON.stringify({open:o,height:h,active:y}))}catch(e){}},[o,h,y]),(0,l.useEffect)(()=>{document.documentElement.style.setProperty("--app-h",o?"calc(100vh - ".concat(h,"px)"):"100vh")},[o,h]);let w=(0,l.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f("");try{let t=await s.FH.post("/terminals",e),n={key:"t:".concat(t.id),kind:"term",id:t.id,title:t.title,cwd:t.cwd};k(e=>[...e,n]),p(n.key),u(!0)}catch(e){f(e instanceof Error?e.message:n("dock.failed")),u(!0)}},[n]),A=(0,l.useCallback)((e,t)=>{let n="l:".concat(e);k(a=>a.some(e=>e.key===n)?a:[...a,{key:n,kind:"logs",objectId:e,title:t}]),p(n),u(!0)},[]),N=(0,l.useCallback)(e=>{k(t=>{let n=t.find(t=>t.key===e);(null==n?void 0:n.kind)==="term"&&s.FH.del("/terminals/".concat(n.id)).catch(()=>void 0);let a=t.filter(t=>t.key!==e);return p(t=>{var n,l;return t===e?null!=(l=null==(n=a[a.length-1])?void 0:n.key)?l:null:t}),a})},[]),M=(0,l.useCallback)((e,t)=>k(n=>n.map(n=>n.key===e&&"term"===n.kind?{...n,ended:null!=t?t:0}:n)),[]),E=(0,l.useCallback)(()=>{if(o)return void u(!1);u(!0),!v.length&&b&&w()},[o,v.length,b,w]);(0,l.useEffect)(()=>{let e=e=>{!e.ctrlKey||e.altKey||e.metaKey||"`"!==e.key&&"Backquote"!==e.code||(e.preventDefault(),e.stopPropagation(),E())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[E]);let z=(0,l.useMemo)(()=>({open:o,height:h,tabs:v,active:y,enabled:b,error:g,toggle:E,setOpen:u,setHeight:e=>m(d(e)),setActive:p,openTerminal:w,openLogs:A,closeTab:N,markEnded:M}),[o,h,v,y,b,g,E,w,A,N,M]);return(0,a.jsx)(i.Provider,{value:z,children:t})}},54234:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]])},54609:(e,t,n)=>{"use strict";n.d(t,{O:()=>a});let a="hive-am.lastChat"},64883:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]])},68449:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},68992:(e,t,n)=>{"use strict";n.d(t,{Shell:()=>J});var a=n(94799),l=n(41463),s=n.n(l),r=n(43624),i=n(34023),o=n(84616),c=n(33974),d=n(78330),u=n(87454),h=n(6261),m=n(29416),v=n(26701),k=n(74955);let y=(0,k.A)("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"}]]);var p=n(15223),b=n(54234),x=n(73784);let g=(0,k.A)("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);var f=n(68449),j=n(70283);let w=(0,k.A)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),A=(0,k.A)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);var N=n(77021),M=n(54609),E=n(48538),z=n(69654),C=n(10804);function S(){let[e,t]=(0,i.useState)(null),[n,l]=(0,i.useState)(null),s=(0,i.useRef)(null);return((0,i.useEffect)(()=>{let e,n=null,a=()=>{clearTimeout(e),n=null,t(null),l(null)},s=e=>e instanceof Element?e.closest("[title],[data-tip]"):null,r=function(l){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!l||l===n)return;a();let r=(e=>{var t,n;let a=e.getAttribute("title");return null!==a&&(e.removeAttribute("title"),a.trim()&&(e.dataset.tip=a,e.getAttribute("aria-label")||(null==(t=e.textContent)?void 0:t.trim())||e.setAttribute("aria-label",a))),null!=(n=e.dataset.tip)?n:""})(l);if(!r)return;n=l;let i=()=>{n===l&&l.isConnected&&t({text:r,rect:l.getBoundingClientRect()})};s?i():e=setTimeout(i,350)},i=e=>r(s(e.target)),o=e=>{n&&!(e.relatedTarget instanceof Node&&n.contains(e.relatedTarget))&&a()},c=e=>{let t=s(e.target);t&&t.matches(":focus-visible")&&r(t,!0)},d=e=>{"Escape"===e.key&&a()};return document.addEventListener("mouseover",i),document.addEventListener("mouseout",o),document.addEventListener("focusin",c),document.addEventListener("focusout",a),document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",d),window.addEventListener("scroll",a,!0),window.addEventListener("blur",a),()=>{a(),document.removeEventListener("mouseover",i),document.removeEventListener("mouseout",o),document.removeEventListener("focusin",c),document.removeEventListener("focusout",a),document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",d),window.removeEventListener("scroll",a,!0),window.removeEventListener("blur",a)}},[]),(0,i.useLayoutEffect)(()=>{if(!e||!s.current)return;let{width:t,height:n}=s.current.getBoundingClientRect(),a=e.rect.top-n-8<8;l({left:Math.min(Math.max(8,e.rect.left+e.rect.width/2-t/2),window.innerWidth-t-8),top:a?e.rect.bottom+8:e.rect.top-n-8,below:a})},[e]),e)?(0,a.jsx)("div",{ref:s,className:"tooltip",role:"tooltip","data-live":!0,"data-below":(null==n?void 0:n.below)?"1":void 0,style:n?{left:n.left,top:n.top}:{left:0,top:0,visibility:"hidden"},children:e.text}):null}var L=n(42162),H=n(19431),_=n(70665),T=n(92947),P=n(80306),F=n(12349),q=n(75010);n(21169);var O=n(69538);let R=(e,t)=>getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t,V=()=>({background:R("--bg-deep","#0c1411"),foreground:R("--ink","#e7eee9"),cursor:R("--honey","#e8a317"),cursorAccent:R("--bg-deep","#0c1411"),selectionBackground:"rgba(232,163,23,.35)"});function I(e){let{id:t,visible:l,onEnded:s}=e,{t:r}=(0,z.s9)(),o=(0,i.useRef)(null),c=(0,i.useRef)(null),d=(0,i.useRef)(l);return d.current=l,(0,i.useEffect)(()=>{let e=!1,a=null,l,i=!1,u=0,h=null,m=null,v=null,k=null,y=e=>{(null==a?void 0:a.readyState)===WebSocket.OPEN&&a.send(JSON.stringify(e))},p=()=>{var e;if(h&&m&&(null==(e=o.current)?void 0:e.offsetParent))try{m.fit(),y({t:"resize",cols:h.cols,rows:h.rows})}catch(e){}};return(async()=>{let[{Terminal:b},{FitAddon:x},{WebLinksAddon:g}]=await Promise.all([n.e(209).then(n.bind(n,75657)),n.e(97).then(n.bind(n,57097)),n.e(545).then(n.bind(n,90545))]);if(e||!o.current)return;h=new b({fontFamily:R("--font-mono","ui-monospace, monospace"),fontSize:13,lineHeight:1.15,cursorBlink:!0,scrollback:5e3,theme:V(),allowProposedApi:!1}),m=new x,h.loadAddon(m),h.loadAddon(new g),h.open(o.current),c.current={fit:p,focus:()=>null==h?void 0:h.focus()},d.current&&(p(),h.focus()),h.onData(e=>y({t:"in",d:e}));let f=()=>{var e;let t=null==h?void 0:h.getSelection();return t&&(null==(e=navigator.clipboard)||e.writeText(t).catch(()=>{})),!!t};h.onSelectionChange(()=>{f()}),h.attachCustomKeyEventHandler(e=>"keydown"!==e.type||!e.ctrlKey||!!e.altKey||!!e.metaKey||!("c"===e.key.toLowerCase()&&(e.shiftKey||(null==h?void 0:h.hasSelection())))||(f(),!1)),(v=new ResizeObserver(p)).observe(o.current),(k=new MutationObserver(()=>{h&&(h.options.theme=V())})).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let j=()=>{var n;(a=new WebSocket("".concat("ws://".concat(location.hostname,":").concat(null!=(n=O.env.NEXT_PUBLIC_HIVE_WS_PORT)?n:4400,"/ws/terminal"),"?id=").concat(encodeURIComponent(t)))).onopen=()=>{u=0},a.onmessage=e=>{let t=JSON.parse(e.data);"init"===t.t?(h.reset(),p()):"out"===t.t?h.write(t.d):"exit"===t.t?(i=!0,h.write("\r\n\x1b[2m[".concat(r("dock.ended",{code:t.code}),"]\x1b[0m\r\n")),s(t.code)):"gone"===t.t&&(i=!0,h.write("\r\n\x1b[2m[".concat(r("dock.gone"),"]\x1b[0m\r\n")),s(null))},a.onclose=()=>{e||i||(l=setTimeout(j,Math.min(5e3,600*2**u++)))}};j()})(),()=>{e=!0,clearTimeout(l),null==v||v.disconnect(),null==k||k.disconnect(),null==a||a.close(),null==h||h.dispose(),c.current=null}},[t]),(0,i.useEffect)(()=>{if(l){let e=setTimeout(()=>{var e,t;null==(e=c.current)||e.fit(),null==(t=c.current)||t.focus()},30);return()=>clearTimeout(e)}},[l]),(0,a.jsx)("div",{className:"xterm-box",ref:o})}let B=e=>"dock-tab-".concat(e);function D(){var e;let{t}=(0,z.s9)(),n=(0,L.n)(),[l,s]=(0,i.useState)(null),r=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=e=>{r.current&&n.setHeight(r.current.h+(r.current.y-e.clientY))},t=()=>{r.current=null,document.body.style.userSelect=""};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t)}},[n]);let o=n.tabs.some(e=>e.key===n.active),c=null==(e=[...n.tabs].reverse().find(e=>"term"===e.kind))?void 0:e.cwd;return(0,a.jsxs)("section",{className:"dock",style:{height:n.height,display:n.open?void 0:"none"},"aria-hidden":!n.open,"aria-label":t("dock.title"),children:[(0,a.jsx)("div",{className:"dock-grip",onPointerDown:e=>{r.current={y:e.clientY,h:n.height},document.body.style.userSelect="none",e.preventDefault()},role:"separator","aria-orientation":"horizontal"}),(0,a.jsxs)("div",{className:"dock-bar",children:[(0,a.jsx)("div",{className:"dock-tabs",role:"tablist","aria-label":t("dock.title"),onKeyDown:e=>{var t;let a=n.tabs.map(e=>e.key),l=a.indexOf(null!=(t=n.active)?t:""),s=null;if("ArrowRight"===e.key)s=(l+1)%a.length;else if("ArrowLeft"===e.key)s=(l-1+a.length)%a.length;else if("Home"===e.key)s=0;else if("End"===e.key)s=a.length-1;else if("Delete"===e.key&&l>=0){e.preventDefault(),n.closeTab(a[l]);return}null!==s&&a.length&&(e.preventDefault(),n.setActive(a[s]),requestAnimationFrame(()=>{var e;return null==(e=document.getElementById(B(a[s])))?void 0:e.focus()}))},children:n.tabs.map(e=>{var l;let s=n.active===e.key,r=B(e.key);return(0,a.jsxs)("div",{className:"dock-tabwrap ".concat(s?"on":""),children:[(0,a.jsxs)("button",{id:r,type:"button",role:"tab","aria-selected":s,"aria-controls":"".concat(r,"-panel"),tabIndex:s||!o&&e===n.tabs[0]?0:-1,className:"dock-tab-btn",onClick:()=>n.setActive(e.key),title:"term"===e.kind?e.cwd:t("obj.logs"),children:["term"===e.kind?(0,a.jsx)(j.A,{size:14}):(0,a.jsx)(H.A,{size:14}),(0,a.jsx)("span",{className:"nm",children:e.title}),"term"===e.kind&&void 0!==e.ended&&(0,a.jsx)("i",{className:"odot off",title:t("dock.ended",{code:null!=(l=e.ended)?l:""})})]}),(0,a.jsx)("button",{type:"button",className:"dock-x",tabIndex:-1,onClick:()=>n.closeTab(e.key),"aria-label":"".concat(t("common.close"),": ").concat(e.title),children:(0,a.jsx)(_.A,{size:12})})]},e.key)})}),n.enabled&&(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>void n.openTerminal(c?{cwd:c}:{}),"aria-label":t("dock.new"),title:t("dock.new"),children:(0,a.jsx)(T.A,{size:15})}),n.enabled&&(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>s(null!=c?c:""),"aria-label":t("dock.inFolder"),title:t("dock.inFolder"),children:(0,a.jsx)(P.A,{size:15})}),(0,a.jsx)("span",{className:"grow"}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>n.setOpen(!1),"aria-label":t("dock.hide"),title:"".concat(t("dock.hide")," (Ctrl+`)"),children:(0,a.jsx)(F.A,{size:15})})]}),(0,a.jsxs)("div",{className:"dock-body",children:[n.error&&(0,a.jsx)("p",{className:"gx-note err gx-hint-row",role:"alert",children:n.error}),!n.enabled&&!n.tabs.length&&(0,a.jsx)("p",{className:"gx-note",children:t("dock.disabled")}),n.enabled&&!n.tabs.length&&!n.error&&(0,a.jsx)("p",{className:"gx-note",children:t("dock.empty")}),n.tabs.map(e=>(0,a.jsx)("div",{id:"".concat(B(e.key),"-panel"),role:"tabpanel","aria-labelledby":B(e.key),className:"dock-pane",hidden:n.active!==e.key,children:"term"===e.kind?(0,a.jsx)(I,{id:e.id,visible:n.open&&n.active===e.key,onEnded:t=>n.markEnded(e.key,t)}):n.open&&(0,a.jsx)("div",{className:"dock-logpane",children:(0,a.jsx)(q.I,{id:e.objectId,height:"100%"})})},e.key))]}),null!==l&&(0,a.jsxs)(C.aF,{title:t("dock.inFolder"),onClose:()=>s(null),children:[(0,a.jsx)(C.dR,{value:l,onChange:s,label:t("obj.f.folder"),hint:t("dock.folder.hint")}),(0,a.jsxs)("div",{className:"row confirm-actions",children:[(0,a.jsx)("button",{className:"btn ghost",onClick:()=>s(null),children:t("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",disabled:!l.startsWith("/"),onClick:()=>{s(null),n.openTerminal({cwd:l})},children:t("dock.open")})]})]})]})}function K(){return(0,a.jsx)("img",{src:"/icon.png",width:34,height:34,alt:"","aria-hidden":!0,className:"brand-mark"})}function W(){let{locale:e,setLocale:t,t:n}=(0,z.s9)();return(0,a.jsxs)("div",{className:"lang-row",role:"group","aria-label":n("lang.label"),children:[(0,a.jsx)(o.A,{size:15,"aria-hidden":!0}),(0,a.jsx)("div",{className:"seg",children:z.YZ.map(n=>(0,a.jsx)("button",{type:"button","aria-pressed":e===n.id,lang:n.id,title:n.name,"aria-label":n.name,onClick:()=>t(n.id),children:n.short},n.id))})]})}function Z(e){let{collapsed:t,onToggle:n}=e,l=(0,r.usePathname)(),{t:o}=(0,z.s9)(),{agents:k,types:C,skills:S,connections:H,objects:_,connected:T}=(0,E.o0)(),P=(0,L.n)(),[F,q]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=document.documentElement,t=()=>q("dark"===e.dataset.theme);t();let n=new MutationObserver(t);return n.observe(e,{attributes:!0,attributeFilter:["data-theme"]}),()=>n.disconnect()},[]);let O=k.filter(e=>"running"===e.status).length,[R]=(0,N.ud)(M.O,""),V=k.some(e=>e.id===R)?"/agents/".concat(R):k[0]?"/agents/".concat(k[0].id):"/chat",I=(e,n)=>t?{"aria-label":void 0!==n?"".concat(e,", ").concat(n):e,title:e}:{},B=e=>(0,a.jsx)("span",{className:"count",children:t&&e>99?"99+":e}),D=(e,t,n,r,i)=>{let o=null!=i?i:"/"===e?"/"===l:l.startsWith(e);return(0,a.jsxs)(s(),{href:e,className:"nav","aria-current":o?"page":void 0,...I(t,r),children:[n,(0,a.jsx)("span",{className:"t",children:t}),void 0!==r&&B(r)]},t)},Z=o(t?"nav.expand":"nav.collapse");return(0,a.jsxs)("nav",{className:"rail","aria-label":o("nav.main"),children:[(0,a.jsxs)("div",{className:"brand",children:[(0,a.jsx)(K,{}),(0,a.jsxs)("div",{className:"brand-name",children:["hive-am",(0,a.jsx)("small",{children:o("app.tagline")})]}),(0,a.jsx)("button",{type:"button",className:"btn ghost icon sm rail-fold",onClick:n,"aria-expanded":!t,"aria-label":Z,title:Z,children:t?(0,a.jsx)(c.A,{size:17}):(0,a.jsx)(d.A,{size:17})})]}),(0,a.jsx)(W,{}),D(V,o("nav.chat"),(0,a.jsx)(u.A,{size:18}),void 0,l.startsWith("/agents/")||"/chat"===l),D("/",o("nav.colony"),(0,a.jsx)(h.A,{size:18}),O||void 0),D("/resources",o("nav.objects"),(0,a.jsx)(m.A,{size:18}),_.length||void 0),D("/agents",o("nav.agents"),(0,a.jsx)(v.A,{size:18}),k.length,"/agents"===l),D("/relations",o("nav.relations"),(0,a.jsx)(y,{size:18})),D("/connections",o("nav.connections"),(0,a.jsx)(p.A,{size:18}),H.length||void 0),D("/schedules",o("nav.schedules"),(0,a.jsx)(b.A,{size:18})),(0,a.jsx)("div",{className:"nav-label",children:o("nav.library")}),D("/types",o("nav.types"),(0,a.jsx)(x.A,{size:18}),C.length),D("/skills",o("nav.skills"),(0,a.jsx)(g,{size:18}),S.length),(0,a.jsx)("div",{className:"nav-label",children:o("nav.history")}),D("/sessions",o("nav.sessions"),(0,a.jsx)(f.A,{size:18})),(0,a.jsxs)("div",{className:"rail-foot",children:[(0,a.jsxs)("button",{type:"button",className:"nav",onClick:P.toggle,"aria-pressed":P.open,...I(o("dock.nav"),P.tabs.length||void 0),title:"".concat(o("dock.nav")," (Ctrl+`)"),children:[(0,a.jsx)(j.A,{size:18}),(0,a.jsx)("span",{className:"t",children:o("dock.nav")}),P.tabs.length>0&&B(P.tabs.length)]}),(0,a.jsxs)("div",{className:"conn",title:t?o(T?"nav.connected":"nav.offline"):void 0,children:[(0,a.jsx)("i",{className:"dot ".concat(T?"ok":"err")}),(0,a.jsx)("span",{className:"t",children:o(T?"nav.connected":"nav.offline")})]}),(0,a.jsxs)("button",{type:"button",className:"nav",onClick:()=>{let e=F?"light":"dark";document.documentElement.dataset.theme=e;try{localStorage.setItem("hive-theme",e)}catch(e){}},"aria-pressed":F,...I(o("nav.switchTheme")),children:[F?(0,a.jsx)(w,{size:18}):(0,a.jsx)(A,{size:18}),(0,a.jsx)("span",{className:"t",children:o("nav.switchTheme")})]})]})]})}function J(e){let{children:t}=e,[n,l,s]=(0,N.ud)("hive-am.railCollapsed",!1);(0,i.useLayoutEffect)(()=>{s&&(document.documentElement.dataset.rail=n?"collapsed":"open")},[n,s]);let[r,o]=(0,i.useState)(!1);return(0,a.jsx)(z.CY,{children:(0,a.jsx)(E.Of,{children:(0,a.jsx)(L.$,{children:(0,a.jsxs)(C.l$,{children:[(0,a.jsx)(S,{}),(0,a.jsxs)("div",{className:"shell ".concat(r?"rail-anim":""),children:[(0,a.jsx)(Z,{collapsed:n,onToggle:()=>{o(!0),l(!n)}}),(0,a.jsx)("main",{className:"main",children:t})]}),(0,a.jsx)(D,{})]})})})})}},70283:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]])},73784:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]])},75010:(e,t,n)=>{"use strict";n.d(t,{I:()=>d});var a=n(94799),l=n(34023),s=n(98392),r=n(64883),i=n(3749),o=n(69654);let c=/\u001b\[[0-9;?]*[ -/]*[@-~]/g;function d(e){let{id:t,height:n=220}=e,{t:d}=(0,o.s9)(),[u,h]=(0,l.useState)(null),m=(0,l.useRef)(""),v=(0,l.useRef)(null),k=(0,l.useRef)(!0),[y,p]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=!1,n;h(null),m.current="",k.current=!0,p(!1);let a=async()=>{try{let n=m.current?"after=".concat(encodeURIComponent(m.current)):"tail=300",a=await i.FH.get("/objects/".concat(t,"/logs?").concat(n));if(e)return;m.current=a.cursor||m.current;let l=a.text.replace(c,"");h(e=>{let t=a.reset?"":null!=e?e:"";if(!l)return null!=e?e:"";let n=!t||t.endsWith("\n")||l.startsWith("\n")?t+l:"".concat(t,"\n").concat(l);return n.length>2e5?n.slice(n.length-2e5):n})}catch(e){}e||(n=setTimeout(a,1200))};return a(),()=>{e=!0,clearTimeout(n)}},[t]),(0,l.useEffect)(()=>{let e=v.current;e&&k.current&&(e.scrollTop=e.scrollHeight)},[u]),(0,a.jsxs)("div",{className:"logv",children:[(0,a.jsx)("pre",{ref:v,className:"logv-body mono",style:{height:n},onScroll:()=>{let e=v.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<24;k.current=t,p(!t)},tabIndex:0,children:null===u?d("git.loading"):u.trim()?u:d("obj.logs.empty")}),(0,a.jsxs)("div",{className:"logv-tools",children:[y&&(0,a.jsxs)("button",{className:"btn sm",onClick:()=>{let e=v.current;e&&(e.scrollTop=e.scrollHeight,k.current=!0,p(!1))},children:[(0,a.jsx)(s.A,{size:14}),d("obj.logs.bottom")]}),(0,a.jsx)("button",{className:"btn ghost icon sm",onClick:()=>h(""),"aria-label":d("obj.logs.clear"),title:d("obj.logs.clear"),children:(0,a.jsx)(r.A,{size:14})})]})]})}},78330:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]])},80306:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])},84616:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},87454:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},87968:()=>{},92605:(e,t,n)=>{Promise.resolve().then(n.bind(n,68992)),Promise.resolve().then(n.t.bind(n,39856,23)),Promise.resolve().then(n.t.bind(n,98682,23)),Promise.resolve().then(n.t.bind(n,15151,23)),Promise.resolve().then(n.t.bind(n,87968,23))},92947:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},98392:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});let a=(0,n(74955).A)("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]])},98682:e=>{e.exports={style:{fontFamily:"'Hanken Grotesk', 'Hanken Grotesk Fallback'",fontStyle:"normal"},className:"__className_67a390",variable:"__variable_67a390"}}},e=>{e.O(0,[584,597,586,281,408,89,358],()=>e(e.s=92605)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{43517:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>X});var l=t(94799),o=t(41463),s=t.n(o),a=t(34023),i=t(92947),c=t(6261),r=t(77841),d=t(73784),m=t(75406),h=t(71529),u=t(14910),y=t(32098),x=t(70665),g=t(33135),j=t(494),p=t(97356),f=t(48538),b=t(77021),v=t(3749),k=t(47890),w=t(10804),N=t(41435),C=t(1517),_=t(12646),M=t(73506),z=t(22214),S=t(69654);let A=k.hg,L=["cwd","permission","skills","prompt"];function F(e){let{colony:n,onClose:t}=e,{t:o}=(0,S.s9)(),{agents:s,skills:i,colonies:c,refresh:r}=(0,f.q5)(),d=(0,w.dj)(),[m,h]=(0,a.useState)(()=>n?{name:n.name,color:n.color,cwd:n.cwd,permission:n.permission,system_prompt:n.system_prompt,skill_ids:n.skill_ids,skill_loads:n.skill_loads,agent_ids:n.agent_ids,inherit:n.inherit}:{name:"",color:A[c.length%A.length],cwd:"",permission:"acceptEdits",system_prompt:"",skill_ids:[],skill_loads:{},agent_ids:[],inherit:{cwd:!0,permission:!0,skills:!0,prompt:!0}}),u=(0,a.useMemo)(()=>JSON.stringify(m),[]),y=JSON.stringify(m)!==u;(0,M.h)(y);let[x,g]=(0,a.useState)(!1),j=()=>{y?g(!0):t()},[b,k]=(0,a.useState)(""),[N,C]=(0,a.useState)(!1),[L,F]=(0,a.useState)(!1),[E,T]=(0,a.useState)(!1),q=(e,n)=>h(t=>({...t,[e]:n})),H=async e=>{T(!0);try{let l={...m,name:m.name.trim(),color:m.color.toLowerCase(),inherit:e};n?await v.FH.patch("/colonies/".concat(n.id),l):await v.FH.post("/colonies",l),await r(["agents","colonies"]),d(n?o("colony.saved"):o("colony.created")),t()}catch(e){C(!1),k(e instanceof Error?e.message:o("edit.saveFailed")),T(!1)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(w._s,{title:n?o("colony.editTitle",{name:n.name}):o("colony.newTitle"),subtitle:o("colony.subtitle"),onClose:j,footer:(0,l.jsxs)(l.Fragment,{children:[n&&(0,l.jsxs)("button",{className:"btn danger push-r",onClick:()=>F(!0),children:[(0,l.jsx)(p.A,{size:15}),o("common.delete")]}),(0,l.jsx)("button",{className:"btn ghost",onClick:j,children:o("common.cancel")}),(0,l.jsx)("button",{className:"btn primary",onClick:()=>m.name.trim()?c.some(e=>e.id!==(null==n?void 0:n.id)&&e.name.toLowerCase()===m.name.trim().toLowerCase())?void k(o("colony.err.nameTaken")):/^#[0-9a-f]{6}$/i.test(m.color)?void(k(""),C(!0)):void k(o("colony.err.color")):void k(o("colony.err.name")),children:n?o("colony.save"):o("colony.create")})]}),children:[(0,l.jsx)(w.D0,{label:o("form.name"),error:b,children:(0,l.jsx)("input",{className:"input",value:m.name,onChange:e=>q("name",e.target.value),placeholder:o("colony.name.placeholder"),"data-autofocus":!0})}),(0,l.jsx)(w.D0,{label:o("colony.color"),children:(0,l.jsxs)("div",{className:"swatches",children:[A.map(e=>(0,l.jsx)("button",{type:"button",className:"swatch",style:{"--c":e},"aria-pressed":m.color.toLowerCase()===e,"aria-label":o("colony.colorOption",{color:e}),onClick:()=>q("color",e)},e)),(0,l.jsx)("label",{className:"swatch custom ".concat(A.includes(m.color.toLowerCase())?"":"on"),style:{"--c":/^#[0-9a-f]{6}$/i.test(m.color)?m.color:"transparent"},title:o("colony.colorCustom"),children:(0,l.jsx)("input",{type:"color",value:/^#[0-9a-f]{6}$/i.test(m.color)?m.color:"#2f8f5b",onChange:e=>q("color",e.target.value),"aria-label":o("colony.colorCustom")})}),(0,l.jsx)("input",{className:"input hex-input mono",value:m.color,maxLength:7,spellCheck:!1,"aria-label":o("colony.colorHex"),placeholder:"#2f8f5b",onChange:e=>{let n=e.target.value.trim();q("color",n.startsWith("#")||!n?n:"#".concat(n))}})]})}),(0,l.jsx)(w.dR,{value:m.cwd,onChange:e=>q("cwd",e)}),(0,l.jsx)(w.en,{value:m.permission,onChange:e=>q("permission",e)}),(0,l.jsx)(w.D0,{label:o("inherit.context"),hint:o("colony.context.hint"),children:(0,l.jsx)(_.n,{value:m.system_prompt,onChange:e=>q("system_prompt",e),placeholder:o("colony.context.placeholder"),defaultView:"write",minHeight:160})}),(0,l.jsx)(w.D0,{label:o("form.skills"),children:(0,l.jsx)(w.kV,{skills:i,value:m.skill_ids,loads:m.skill_loads,onChange:(e,n)=>h({...m,skill_ids:e,skill_loads:n})})}),(0,l.jsx)(w.D0,{label:o("colony.members"),hint:o("colony.members.hint"),children:0===s.length?(0,l.jsx)("p",{className:"hint",children:o("colony.members.empty")}):(0,l.jsx)(z.C,{value:m.agent_ids,onChange:e=>q("agent_ids",e),items:s.map(e=>{let t=e.colony_id&&e.colony_id!==(null==n?void 0:n.id)?c.find(n=>n.id===e.colony_id):null;return{id:e.id,name:e.name,note:t?o("colony.currentlyIn",{name:t.name}):e.description||o("role.".concat(e.role))}})})})]}),N&&(0,l.jsx)(D,{draft:m,colony:n,members:s.filter(e=>m.agent_ids.includes(e.id)),busy:E,onBack:()=>C(!1),onConfirm:H}),x&&(0,l.jsx)(w.TM,{danger:!0,title:o("fa.unsaved.title"),body:o("fa.unsaved.body"),confirmLabel:o("fa.unsaved.discard"),cancelLabel:o("fa.unsaved.keep"),onClose:()=>g(!1),onConfirm:t}),L&&n&&(0,l.jsx)(w.TM,{title:o("colony.deleteTitle",{name:n.name}),body:o("colony.deleteBody",{count:n.agent_ids.length}),danger:!0,confirmLabel:o("colony.delete"),cancelLabel:o("colony.keep"),onClose:()=>F(!1),onConfirm:async()=>{await v.FH.del("/colonies/".concat(n.id)),await r(["agents","colonies"]),d(o("colony.deleted")),t()}})]})}function D(e){let{draft:n,colony:t,members:o,busy:s,onBack:i,onConfirm:c}=e,{t:r}=(0,S.s9)(),d={cwd:!!n.cwd,permission:!0,skills:n.skill_ids.length>0,prompt:!!n.system_prompt.trim()},[m,h]=(0,a.useState)(()=>({cwd:(!t||t.inherit.cwd)&&d.cwd,permission:!t||t.inherit.permission,skills:(!t||t.inherit.skills)&&d.skills,prompt:(!t||t.inherit.prompt)&&d.prompt})),u=(0,a.useMemo)(()=>m.cwd&&n.cwd&&o.filter(e=>!e.overrides.includes("cwd")&&e.effective.cwd!==n.cwd).length,[m.cwd,n.cwd,o]);return(0,l.jsxs)(w.aF,{title:r("inheritAsk.title"),onClose:i,children:[(0,l.jsx)("p",{className:"muted small m0",children:r("inheritAsk.intro")}),(0,l.jsx)("div",{className:"col gap-s",children:L.map(e=>(0,l.jsx)(w.Tl,{disabled:!d[e],checked:m[e],onChange:n=>h(t=>({...t,[e]:n})),label:(0,l.jsxs)(l.Fragment,{children:[r("inheritAsk.field.".concat(e)),"cwd"===e&&n.cwd?(0,l.jsxs)("span",{className:"muted mono fw-400",children:[" \xb7 ",(0,k._1)(n.cwd)]}):null,"permission"===e?(0,l.jsxs)("span",{className:"muted fw-400",children:[" \xb7 ",(0,k.Ck)(n.permission)]}):null]}),hint:d[e]?r("inheritAsk.hint.".concat(e)):r("inheritAsk.empty.".concat(e))},e))}),u?(0,l.jsx)(w.lZ,{kind:"honey",children:r("inheritAsk.folderMoves",{count:Number(u)})}):null,(0,l.jsxs)("div",{className:"row push-end",children:[(0,l.jsx)("button",{className:"btn ghost",onClick:i,children:r("common.back")}),(0,l.jsx)("button",{className:"btn primary",disabled:s,onClick:()=>c(m),children:s?r("common.saving"):t?r("colony.save"):r("colony.create")})]})]})}var E=t(5300),T=t(89128);function q(e){let{agent:n,onClose:t}=e,{t:o}=(0,S.s9)(),s=(0,T.A)(n,{onSaved:t,onDeleted:t,onCloned:t});return s.draft?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(w._s,{title:o("edit.title",{name:n.name}),subtitle:o("running"===n.status?"edit.subtitleRunning":"edit.subtitleIdle"),onClose:t,footer:s.actions({onCancel:t}),children:(0,l.jsx)(E.SU,{draft:s.draft,onChange:s.setDraft,errors:s.errors,selfId:n.id})}),s.deleteModal,s.cloneModal]}):null}var H=t(48776),O=t(80696),I=t(42366),B=t(5372),W=t(31606),K=t(95587),R=t(74988);let P=74*Math.sqrt(3),J=[[1,0],[1,-1],[0,-1],[-1,0],[-1,1],[0,1]],G=e=>{let[n,t]=e;return{x:P*(n+t/2),y:111*t}},U=(e,n,t)=>Array.from({length:6},(l,o)=>{let s=(60*o-30)*Math.PI/180;return"".concat((e+t*Math.cos(s)).toFixed(1),",").concat((n+t*Math.sin(s)).toFixed(1))}).join(" ");function X(){var e,n,t;let{t:o}=(0,S.s9)(),{agents:_,colonies:M,objects:z,dispatches:A,ready:L,error:D,retry:E,refresh:T}=(0,f.q5)(),X=(0,w.dj)(),[Y,$]=(0,a.useState)(null),[V,Z]=(0,a.useState)(null),[Q,ee]=(0,a.useState)(null),[en,et]=(0,a.useState)(null),[el,eo]=(0,a.useState)(null),[es,ea]=(0,a.useState)(null),[ei,ec]=(0,b.ud)("hive-colony-layout",{}),[er,ed]=(0,a.useState)(null),[em,eh]=(0,b.ud)("hive-colony-zoom",1),eu=em>=.4&&em<=2.5?em:1,ey=e=>eh(Math.min(2.5,Math.max(.4,Math.round(100*e)/100))),ex=(0,a.useMemo)(()=>er?{...ei,[er.key]:{x:er.x,y:er.y}}:ei,[ei,er]),{clusters:eg,width:ej,height:ep}=(0,a.useMemo)(()=>(function(e,n,t){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e=>!!e&&n.some(n=>n.id===e),s=n.map(n=>({key:n.id,colony:n,members:e.filter(e=>e.colony_id===n.id),things:t.filter(e=>e.colony_id===n.id)}));s.push({key:"free",colony:null,members:e.filter(e=>!o(e.colony_id)),things:t.filter(e=>!o(e.colony_id))});let a=[],i=0,c=0,r=0;for(let n of s){if(!n.members.length&&!n.things.length&&!n.colony&&e.length+t.length>0)continue;let o=function(e){let n=e.filter(e=>"orchestrator"===e.role);for(let t of[...n])for(let l of t.worker_ids){let t=e.find(e=>e.id===l);t&&!n.includes(t)&&n.push(t)}for(let t of e)n.includes(t)||n.push(t);return n}(n.members),s=(function(e){let n=[[0,0]];for(let t=1;n.length<e;t++){let e=J[4][0]*t,l=J[4][1]*t;for(let o=0;o<6;o++)for(let s=0;s<t;s++)n.push([e,l]),e+=J[o][0],l+=J[o][1]}return n.slice(0,e)})(o.length+n.things.length+1).map(G),d=Math.min(...s.map(e=>e.x))-P/2,m=Math.max(...s.map(e=>e.x))+P/2,h=Math.min(...s.map(e=>e.y))-74,u=Math.max(...s.map(e=>e.y))+74,y=m-d+52,x=u-h+52+50,g=n.colony?l[n.key]:void 0;!g&&i>0&&i+y>880&&(i=0,c+=r+36,r=0);let j=g?g.x:i,p=g?g.y:c,f=s.map((e,t)=>{var s,a,i;let c=null!=(a=o[t])?a:null,r=n.things[t-o.length],m=n.colony?void 0:l[null!=(i=null==(s=null!=c?c:r)?void 0:s.id)?i:""];return{agent:c,object:r,x:m?m.x:j+(e.x-d)+26,y:m?m.y:p+(e.y-h)+26+50}});a.push({key:n.key,colony:n.colony,cells:f,x:j,y:p,w:y,h:x}),g||(i+=y+36,r=Math.max(r,x))}let d=0,m=0;for(let e of a)if(e.colony)d=Math.max(d,e.x+e.w),m=Math.max(m,e.y+e.h);else for(let n of e.cells)d=Math.max(d,n.x+P/2+26),m=Math.max(m,n.y+74+26);return{clusters:a,width:d,height:m}})(_,M,z,ex),[_,M,z,ex]),ef=(0,a.useRef)(null),[eb,ev]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=ef.current;if(!e)return;let n=new ResizeObserver(()=>ev(e.clientWidth));return n.observe(e),ev(e.clientWidth),()=>n.disconnect()},[L,0===_.length]);let ek=(0,a.useRef)(eu);ek.current=eu,(0,a.useEffect)(()=>{let e=ef.current;if(!e)return;let n=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ey(ek.current*(e.deltaY<0?1.1:1/1.1)))};return e.addEventListener("wheel",n,{passive:!1}),()=>e.removeEventListener("wheel",n)},[L]);let ew=ej+80,eN=ep+80,eC=(eb?Math.min(1,(eb-24)/ew):1)*eu,e_=(0,a.useRef)(null),eM=(0,a.useRef)(!1),ez=function(e,n,t,l){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{x:0,y:0};if(0===e.button){e_.current={key:n,sx:e.clientX,sy:e.clientY,ox:t,oy:l,min:o,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch(e){}}},eS=e=>{let n=e_.current;if(!n)return;let t=(e.clientX-n.sx)/eC,l=(e.clientY-n.sy)/eC;!n.moved&&Math.hypot(t,l)*eC<6||(n.moved=!0,n.last={x:Math.max(n.min.x,n.ox+t),y:Math.max(n.min.y,n.oy+l)},ed({key:n.key,...n.last}))},eA=()=>{let e=e_.current;e_.current=null,(null==e?void 0:e.moved)&&e.last&&(eM.current=!0,setTimeout(()=>{eM.current=!1},0),ec({...ei,[e.key]:e.last}),ed(null))},eL=function(e,n,t,l){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{x:0,y:0},s={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!s||e.altKey||e.ctrlKey||e.metaKey)return;e.preventDefault();let a=e.shiftKey?64:16;ec({...ei,[n]:{x:Math.max(o.x,t+s[0]*a),y:Math.max(o.y,l+s[1]*a)}})},eF=(e,n,t,l)=>({onPointerDown:o=>ez(o,e,n,t,l),onPointerMove:eS,onPointerUp:eA,onPointerCancel:eA}),eD=new Map;for(let e of eg)for(let n of e.cells)n.agent&&eD.set(n.agent.id,{x:n.x+40,y:n.y+40}),n.object&&eD.set(n.object.id,{x:n.x+40,y:n.y+40});let eE=z.filter(e=>"cluster"===e.kind).flatMap(e=>e.config.members.map(n=>({from:e.id,to:n}))),eT=z.filter(e=>e.manager_id&&eD.has(e.manager_id)&&eD.has(e.id)).map(e=>({from:e.manager_id,to:e.id})),eq=e=>z.filter(n=>n.manager_id===e),eH=e=>{var n;return e.cloned_from?null==(n=_.find(n=>n.id===e.cloned_from))?void 0:n.name:void 0},[eO,eI]=(0,a.useState)(null),[eB,eW]=(0,a.useState)(null),eK=null!=(e=_.find(e=>e.id===Y))?e:null,eR=null!=(n=z.find(e=>e.id===Y))?n:null,[eP,eJ]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{eJ(Y?document.querySelector('[data-sid="'.concat(Y,'"]')):null)},[Y,_.length,z.length]),(0,a.useEffect)(()=>{if(!Y)return;let e=e=>{"Escape"!==e.key||document.querySelector('[role="dialog"]')||$(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Y]);let eG=null!=V?V:Y,eU=_.filter(e=>"orchestrator"===e.role).flatMap(e=>e.worker_ids.map(n=>({from:e.id,to:n}))),eX=new Set(eG?[eG,...[...eU,...eE,...eT].filter(e=>e.from===eG||e.to===eG).flatMap(e=>[e.from,e.to])]:[]),eY=e=>_.filter(n=>"orchestrator"===n.role&&n.worker_ids.includes(e)),e$=_.filter(e=>"running"===e.status).length,eV=z.filter(e=>"running"===e.state.status).length,eZ=_.filter(e=>"orchestrator"===e.role).length,eQ=e=>{var n,t;return null!=(t=null==(n=_.find(n=>n.id===e))?void 0:n.name)?t:o("colony.removedAgent")},e0=A.filter(e=>"running"===e.status||"queued"===e.status).length,e1=[{id:"agents",n:_.length,label:o("stat.agents",{count:_.length}),href:"/agents"},{id:"colonies",n:M.length,label:o("stat.colonies",{count:M.length})},{id:"objects",n:z.length,label:o("stat.objects",{count:z.length}),href:"/resources",title:z.length?o("obj.running",{count:eV}):void 0},{id:"queens",n:eZ,label:o("stat.orchestrators",{count:eZ}),href:"/agents"},{id:"working",n:e$,label:o("stat.working"),href:"/agents"},{id:"tasks",n:e0,label:o("stat.tasks"),href:"#recent"}],e4=eK?M.find(e=>e.id===eK.colony_id):void 0,e8=async(e,n)=>{try{var t,l;await v.FH.patch("/agents/".concat(e.id),{colony_id:n||null,overrides:[]}),await T(["agents","colonies"]),X(n?o("colony.joined",{name:e.name,colony:null!=(l=null==(t=M.find(e=>e.id===n))?void 0:t.name)?l:""}):o("colony.left",{name:e.name}))}catch(e){X(e instanceof Error?e.message:o("colony.moveFailed"),"err")}};return(0,l.jsxs)("div",{className:"page",children:[(0,l.jsxs)("div",{className:"page-head",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"row gap-s",children:[(0,l.jsx)("h1",{children:o("nav.colony")}),(0,l.jsx)(I.B,{label:o("colony.helpLabel"),title:o("colony.howTitle"),children:o("colony.howBody")})]}),(0,l.jsx)("p",{children:o("colony.page.subtitle")})]}),(0,l.jsx)("div",{className:"cx-head-actions",children:(0,l.jsx)(N.W1,{label:o("cx.new"),icon:(0,l.jsx)(i.A,{size:14}),children:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(N.Dr,{icon:(0,l.jsx)(c.A,{size:15}),onClick:()=>{e(),ee({})},children:o("newAgent.title")}),(0,l.jsx)(N.Dr,{icon:(0,l.jsx)(r.A,{size:15}),onClick:()=>{e(),et("new")},children:o("colony.newTitle")}),(0,l.jsx)(N.Dr,{icon:(0,l.jsx)(d.A,{size:15}),onClick:()=>{e(),ea({})},children:o("obj.new")})]})})})]}),(0,l.jsx)("div",{className:"stats",children:e1.map(e=>{let n=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("b",{children:e.n}),(0,l.jsx)("span",{children:e.label})]});return e.href?(0,l.jsx)(s(),{href:e.href,className:"card stat",title:e.title,"aria-label":"".concat(e.n," ").concat(e.label,". ").concat(o("cx.stat.open",{label:e.label})),children:n},e.id):(0,l.jsx)("div",{className:"card stat",title:e.title,children:n},e.id)})}),(0,l.jsxs)("div",{className:"colony",children:[(0,l.jsxs)("div",{className:"comb-wrap",ref:ef,children:[L?0===_.length&&0===M.length&&0===z.length?(0,l.jsx)("div",{className:"comb-empty-wrap",children:(0,l.jsx)(w.pp,{icon:(0,l.jsx)(w._h,{size:"lg",queen:!0,label:"+"}),title:o("colony.empty.title"),body:o("colony.empty.body"),action:(0,l.jsxs)("div",{className:"row",children:[(0,l.jsxs)("button",{className:"btn",onClick:()=>et("new"),children:[(0,l.jsx)(i.A,{size:16}),o("colony.empty.createColony")]}),(0,l.jsxs)("button",{className:"btn primary",onClick:()=>ee({}),children:[(0,l.jsx)(i.A,{size:16}),o("colony.empty.createAgent")]})]})})}):(0,l.jsx)("div",{className:"comb-box",style:{width:ew*eC,height:eN*eC},children:(0,l.jsxs)("div",{className:"comb",style:{width:ew,height:eN,transform:"scale(".concat(eC,")"),transformOrigin:"0 0","--w":"".concat(.9*P,"px"),"--h":"".concat(133.20000000000002,"px")},children:[(0,l.jsx)("svg",{className:"links",width:ew,height:eN,children:eg.filter(e=>e.colony).map(e=>{let n=e.colony.color||"var(--honey)";return(0,l.jsxs)("g",{children:[e.cells.map((e,t)=>(0,l.jsx)("polygon",{points:U(e.x+40,e.y+40,74),style:{fill:n,stroke:n},strokeWidth:44,strokeLinejoin:"round"},"o"+t)),e.cells.map((e,t)=>(0,l.jsx)("polygon",{points:U(e.x+40,e.y+40,74),style:{fill:"color-mix(in srgb, ".concat(n," 9%, var(--surface))"),stroke:"color-mix(in srgb, ".concat(n," 9%, var(--surface))")},strokeWidth:38,strokeLinejoin:"round"},"i"+t))]},e.key)})}),eg.map(e=>(0,l.jsxs)("div",{children:[e.colony?(0,l.jsxs)("button",{className:"colony-label draggable ".concat((null==er?void 0:er.key)===e.key?"dragging":""),style:{left:e.x+e.w/2+40,top:e.y+50-10+40,"--c":e.colony.color||"var(--honey)"},...eF(e.key,e.x,e.y),onKeyDown:n=>eL(n,e.key,e.x,e.y),onClick:()=>{eM.current||et(e.colony)},title:"".concat(e.colony.cwd?o("colony.editHover",{path:(0,k._1)(e.colony.cwd)}):o("colony.editHoverShort")," \xb7 ").concat(o("colony.dragHint")," \xb7 ").concat(o("cx.moveHint")),children:[(0,l.jsx)("i",{className:"cdot"}),e.colony.name,(0,l.jsx)("small",{children:o("colony.agentCount",{count:e.cells.filter(e=>e.agent).length})}),(0,l.jsx)(r.A,{size:13,className:"muted"})]}):M.length>0&&e.cells.some(e=>e.agent)?(0,l.jsx)("span",{className:"colony-label cx-unplaced",style:{left:e.x+e.w/2+40,top:e.y+50-10+40},children:(0,l.jsx)("small",{children:o("common.noColony")})}):null,e.cells.map((n,t)=>{let s=n.agent,a={left:n.x+40,top:n.y+40},c=n.object;if(c){let{icon:t,color:s}=R.Nd[c.kind];return(0,l.jsxs)("button",{"data-sid":c.id,className:"cell fill obj st-".concat(c.state.status," ").concat("running"===c.state.status?"running":""," ").concat(eG&&!eX.has(c.id)?"dim":""," ").concat(eG&&eX.has(c.id)&&c.id!==eG?"linked":""," ").concat(e.colony?"":"draggable"),style:{...a,"--c":s},"aria-pressed":Y===c.id,onMouseEnter:()=>Z(c.id),onMouseLeave:()=>Z(null),onFocus:()=>Z(c.id),onBlur:()=>Z(null),...e.colony?{}:{...eF(c.id,n.x,n.y,{x:P/2,y:74}),onKeyDown:e=>eL(e,c.id,n.x,n.y,{x:P/2,y:74})},onClick:()=>{eM.current||$(c.id===Y?null:c.id)},"aria-label":"".concat(c.name,", ").concat(o("obj.kind.".concat(c.kind)),", ").concat(o("obj.status.".concat(c.state.status))),title:c.state.detail?"".concat(o("obj.status.".concat(c.state.status)),": ").concat(c.state.detail):o("obj.status.".concat(c.state.status)),children:[(0,l.jsx)("span",{className:"shape"}),(0,l.jsxs)("span",{className:"label",children:[(0,l.jsx)(t,{size:16}),(0,l.jsx)("b",{children:c.name}),(0,l.jsx)("small",{children:o("obj.status.".concat(c.state.status))})]}),(0,l.jsx)("span",{className:"pip o-".concat(c.state.status)}),c.manager_id&&(0,l.jsxs)("span",{className:"ltag top mgr",title:o("colony.managedBy",{name:eQ(c.manager_id)}),children:["⚙ ",eQ(c.manager_id)]})]},c.id)}return s?(0,l.jsxs)("button",{"data-sid":s.id,className:"cell fill ".concat("orchestrator"===s.role?"queen":""," ").concat("running"===s.status?"running":""," ").concat(eG&&!eX.has(s.id)?"dim":""," ").concat(eG&&eX.has(s.id)&&s.id!==eG?"linked":""," ").concat(e.colony?"":"draggable"),onMouseEnter:()=>Z(s.id),onMouseLeave:()=>Z(null),onFocus:()=>Z(s.id),onBlur:()=>Z(null),style:{...a,"--c":k.xq[s.provider].color},"aria-pressed":Y===s.id,...e.colony?{}:{...eF(s.id,n.x,n.y,{x:P/2,y:74}),onKeyDown:e=>eL(e,s.id,n.x,n.y,{x:P/2,y:74}),title:o("cx.moveHint")},onClick:()=>{eM.current||$(s.id===Y?null:s.id)},"aria-label":"".concat(s.name,", ").concat(o("role.".concat(s.role)),", ").concat(k.xq[s.provider].short,", ").concat(o("status.".concat(s.status))),children:[(0,l.jsx)("span",{className:"shape"}),(0,l.jsxs)("span",{className:"label",children:[(0,l.jsx)("b",{children:s.name}),(0,l.jsx)("small",{children:k.xq[s.provider].short})]}),"idle"!==s.status&&(0,l.jsx)("span",{className:"pip ".concat("error"===s.status?"err":"")}),(eq(s.id).length>0||eH(s))&&(0,l.jsxs)("span",{className:"ltag top ".concat(eq(s.id).length>0?"mgr":"clone"),title:[eH(s)?o("agent.cloneOf",{name:eH(s)}):"",eq(s.id).length>0?o("colony.manages",{names:eq(s.id).map(e=>e.name).join(", ")}):""].filter(Boolean).join(" \xb7 "),children:[eH(s)?"⧉ ".concat(eH(s)):"",eH(s)&&eq(s.id).length>0?" \xb7 ":"",eq(s.id).length>0?"⚙ ".concat(1===eq(s.id).length?eq(s.id)[0].name:eq(s.id).length):""]}),("orchestrator"===s.role?s.worker_ids.length>0:eY(s.id).length>0)&&(0,l.jsx)("span",{className:"ltag",title:"orchestrator"===s.role?o("colony.delegatesTo",{count:s.worker_ids.length}):o("colony.connectedTo",{names:eY(s.id).map(e=>e.name).join(", ")}),children:"orchestrator"===s.role?"↓ ".concat(s.worker_ids.length):"↑ ".concat(1===eY(s.id).length?eY(s.id)[0].name:eY(s.id).length)})]},s.id):(0,l.jsxs)("button",{className:"cell ghost",style:a,onClick:()=>{var n;return ee({colonyId:null==(n=e.colony)?void 0:n.id})},"aria-label":e.colony?o("colony.addTo",{name:e.colony.name}):o("colony.addAgent"),children:[(0,l.jsx)("svg",{className:"ghost-hex",viewBox:"0 0 100 115",preserveAspectRatio:"none","aria-hidden":!0,children:(0,l.jsx)("polygon",{points:"50,2 98,29 98,86 50,113 2,86 2,29"})}),(0,l.jsxs)("span",{className:"label",children:[(0,l.jsx)(i.A,{size:18}),o("colony.addAgent")]})]},e.key+"g"+t)})]},e.key+"l")),(0,l.jsxs)("svg",{className:"links top",width:ew,height:eN,"aria-hidden":!0,children:[eU.filter(e=>!!eG&&(e.from===eG||e.to===eG)).map(e=>{var n;let t=eD.get(e.from),o=eD.get(e.to);if(!t||!o)return null;let s=o.x-t.x,a=o.y-t.y,i=Math.hypot(s,a)||1,c=s/i,r=a/i,d=t.x+45.88*c,m=t.y+45.88*r,h=o.x-45.88*c,u=o.y-45.88*r,y=(null==(n=_.find(n=>n.id===e.to))?void 0:n.status)==="running",x=!!eG&&(e.from===eG||e.to===eG),g=!!eG&&!x;return(0,l.jsxs)("g",{opacity:g?.18:1,children:[(0,l.jsx)("line",{x1:d,y1:m,x2:h,y2:u,stroke:"var(--surface)",strokeWidth:x?8:5,strokeLinecap:"round",opacity:.85}),(0,l.jsx)("line",{x1:d,y1:m,x2:h,y2:u,stroke:"var(--honey)",strokeWidth:x?3.5:2.2,strokeDasharray:y?"7 6":x?void 0:"1 6",strokeLinecap:"round",children:y&&(0,l.jsx)("animate",{attributeName:"stroke-dashoffset",from:"26",to:"0",dur:"0.8s",repeatCount:"indefinite"})}),(0,l.jsx)("circle",{cx:h,cy:u,r:x?5.5:4,fill:"var(--honey)",stroke:"var(--surface)",strokeWidth:2})]},e.from+e.to)}),[...eE.map(e=>({...e,kind:"cluster"})),...eT.map(e=>({...e,kind:"manager"}))].filter(e=>!!eG&&(e.from===eG||e.to===eG)).map(e=>{let n=eD.get(e.from),t=eD.get(e.to);if(!n||!t)return null;let o=t.x-n.x,s=t.y-n.y,a=Math.hypot(o,s)||1,i=o/a,c=s/a,r="cluster"===e.kind?k.Ng:"var(--link-manager)";return(0,l.jsxs)("g",{children:[(0,l.jsx)("line",{x1:n.x+45.88*i,y1:n.y+45.88*c,x2:t.x-45.88*i,y2:t.y-45.88*c,stroke:"var(--surface)",strokeWidth:8,strokeLinecap:"round",opacity:.9}),(0,l.jsx)("line",{x1:n.x+45.88*i,y1:n.y+45.88*c,x2:t.x-45.88*i,y2:t.y-45.88*c,stroke:r,strokeWidth:3,strokeDasharray:"cluster"===e.kind?"3 5":"8 5",strokeLinecap:"round"}),(0,l.jsx)("circle",{cx:t.x-45.88*i,cy:t.y-45.88*c,r:5,fill:r,stroke:"var(--surface)",strokeWidth:2})]},e.kind+e.from+e.to)})]})]})}):D?(0,l.jsx)("div",{className:"comb-skel",children:(0,l.jsx)(w.lZ,{kind:"err",children:(0,l.jsxs)("div",{className:"row gap-s wrap",children:[(0,l.jsxs)("span",{className:"grow",children:[o("cx.loadFailed")," ",D]}),(0,l.jsx)("button",{className:"btn sm",onClick:()=>void E(),children:o("cx.retry")})]})})}):(0,l.jsxs)("div",{className:"comb-skel",role:"status","aria-label":o("cx.loading"),children:[(0,l.jsx)("div",{className:"skel",style:{width:220,height:190}}),(0,l.jsxs)("div",{className:"row gap-l",children:[(0,l.jsx)("div",{className:"skel",style:{width:150,height:130}}),(0,l.jsx)("div",{className:"skel",style:{width:150,height:130}})]})]}),(0,l.jsxs)("div",{className:"comb-zoom",role:"group","aria-label":o("colony.zoom"),children:[Object.keys(ei).length>0&&(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>ec({}),title:o("colony.layout.reset"),"aria-label":o("colony.layout.reset"),children:(0,l.jsx)(m.A,{size:14})}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>ey(eu/1.2),disabled:eu<=.4,title:o("colony.zoom.out"),"aria-label":o("colony.zoom.out"),children:(0,l.jsx)(h.A,{size:14})}),(0,l.jsxs)("button",{className:"btn ghost sm zoom-pct",onClick:()=>ey(1),title:o("colony.zoom.fit"),"aria-label":o("colony.zoom.fit"),children:[Math.round(100*eu),"%"]}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>ey(1.2*eu),disabled:eu>=2.5,title:o("colony.zoom.in"),"aria-label":o("colony.zoom.in"),children:(0,l.jsx)(i.A,{size:14})}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>ey(1),title:o("colony.zoom.fit"),"aria-label":o("colony.zoom.fit"),children:(0,l.jsx)(u.A,{size:14})})]}),(0,l.jsxs)("div",{className:"comb-legend",children:[Object.keys(k.xq).map(e=>(0,l.jsxs)("span",{className:"pbadge",style:{"--c":k.xq[e].color},children:[(0,l.jsx)("i",{}),k.xq[e].short]},e)),(0,l.jsxs)("span",{className:"pbadge",style:{"--c":"var(--honey)"},children:[(0,l.jsx)("i",{}),o("role.orchestrator")]})]})]}),eR?(0,l.jsx)(W.wl,{object:eR,target:eP,onClose:()=>$(null),onCreateManager:()=>{var e;return ee({colonyId:null!=(e=eR.colony_id)?e:void 0,manager:!0,objectId:eR.id})}},eR.id):eK?(0,l.jsxs)(B.rs,{target:eP,pinned:!0,width:340,label:eK.name,onClose:()=>$(null),children:[(0,l.jsxs)("div",{className:"ap-corner row gap-s",children:[(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>eo(eK.id),"aria-label":o("colony.settingsFor",{name:eK.name}),title:o("colony.agentSettings"),children:(0,l.jsx)(y.A,{size:16})}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>$(null),"aria-label":o("common.close"),title:"".concat(o("common.close")," (Esc)"),children:(0,l.jsx)(x.A,{size:16})})]}),(0,l.jsx)(B.kh,{agent:eK,hideColony:!0}),(0,l.jsxs)("div",{className:"field ap-pin-field",children:[(0,l.jsx)("label",{children:o("form.colony")}),(0,l.jsxs)("select",{className:"select",value:null!=(t=null==e4?void 0:e4.id)?t:"",onChange:e=>void e8(eK,e.target.value),children:[(0,l.jsx)("option",{value:"",children:o("common.noColony")}),M.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,l.jsxs)("div",{className:"row ap-pin-actions",children:[(0,l.jsxs)(s(),{className:"btn primary grow",href:"/agents/".concat(eK.id),children:[o("colony.openChat")," ",(0,l.jsx)(g.A,{size:16})]}),(0,l.jsx)("button",{className:"btn icon",onClick:()=>eW(eK.id),"aria-label":o("agent.clone"),title:o("agent.clone.hint"),children:(0,l.jsx)(j.A,{size:16})}),(0,l.jsx)("button",{className:"btn danger icon",onClick:()=>eI(eK.id),"aria-label":o("agent.delete"),title:o("agent.delete"),children:(0,l.jsx)(p.A,{size:16})})]})]},eK.id):null]}),(0,l.jsxs)("div",{className:"card card-pad recent",id:"recent",children:[(0,l.jsx)("div",{className:"eyebrow recent-head",children:o("colony.recent")}),0===A.length?(0,l.jsx)("p",{className:"muted small m0",children:o("colony.recentEmpty")}):(0,l.jsx)("div",{className:"recent-grid",children:A.slice(0,6).map(e=>(0,l.jsxs)("div",{className:"feed-item",children:[(0,l.jsx)("i",{className:"dot ".concat("running"===e.status?"run":"queued"===e.status?"wait":"done"===e.status?"ok":"err"),title:o("colony.task.".concat(e.status))}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"feed-line",children:[_.some(n=>n.id===e.from_id)?(0,l.jsx)(s(),{href:"/agents/".concat(e.from_id),"aria-label":o("cx.openAgent",{name:eQ(e.from_id)}),children:eQ(e.from_id)}):(0,l.jsx)("b",{children:eQ(e.from_id)})," → ",_.some(n=>n.id===e.to_id)?(0,l.jsx)(s(),{href:"/agents/".concat(e.to_id),"aria-label":o("cx.openAgent",{name:eQ(e.to_id)}),children:eQ(e.to_id)}):(0,l.jsx)("b",{children:eQ(e.to_id)})]}),(0,l.jsx)("div",{className:"muted small ellipsis",children:e.task}),(0,l.jsx)("div",{className:"muted feed-when",children:(0,k.KN)(e.created_at)})]})]},e.id))})]}),eB&&_.find(e=>e.id===eB)&&(0,l.jsx)(O.y,{agent:_.find(e=>e.id===eB),onClose:()=>eW(null),onCloned:e=>$(e.id)}),eO&&_.find(e=>e.id===eO)&&(0,l.jsx)(H.G,{agent:_.find(e=>e.id===eO),onClose:()=>eI(null),onDeleted:()=>$(null)}),Q&&(0,l.jsx)(C.bC,{presetColonyId:Q.colonyId,presetObjectId:Q.objectId,manager:Q.manager,onClose:()=>ee(null),onCreated:e=>$(e)}),el&&_.find(e=>e.id===el)&&(0,l.jsx)(q,{agent:_.find(e=>e.id===el),onClose:()=>eo(null)},el),es&&(0,l.jsx)(K.X,{presetColonyId:es.colonyId,onClose:()=>ea(null),onSaved:e=>$(e)}),en&&(0,l.jsx)(F,{colony:"new"===en?void 0:en,onClose:()=>et(null)})]})}},48776:(e,n,t)=>{"use strict";t.d(n,{G:()=>r});var l=t(94799),o=t(34023),s=t(10804),a=t(48538),i=t(3749),c=t(69654);function r(e){let{agent:n,onClose:t,onDeleted:r}=e,{t:d}=(0,c.s9)(),{refresh:m}=(0,a.zd)(),h=(0,s.dj)(),[u,y]=(0,o.useState)([]);return(0,o.useEffect)(()=>{let e=!1;return i.FH.get("/agents/".concat(n.id,"/notebook")).then(n=>{var t;e||y((null!=(t=n.shared_with)?t:[]).map(e=>e.name))}).catch(()=>void 0),()=>{e=!0}},[n.id]),(0,l.jsx)(s.TM,{title:d("agent.deleteTitle",{name:n.name}),body:u.length?d("agent.deleteBody.shared",{names:u.join(", ")}):d("agent.deleteBody"),danger:!0,confirmLabel:d("agent.delete"),cancelLabel:d("agent.keep"),onClose:t,onConfirm:async()=>{await i.FH.del("/agents/".concat(n.id)),await m(["agents","colonies"]),h(d("agent.deleted")),null==r||r()}})}},77701:(e,n,t)=>{Promise.resolve().then(t.bind(t,43517))},80696:(e,n,t)=>{"use strict";t.d(n,{y:()=>d});var l=t(94799),o=t(34023),s=t(494),a=t(3749),i=t(48538),c=t(69654),r=t(10804);function d(e){var n;let{agent:t,onClose:d,onCloned:m}=e,{t:h}=(0,c.s9)(),{agents:u,colonies:y}=(0,i.q5)(),{refresh:x}=(0,i.zd)(),g=(0,r.dj)(),[j,p]=(0,o.useState)(()=>((e,n)=>{for(let t=2;;t++){let l="".concat(e," ").concat(t);if(!n.has(l.toLowerCase()))return l}})(t.name,new Set(u.map(e=>e.name.toLowerCase())))),[f,b]=(0,o.useState)(null!=(n=t.colony_id)?n:""),[v,k]=(0,o.useState)(!1),[w,N]=(0,o.useState)(""),C=u.some(e=>e.name.toLowerCase()===j.trim().toLowerCase()),_=async()=>{k(!0),N("");try{let e=await a.FH.post("/agents/".concat(t.id,"/clone"),{name:j.trim(),colony_id:f||null});await x(["agents","colonies"]),g(h("agent.cloned",{name:e.name})),null==m||m(e),d()}catch(e){N(e instanceof Error?e.message:String(e)),k(!1)}};return(0,l.jsxs)(r.aF,{title:h("agent.clone.title",{name:t.name}),onClose:d,children:[(0,l.jsx)(r.D0,{label:h("agent.clone.name"),error:C?h("agent.clone.taken"):w,children:(0,l.jsx)("input",{className:"input",value:j,autoFocus:!0,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j.trim()&&!C&&!v&&_()}})}),(0,l.jsx)(r.D0,{label:h("form.colony"),children:(0,l.jsxs)("select",{className:"select",value:f,onChange:e=>b(e.target.value),children:[(0,l.jsx)("option",{value:"",children:h("common.noColony")}),y.map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,l.jsxs)("ul",{className:"muted small clone-facts",children:[(0,l.jsx)("li",{children:h("agent.clone.parallel",{name:t.name})}),(0,l.jsx)("li",{children:h("agent.clone.config")}),(0,l.jsx)("li",{children:h("agent.clone.notebook",{name:t.name})}),(0,l.jsx)("li",{children:h("agent.clone.notBring",{name:t.name})})]}),(0,l.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,l.jsx)("button",{className:"btn ghost",onClick:d,children:h("common.cancel")}),(0,l.jsxs)("button",{className:"btn primary",disabled:!j.trim()||C||v,onClick:()=>void _(),children:[(0,l.jsx)(s.A,{size:14}),v?h("agent.clone.working"):h("agent.clone")]})]})]})}},89128:(e,n,t)=>{"use strict";t.d(n,{A:()=>x});var l=t(94799),o=t(34023),s=t(97356),a=t(494),i=t(10804),c=t(5300),r=t(48776),d=t(80696),m=t(48538),h=t(73506),u=t(3749),y=t(69654);function x(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{t}=(0,y.s9)(),{agents:x,colonies:g,objects:j,refresh:p}=(0,m.q5)(),f=(0,i.dj)(),b=(0,o.useMemo)(()=>e?j.filter(n=>n.manager_id===e.id).map(e=>e.id).sort():[],[j,null==e?void 0:e.id]),v=(0,o.useMemo)(()=>e?JSON.stringify((0,c.TN)(e,b)):"",[e,b]),[k,w]=(0,o.useState)(()=>e?(0,c.TN)(e,b):null),[N,C]=(0,o.useState)(!1),[_,M]=(0,o.useState)(!1),[z,S]=(0,o.useState)(!1);(0,o.useEffect)(()=>{w(e?(0,c.TN)(e,b):null)},[v]);let A=k&&e?(0,c.tf)(k,x,e.id,g):{},L=!!k&&JSON.stringify(k)!==v;(0,h.h)(L);let F=async()=>{if(k&&e){if(Object.keys(A).length)return void f(t("edit.fixFields"),"err");C(!0);try{var l;let{type_id:o,object_ids:s,...a}=k;await u.FH.patch("/agents/".concat(e.id),a),JSON.stringify([...s].sort())!==JSON.stringify(b)&&await u.FH.put("/agents/".concat(e.id,"/resources"),{object_ids:s}),await p(["agents","colonies","objects"]),f(t("edit.saved",{name:k.name.trim()})),null==(l=n.onSaved)||l.call(n)}catch(e){f(e instanceof Error?e.message:t("edit.saveFailed"),"err")}C(!1)}},D=()=>{e&&w((0,c.TN)(e,b))};return{draft:k,setDraft:w,errors:A,dirty:L,saving:N,save:F,discard:D,actions:function(){var e,n,o,i,c;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,l.jsxs)("span",{className:"foot-actions push-r",children:[(0,l.jsxs)("span",{className:"row gap-s",children:[(0,l.jsxs)("button",{className:"btn danger ".concat(null!=(e=r.size)?e:""),onClick:()=>M(!0),children:[(0,l.jsx)(s.A,{size:r.size?14:15}),t("agent.delete")]}),(0,l.jsx)("button",{className:"btn icon ".concat(null!=(n=r.size)?n:""),onClick:()=>S(!0),title:t("agent.clone.hint"),"aria-label":t("agent.clone"),children:(0,l.jsx)(a.A,{size:r.size?14:15})})]}),r.onCancel?(0,l.jsx)("button",{className:"btn ghost ".concat(null!=(o=r.size)?o:""),onClick:r.onCancel,children:t("common.cancel")}):(0,l.jsx)("button",{className:"btn ghost ".concat(null!=(i=r.size)?i:""),disabled:!L,onClick:D,children:t("common.discard")}),(0,l.jsx)("button",{className:"btn primary ".concat(null!=(c=r.size)?c:""),disabled:!L||N,onClick:F,children:N?t("common.saving"):t("common.saveChanges")})]})},deleteModal:_&&e?(0,l.jsx)(r.G,{agent:e,onClose:()=>M(!1),onDeleted:n.onDeleted}):null,cloneModal:z&&e?(0,l.jsx)(d.y,{agent:e,onClose:()=>S(!1),onCloned:n.onCloned}):null}}}},e=>{e.O(0,[586,706,642,162,281,517,350,606,587,408,89,358],()=>e(e.s=77701)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[964],{15426:(e,r,l)=>{"use strict";l.d(r,{IX:()=>u,R4:()=>h});var s=l(94799),t=l(41463),n=l.n(t),a=l(34023),i=l(494),o=l(48538),c=l(69654);function d(e){let r=(0,o.Tu)(e=>e.agents);return(0,a.useMemo)(()=>({of:e.cloned_from?r.find(r=>r.id===e.cloned_from):void 0,clones:r.filter(r=>r.cloned_from===e.id)}),[r,e.id,e.cloned_from])}function u(e){let{agent:r,link:l=!1,className:t=""}=e,{t:a}=(0,c.s9)(),{of:o}=d(r);if(!o)return null;let u=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{size:11,"aria-hidden":!0}),o.name]}),h=a("agent.cloneOf",{name:o.name});return l?(0,s.jsx)(n(),{className:"chip clone ".concat(t),href:"/agents/".concat(o.id),title:h,onClick:e=>e.stopPropagation(),children:u}):(0,s.jsx)("span",{className:"chip clone ".concat(t),title:h,children:u})}function h(e){let{agent:r}=e,{t:l}=(0,c.s9)(),{clones:t}=d(r);return t.length?(0,s.jsxs)("span",{className:"chip clone",title:l("agent.clonesList",{names:t.map(e=>e.name).join(", ")}),children:[(0,s.jsx)(i.A,{size:11,"aria-hidden":!0}),l("agent.clones.count",{count:t.length})]}):null}},27949:(e,r,l)=>{Promise.resolve().then(l.bind(l,86300))},86300:(e,r,l)=>{"use strict";l.r(r),l.d(r,{default:()=>f});var s=l(94799),t=l(34023),n=l(20831),a=l(15334);l(40117);var i=l(70665),o=l(10964),c=l(48538),d=l(77021),u=l(3749),h=l(47890),m=l(10804),x=l(15426),p=l(69654);let g=e=>{let r=h.hg[e%h.hg.length];return"color-mix(in srgb, ".concat(r," calc(100% - var(--series-mix, 0%)), white)")},j={agent:function(e){let{data:r}=e,{t:l}=(0,p.s9)(),t=r.agent;return(0,s.jsxs)("div",{className:"rnode ".concat(r.dim?"dim":""," ").concat(r.active?"active":""),children:["worker"===t.role&&(0,s.jsx)(n.h7,{type:"target",position:a.yX.Top}),(0,s.jsx)(m._h,{agent:t}),(0,s.jsx)("b",{children:t.name}),(0,s.jsx)("small",{children:"orchestrator"===t.role?l("role.orchestrator"):h.xq[t.provider].short}),(0,s.jsxs)("span",{className:"rnode-clone",children:[(0,s.jsx)(x.IX,{agent:t}),(0,s.jsx)(x.R4,{agent:t})]}),"orchestrator"===t.role&&(0,s.jsx)(n.h7,{type:"source",position:a.yX.Bottom})]})}},v={link:function(e){let{id:r,sourceX:l,sourceY:t,targetX:o,targetY:c,sourcePosition:d,targetPosition:u,data:h}=e,[m,x,p]=(0,a.Fp)({sourceX:l,sourceY:t,targetX:o,targetY:c,sourcePosition:d,targetPosition:u,curvature:.35});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.tE,{id:r,path:m,interactionWidth:26,style:{stroke:h.color,strokeWidth:h.active?4:2.5,opacity:h.dim?.15:1,transition:"opacity .15s, stroke-width .15s"}}),h.show&&(0,s.jsx)(n.rV,{children:(0,s.jsx)("button",{className:"edge-x nodrag nopan",style:{transform:"translate(-50%, -50%) translate(".concat(x,"px, ").concat(p,"px)")},onClick:h.onRemove,"aria-label":h.label,title:h.label,children:(0,s.jsx)(i.A,{size:13,strokeWidth:3})})})]})}};function f(){let{t:e,locale:r}=(0,p.s9)(),{agents:l,refresh:a,ready:h,error:x,retry:f}=(0,c.q5)(),k=(0,m.dj)(),[w,N]=(0,d.ud)("hive-rel-pos-v2",{}),[b,y]=(0,t.useState)([]),[_,C]=(0,t.useState)(null),[E,M]=(0,t.useState)(null),[F,O]=(0,t.useState)(null),[A,S]=(0,t.useState)(0),W=(0,t.useMemo)(()=>(function(e){let r=e.filter(e=>"orchestrator"===e.role),l=e.filter(e=>"worker"===e.role),s=e=>r.find(r=>r.worker_ids.includes(e.id)),t={},n=0;for(let e of r){let r=l.filter(r=>{var l;return(null==(l=s(r))?void 0:l.id)===e.id}),a=Math.max(1,r.length);r.forEach((e,r)=>t[e.id]={x:n+190*r,y:280}),t[e.id]={x:n+(a-1)*190/2,y:0},n+=190*a+114}return l.filter(e=>!s(e)).forEach((e,r)=>t[e.id]={x:n+190*r,y:280}),t})(l),[l]);(0,t.useEffect)(()=>{y(l.map(e=>{var r,l;return{id:e.id,type:"agent",position:null!=(l=null!=(r=w[e.id])?r:W[e.id])?l:{x:0,y:0},data:{agent:e,dim:!1,active:!1}}}))},[l,W,w]);let z=(0,t.useMemo)(()=>new Map(l.filter(e=>"orchestrator"===e.role).map((e,r)=>[e.id,r])),[l]),R=null!=_?_:F,T=e=>{var r,s;return null!=(s=null==(r=l.find(r=>r.id===e))?void 0:r.name)?s:"?"},L=(0,t.useCallback)(async(r,l,s)=>{try{await u.FH.put("/orchestrators/".concat(r,"/workers"),{worker_ids:l}),await a(["agents"]),k(s)}catch(r){k(r instanceof Error?r.message:e("rel.updateFailed"),"err")}},[a,k]),V=(0,t.useCallback)((r,s)=>{let t=l.find(e=>e.id===r);t&&L(r,t.worker_ids.filter(e=>e!==s),e("rel.disconnected",{worker:T(s),orchestrator:t.name}))},[l,L]),X=(0,t.useCallback)((r,s)=>{let t=l.find(e=>e.id===r);!t||t.worker_ids.includes(s)||L(r,[...t.worker_ids,s],e("rel.connected",{worker:T(s),orchestrator:t.name}))},[l,L]),I=(0,t.useMemo)(()=>l.filter(e=>"orchestrator"===e.role).flatMap(r=>r.worker_ids.map(s=>{var t,n;let a="".concat(r.id,">").concat(s),i=!!R&&(r.id===R||s===R);return{id:a,source:r.id,target:s,type:"link",animated:(null==(t=l.find(e=>e.id===s))?void 0:t.status)==="running",data:{color:g(null!=(n=z.get(r.id))?n:0),dim:!!R&&!i,active:i||E===a,show:i||E===a,label:e("rel.disconnectLabel",{worker:T(s),orchestrator:r.name}),onRemove:()=>V(r.id,s)}}})),[l,R,E,z,V,r]),P=(0,t.useMemo)(()=>{let e=new Set(R?[R]:[]);if(R)for(let r of I)(r.source===R||r.target===R)&&(e.add(r.source),e.add(r.target));return b.map(r=>({...r,selected:r.id===F,data:{...r.data,dim:!!R&&!e.has(r.id),active:r.id===R}}))},[b,I,R,F]),Z=(0,t.useCallback)(e=>{y(r=>(0,n._0)(e,r));let r=e.filter(e=>"position"===e.type&&!e.dragging&&e.position);r.length&&N(e=>{let l={...e};for(let e of r)"position"===e.type&&e.position&&(l[e.id]=e.position);return l})},[]),q=l.find(e=>e.id===F),B=l.filter(e=>"orchestrator"===e.role),H=l.filter(e=>"worker"===e.role);return(0,s.jsxs)("div",{className:"page full rel",children:[(0,s.jsxs)("div",{className:"rel-hud",children:[(0,s.jsx)("h1",{children:e("nav.relations")}),(0,s.jsx)("p",{children:e("rel.hud")})]}),(0,s.jsx)("div",{className:"rel-tools",children:(0,s.jsxs)("button",{className:"btn sm",onClick:()=>{N({}),S(e=>e+1),k(e("rel.layoutReset"))},children:[(0,s.jsx)(o.A,{size:14}),e("rel.autoArrange")]})}),h?0===l.length?(0,s.jsx)("div",{className:"rel-empty",children:(0,s.jsx)(m.pp,{title:e("rel.empty.title"),body:e("rel.empty.body")})}):(0,s.jsxs)(n.Gc,{nodes:P,edges:I,nodeTypes:j,edgeTypes:v,onNodesChange:Z,onConnect:e=>{e.source&&e.target&&X(e.source,e.target)},onNodeMouseEnter:(e,r)=>C(r.id),onNodeMouseLeave:()=>C(null),onNodeClick:(e,r)=>O(e=>e===r.id?null:r.id),onPaneClick:()=>O(null),onEdgeMouseEnter:(e,r)=>M(r.id),onEdgeMouseLeave:()=>M(null),fitView:!0,fitViewOptions:{padding:.35,maxZoom:1.1},minZoom:.3,proOptions:{hideAttribution:!0},deleteKeyCode:null,nodesConnectable:!0,children:[(0,s.jsx)(n.VS,{gap:28,color:"var(--line-strong)"}),(0,s.jsx)(n.H2,{showInteractive:!1})]},A):x?(0,s.jsx)("div",{className:"rel-empty",children:(0,s.jsx)(m.lZ,{kind:"err",children:(0,s.jsxs)("div",{className:"row gap-s wrap",children:[(0,s.jsxs)("span",{className:"grow",children:[e("cx.loadFailed")," ",x]}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>void f(),children:e("cx.retry")})]})})}):(0,s.jsx)("div",{className:"rel-empty comb-skel",role:"status","aria-label":e("cx.loading"),children:(0,s.jsx)("div",{className:"skel",style:{width:200,height:120}})}),q&&(0,s.jsxs)("aside",{className:"rel-panel card",children:[(0,s.jsxs)("div",{className:"row gap-l",children:[(0,s.jsx)(m._h,{agent:q}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"rel-panel-name",children:q.name}),(0,s.jsx)("div",{className:"muted small",children:e("role.".concat(q.role))})]}),(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:()=>O(null),"aria-label":e("common.close"),children:(0,s.jsx)(i.A,{size:16})})]}),"orchestrator"===q.role?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"eyebrow",children:e("rel.delegatesTo",{count:q.worker_ids.length})}),0===q.worker_ids.length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noWorkers")}),q.worker_ids.map(r=>(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("span",{className:"grow",children:T(r)}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>V(q.id,r),children:e("rel.disconnect")})]},r)),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&X(q.id,e.target.value),"aria-label":e("rel.connectWorker"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectWorker")}),H.filter(e=>!q.worker_ids.includes(e.id)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"eyebrow",children:e("rel.directedBy")}),0===B.filter(e=>e.worker_ids.includes(q.id)).length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noOrchestrators")}),B.filter(e=>e.worker_ids.includes(q.id)).map(r=>{var l;return(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("i",{className:"cdot cx-chip-dot",style:{background:g(null!=(l=z.get(r.id))?l:0)}}),(0,s.jsx)("span",{className:"grow",children:r.name}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>V(r.id,q.id),children:e("rel.disconnect")})]},r.id)}),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&X(e.target.value,q.id),"aria-label":e("rel.connectOrchestrator"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectOrchestrator")}),B.filter(e=>!e.worker_ids.includes(q.id)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]})]})}}},e=>{e.O(0,[48,986,586,757,281,408,89,358],()=>e(e.s=27949)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[594],{72317:(e,s,u)=>{Promise.resolve().then(u.bind(u,75750))},75750:(e,s,u)=>{"use strict";u.r(s),u.d(s,{default:()=>_});var n=u(94799),r=u(34023),t=u(84491);function _(e){let{params:s}=e,{id:u}=(0,r.use)(s);return(0,n.jsx)(t.D,{id:u})}}},e=>{e.O(0,[586,706,642,837,771,281,517,350,606,587,30,491,408,89,358],()=>e(e.s=72317)),_N_E=e.O()}]);
|
package/web/.next/static/chunks/app/resources/{page-61cccd8fdcc2f6c8.js → page-195b0af83b8ace0d.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[752],{57933:(e,s,t)=>{Promise.resolve().then(t.bind(t,89976))},89976:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>u});var r=t(94799),i=t(34023),n=t(48538),o=t(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[752],{57933:(e,s,t)=>{Promise.resolve().then(t.bind(t,89976))},89976:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>u});var r=t(94799),i=t(34023),n=t(48538),o=t(84491);function u(){var e;let{objects:s,ready:t}=(0,n.o0)(),u=null==(e=s[0])?void 0:e.id;return(0,i.useEffect)(()=>{t&&u&&window.history.replaceState(window.history.state,"","/resources/".concat(u))},[t,u]),(0,r.jsx)(o.D,{id:u})}}},e=>{e.O(0,[586,706,642,837,771,281,517,350,606,587,30,491,408,89,358],()=>e(e.s=57933)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[898],{15065:(e,s,n)=>{Promise.resolve().then(n.bind(n,25382))},25382:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>x});var t=n(94799),a=n(41463),i=n.n(a),l=n(34023),c=n(3749),r=n(48538),o=n(37064),d=n(61748),u=n(51705),m=n(10969),h=n(47890),g=n(56072),v=n(10804),p=n(69654);function x(){let{t:e,locale:s}=(0,p.s9)(),{agents:n}=(0,r.q5)(),[a,x]=(0,l.useState)(null),[j,f]=(0,l.useState)(""),[w,N]=(0,l.useState)("all"),[_,y]=(0,d.Z)("session",""),[b,k]=(0,l.useState)(!1),[E,S]=(0,l.useState)(null),[L,C]=(0,l.useState)(0),[R,M]=(0,l.useState)(100),P=(0,l.useRef)(null),q=null===a||a.some(e=>e.pending);(0,o.n)(async()=>{x(await c.FH.get("/sessions")),k(!1)},2500,{enabled:q,onError:()=>{k(!0),x(e=>null!=e?e:[])}});let F=(0,l.useMemo)(()=>_&&(null==a?void 0:a.find(e=>e.session_id===_))||null,[a,_]);(0,l.useEffect)(()=>{M(100)},[null==F?void 0:F.session_id]),(0,l.useEffect)(()=>{let e=!1;return F?(c.FH.get("/agents/".concat(F.agent_id,"/history?session=").concat(encodeURIComponent(F.session_id),"&limit=").concat(R)).then(s=>{var n;e||(S(s.messages),C(null!=(n=s.total)?n:s.messages.length))}).catch(()=>!e&&S([])),()=>{e=!0}):void S(null)},[null==F?void 0:F.agent_id,null==F?void 0:F.session_id,R]),(0,l.useEffect)(()=>{E&&100===R&&P.current&&(P.current.scrollTop=P.current.scrollHeight)},[E,R]);let O=(0,l.useMemo)(()=>(null!=a?a:[]).filter(e=>("all"===w||e.provider===w)&&(!j||"".concat(e.agent_name," ").concat(e.preview," ").concat(e.cwd).toLowerCase().includes(j.toLowerCase()))),[a,j,w]),T=(0,l.useMemo)(()=>{let e=new Map;for(let n of O){var s;let t=new Date(n.last_seen).toLocaleDateString((0,p.VR)(),{weekday:"long",day:"numeric",month:"short"});e.set(t,[...null!=(s=e.get(t))?s:[],n])}return[...e.entries()]},[O,s]),Z=F&&n.find(e=>e.id===F.agent_id),D=E?L-E.length:0;return(0,t.jsx)("div",{className:"page full",children:!b||(null==a?void 0:a.length)?a&&!a.length?(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(v.pp,{title:e("sessions.empty.title"),body:e("sessions.empty.body"),action:(0,t.jsx)(i(),{className:"btn primary",href:"/agents",children:e("sessions.empty.go")})})}):(0,t.jsxs)("div",{className:"sk-ws sx-ws",children:[(0,t.jsxs)("aside",{className:"switcher","aria-label":e("nav.sessions"),children:[(0,t.jsxs)("div",{className:"switcher-head",children:[(0,t.jsx)("b",{className:"fa-title",children:e("nav.sessions")}),(0,t.jsx)(v.DO,{value:j,onChange:f,placeholder:e("sessions.searchPlaceholder"),label:e("sessions.searchLabel")}),(0,t.jsx)(v.$q,{value:w,onChange:N,options:[{id:"all",label:e("common.all")},...Object.keys(h.xq).map(e=>({id:e,label:h.xq[e].short}))]})]}),(0,t.jsxs)("div",{className:"switcher-list",children:[null===a&&(0,t.jsx)("p",{className:"muted small pad-m",children:e("sessions.reading")}),T.map(s=>{let[n,a]=s;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"switcher-group",children:[n,(0,t.jsx)("span",{children:a.length})]}),a.map(s=>{var n;return(0,t.jsxs)("button",{className:"sk-item","aria-current":(null==F?void 0:F.session_id)===s.session_id,onClick:()=>y(s.session_id),children:[(0,t.jsxs)("div",{className:"row gap-xs",children:[(0,t.jsx)("b",{className:"grow",children:s.agent_name}),(0,t.jsx)(v.dJ,{provider:s.provider}),s.current&&(0,t.jsx)("span",{className:"chip honey",children:e("sessions.current")})]}),(0,t.jsx)("span",{className:"sk-desc",children:s.preview||(s.pending?e("sessions.counting"):s.task||e("sessions.emptySession"))}),(0,t.jsxs)("span",{className:"sk-meta",children:[(0,h.KN)(s.last_seen),"delegation"===s.kind&&" \xb7 ".concat(e("sessions.delegatedBy",{name:null!=(n=s.from_name)?n:e("chat.anOrchestrator")})),s.pending&&!s.message_count?" \xb7 …":" \xb7 ".concat(e("sessions.messages",{count:s.message_count})),(0,g.RP)(s.usage)>0&&" \xb7 ".concat((0,g.yj)((0,g.RP)(s.usage))," ").concat(e("stats.tokens")),null!==s.cost&&" \xb7 ≈ ".concat((0,g.F0)(s.cost))]})]},s.agent_id+s.session_id)})]},n)}),a&&a.length>0&&!O.length&&(0,t.jsx)("p",{className:"muted small pad-m",children:e("sessions.noMatch")})]})]}),F?(0,t.jsxs)("section",{className:"sk-main",children:[(0,t.jsxs)("header",{className:"sx-head",children:[(0,t.jsxs)("div",{className:"grow",children:[(0,t.jsx)("b",{className:"fa-title lg",children:F.agent_name}),(0,t.jsxs)("div",{className:"muted small mono sess-id",children:[(0,h._1)(F.cwd)," \xb7 ",F.session_id," ",(0,t.jsx)(m.WQ,{compact:!0,text:F.session_id,label:e("agent.sessions.copyId")})]})]}),Z&&(0,t.jsx)(i(),{className:"btn sm primary",href:"/agents/".concat(Z.id),children:e("sessions.openAgent")})]}),(0,t.jsx)("div",{className:"transcript col sx-transcript",ref:P,children:null===E?(0,t.jsx)("p",{className:"muted",children:e("sessions.loading")}):0===E.length?(0,t.jsx)("p",{className:"muted",children:e("sessions.noMessages")}):(0,t.jsxs)(t.Fragment,{children:[D>0&&(0,t.jsx)("button",{className:"btn sm push-c",onClick:()=>M(R+200),children:e("sessions.older",{count:D})}),(0,t.jsx)(u.BZ,{msgs:E,agent:{id:F.agent_id,name:F.agent_name,provider:F.provider,role:F.agent_role}})]})})]}):(0,t.jsx)("section",{className:"sk-main sk-none",children:(0,t.jsx)("p",{className:"muted",children:e("sessions.select")})})]}):(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(v.lZ,{kind:"err",children:e("fa.sessions.loadFailed")})})})}},37064:(e,s,n)=>{"use strict";n.d(s,{n:()=>a});var t=n(34023);function a(e,s){let{enabled:n=!0,pauseHidden:a=!0,immediate:i=!0,onError:l}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=(0,t.useRef)(e);c.current=e;let r=(0,t.useRef)(l);r.current=l,(0,t.useEffect)(()=>{let e;if(!n)return;let t=!1,l=0,o=!1,d=()=>{clearTimeout(e),t||(e=setTimeout(()=>void u(),s*Math.min(6,2**l)))},u=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t&&!o){if(!e&&a&&"undefined"!=typeof document&&"hidden"===document.visibilityState)return void d();o=!0;try{await c.current(),l=0}catch(e){var s;0==l++&&(null==(s=r.current)||s.call(r,e))}finally{o=!1,d()}}},m=()=>{"visible"!==document.visibilityState||o||(clearTimeout(e),u())};return i?u(!0):d(),a&&document.addEventListener("visibilitychange",m),()=>{t=!0,clearTimeout(e),document.removeEventListener("visibilitychange",m)}},[s,n,a,i])}},61748:(e,s,n)=>{"use strict";n.d(s,{Z:()=>i});var t=n(34023);let a="hive-am:query";function i(e,s){let[n,i]=(0,t.useState)(s);return(0,t.useEffect)(()=>{let n=()=>{var n;return i(null!=(n=new URLSearchParams(location.search).get(e))?n:s)};return n(),window.addEventListener("popstate",n),window.addEventListener(a,n),()=>{window.removeEventListener("popstate",n),window.removeEventListener(a,n)}},[e,s]),[n,(0,t.useCallback)(n=>{let t=new URL(location.href);n===s?t.searchParams.delete(e):t.searchParams.set(e,n),history.replaceState(history.state,"",t),i(n),window.dispatchEvent(new Event(a))},[e,s])]}}},e=>{e.O(0,[586,706,654,281,350,705,408,89,358],()=>e(e.s=15065)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[192],{3492:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]])},11108:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>m});var a=s(94799),l=s(34023),n=s(92947),d=s(97356),i=s(48538),r=s(3749),c=s(47890),p=s(10804),y=s(5300),h=s(1517),o=s(69654),u=s(73506);function m(){let{t:e}=(0,o.s9)(),{types:t,agents:s,refresh:m,ready:x}=(0,i.o0)(),k=(0,p.dj)(),[j,v]=(0,l.useState)(null),[b,M]=(0,l.useState)(null),[f,A]=(0,l.useState)(""),[N,g]=(0,l.useState)(null),[C,w]=(0,l.useState)(null),[z,_]=(0,l.useState)(!1),q=(0,l.useRef)(""),S=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;q.current=JSON.stringify(e),v(e),M(t),A("")},H=!!j&&JSON.stringify(j)!==q.current;(0,u.h)(H);let L=()=>{H?_(!0):v(null)},T=async()=>{if(j){if(!j.name.trim())return void A(e("types.err.name"));try{b?await r.FH.patch("/types/".concat(b),(0,y.hW)(j)):await r.FH.post("/types",(0,y.hW)(j)),await m(["types"]),k(b?e("types.updated"):e("types.created")),v(null),A("")}catch(t){A(t instanceof Error?t.message:e("edit.saveFailed"))}}};return(0,a.jsxs)("div",{className:"page",children:[(0,a.jsxs)("div",{className:"page-head",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{children:e("nav.types")}),(0,a.jsx)("p",{children:e("types.subtitle")})]}),(0,a.jsxs)("button",{className:"btn primary",onClick:()=>S((0,y.x_)()),children:[(0,a.jsx)(n.A,{size:16}),e("types.new")]})]}),x&&!t.length?(0,a.jsx)(p.pp,{title:e("types.empty.title"),body:e("types.empty.body"),action:(0,a.jsxs)("button",{className:"btn primary",onClick:()=>S((0,y.x_)()),children:[(0,a.jsx)(n.A,{size:16}),e("types.empty.create")]})}):(0,a.jsx)("div",{className:"typegrid",children:t.map(t=>{let l=s.filter(e=>e.type_id===t.id).length;return(0,a.jsxs)("div",{className:"card typecard",children:[(0,a.jsxs)("div",{className:"row gap-l",children:[(0,a.jsx)(p._h,{color:c.xq[t.provider].color,queen:"orchestrator"===t.role,label:t.name.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("h3",{className:"fa-card-title",children:t.name}),(0,a.jsx)("div",{className:"row gap-s mt-xs",children:(0,a.jsx)(p.PW,{role:t.role})})]})]}),(0,a.jsx)("p",{className:"muted small m0 fa-desc",children:t.description||e("types.noDescription")}),(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsx)("span",{className:"chip",children:c.xq[t.provider].label}),(0,a.jsx)("span",{className:"chip",children:t.model||e("types.defaultModel")}),(0,a.jsx)("span",{className:"chip",children:e("types.skillsCount",{count:t.skill_ids.length})})]}),(0,a.jsxs)("div",{className:"row mt-xs",children:[(0,a.jsx)("span",{className:"muted small grow",children:e("types.usedBy",{count:l})}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>S((0,y.x_)(t),t.id),children:e("common.edit")}),(0,a.jsx)("button",{className:"btn sm primary",onClick:()=>w(t.id),children:e("newAgent.create")})]})]},t.id)})}),j&&(0,a.jsx)(p._s,{title:b?e("types.editTitle",{name:j.name||e("types.typeWord")}):e("types.newTitle"),subtitle:e("types.drawerSubtitle"),onClose:L,footer:(0,a.jsxs)(a.Fragment,{children:[b&&(0,a.jsxs)("button",{className:"btn danger push-r",onClick:()=>{var e;return g(null!=(e=t.find(e=>e.id===b))?e:null)},children:[(0,a.jsx)(d.A,{size:15}),e("common.delete")]}),(0,a.jsx)("button",{className:"btn ghost",onClick:L,children:e("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",onClick:T,children:b?e("types.save"):e("types.create")})]}),children:(0,a.jsx)(y.SU,{mode:"type",draft:j,onChange:v,errors:{name:f},focusName:!0})}),N&&(0,a.jsx)(p.TM,{danger:!0,title:e("types.deleteTitle",{name:N.name}),body:e("types.deleteBody"),cancelLabel:e("types.keep"),confirmLabel:e("types.delete"),onClose:()=>g(null),onConfirm:async()=>{await r.FH.del("/types/".concat(N.id)),await m(["types","agents"]),v(null),k(e("types.deleted"))}}),z&&(0,a.jsx)(p.TM,{danger:!0,title:e("fa.unsaved.title"),body:e("fa.unsaved.body"),confirmLabel:e("fa.unsaved.discard"),cancelLabel:e("fa.unsaved.keep"),onClose:()=>_(!1),onConfirm:()=>v(null)}),C&&(0,a.jsx)(h.bC,{presetTypeId:C,onClose:()=>w(null)})]})}},20555:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]])},32021:(e,t,s)=>{Promise.resolve().then(s.bind(s,11108))},52263:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])},55712:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])},55838:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},71529:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},91833:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]])},92947:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},98148:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]])},98938:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},99579:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});let a=(0,s(74955).A)("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]])}},e=>{e.O(0,[586,706,281,517,408,89,358],()=>e(e.s=32021)),_N_E=e.O()}]);
|