hive-am 1.2.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/README.md +19 -0
  3. package/package.json +1 -1
  4. package/server/dist/context.js +62 -0
  5. package/server/dist/db/migrations.js +7 -0
  6. package/server/dist/db.js +4 -4
  7. package/server/dist/history/claude.js +8 -2
  8. package/server/dist/http/routes/agents.js +1 -1
  9. package/server/dist/http/validate.js +2 -0
  10. package/server/dist/instructions.js +4 -0
  11. package/server/dist/models.js +2 -0
  12. package/server/dist/objects/index.js +4 -6
  13. package/server/dist/objects/runner.js +20 -0
  14. package/server/dist/objects/supervisor.js +2 -2
  15. package/server/dist/providers/claude.js +13 -1
  16. package/server/dist/providers/opencode-server.js +59 -0
  17. package/server/dist/providers/opencode.js +4 -1
  18. package/server/dist/stats.js +15 -3
  19. package/web/.next/BUILD_ID +1 -1
  20. package/web/.next/app-build-manifest.json +80 -71
  21. package/web/.next/app-path-routes-manifest.json +6 -5
  22. package/web/.next/build-manifest.json +2 -2
  23. package/web/.next/prerender-manifest.json +73 -49
  24. package/web/.next/routes-manifest.json +6 -0
  25. package/web/.next/server/app/_not-found/page.js +1 -1
  26. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  27. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  28. package/web/.next/server/app/_not-found.html +1 -1
  29. package/web/.next/server/app/_not-found.rsc +3 -3
  30. package/web/.next/server/app/agents/[id]/page.js +4 -4
  31. package/web/.next/server/app/agents/[id]/page.js.nft.json +1 -1
  32. package/web/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
  33. package/web/.next/server/app/agents/page.js +1 -1
  34. package/web/.next/server/app/agents/page.js.nft.json +1 -1
  35. package/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  36. package/web/.next/server/app/agents.html +1 -1
  37. package/web/.next/server/app/agents.rsc +4 -4
  38. package/web/.next/server/app/chat/page.js +2 -0
  39. package/web/.next/server/app/chat/page.js.nft.json +1 -0
  40. package/web/.next/server/app/chat/page_client-reference-manifest.js +1 -0
  41. package/web/.next/server/app/chat.html +1 -0
  42. package/web/.next/server/app/chat.meta +15 -0
  43. package/web/.next/server/app/chat.rsc +25 -0
  44. package/web/.next/server/app/connections/page.js +1 -1
  45. package/web/.next/server/app/connections/page.js.nft.json +1 -1
  46. package/web/.next/server/app/connections/page_client-reference-manifest.js +1 -1
  47. package/web/.next/server/app/connections.html +1 -1
  48. package/web/.next/server/app/connections.rsc +4 -4
  49. package/web/.next/server/app/index.html +1 -1
  50. package/web/.next/server/app/index.rsc +4 -4
  51. package/web/.next/server/app/page.js +1 -1
  52. package/web/.next/server/app/page.js.nft.json +1 -1
  53. package/web/.next/server/app/page_client-reference-manifest.js +1 -1
  54. package/web/.next/server/app/relations/page.js +2 -2
  55. package/web/.next/server/app/relations/page.js.nft.json +1 -1
  56. package/web/.next/server/app/relations/page_client-reference-manifest.js +1 -1
  57. package/web/.next/server/app/relations.html +1 -1
  58. package/web/.next/server/app/relations.rsc +4 -4
  59. package/web/.next/server/app/resources/[id]/page.js +2 -2
  60. package/web/.next/server/app/resources/[id]/page.js.nft.json +1 -1
  61. package/web/.next/server/app/resources/[id]/page_client-reference-manifest.js +1 -1
  62. package/web/.next/server/app/resources/page.js +2 -2
  63. package/web/.next/server/app/resources/page.js.nft.json +1 -1
  64. package/web/.next/server/app/resources/page_client-reference-manifest.js +1 -1
  65. package/web/.next/server/app/resources.html +1 -1
  66. package/web/.next/server/app/resources.rsc +4 -4
  67. package/web/.next/server/app/schedules/page.js +1 -1
  68. package/web/.next/server/app/schedules/page.js.nft.json +1 -1
  69. package/web/.next/server/app/schedules/page_client-reference-manifest.js +1 -1
  70. package/web/.next/server/app/schedules.html +1 -1
  71. package/web/.next/server/app/schedules.rsc +4 -4
  72. package/web/.next/server/app/sessions/page.js +2 -2
  73. package/web/.next/server/app/sessions/page.js.nft.json +1 -1
  74. package/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  75. package/web/.next/server/app/sessions.html +1 -1
  76. package/web/.next/server/app/sessions.rsc +4 -4
  77. package/web/.next/server/app/skills/page.js +1 -1
  78. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  79. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  80. package/web/.next/server/app/skills.html +1 -1
  81. package/web/.next/server/app/skills.rsc +4 -4
  82. package/web/.next/server/app/types/page.js +1 -1
  83. package/web/.next/server/app/types/page.js.nft.json +1 -1
  84. package/web/.next/server/app/types/page_client-reference-manifest.js +1 -1
  85. package/web/.next/server/app/types.html +1 -1
  86. package/web/.next/server/app/types.rsc +4 -4
  87. package/web/.next/server/app-paths-manifest.json +6 -5
  88. package/web/.next/server/chunks/143.js +1 -1
  89. package/web/.next/server/chunks/148.js +1 -0
  90. package/web/.next/server/chunks/213.js +6 -0
  91. package/web/.next/server/chunks/274.js +1 -1
  92. package/web/.next/server/chunks/368.js +1 -0
  93. package/web/.next/server/chunks/403.js +1 -0
  94. package/web/.next/server/chunks/{790.js → 435.js} +2 -2
  95. package/web/.next/server/chunks/505.js +1 -6
  96. package/web/.next/server/chunks/612.js +1 -1
  97. package/web/.next/server/chunks/716.js +2 -2
  98. package/web/.next/server/pages/404.html +1 -1
  99. package/web/.next/server/pages/500.html +1 -1
  100. package/web/.next/server/server-reference-manifest.json +1 -1
  101. package/web/.next/static/YT6HM6qmegMJaBMX5QvuP/_buildManifest.js +1 -0
  102. package/web/.next/static/chunks/281-113274e705940a55.js +1 -0
  103. package/web/.next/static/chunks/350-0fe82e622e7a670f.js +1 -0
  104. package/web/.next/static/chunks/391-18768499e741112e.js +1 -0
  105. package/web/.next/static/chunks/517-373a80c8ba432bdc.js +1 -0
  106. package/web/.next/static/chunks/587-8e4d2be01ba7d48f.js +1 -0
  107. package/web/.next/static/chunks/606-c9a19918b02a98d0.js +1 -0
  108. package/web/.next/static/chunks/654-92a63b3c4b412666.js +1 -0
  109. package/web/.next/static/chunks/656-f537149fe28f79aa.js +1 -0
  110. package/web/.next/static/chunks/705-f81face97b1bb1af.js +1 -0
  111. package/web/.next/static/chunks/app/agents/[id]/page-6ed6edb3e74b0ebe.js +1 -0
  112. package/web/.next/static/chunks/app/agents/{page-f4c4c80f955f3967.js → page-9bb8cba69776c719.js} +1 -1
  113. package/web/.next/static/chunks/app/chat/page-5261b12b7d50f5d1.js +1 -0
  114. package/web/.next/static/chunks/app/connections/{page-0936beaf02d863c6.js → page-eb11cfb1ffeab3ca.js} +1 -1
  115. package/web/.next/static/chunks/app/layout-fad968a635f9a4b3.js +1 -0
  116. package/web/.next/static/chunks/app/page-99e0351e6ccaa384.js +1 -0
  117. package/web/.next/static/chunks/app/relations/{page-fba25393c8688714.js → page-a44fd515a3b0525e.js} +1 -1
  118. package/web/.next/static/chunks/app/resources/[id]/{page-d110d89bb8b5fca7.js → page-fc494e85b01e8cb7.js} +1 -1
  119. package/web/.next/static/chunks/app/resources/{page-bbd0b450d3f3131d.js → page-61cccd8fdcc2f6c8.js} +1 -1
  120. package/web/.next/static/chunks/app/schedules/{page-a1124397fc760413.js → page-96976fff4ee23538.js} +1 -1
  121. package/web/.next/static/chunks/app/sessions/{page-0e322811b0cde724.js → page-a7534ebd90e982d6.js} +1 -1
  122. package/web/.next/static/chunks/app/skills/{page-22ea0ef89d9f7a13.js → page-bc1acd0663f36129.js} +1 -1
  123. package/web/.next/static/chunks/app/types/{page-18c4e1db2724d41d.js → page-ebd37e220f77c1f3.js} +1 -1
  124. package/web/.next/static/css/582723fcea1f9887.css +1 -0
  125. package/web/.next/trace +30 -29
  126. package/web/.next/types/app/chat/page.ts +84 -0
  127. package/web/.next/types/routes.d.ts +2 -1
  128. package/web/.next/types/validator.ts +9 -0
  129. package/web/.next/server/chunks/306.js +0 -1
  130. package/web/.next/server/chunks/555.js +0 -1
  131. package/web/.next/server/chunks/638.js +0 -1
  132. package/web/.next/server/chunks/802.js +0 -1
  133. package/web/.next/static/7BI__-ayGDTlOrSboD_bT/_buildManifest.js +0 -1
  134. package/web/.next/static/chunks/176-aeaf907a6ea5627d.js +0 -1
  135. package/web/.next/static/chunks/291-efae53ea5f7ee92d.js +0 -1
  136. package/web/.next/static/chunks/350-56599dc3bf06066d.js +0 -1
  137. package/web/.next/static/chunks/486-13e08542f3a1cbac.js +0 -1
  138. package/web/.next/static/chunks/491-6b4e6201f5110dff.js +0 -1
  139. package/web/.next/static/chunks/517-ccaf8cc5c733cbd8.js +0 -1
  140. package/web/.next/static/chunks/581-3ad5c4343dad3f50.js +0 -1
  141. package/web/.next/static/chunks/705-c7e75806f77b880c.js +0 -1
  142. package/web/.next/static/chunks/839-4aefe6e71be6e1ef.js +0 -1
  143. package/web/.next/static/chunks/844-fe55292e0701f436.js +0 -1
  144. package/web/.next/static/chunks/app/agents/[id]/page-3faf40800981a736.js +0 -1
  145. package/web/.next/static/chunks/app/layout-99620746d028dda8.js +0 -1
  146. package/web/.next/static/chunks/app/page-a7f292117b7d76bf.js +0 -1
  147. package/web/.next/static/css/b7a03c62468f4263.css +0 -1
  148. /package/web/.next/static/{7BI__-ayGDTlOrSboD_bT → YT6HM6qmegMJaBMX5QvuP}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{5506:(e,t,n)=>{"use strict";n.d(t,{Shell:()=>W});var l=n(94799),a=n(41463),s=n.n(a),r=n(43624),i=n(34023),o=n(84616),c=n(87454),d=n(6261),u=n(29416),h=n(26701),m=n(74955);let v=(0,m.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 k=n(15223),y=n(54234),p=n(73784);let b=(0,m.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 x=n(68449),g=n(70283);let f=(0,m.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"}]]),j=(0,m.A)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);var w=n(77021),A=n(54609),N=n(48538),M=n(69654),E=n(10804);function z(){let[e,t]=(0,i.useState)(null),[n,a]=(0,i.useState)(null),s=(0,i.useRef)(null);return((0,i.useEffect)(()=>{let e,n=null,l=()=>{clearTimeout(e),n=null,t(null),a(null)},s=e=>e instanceof Element?e.closest("[title],[data-tip]"):null,r=function(a){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!a||a===n)return;l();let r=(e=>{var t,n;let l=e.getAttribute("title");return null!==l&&(e.removeAttribute("title"),l.trim()&&(e.dataset.tip=l,e.getAttribute("aria-label")||(null==(t=e.textContent)?void 0:t.trim())||e.setAttribute("aria-label",l))),null!=(n=e.dataset.tip)?n:""})(a);if(!r)return;n=a;let i=()=>{n===a&&a.isConnected&&t({text:r,rect:a.getBoundingClientRect()})};s?i():e=setTimeout(i,350)},i=e=>r(s(e.target)),o=e=>{n&&!(e.relatedTarget instanceof Node&&n.contains(e.relatedTarget))&&l()},c=e=>{let t=s(e.target);t&&t.matches(":focus-visible")&&r(t,!0)},d=e=>{"Escape"===e.key&&l()};return document.addEventListener("mouseover",i),document.addEventListener("mouseout",o),document.addEventListener("focusin",c),document.addEventListener("focusout",l),document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",d),window.addEventListener("scroll",l,!0),window.addEventListener("blur",l),()=>{l(),document.removeEventListener("mouseover",i),document.removeEventListener("mouseout",o),document.removeEventListener("focusin",c),document.removeEventListener("focusout",l),document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",d),window.removeEventListener("scroll",l,!0),window.removeEventListener("blur",l)}},[]),(0,i.useLayoutEffect)(()=>{if(!e||!s.current)return;let{width:t,height:n}=s.current.getBoundingClientRect(),l=e.rect.top-n-8<8;a({left:Math.min(Math.max(8,e.rect.left+e.rect.width/2-t/2),window.innerWidth-t-8),top:l?e.rect.bottom+8:e.rect.top-n-8,below:l})},[e]),e)?(0,l.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 C=n(42162),S=n(19431),L=n(70665),H=n(92947),_=n(80306),T=n(12349),F=n(75010);n(21169);var P=n(69538);let O=(e,t)=>getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t,q=()=>({background:O("--bg-deep","#0c1411"),foreground:O("--ink","#e7eee9"),cursor:O("--honey","#e8a317"),cursorAccent:O("--bg-deep","#0c1411"),selectionBackground:"rgba(232,163,23,.35)"});function R(e){let{id:t,visible:a,onEnded:s}=e,{t:r}=(0,M.s9)(),o=(0,i.useRef)(null),c=(0,i.useRef)(null),d=(0,i.useRef)(a);return d.current=a,(0,i.useEffect)(()=>{let e=!1,l=null,a,i=!1,u=0,h=null,m=null,v=null,k=null,y=e=>{(null==l?void 0:l.readyState)===WebSocket.OPEN&&l.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:O("--font-mono","ui-monospace, monospace"),fontSize:13,lineHeight:1.15,cursorBlink:!0,scrollback:5e3,theme:q(),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=q())})).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let j=()=>{var n;(l=new WebSocket("".concat("ws://".concat(location.hostname,":").concat(null!=(n=P.env.NEXT_PUBLIC_HIVE_WS_PORT)?n:4400,"/ws/terminal"),"?id=").concat(encodeURIComponent(t)))).onopen=()=>{u=0},l.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))},l.onclose=()=>{e||i||(a=setTimeout(j,Math.min(5e3,600*2**u++)))}};j()})(),()=>{e=!0,clearTimeout(a),null==v||v.disconnect(),null==k||k.disconnect(),null==l||l.close(),null==h||h.dispose(),c.current=null}},[t]),(0,i.useEffect)(()=>{if(a){let e=setTimeout(()=>{var e,t;null==(e=c.current)||e.fit(),null==(t=c.current)||t.focus()},30);return()=>clearTimeout(e)}},[a]),(0,l.jsx)("div",{className:"xterm-box",ref:o})}let V=e=>"dock-tab-".concat(e);function I(){var e;let{t}=(0,M.s9)(),n=(0,C.n)(),[a,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,l.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,l.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,l.jsxs)("div",{className:"dock-bar",children:[(0,l.jsx)("div",{className:"dock-tabs",role:"tablist","aria-label":t("dock.title"),onKeyDown:e=>{var t;let l=n.tabs.map(e=>e.key),a=l.indexOf(null!=(t=n.active)?t:""),s=null;if("ArrowRight"===e.key)s=(a+1)%l.length;else if("ArrowLeft"===e.key)s=(a-1+l.length)%l.length;else if("Home"===e.key)s=0;else if("End"===e.key)s=l.length-1;else if("Delete"===e.key&&a>=0){e.preventDefault(),n.closeTab(l[a]);return}null!==s&&l.length&&(e.preventDefault(),n.setActive(l[s]),requestAnimationFrame(()=>{var e;return null==(e=document.getElementById(V(l[s])))?void 0:e.focus()}))},children:n.tabs.map(e=>{var a;let s=n.active===e.key,r=V(e.key);return(0,l.jsxs)("div",{className:"dock-tabwrap ".concat(s?"on":""),children:[(0,l.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,l.jsx)(g.A,{size:14}):(0,l.jsx)(S.A,{size:14}),(0,l.jsx)("span",{className:"nm",children:e.title}),"term"===e.kind&&void 0!==e.ended&&(0,l.jsx)("i",{className:"odot off",title:t("dock.ended",{code:null!=(a=e.ended)?a:""})})]}),(0,l.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,l.jsx)(L.A,{size:12})})]},e.key)})}),n.enabled&&(0,l.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,l.jsx)(H.A,{size:15})}),n.enabled&&(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>s(null!=c?c:""),"aria-label":t("dock.inFolder"),title:t("dock.inFolder"),children:(0,l.jsx)(_.A,{size:15})}),(0,l.jsx)("span",{className:"grow"}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>n.setOpen(!1),"aria-label":t("dock.hide"),title:"".concat(t("dock.hide")," (Ctrl+`)"),children:(0,l.jsx)(T.A,{size:15})})]}),(0,l.jsxs)("div",{className:"dock-body",children:[n.error&&(0,l.jsx)("p",{className:"gx-note err gx-hint-row",role:"alert",children:n.error}),!n.enabled&&!n.tabs.length&&(0,l.jsx)("p",{className:"gx-note",children:t("dock.disabled")}),n.enabled&&!n.tabs.length&&!n.error&&(0,l.jsx)("p",{className:"gx-note",children:t("dock.empty")}),n.tabs.map(e=>(0,l.jsx)("div",{id:"".concat(V(e.key),"-panel"),role:"tabpanel","aria-labelledby":V(e.key),className:"dock-pane",hidden:n.active!==e.key,children:"term"===e.kind?(0,l.jsx)(R,{id:e.id,visible:n.open&&n.active===e.key,onEnded:t=>n.markEnded(e.key,t)}):n.open&&(0,l.jsx)("div",{className:"dock-logpane",children:(0,l.jsx)(F.I,{id:e.objectId,height:"100%"})})},e.key))]}),null!==a&&(0,l.jsxs)(E.aF,{title:t("dock.inFolder"),onClose:()=>s(null),children:[(0,l.jsx)(E.dR,{value:a,onChange:s,label:t("obj.f.folder"),hint:t("dock.folder.hint")}),(0,l.jsxs)("div",{className:"row confirm-actions",children:[(0,l.jsx)("button",{className:"btn ghost",onClick:()=>s(null),children:t("common.cancel")}),(0,l.jsx)("button",{className:"btn primary",disabled:!a.startsWith("/"),onClick:()=>{s(null),n.openTerminal({cwd:a})},children:t("dock.open")})]})]})]})}function B(){return(0,l.jsx)("img",{src:"/icon.png",width:34,height:34,alt:"","aria-hidden":!0,className:"brand-mark"})}function D(){let{locale:e,setLocale:t,t:n}=(0,M.s9)();return(0,l.jsxs)("div",{className:"lang-row",role:"group","aria-label":n("lang.label"),children:[(0,l.jsx)(o.A,{size:15,"aria-hidden":!0}),(0,l.jsx)("div",{className:"seg",children:M.YZ.map(n=>(0,l.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 K(){let e=(0,r.usePathname)(),{t}=(0,M.s9)(),{agents:n,types:a,skills:o,connections:m,objects:E,connected:z}=(0,N.o0)(),S=(0,C.n)(),[L,H]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=document.documentElement,t=()=>H("dark"===e.dataset.theme);t();let n=new MutationObserver(t);return n.observe(e,{attributes:!0,attributeFilter:["data-theme"]}),()=>n.disconnect()},[]);let _=n.filter(e=>"running"===e.status).length,[T]=(0,w.ud)(A.O,""),F=n.some(e=>e.id===T)?"/agents/".concat(T):n[0]?"/agents/".concat(n[0].id):"/chat",P=(t,n,a,r,i)=>{let o=null!=i?i:"/"===t?"/"===e:e.startsWith(t);return(0,l.jsxs)(s(),{href:t,className:"nav","aria-current":o?"page":void 0,children:[a,(0,l.jsx)("span",{className:"t",children:n}),void 0!==r&&(0,l.jsx)("span",{className:"count",children:r})]},n)};return(0,l.jsxs)("nav",{className:"rail","aria-label":t("nav.main"),children:[(0,l.jsxs)("div",{className:"brand",children:[(0,l.jsx)(B,{}),(0,l.jsxs)("div",{children:["hive-am",(0,l.jsx)("small",{children:t("app.tagline")})]})]}),(0,l.jsx)(D,{}),P(F,t("nav.chat"),(0,l.jsx)(c.A,{size:18}),void 0,e.startsWith("/agents/")||"/chat"===e),P("/",t("nav.colony"),(0,l.jsx)(d.A,{size:18}),_||void 0),P("/resources",t("nav.objects"),(0,l.jsx)(u.A,{size:18}),E.length||void 0),P("/agents",t("nav.agents"),(0,l.jsx)(h.A,{size:18}),n.length,"/agents"===e),P("/relations",t("nav.relations"),(0,l.jsx)(v,{size:18})),P("/connections",t("nav.connections"),(0,l.jsx)(k.A,{size:18}),m.length||void 0),P("/schedules",t("nav.schedules"),(0,l.jsx)(y.A,{size:18})),(0,l.jsx)("div",{className:"nav-label",children:t("nav.library")}),P("/types",t("nav.types"),(0,l.jsx)(p.A,{size:18}),a.length),P("/skills",t("nav.skills"),(0,l.jsx)(b,{size:18}),o.length),(0,l.jsx)("div",{className:"nav-label",children:t("nav.history")}),P("/sessions",t("nav.sessions"),(0,l.jsx)(x.A,{size:18})),(0,l.jsxs)("div",{className:"rail-foot",children:[(0,l.jsxs)("button",{type:"button",className:"nav",onClick:S.toggle,"aria-pressed":S.open,title:"".concat(t("dock.nav")," (Ctrl+`)"),children:[(0,l.jsx)(g.A,{size:18}),(0,l.jsx)("span",{className:"t",children:t("dock.nav")}),S.tabs.length>0&&(0,l.jsx)("span",{className:"count",children:S.tabs.length})]}),(0,l.jsxs)("div",{className:"conn",children:[(0,l.jsx)("i",{className:"dot ".concat(z?"ok":"err")}),t(z?"nav.connected":"nav.offline")]}),(0,l.jsxs)("button",{type:"button",className:"nav",onClick:()=>{let e=L?"light":"dark";document.documentElement.dataset.theme=e;try{localStorage.setItem("hive-theme",e)}catch(e){}},"aria-pressed":L,children:[L?(0,l.jsx)(f,{size:18}):(0,l.jsx)(j,{size:18}),(0,l.jsx)("span",{className:"t",children:t("nav.switchTheme")})]})]})]})}function W(e){let{children:t}=e;return(0,l.jsx)(M.CY,{children:(0,l.jsx)(N.Of,{children:(0,l.jsx)(C.$,{children:(0,l.jsxs)(E.l$,{children:[(0,l.jsx)(z,{}),(0,l.jsxs)("div",{className:"shell",children:[(0,l.jsx)(K,{}),(0,l.jsx)("main",{className:"main",children:t})]}),(0,l.jsx)(I,{})]})})})})}},6261:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});let l=(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:()=>l});let l=(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:()=>l});let l=(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:()=>l});let l=(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:()=>l});let l=(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"}]])},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 l=n(94799),a=n(34023),s=n(3749),r=n(69654);let i=(0,a.createContext)(null),o=()=>{let e=(0,a.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,a.useState)(!1),[h,m]=(0,a.useState)(320),[v,k]=(0,a.useState)([]),[y,p]=(0,a.useState)(null),[b,x]=(0,a.useState)(!0),[g,f]=(0,a.useState)(""),j=(0,a.useRef)(!1);(0,a.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,a.useEffect)(()=>{if(j.current)try{localStorage.setItem(c,JSON.stringify({open:o,height:h,active:y}))}catch(e){}},[o,h,y]),(0,a.useEffect)(()=>{document.documentElement.style.setProperty("--app-h",o?"calc(100vh - ".concat(h,"px)"):"100vh")},[o,h]);let w=(0,a.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,a.useCallback)((e,t)=>{let n="l:".concat(e);k(l=>l.some(e=>e.key===n)?l:[...l,{key:n,kind:"logs",objectId:e,title:t}]),p(n),u(!0)},[]),N=(0,a.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 l=t.filter(t=>t.key!==e);return p(t=>{var n,a;return t===e?null!=(a=null==(n=l[l.length-1])?void 0:n.key)?a:null:t}),l})},[]),M=(0,a.useCallback)((e,t)=>k(n=>n.map(n=>n.key===e&&"term"===n.kind?{...n,ended:null!=t?t:0}:n)),[]),E=(0,a.useCallback)(()=>{if(o)return void u(!1);u(!0),!v.length&&b&&w()},[o,v.length,b,w]);(0,a.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,a.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,l.jsx)(i.Provider,{value:z,children:t})}},54234:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});let l=(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:()=>l});let l="hive-am.lastChat"},64883:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});let l=(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:()=>l});let l=(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"}]])},70283:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});let l=(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:()=>l});let l=(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 l=n(94799),a=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,a.useState)(null),m=(0,a.useRef)(""),v=(0,a.useRef)(null),k=(0,a.useRef)(!0),[y,p]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!1,n;h(null),m.current="",k.current=!0,p(!1);let l=async()=>{try{let n=m.current?"after=".concat(encodeURIComponent(m.current)):"tail=300",l=await i.FH.get("/objects/".concat(t,"/logs?").concat(n));if(e)return;m.current=l.cursor||m.current;let a=l.text.replace(c,"");h(e=>{let t=l.reset?"":null!=e?e:"";if(!a)return null!=e?e:"";let n=!t||t.endsWith("\n")||a.startsWith("\n")?t+a:"".concat(t,"\n").concat(a);return n.length>2e5?n.slice(n.length-2e5):n})}catch(e){}e||(n=setTimeout(l,1200))};return l(),()=>{e=!0,clearTimeout(n)}},[t]),(0,a.useEffect)(()=>{let e=v.current;e&&k.current&&(e.scrollTop=e.scrollHeight)},[u]),(0,l.jsxs)("div",{className:"logv",children:[(0,l.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,l.jsxs)("div",{className:"logv-tools",children:[y&&(0,l.jsxs)("button",{className:"btn sm",onClick:()=>{let e=v.current;e&&(e.scrollTop=e.scrollHeight,k.current=!0,p(!1))},children:[(0,l.jsx)(s.A,{size:14}),d("obj.logs.bottom")]}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>h(""),"aria-label":d("obj.logs.clear"),title:d("obj.logs.clear"),children:(0,l.jsx)(r.A,{size:14})})]})]})}},80306:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});let l=(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:()=>l});let l=(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:()=>l});let l=(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,5506)),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:()=>l});let l=(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:()=>l});let l=(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],{6261:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});let l=(0,t(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"}]])},32098:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});let l=(0,t(74955).A)("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]])},36098:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>G});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);let g=(0,t(74955).A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var p=t(97356),j=t(48538),f=t(77021),b=t(3749),v=t(47890),k=t(10804),w=t(41435),N=t(1517),C=t(12646),_=t(73506),M=t(22214),A=t(69654);let z=v.hg,S=["cwd","permission","skills","prompt"];function L(e){let{colony:n,onClose:t}=e,{t:o}=(0,A.s9)(),{agents:s,skills:i,colonies:c,refresh:r}=(0,j.q5)(),d=(0,k.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:z[c.length%z.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,_.h)(y);let[x,g]=(0,a.useState)(!1),f=()=>{y?g(!0):t()},[v,w]=(0,a.useState)(""),[N,S]=(0,a.useState)(!1),[L,D]=(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 b.FH.patch("/colonies/".concat(n.id),l):await b.FH.post("/colonies",l),await r(["agents","colonies"]),d(n?o("colony.saved"):o("colony.created")),t()}catch(e){S(!1),w(e instanceof Error?e.message:o("edit.saveFailed")),T(!1)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(k._s,{title:n?o("colony.editTitle",{name:n.name}):o("colony.newTitle"),subtitle:o("colony.subtitle"),onClose:f,footer:(0,l.jsxs)(l.Fragment,{children:[n&&(0,l.jsxs)("button",{className:"btn danger push-r",onClick:()=>D(!0),children:[(0,l.jsx)(p.A,{size:15}),o("common.delete")]}),(0,l.jsx)("button",{className:"btn ghost",onClick:f,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 w(o("colony.err.nameTaken")):/^#[0-9a-f]{6}$/i.test(m.color)?void(w(""),S(!0)):void w(o("colony.err.color")):void w(o("colony.err.name")),children:n?o("colony.save"):o("colony.create")})]}),children:[(0,l.jsx)(k.D0,{label:o("form.name"),error:v,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)(k.D0,{label:o("colony.color"),children:(0,l.jsxs)("div",{className:"swatches",children:[z.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(z.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)(k.dR,{value:m.cwd,onChange:e=>q("cwd",e)}),(0,l.jsx)(k.en,{value:m.permission,onChange:e=>q("permission",e)}),(0,l.jsx)(k.D0,{label:o("inherit.context"),hint:o("colony.context.hint"),children:(0,l.jsx)(C.n,{value:m.system_prompt,onChange:e=>q("system_prompt",e),placeholder:o("colony.context.placeholder"),defaultView:"write",minHeight:160})}),(0,l.jsx)(k.D0,{label:o("form.skills"),children:(0,l.jsx)(k.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)(k.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)(M.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)(F,{draft:m,colony:n,members:s.filter(e=>m.agent_ids.includes(e.id)),busy:E,onBack:()=>S(!1),onConfirm:H}),x&&(0,l.jsx)(k.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)(k.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:()=>D(!1),onConfirm:async()=>{await b.FH.del("/colonies/".concat(n.id)),await r(["agents","colonies"]),d(o("colony.deleted")),t()}})]})}function F(e){let{draft:n,colony:t,members:o,busy:s,onBack:i,onConfirm:c}=e,{t:r}=(0,A.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)(k.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:S.map(e=>(0,l.jsx)(k.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,v._1)(n.cwd)]}):null,"permission"===e?(0,l.jsxs)("span",{className:"muted fw-400",children:[" \xb7 ",(0,v.Ck)(n.permission)]}):null]}),hint:d[e]?r("inheritAsk.hint.".concat(e)):r("inheritAsk.empty.".concat(e))},e))}),u?(0,l.jsx)(k.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 D=t(5300),E=t(89128);function T(e){let{agent:n,onClose:t}=e,{t:o}=(0,A.s9)(),s=(0,E.A)(n,{onSaved:t,onDeleted:t});return s.draft?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(k._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)(D.SU,{draft:s.draft,onChange:s.setDraft,errors:s.errors,selfId:n.id})}),s.deleteModal]}):null}var q=t(48776),H=t(37165),O=t(5372),I=t(31606),W=t(95587),R=t(74988);let K=74*Math.sqrt(3),B=[[1,0],[1,-1],[0,-1],[-1,0],[-1,1],[0,1]],P=e=>{let[n,t]=e;return{x:K*(n+t/2),y:111*t}},J=(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 G(){var e,n,t;let{t:o}=(0,A.s9)(),{agents:C,colonies:_,objects:M,dispatches:z,ready:S,error:F,retry:D,refresh:E}=(0,j.q5)(),G=(0,k.dj)(),[U,V]=(0,a.useState)(null),[X,Y]=(0,a.useState)(null),[$,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,f.ud)("hive-colony-layout",{}),[ei,ec]=(0,a.useState)(null),[er,ed]=(0,f.ud)("hive-colony-zoom",1),em=er>=.4&&er<=2.5?er:1,eh=e=>ed(Math.min(2.5,Math.max(.4,Math.round(100*e)/100))),eu=(0,a.useMemo)(()=>ei?{...es,[ei.key]:{x:ei.x,y:ei.y}}:es,[es,ei]),{clusters:ey,width:ex,height:eg}=(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=B[4][0]*t,l=B[4][1]*t;for(let o=0;o<6;o++)for(let s=0;s<t;s++)n.push([e,l]),e+=B[o][0],l+=B[o][1]}return n.slice(0,e)})(o.length+n.things.length+1).map(P),d=Math.min(...s.map(e=>e.x))-K/2,m=Math.max(...s.map(e=>e.x))+K/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 p=g?g.x:i,j=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:p+(e.x-d)+26,y:m?m.y:j+(e.y-h)+26+50}});a.push({key:n.key,colony:n.colony,cells:f,x:p,y:j,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+K/2+26),m=Math.max(m,n.y+74+26);return{clusters:a,width:d,height:m}})(C,_,M,eu),[C,_,M,eu]),ep=(0,a.useRef)(null),[ej,ef]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=ep.current;if(!e)return;let n=new ResizeObserver(()=>ef(e.clientWidth));return n.observe(e),ef(e.clientWidth),()=>n.disconnect()},[S,0===C.length]);let eb=(0,a.useRef)(em);eb.current=em,(0,a.useEffect)(()=>{let e=ep.current;if(!e)return;let n=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),eh(eb.current*(e.deltaY<0?1.1:1/1.1)))};return e.addEventListener("wheel",n,{passive:!1}),()=>e.removeEventListener("wheel",n)},[S]);let ev=ex+80,ek=eg+80,ew=(ej?Math.min(1,(ej-24)/ev):1)*em,eN=(0,a.useRef)(null),eC=(0,a.useRef)(!1),e_=function(e,n,t,l){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{x:0,y:0};if(0===e.button){eN.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){}}},eM=e=>{let n=eN.current;if(!n)return;let t=(e.clientX-n.sx)/ew,l=(e.clientY-n.sy)/ew;!n.moved&&Math.hypot(t,l)*ew<6||(n.moved=!0,n.last={x:Math.max(n.min.x,n.ox+t),y:Math.max(n.min.y,n.oy+l)},ec({key:n.key,...n.last}))},eA=()=>{let e=eN.current;eN.current=null,(null==e?void 0:e.moved)&&e.last&&(eC.current=!0,setTimeout(()=>{eC.current=!1},0),ea({...es,[e.key]:e.last}),ec(null))},ez=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;ea({...es,[n]:{x:Math.max(o.x,t+s[0]*a),y:Math.max(o.y,l+s[1]*a)}})},eS=(e,n,t,l)=>({onPointerDown:o=>e_(o,e,n,t,l),onPointerMove:eM,onPointerUp:eA,onPointerCancel:eA}),eL=new Map;for(let e of ey)for(let n of e.cells)n.agent&&eL.set(n.agent.id,{x:n.x+40,y:n.y+40}),n.object&&eL.set(n.object.id,{x:n.x+40,y:n.y+40});let eF=M.filter(e=>"cluster"===e.kind).flatMap(e=>e.config.members.map(n=>({from:e.id,to:n}))),eD=M.filter(e=>e.manager_id&&eL.has(e.manager_id)&&eL.has(e.id)).map(e=>({from:e.manager_id,to:e.id})),eE=e=>M.filter(n=>n.manager_id===e),[eT,eq]=(0,a.useState)(null),eH=null!=(e=C.find(e=>e.id===U))?e:null,eO=null!=(n=M.find(e=>e.id===U))?n:null,[eI,eW]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{eW(U?document.querySelector('[data-sid="'.concat(U,'"]')):null)},[U,C.length,M.length]),(0,a.useEffect)(()=>{if(!U)return;let e=e=>{"Escape"!==e.key||document.querySelector('[role="dialog"]')||V(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[U]);let eR=null!=X?X:U,eK=C.filter(e=>"orchestrator"===e.role).flatMap(e=>e.worker_ids.map(n=>({from:e.id,to:n}))),eB=new Set(eR?[eR,...[...eK,...eF,...eD].filter(e=>e.from===eR||e.to===eR).flatMap(e=>[e.from,e.to])]:[]),eP=e=>C.filter(n=>"orchestrator"===n.role&&n.worker_ids.includes(e)),eJ=C.filter(e=>"running"===e.status).length,eG=M.filter(e=>"running"===e.state.status).length,eU=C.filter(e=>"orchestrator"===e.role).length,eV=e=>{var n,t;return null!=(t=null==(n=C.find(n=>n.id===e))?void 0:n.name)?t:o("colony.removedAgent")},eX=z.filter(e=>"running"===e.status).length,eY=[{id:"agents",n:C.length,label:o("stat.agents",{count:C.length}),href:"/agents"},{id:"colonies",n:_.length,label:o("stat.colonies",{count:_.length})},{id:"objects",n:M.length,label:o("stat.objects",{count:M.length}),href:"/resources",title:M.length?o("obj.running",{count:eG}):void 0},{id:"queens",n:eU,label:o("stat.orchestrators",{count:eU}),href:"/agents"},{id:"working",n:eJ,label:o("stat.working"),href:"/agents"},{id:"tasks",n:eX,label:o("stat.tasks"),href:"#recent"}],e$=eH?_.find(e=>e.id===eH.colony_id):void 0,eZ=async(e,n)=>{try{var t,l;await b.FH.patch("/agents/".concat(e.id),{colony_id:n||null,overrides:[]}),await E(["agents","colonies"]),G(n?o("colony.joined",{name:e.name,colony:null!=(l=null==(t=_.find(e=>e.id===n))?void 0:t.name)?l:""}):o("colony.left",{name:e.name}))}catch(e){G(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)(H.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)(w.W1,{label:o("cx.new"),icon:(0,l.jsx)(i.A,{size:14}),children:e=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(w.Dr,{icon:(0,l.jsx)(c.A,{size:15}),onClick:()=>{e(),Z({})},children:o("newAgent.title")}),(0,l.jsx)(w.Dr,{icon:(0,l.jsx)(r.A,{size:15}),onClick:()=>{e(),ee("new")},children:o("colony.newTitle")}),(0,l.jsx)(w.Dr,{icon:(0,l.jsx)(d.A,{size:15}),onClick:()=>{e(),eo({})},children:o("obj.new")})]})})})]}),(0,l.jsx)("div",{className:"stats",children:eY.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:ep,children:[S?0===C.length&&0===_.length&&0===M.length?(0,l.jsx)("div",{className:"comb-empty-wrap",children:(0,l.jsx)(k.pp,{icon:(0,l.jsx)(k._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:()=>ee("new"),children:[(0,l.jsx)(i.A,{size:16}),o("colony.empty.createColony")]}),(0,l.jsxs)("button",{className:"btn primary",onClick:()=>Z({}),children:[(0,l.jsx)(i.A,{size:16}),o("colony.empty.createAgent")]})]})})}):(0,l.jsx)("div",{className:"comb-box",style:{width:ev*ew,height:ek*ew},children:(0,l.jsxs)("div",{className:"comb",style:{width:ev,height:ek,transform:"scale(".concat(ew,")"),transformOrigin:"0 0","--w":"".concat(.9*K,"px"),"--h":"".concat(133.20000000000002,"px")},children:[(0,l.jsx)("svg",{className:"links",width:ev,height:ek,children:ey.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:J(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:J(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)})}),ey.map(e=>(0,l.jsxs)("div",{children:[e.colony?(0,l.jsxs)("button",{className:"colony-label draggable ".concat((null==ei?void 0:ei.key)===e.key?"dragging":""),style:{left:e.x+e.w/2+40,top:e.y+50-10+40,"--c":e.colony.color||"var(--honey)"},...eS(e.key,e.x,e.y),onKeyDown:n=>ez(n,e.key,e.x,e.y),onClick:()=>{eC.current||ee(e.colony)},title:"".concat(e.colony.cwd?o("colony.editHover",{path:(0,v._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"})]}):_.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(eR&&!eB.has(c.id)?"dim":""," ").concat(eR&&eB.has(c.id)&&c.id!==eR?"linked":""," ").concat(e.colony?"":"draggable"),style:{...a,"--c":s},"aria-pressed":U===c.id,onMouseEnter:()=>Y(c.id),onMouseLeave:()=>Y(null),onFocus:()=>Y(c.id),onBlur:()=>Y(null),...e.colony?{}:{...eS(c.id,n.x,n.y,{x:K/2,y:74}),onKeyDown:e=>ez(e,c.id,n.x,n.y,{x:K/2,y:74})},onClick:()=>{eC.current||V(c.id===U?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:eV(c.manager_id)}),children:["⚙ ",eV(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(eR&&!eB.has(s.id)?"dim":""," ").concat(eR&&eB.has(s.id)&&s.id!==eR?"linked":""," ").concat(e.colony?"":"draggable"),onMouseEnter:()=>Y(s.id),onMouseLeave:()=>Y(null),onFocus:()=>Y(s.id),onBlur:()=>Y(null),style:{...a,"--c":v.xq[s.provider].color},"aria-pressed":U===s.id,...e.colony?{}:{...eS(s.id,n.x,n.y,{x:K/2,y:74}),onKeyDown:e=>ez(e,s.id,n.x,n.y,{x:K/2,y:74}),title:o("cx.moveHint")},onClick:()=>{eC.current||V(s.id===U?null:s.id)},"aria-label":"".concat(s.name,", ").concat(o("role.".concat(s.role)),", ").concat(v.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:v.xq[s.provider].short})]}),"idle"!==s.status&&(0,l.jsx)("span",{className:"pip ".concat("error"===s.status?"err":"")}),eE(s.id).length>0&&(0,l.jsxs)("span",{className:"ltag top mgr",title:o("colony.manages",{names:eE(s.id).map(e=>e.name).join(", ")}),children:["⚙ ",1===eE(s.id).length?eE(s.id)[0].name:eE(s.id).length]}),("orchestrator"===s.role?s.worker_ids.length>0:eP(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:eP(s.id).map(e=>e.name).join(", ")}),children:"orchestrator"===s.role?"↓ ".concat(s.worker_ids.length):"↑ ".concat(1===eP(s.id).length?eP(s.id)[0].name:eP(s.id).length)})]},s.id):(0,l.jsxs)("button",{className:"cell ghost",style:a,onClick:()=>{var n;return Z({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:ev,height:ek,"aria-hidden":!0,children:[eK.filter(e=>!!eR&&(e.from===eR||e.to===eR)).map(e=>{var n;let t=eL.get(e.from),o=eL.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=C.find(n=>n.id===e.to))?void 0:n.status)==="running",x=!!eR&&(e.from===eR||e.to===eR),g=!!eR&&!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)}),[...eF.map(e=>({...e,kind:"cluster"})),...eD.map(e=>({...e,kind:"manager"}))].filter(e=>!!eR&&(e.from===eR||e.to===eR)).map(e=>{let n=eL.get(e.from),t=eL.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?v.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)})]})]})}):F?(0,l.jsx)("div",{className:"comb-skel",children:(0,l.jsx)(k.lZ,{kind:"err",children:(0,l.jsxs)("div",{className:"row gap-s wrap",children:[(0,l.jsxs)("span",{className:"grow",children:[o("cx.loadFailed")," ",F]}),(0,l.jsx)("button",{className:"btn sm",onClick:()=>void D(),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(es).length>0&&(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>ea({}),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:()=>eh(em/1.2),disabled:em<=.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:()=>eh(1),title:o("colony.zoom.fit"),"aria-label":o("colony.zoom.fit"),children:[Math.round(100*em),"%"]}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>eh(1.2*em),disabled:em>=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:()=>eh(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(v.xq).map(e=>(0,l.jsxs)("span",{className:"pbadge",style:{"--c":v.xq[e].color},children:[(0,l.jsx)("i",{}),v.xq[e].short]},e)),(0,l.jsxs)("span",{className:"pbadge",style:{"--c":"var(--honey)"},children:[(0,l.jsx)("i",{}),o("role.orchestrator")]})]})]}),eO?(0,l.jsx)(I.wl,{object:eO,target:eI,onClose:()=>V(null),onCreateManager:()=>{var e;return Z({colonyId:null!=(e=eO.colony_id)?e:void 0,manager:!0,objectId:eO.id})}},eO.id):eH?(0,l.jsxs)(O.rs,{target:eI,pinned:!0,width:340,label:eH.name,onClose:()=>V(null),children:[(0,l.jsxs)("div",{className:"ap-corner row gap-s",children:[(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>et(eH.id),"aria-label":o("colony.settingsFor",{name:eH.name}),title:o("colony.agentSettings"),children:(0,l.jsx)(y.A,{size:16})}),(0,l.jsx)("button",{className:"btn ghost icon sm",onClick:()=>V(null),"aria-label":o("common.close"),title:"".concat(o("common.close")," (Esc)"),children:(0,l.jsx)(x.A,{size:16})})]}),(0,l.jsx)(O.kh,{agent:eH,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==e$?void 0:e$.id)?t:"",onChange:e=>void eZ(eH,e.target.value),children:[(0,l.jsx)("option",{value:"",children:o("common.noColony")}),_.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(eH.id),children:[o("colony.openChat")," ",(0,l.jsx)(g,{size:16})]}),(0,l.jsx)("button",{className:"btn danger icon",onClick:()=>eq(eH.id),"aria-label":o("agent.delete"),title:o("agent.delete"),children:(0,l.jsx)(p.A,{size:16})})]})]},eH.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===z.length?(0,l.jsx)("p",{className:"muted small m0",children:o("colony.recentEmpty")}):(0,l.jsx)("div",{className:"recent-grid",children:z.slice(0,6).map(e=>(0,l.jsxs)("div",{className:"feed-item",children:[(0,l.jsx)("i",{className:"dot ".concat("running"===e.status?"run":"done"===e.status?"ok":"err")}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"feed-line",children:[C.some(n=>n.id===e.from_id)?(0,l.jsx)(s(),{href:"/agents/".concat(e.from_id),"aria-label":o("cx.openAgent",{name:eV(e.from_id)}),children:eV(e.from_id)}):(0,l.jsx)("b",{children:eV(e.from_id)})," → ",C.some(n=>n.id===e.to_id)?(0,l.jsx)(s(),{href:"/agents/".concat(e.to_id),"aria-label":o("cx.openAgent",{name:eV(e.to_id)}),children:eV(e.to_id)}):(0,l.jsx)("b",{children:eV(e.to_id)})]}),(0,l.jsx)("div",{className:"muted small ellipsis",children:e.task}),(0,l.jsx)("div",{className:"muted feed-when",children:(0,v.KN)(e.created_at)})]})]},e.id))})]}),eT&&C.find(e=>e.id===eT)&&(0,l.jsx)(q.G,{agent:C.find(e=>e.id===eT),onClose:()=>eq(null),onDeleted:()=>V(null)}),$&&(0,l.jsx)(N.b,{presetColonyId:$.colonyId,presetObjectId:$.objectId,manager:$.manager,onClose:()=>Z(null),onCreated:e=>V(e)}),en&&C.find(e=>e.id===en)&&(0,l.jsx)(T,{agent:C.find(e=>e.id===en),onClose:()=>et(null)},en),el&&(0,l.jsx)(W.X,{presetColonyId:el.colonyId,onClose:()=>eo(null),onSaved:e=>V(e)}),Q&&(0,l.jsx)(L,{colony:"new"===Q?void 0:Q,onClose:()=>ee(null)})]})}},48776:(e,n,t)=>{"use strict";t.d(n,{G:()=>c});var l=t(94799),o=t(10804),s=t(48538),a=t(3749),i=t(69654);function c(e){let{agent:n,onClose:t,onDeleted:c}=e,{t:r}=(0,i.s9)(),{refresh:d}=(0,s.zd)(),m=(0,o.dj)();return(0,l.jsx)(o.TM,{title:r("agent.deleteTitle",{name:n.name}),body:r("agent.deleteBody"),danger:!0,confirmLabel:r("agent.delete"),cancelLabel:r("agent.keep"),onClose:t,onConfirm:async()=>{await a.FH.del("/agents/".concat(n.id)),await d(["agents","colonies"]),m(r("agent.deleted")),null==c||c()}})}},75406:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});let l=(0,t(74955).A)("RotateCcw",[["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"}]])},77701:(e,n,t)=>{Promise.resolve().then(t.bind(t,36098))},89128:(e,n,t)=>{"use strict";t.d(n,{A:()=>u});var l=t(94799),o=t(34023),s=t(97356),a=t(10804),i=t(5300),c=t(48776),r=t(48538),d=t(73506),m=t(3749),h=t(69654);function u(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{t}=(0,h.s9)(),{agents:u,colonies:y,objects:x,refresh:g}=(0,r.q5)(),p=(0,a.dj)(),j=(0,o.useMemo)(()=>e?x.filter(n=>n.manager_id===e.id).map(e=>e.id).sort():[],[x,null==e?void 0:e.id]),f=(0,o.useMemo)(()=>e?JSON.stringify((0,i.TN)(e,j)):"",[e,j]),[b,v]=(0,o.useState)(()=>e?(0,i.TN)(e,j):null),[k,w]=(0,o.useState)(!1),[N,C]=(0,o.useState)(!1);(0,o.useEffect)(()=>{v(e?(0,i.TN)(e,j):null)},[f]);let _=b&&e?(0,i.tf)(b,u,e.id,y):{},M=!!b&&JSON.stringify(b)!==f;(0,d.h)(M);let A=async()=>{if(b&&e){if(Object.keys(_).length)return void p(t("edit.fixFields"),"err");w(!0);try{var l;let{type_id:o,object_ids:s,...a}=b;await m.FH.patch("/agents/".concat(e.id),a),JSON.stringify([...s].sort())!==JSON.stringify(j)&&await m.FH.put("/agents/".concat(e.id,"/resources"),{object_ids:s}),await g(["agents","colonies","objects"]),p(t("edit.saved",{name:b.name.trim()})),null==(l=n.onSaved)||l.call(n)}catch(e){p(e instanceof Error?e.message:t("edit.saveFailed"),"err")}w(!1)}},z=()=>{e&&v((0,i.TN)(e,j))};return{draft:b,setDraft:v,errors:_,dirty:M,saving:k,save:A,discard:z,actions:function(){var e,n,o,a;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("button",{className:"btn danger push-r ".concat(null!=(e=i.size)?e:""),onClick:()=>C(!0),children:[(0,l.jsx)(s.A,{size:i.size?14:15}),t("agent.delete")]}),i.onCancel?(0,l.jsx)("button",{className:"btn ghost ".concat(null!=(n=i.size)?n:""),onClick:i.onCancel,children:t("common.cancel")}):(0,l.jsx)("button",{className:"btn ghost ".concat(null!=(o=i.size)?o:""),disabled:!M,onClick:z,children:t("common.discard")}),(0,l.jsx)("button",{className:"btn primary ".concat(null!=(a=i.size)?a:""),disabled:!M||k,onClick:A,children:k?t("common.saving"):t("common.saveChanges")})]})},deleteModal:N&&e?(0,l.jsx)(c.G,{agent:e,onClose:()=>C(!1),onDeleted:n.onDeleted}):null}}}},e=>{e.O(0,[586,706,391,281,517,350,606,587,408,89,358],()=>e(e.s=77701)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[964],{27949:(e,r,l)=>{Promise.resolve().then(l.bind(l,86300))},86300:(e,r,l)=>{"use strict";l.r(r),l.d(r,{default:()=>v});var s=l(94799),t=l(34023),a=l(20831),i=l(15334);l(40117);var n=l(70665),o=l(10964),d=l(48538),c=l(77021),h=l(3749),u=l(47890),m=l(86606),x=l(69654);let p=e=>{let r=u.hg[e%u.hg.length];return"color-mix(in srgb, ".concat(r," calc(100% - var(--series-mix, 0%)), white)")},g={agent:function(e){let{data:r}=e,{t:l}=(0,x.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)(a.h7,{type:"target",position:i.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"):u.xq[t.provider].short}),"orchestrator"===t.role&&(0,s.jsx)(a.h7,{type:"source",position:i.yX.Bottom})]})}},j={link:function(e){let{id:r,sourceX:l,sourceY:t,targetX:o,targetY:d,sourcePosition:c,targetPosition:h,data:u}=e,[m,x,p]=(0,i.Fp)({sourceX:l,sourceY:t,targetX:o,targetY:d,sourcePosition:c,targetPosition:h,curvature:.35});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.tE,{id:r,path:m,interactionWidth:26,style:{stroke:u.color,strokeWidth:u.active?4:2.5,opacity:u.dim?.15:1,transition:"opacity .15s, stroke-width .15s"}}),u.show&&(0,s.jsx)(a.rV,{children:(0,s.jsx)("button",{className:"edge-x nodrag nopan",style:{transform:"translate(-50%, -50%) translate(".concat(x,"px, ").concat(p,"px)")},onClick:u.onRemove,"aria-label":u.label,title:u.label,children:(0,s.jsx)(n.A,{size:13,strokeWidth:3})})})]})}};function v(){let{t:e,locale:r}=(0,x.s9)(),{agents:l,refresh:i,ready:u,error:v,retry:k}=(0,d.q5)(),w=(0,m.dj)(),[f,N]=(0,c.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),[S,W]=(0,t.useState)(0),A=(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={},a=0;for(let e of r){let r=l.filter(r=>{var l;return(null==(l=s(r))?void 0:l.id)===e.id}),i=Math.max(1,r.length);r.forEach((e,r)=>t[e.id]={x:a+190*r,y:280}),t[e.id]={x:a+(i-1)*190/2,y:0},a+=190*i+114}return l.filter(e=>!s(e)).forEach((e,r)=>t[e.id]={x:a+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=f[e.id])?r:A[e.id])?l:{x:0,y:0},data:{agent:e,dim:!1,active:!1}}}))},[l,A,f]);let T=(0,t.useMemo)(()=>new Map(l.filter(e=>"orchestrator"===e.role).map((e,r)=>[e.id,r])),[l]),V=null!=_?_:F,z=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 h.FH.put("/orchestrators/".concat(r,"/workers"),{worker_ids:l}),await i(["agents"]),w(s)}catch(r){w(r instanceof Error?r.message:e("rel.updateFailed"),"err")}},[i,w]),R=(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:z(s),orchestrator:t.name}))},[l,L]),Z=(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:z(s),orchestrator:t.name}))},[l,L]),q=(0,t.useMemo)(()=>l.filter(e=>"orchestrator"===e.role).flatMap(r=>r.worker_ids.map(s=>{var t,a;let i="".concat(r.id,">").concat(s),n=!!V&&(r.id===V||s===V);return{id:i,source:r.id,target:s,type:"link",animated:(null==(t=l.find(e=>e.id===s))?void 0:t.status)==="running",data:{color:p(null!=(a=T.get(r.id))?a:0),dim:!!V&&!n,active:n||E===i,show:n||E===i,label:e("rel.disconnectLabel",{worker:z(s),orchestrator:r.name}),onRemove:()=>R(r.id,s)}}})),[l,V,E,T,R,r]),B=(0,t.useMemo)(()=>{let e=new Set(V?[V]:[]);if(V)for(let r of q)(r.source===V||r.target===V)&&(e.add(r.source),e.add(r.target));return b.map(r=>({...r,selected:r.id===F,data:{...r.data,dim:!!V&&!e.has(r.id),active:r.id===V}}))},[b,q,V,F]),H=(0,t.useCallback)(e=>{y(r=>(0,a._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})},[]),P=l.find(e=>e.id===F),X=l.filter(e=>"orchestrator"===e.role),G=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({}),W(e=>e+1),w(e("rel.layoutReset"))},children:[(0,s.jsx)(o.A,{size:14}),e("rel.autoArrange")]})}),u?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)(a.Gc,{nodes:B,edges:q,nodeTypes:g,edgeTypes:j,onNodesChange:H,onConnect:e=>{e.source&&e.target&&Z(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)(a.VS,{gap:28,color:"var(--line-strong)"}),(0,s.jsx)(a.H2,{showInteractive:!1})]},S):v?(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")," ",v]}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>void k(),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}})}),P&&(0,s.jsxs)("aside",{className:"rel-panel card",children:[(0,s.jsxs)("div",{className:"row gap-l",children:[(0,s.jsx)(m._h,{agent:P}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"rel-panel-name",children:P.name}),(0,s.jsx)("div",{className:"muted small",children:e("role.".concat(P.role))})]}),(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:()=>O(null),"aria-label":e("common.close"),children:(0,s.jsx)(n.A,{size:16})})]}),"orchestrator"===P.role?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"eyebrow",children:e("rel.delegatesTo",{count:P.worker_ids.length})}),0===P.worker_ids.length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noWorkers")}),P.worker_ids.map(r=>(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("span",{className:"grow",children:z(r)}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>R(P.id,r),children:e("rel.disconnect")})]},r)),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&Z(P.id,e.target.value),"aria-label":e("rel.connectWorker"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectWorker")}),G.filter(e=>!P.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===X.filter(e=>e.worker_ids.includes(P.id)).length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noOrchestrators")}),X.filter(e=>e.worker_ids.includes(P.id)).map(r=>{var l;return(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("i",{className:"cdot cx-chip-dot",style:{background:p(null!=(l=T.get(r.id))?l:0)}}),(0,s.jsx)("span",{className:"grow",children:r.name}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>R(r.id,P.id),children:e("rel.disconnect")})]},r.id)}),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&Z(e.target.value,P.id),"aria-label":e("rel.connectOrchestrator"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectOrchestrator")}),X.filter(e=>!e.worker_ids.includes(P.id)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]})]})}}},e=>{e.O(0,[48,986,586,562,839,408,89,358],()=>e(e.s=27949)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[964],{27949:(e,r,l)=>{Promise.resolve().then(l.bind(l,86300))},86300:(e,r,l)=>{"use strict";l.r(r),l.d(r,{default:()=>v});var s=l(94799),t=l(34023),a=l(20831),i=l(15334);l(40117);var n=l(70665),o=l(10964),d=l(48538),c=l(77021),h=l(3749),u=l(47890),m=l(10804),x=l(69654);let p=e=>{let r=u.hg[e%u.hg.length];return"color-mix(in srgb, ".concat(r," calc(100% - var(--series-mix, 0%)), white)")},g={agent:function(e){let{data:r}=e,{t:l}=(0,x.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)(a.h7,{type:"target",position:i.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"):u.xq[t.provider].short}),"orchestrator"===t.role&&(0,s.jsx)(a.h7,{type:"source",position:i.yX.Bottom})]})}},j={link:function(e){let{id:r,sourceX:l,sourceY:t,targetX:o,targetY:d,sourcePosition:c,targetPosition:h,data:u}=e,[m,x,p]=(0,i.Fp)({sourceX:l,sourceY:t,targetX:o,targetY:d,sourcePosition:c,targetPosition:h,curvature:.35});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.tE,{id:r,path:m,interactionWidth:26,style:{stroke:u.color,strokeWidth:u.active?4:2.5,opacity:u.dim?.15:1,transition:"opacity .15s, stroke-width .15s"}}),u.show&&(0,s.jsx)(a.rV,{children:(0,s.jsx)("button",{className:"edge-x nodrag nopan",style:{transform:"translate(-50%, -50%) translate(".concat(x,"px, ").concat(p,"px)")},onClick:u.onRemove,"aria-label":u.label,title:u.label,children:(0,s.jsx)(n.A,{size:13,strokeWidth:3})})})]})}};function v(){let{t:e,locale:r}=(0,x.s9)(),{agents:l,refresh:i,ready:u,error:v,retry:k}=(0,d.q5)(),w=(0,m.dj)(),[f,N]=(0,c.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),[S,W]=(0,t.useState)(0),A=(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={},a=0;for(let e of r){let r=l.filter(r=>{var l;return(null==(l=s(r))?void 0:l.id)===e.id}),i=Math.max(1,r.length);r.forEach((e,r)=>t[e.id]={x:a+190*r,y:280}),t[e.id]={x:a+(i-1)*190/2,y:0},a+=190*i+114}return l.filter(e=>!s(e)).forEach((e,r)=>t[e.id]={x:a+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=f[e.id])?r:A[e.id])?l:{x:0,y:0},data:{agent:e,dim:!1,active:!1}}}))},[l,A,f]);let T=(0,t.useMemo)(()=>new Map(l.filter(e=>"orchestrator"===e.role).map((e,r)=>[e.id,r])),[l]),V=null!=_?_:F,z=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 h.FH.put("/orchestrators/".concat(r,"/workers"),{worker_ids:l}),await i(["agents"]),w(s)}catch(r){w(r instanceof Error?r.message:e("rel.updateFailed"),"err")}},[i,w]),R=(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:z(s),orchestrator:t.name}))},[l,L]),Z=(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:z(s),orchestrator:t.name}))},[l,L]),q=(0,t.useMemo)(()=>l.filter(e=>"orchestrator"===e.role).flatMap(r=>r.worker_ids.map(s=>{var t,a;let i="".concat(r.id,">").concat(s),n=!!V&&(r.id===V||s===V);return{id:i,source:r.id,target:s,type:"link",animated:(null==(t=l.find(e=>e.id===s))?void 0:t.status)==="running",data:{color:p(null!=(a=T.get(r.id))?a:0),dim:!!V&&!n,active:n||E===i,show:n||E===i,label:e("rel.disconnectLabel",{worker:z(s),orchestrator:r.name}),onRemove:()=>R(r.id,s)}}})),[l,V,E,T,R,r]),B=(0,t.useMemo)(()=>{let e=new Set(V?[V]:[]);if(V)for(let r of q)(r.source===V||r.target===V)&&(e.add(r.source),e.add(r.target));return b.map(r=>({...r,selected:r.id===F,data:{...r.data,dim:!!V&&!e.has(r.id),active:r.id===V}}))},[b,q,V,F]),H=(0,t.useCallback)(e=>{y(r=>(0,a._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})},[]),P=l.find(e=>e.id===F),X=l.filter(e=>"orchestrator"===e.role),G=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({}),W(e=>e+1),w(e("rel.layoutReset"))},children:[(0,s.jsx)(o.A,{size:14}),e("rel.autoArrange")]})}),u?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)(a.Gc,{nodes:B,edges:q,nodeTypes:g,edgeTypes:j,onNodesChange:H,onConnect:e=>{e.source&&e.target&&Z(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)(a.VS,{gap:28,color:"var(--line-strong)"}),(0,s.jsx)(a.H2,{showInteractive:!1})]},S):v?(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")," ",v]}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>void k(),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}})}),P&&(0,s.jsxs)("aside",{className:"rel-panel card",children:[(0,s.jsxs)("div",{className:"row gap-l",children:[(0,s.jsx)(m._h,{agent:P}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"rel-panel-name",children:P.name}),(0,s.jsx)("div",{className:"muted small",children:e("role.".concat(P.role))})]}),(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:()=>O(null),"aria-label":e("common.close"),children:(0,s.jsx)(n.A,{size:16})})]}),"orchestrator"===P.role?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"eyebrow",children:e("rel.delegatesTo",{count:P.worker_ids.length})}),0===P.worker_ids.length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noWorkers")}),P.worker_ids.map(r=>(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("span",{className:"grow",children:z(r)}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>R(P.id,r),children:e("rel.disconnect")})]},r)),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&Z(P.id,e.target.value),"aria-label":e("rel.connectWorker"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectWorker")}),G.filter(e=>!P.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===X.filter(e=>e.worker_ids.includes(P.id)).length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noOrchestrators")}),X.filter(e=>e.worker_ids.includes(P.id)).map(r=>{var l;return(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("i",{className:"cdot cx-chip-dot",style:{background:p(null!=(l=T.get(r.id))?l:0)}}),(0,s.jsx)("span",{className:"grow",children:r.name}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>R(r.id,P.id),children:e("rel.disconnect")})]},r.id)}),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&Z(e.target.value,P.id),"aria-label":e("rel.connectOrchestrator"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectOrchestrator")}),X.filter(e=>!e.worker_ids.includes(P.id)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]})]})}}},e=>{e.O(0,[48,986,586,562,281,408,89,358],()=>e(e.s=27949)),_N_E=e.O()}]);
@@ -1 +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,837,486,581,839,517,350,291,844,30,491,408,89,358],()=>e(e.s=72317)),_N_E=e.O()}]);
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(38656);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,837,391,281,517,350,606,587,30,656,408,89,358],()=>e(e.s=72317)),_N_E=e.O()}]);
@@ -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(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,837,486,581,839,517,350,291,844,30,491,408,89,358],()=>e(e.s=57933)),_N_E=e.O()}]);
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(38656);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,837,391,281,517,350,606,587,30,656,408,89,358],()=>e(e.s=57933)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[547],{14676:(e,s,t)=>{Promise.resolve().then(t.bind(t,95339))},17395:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},32480:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},37064:(e,s,t)=>{"use strict";t.d(s,{n:()=>a});var n=t(34023);function a(e,s){let{enabled:t=!0,pauseHidden:a=!0,immediate:c=!0,onError:d}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=(0,n.useRef)(e);l.current=e;let i=(0,n.useRef)(d);i.current=d,(0,n.useEffect)(()=>{let e;if(!t)return;let n=!1,d=0,r=!1,h=()=>{clearTimeout(e),n||(e=setTimeout(()=>void u(),s*Math.min(6,2**d)))},u=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!n&&!r){if(!e&&a&&"undefined"!=typeof document&&"hidden"===document.visibilityState)return void h();r=!0;try{await l.current(),d=0}catch(e){var s;0==d++&&(null==(s=i.current)||s.call(i,e))}finally{r=!1,h()}}},o=()=>{"visible"!==document.visibilityState||r||(clearTimeout(e),u())};return c?u(!0):h(),a&&document.addEventListener("visibilitychange",o),()=>{n=!0,clearTimeout(e),document.removeEventListener("visibilitychange",o)}},[s,t,a,c])}},47405:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},54234:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(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"}]])},95339:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>k});var n=t(94799),a=t(34023),c=t(54234),d=t(17395),l=t(47405),i=t(97356),r=t(32480),h=t(12349),u=t(3749),o=t(48538),m=t(37064),x=t(56072),p=t(47890),j=t(69654),v=t(86606);let y=["failed","skipped_reassigned"];function k(){var e;let{t:s}=(0,j.s9)(),t=(0,v.dj)(),{agents:k,ready:f}=(0,o.q5)(),[b,g]=(0,a.useState)(null),[N,_]=(0,a.useState)(null),[w,A]=(0,a.useState)([]),[M,z]=(0,a.useState)(null),[C,S]=(0,a.useState)(!1),F=(0,a.useCallback)(async()=>{g((await u.FH.get("/schedules")).sort((e,s)=>{var t,n;return(null!=(t=e.next_due)?t:1/0)-(null!=(n=s.next_due)?n:1/0)})),S(!1)},[]);(0,m.n)(F,1e4,{onError:()=>S(!0)});let E=null==b||null==(e=b.find(e=>e.id===N))?void 0:e.fire_count;(0,a.useEffect)(()=>{N&&u.FH.get("/schedules/".concat(N,"/runs")).then(A).catch(()=>A([]))},[N,E]);let T=async e=>{await u.FH.del("/schedules/".concat(e.id)),await F()};return(0,n.jsxs)("div",{className:"page",children:[(0,n.jsx)("div",{className:"page-head",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{children:s("nav.schedules")}),(0,n.jsx)("p",{children:s("sched.subtitle")})]})}),C&&(0,n.jsx)(v.lZ,{kind:"err",children:s("fa.sched.loadFailed")}),f&&b&&0===b.length?(0,n.jsx)(v.pp,{icon:(0,n.jsx)(c.A,{size:28}),title:s("sched.empty.title"),body:s("sched.empty.body")}):(0,n.jsx)("div",{className:"sched-list",children:(null!=b?b:[]).map(e=>{let a=k.find(s=>s.id===e.agent_id),c="once"!==e.kind;return(0,n.jsxs)("div",{className:"card card-pad sched ".concat(e.enabled?"":"off"),children:[(0,n.jsxs)("div",{className:"row gap-s",children:[a?(0,n.jsx)(v._h,{agent:a,size:"sm"}):null,(0,n.jsx)("b",{children:e.agent_name}),(0,n.jsx)("span",{className:"chip",children:s("sched.kind.".concat(e.kind))}),(0,n.jsx)("span",{className:"chip",children:e.thread_id?e.place||"chat":s("sched.where.web")}),!e.enabled&&(0,n.jsx)("span",{className:"chip warn",children:s("sched.paused")}),(0,n.jsx)("span",{className:"grow"}),c&&(0,n.jsx)("button",{className:"btn ghost sm",onClick:()=>{u.FH.patch("/schedules/".concat(e.id),{enabled:!e.enabled}).then(F).catch(e=>t(e.message,"err"))},children:e.enabled?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.A,{size:14}),s("sched.pause")]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{size:14}),s("sched.resume")]})}),(0,n.jsx)("button",{className:"btn ghost sm","aria-label":s("common.delete"),onClick:()=>z(e),children:(0,n.jsx)(i.A,{size:14})})]}),(c||"watch"===e.kind)&&(0,n.jsx)("div",{className:"small",children:(0,n.jsx)("code",{children:e.description})}),(0,n.jsx)("p",{className:"note",children:e.note}),(0,n.jsxs)("div",{className:"meta muted small",children:[(0,n.jsxs)("span",{children:[s("watch"===e.kind?"sched.until":"sched.next"),": ",e.next_due?"".concat((0,x.v7)(e.next_due)," \xb7 ").concat(s("sched.in",{when:(e=>{let t=Math.max(1,Math.round((e-Date.now())/6e4));if(t<60)return s("sched.minShort",{count:t});let n=Math.round(t/60);return n<48?s("sched.hourShort",{count:n}):s("sched.dayShort",{count:Math.round(n/24)})})(e.next_due)})):s("sched.never")]}),c&&e.last_status&&(0,n.jsxs)("span",{children:[s("sched.last"),": ",(0,n.jsx)("span",{className:"chip ".concat(y.includes(e.last_status)?"warn":""),children:s("sched.status.".concat(e.last_status))})," ",(0,p.KN)(e.last_fired_at)]}),c&&(0,n.jsx)("span",{children:s("sched.runs",{count:e.fire_count})}),c&&(0,n.jsx)("button",{className:"linkbtn",onClick:()=>_(N===e.id?null:e.id),children:N===e.id?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.A,{size:13})," ",s("sched.hide")]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.A,{size:13})," ",s("sched.history")]})})]}),N===e.id&&(0,n.jsx)("div",{className:"sched-runs",children:0===w.length?(0,n.jsx)("span",{className:"muted",children:s("sched.noRuns")}):w.map(e=>(0,n.jsxs)("div",{className:"r",children:[(0,n.jsx)("span",{className:"muted",children:(0,x.v7)(e.fired_at)}),(0,n.jsx)("span",{className:"chip ".concat(y.includes(e.status)?"warn":""),children:s("sched.status.".concat(e.status))}),e.duration_ms?(0,n.jsxs)("span",{className:"muted",children:[Math.round(e.duration_ms/1e3)," s"]}):null,e.detail?(0,n.jsx)("span",{className:"muted",children:e.detail}):null]},e.id))})]},e.id)})}),M&&(0,n.jsx)(v.TM,{danger:!0,title:s("sched.deleteTitle"),body:s("sched.deleteBody"),confirmLabel:s("common.delete"),onConfirm:()=>T(M),onClose:()=>z(null)})]})}},97356:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(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"}]])}},e=>{e.O(0,[586,839,408,89,358],()=>e(e.s=14676)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[547],{14676:(e,s,t)=>{Promise.resolve().then(t.bind(t,95339))},17395:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},32480:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},37064:(e,s,t)=>{"use strict";t.d(s,{n:()=>a});var n=t(34023);function a(e,s){let{enabled:t=!0,pauseHidden:a=!0,immediate:c=!0,onError:d}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=(0,n.useRef)(e);l.current=e;let i=(0,n.useRef)(d);i.current=d,(0,n.useEffect)(()=>{let e;if(!t)return;let n=!1,d=0,r=!1,h=()=>{clearTimeout(e),n||(e=setTimeout(()=>void u(),s*Math.min(6,2**d)))},u=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!n&&!r){if(!e&&a&&"undefined"!=typeof document&&"hidden"===document.visibilityState)return void h();r=!0;try{await l.current(),d=0}catch(e){var s;0==d++&&(null==(s=i.current)||s.call(i,e))}finally{r=!1,h()}}},o=()=>{"visible"!==document.visibilityState||r||(clearTimeout(e),u())};return c?u(!0):h(),a&&document.addEventListener("visibilitychange",o),()=>{n=!0,clearTimeout(e),document.removeEventListener("visibilitychange",o)}},[s,t,a,c])}},47405:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},54234:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(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"}]])},95339:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>k});var n=t(94799),a=t(34023),c=t(54234),d=t(17395),l=t(47405),i=t(97356),r=t(32480),h=t(12349),u=t(3749),o=t(48538),m=t(37064),x=t(56072),p=t(47890),j=t(69654),v=t(10804);let y=["failed","skipped_reassigned"];function k(){var e;let{t:s}=(0,j.s9)(),t=(0,v.dj)(),{agents:k,ready:f}=(0,o.q5)(),[b,g]=(0,a.useState)(null),[N,_]=(0,a.useState)(null),[w,A]=(0,a.useState)([]),[M,z]=(0,a.useState)(null),[C,S]=(0,a.useState)(!1),F=(0,a.useCallback)(async()=>{g((await u.FH.get("/schedules")).sort((e,s)=>{var t,n;return(null!=(t=e.next_due)?t:1/0)-(null!=(n=s.next_due)?n:1/0)})),S(!1)},[]);(0,m.n)(F,1e4,{onError:()=>S(!0)});let E=null==b||null==(e=b.find(e=>e.id===N))?void 0:e.fire_count;(0,a.useEffect)(()=>{N&&u.FH.get("/schedules/".concat(N,"/runs")).then(A).catch(()=>A([]))},[N,E]);let T=async e=>{await u.FH.del("/schedules/".concat(e.id)),await F()};return(0,n.jsxs)("div",{className:"page",children:[(0,n.jsx)("div",{className:"page-head",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{children:s("nav.schedules")}),(0,n.jsx)("p",{children:s("sched.subtitle")})]})}),C&&(0,n.jsx)(v.lZ,{kind:"err",children:s("fa.sched.loadFailed")}),f&&b&&0===b.length?(0,n.jsx)(v.pp,{icon:(0,n.jsx)(c.A,{size:28}),title:s("sched.empty.title"),body:s("sched.empty.body")}):(0,n.jsx)("div",{className:"sched-list",children:(null!=b?b:[]).map(e=>{let a=k.find(s=>s.id===e.agent_id),c="once"!==e.kind;return(0,n.jsxs)("div",{className:"card card-pad sched ".concat(e.enabled?"":"off"),children:[(0,n.jsxs)("div",{className:"row gap-s",children:[a?(0,n.jsx)(v._h,{agent:a,size:"sm"}):null,(0,n.jsx)("b",{children:e.agent_name}),(0,n.jsx)("span",{className:"chip",children:s("sched.kind.".concat(e.kind))}),(0,n.jsx)("span",{className:"chip",children:e.thread_id?e.place||"chat":s("sched.where.web")}),!e.enabled&&(0,n.jsx)("span",{className:"chip warn",children:s("sched.paused")}),(0,n.jsx)("span",{className:"grow"}),c&&(0,n.jsx)("button",{className:"btn ghost sm",onClick:()=>{u.FH.patch("/schedules/".concat(e.id),{enabled:!e.enabled}).then(F).catch(e=>t(e.message,"err"))},children:e.enabled?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.A,{size:14}),s("sched.pause")]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{size:14}),s("sched.resume")]})}),(0,n.jsx)("button",{className:"btn ghost sm","aria-label":s("common.delete"),onClick:()=>z(e),children:(0,n.jsx)(i.A,{size:14})})]}),(c||"watch"===e.kind)&&(0,n.jsx)("div",{className:"small",children:(0,n.jsx)("code",{children:e.description})}),(0,n.jsx)("p",{className:"note",children:e.note}),(0,n.jsxs)("div",{className:"meta muted small",children:[(0,n.jsxs)("span",{children:[s("watch"===e.kind?"sched.until":"sched.next"),": ",e.next_due?"".concat((0,x.v7)(e.next_due)," \xb7 ").concat(s("sched.in",{when:(e=>{let t=Math.max(1,Math.round((e-Date.now())/6e4));if(t<60)return s("sched.minShort",{count:t});let n=Math.round(t/60);return n<48?s("sched.hourShort",{count:n}):s("sched.dayShort",{count:Math.round(n/24)})})(e.next_due)})):s("sched.never")]}),c&&e.last_status&&(0,n.jsxs)("span",{children:[s("sched.last"),": ",(0,n.jsx)("span",{className:"chip ".concat(y.includes(e.last_status)?"warn":""),children:s("sched.status.".concat(e.last_status))})," ",(0,p.KN)(e.last_fired_at)]}),c&&(0,n.jsx)("span",{children:s("sched.runs",{count:e.fire_count})}),c&&(0,n.jsx)("button",{className:"linkbtn",onClick:()=>_(N===e.id?null:e.id),children:N===e.id?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.A,{size:13})," ",s("sched.hide")]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.A,{size:13})," ",s("sched.history")]})})]}),N===e.id&&(0,n.jsx)("div",{className:"sched-runs",children:0===w.length?(0,n.jsx)("span",{className:"muted",children:s("sched.noRuns")}):w.map(e=>(0,n.jsxs)("div",{className:"r",children:[(0,n.jsx)("span",{className:"muted",children:(0,x.v7)(e.fired_at)}),(0,n.jsx)("span",{className:"chip ".concat(y.includes(e.status)?"warn":""),children:s("sched.status.".concat(e.status))}),e.duration_ms?(0,n.jsxs)("span",{className:"muted",children:[Math.round(e.duration_ms/1e3)," s"]}):null,e.detail?(0,n.jsx)("span",{className:"muted",children:e.detail}):null]},e.id))})]},e.id)})}),M&&(0,n.jsx)(v.TM,{danger:!0,title:s("sched.deleteTitle"),body:s("sched.deleteBody"),confirmLabel:s("common.delete"),onConfirm:()=>T(M),onClose:()=>z(null)})]})}},97356:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(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"}]])}},e=>{e.O(0,[586,281,408,89,358],()=>e(e.s=14676)),_N_E=e.O()}]);
@@ -1 +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:()=>p});var t=n(94799),a=n(41463),l=n.n(a),i=n(34023),r=n(3749),c=n(48538),o=n(37064),d=n(61748),u=n(51705),m=n(47890),h=n(56072),g=n(86606),v=n(69654);function p(){let{t:e,locale:s}=(0,v.s9)(),{agents:n}=(0,c.q5)(),[a,p]=(0,i.useState)(null),[x,j]=(0,i.useState)(""),[f,w]=(0,i.useState)("all"),[N,_]=(0,d.Z)("session",""),[y,b]=(0,i.useState)(!1),[k,E]=(0,i.useState)(null),[S,L]=(0,i.useState)(0),[C,R]=(0,i.useState)(100),M=(0,i.useRef)(null),P=null===a||a.some(e=>e.pending);(0,o.n)(async()=>{p(await r.FH.get("/sessions")),b(!1)},2500,{enabled:P,onError:()=>{b(!0),p(e=>null!=e?e:[])}});let q=(0,i.useMemo)(()=>N&&(null==a?void 0:a.find(e=>e.session_id===N))||null,[a,N]);(0,i.useEffect)(()=>{R(100)},[null==q?void 0:q.session_id]),(0,i.useEffect)(()=>{let e=!1;return q?(r.FH.get("/agents/".concat(q.agent_id,"/history?session=").concat(encodeURIComponent(q.session_id),"&limit=").concat(C)).then(s=>{var n;e||(E(s.messages),L(null!=(n=s.total)?n:s.messages.length))}).catch(()=>!e&&E([])),()=>{e=!0}):void E(null)},[null==q?void 0:q.agent_id,null==q?void 0:q.session_id,C]),(0,i.useEffect)(()=>{k&&100===C&&M.current&&(M.current.scrollTop=M.current.scrollHeight)},[k,C]);let F=(0,i.useMemo)(()=>(null!=a?a:[]).filter(e=>("all"===f||e.provider===f)&&(!x||"".concat(e.agent_name," ").concat(e.preview," ").concat(e.cwd).toLowerCase().includes(x.toLowerCase()))),[a,x,f]),O=(0,i.useMemo)(()=>{let e=new Map;for(let n of F){var s;let t=new Date(n.last_seen).toLocaleDateString((0,v.VR)(),{weekday:"long",day:"numeric",month:"short"});e.set(t,[...null!=(s=e.get(t))?s:[],n])}return[...e.entries()]},[F,s]),T=q&&n.find(e=>e.id===q.agent_id),Z=k?S-k.length:0;return(0,t.jsx)("div",{className:"page full",children:!y||(null==a?void 0:a.length)?a&&!a.length?(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(g.pp,{title:e("sessions.empty.title"),body:e("sessions.empty.body"),action:(0,t.jsx)(l(),{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)(g.DO,{value:x,onChange:j,placeholder:e("sessions.searchPlaceholder"),label:e("sessions.searchLabel")}),(0,t.jsx)(g.$q,{value:f,onChange:w,options:[{id:"all",label:e("common.all")},...Object.keys(m.xq).map(e=>({id:e,label:m.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")}),O.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==q?void 0:q.session_id)===s.session_id,onClick:()=>_(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)(g.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,m.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,h.RP)(s.usage)>0&&" \xb7 ".concat((0,h.yj)((0,h.RP)(s.usage))," ").concat(e("stats.tokens")),null!==s.cost&&" \xb7 ≈ ".concat((0,h.F0)(s.cost))]})]},s.agent_id+s.session_id)})]},n)}),a&&a.length>0&&!F.length&&(0,t.jsx)("p",{className:"muted small pad-m",children:e("sessions.noMatch")})]})]}),q?(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:q.agent_name}),(0,t.jsxs)("div",{className:"muted small mono ellipsis",children:[(0,m._1)(q.cwd)," \xb7 ",q.session_id]})]}),T&&(0,t.jsx)(l(),{className:"btn sm primary",href:"/agents/".concat(T.id),children:e("sessions.openAgent")})]}),(0,t.jsx)("div",{className:"transcript col sx-transcript",ref:M,children:null===k?(0,t.jsx)("p",{className:"muted",children:e("sessions.loading")}):0===k.length?(0,t.jsx)("p",{className:"muted",children:e("sessions.noMessages")}):(0,t.jsxs)(t.Fragment,{children:[Z>0&&(0,t.jsx)("button",{className:"btn sm push-c",onClick:()=>R(C+200),children:e("sessions.older",{count:Z})}),(0,t.jsx)(u.BZ,{msgs:k,agent:{id:q.agent_id,name:q.agent_name,provider:q.provider,role:q.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)(g.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:l=!0,onError:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(0,t.useRef)(e);r.current=e;let c=(0,t.useRef)(i);c.current=i,(0,t.useEffect)(()=>{let e;if(!n)return;let t=!1,i=0,o=!1,d=()=>{clearTimeout(e),t||(e=setTimeout(()=>void u(),s*Math.min(6,2**i)))},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 r.current(),i=0}catch(e){var s;0==i++&&(null==(s=c.current)||s.call(c,e))}finally{o=!1,d()}}},m=()=>{"visible"!==document.visibilityState||o||(clearTimeout(e),u())};return l?u(!0):d(),a&&document.addEventListener("visibilitychange",m),()=>{t=!0,clearTimeout(e),document.removeEventListener("visibilitychange",m)}},[s,n,a,l])}},61748:(e,s,n)=>{"use strict";n.d(s,{Z:()=>l});var t=n(34023);let a="hive-am:query";function l(e,s){let[n,l]=(0,t.useState)(s);return(0,t.useEffect)(()=>{let n=()=>{var n;return l(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),l(n),window.dispatchEvent(new Event(a))},[e,s])]}}},e=>{e.O(0,[586,706,176,839,350,705,408,89,358],()=>e(e.s=15065)),_N_E=e.O()}]);
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:()=>p});var t=n(94799),a=n(41463),l=n.n(a),i=n(34023),r=n(3749),c=n(48538),o=n(37064),d=n(61748),u=n(51705),m=n(47890),h=n(56072),g=n(10804),v=n(69654);function p(){let{t:e,locale:s}=(0,v.s9)(),{agents:n}=(0,c.q5)(),[a,p]=(0,i.useState)(null),[x,j]=(0,i.useState)(""),[f,w]=(0,i.useState)("all"),[N,_]=(0,d.Z)("session",""),[y,b]=(0,i.useState)(!1),[k,E]=(0,i.useState)(null),[S,L]=(0,i.useState)(0),[C,R]=(0,i.useState)(100),M=(0,i.useRef)(null),P=null===a||a.some(e=>e.pending);(0,o.n)(async()=>{p(await r.FH.get("/sessions")),b(!1)},2500,{enabled:P,onError:()=>{b(!0),p(e=>null!=e?e:[])}});let q=(0,i.useMemo)(()=>N&&(null==a?void 0:a.find(e=>e.session_id===N))||null,[a,N]);(0,i.useEffect)(()=>{R(100)},[null==q?void 0:q.session_id]),(0,i.useEffect)(()=>{let e=!1;return q?(r.FH.get("/agents/".concat(q.agent_id,"/history?session=").concat(encodeURIComponent(q.session_id),"&limit=").concat(C)).then(s=>{var n;e||(E(s.messages),L(null!=(n=s.total)?n:s.messages.length))}).catch(()=>!e&&E([])),()=>{e=!0}):void E(null)},[null==q?void 0:q.agent_id,null==q?void 0:q.session_id,C]),(0,i.useEffect)(()=>{k&&100===C&&M.current&&(M.current.scrollTop=M.current.scrollHeight)},[k,C]);let F=(0,i.useMemo)(()=>(null!=a?a:[]).filter(e=>("all"===f||e.provider===f)&&(!x||"".concat(e.agent_name," ").concat(e.preview," ").concat(e.cwd).toLowerCase().includes(x.toLowerCase()))),[a,x,f]),O=(0,i.useMemo)(()=>{let e=new Map;for(let n of F){var s;let t=new Date(n.last_seen).toLocaleDateString((0,v.VR)(),{weekday:"long",day:"numeric",month:"short"});e.set(t,[...null!=(s=e.get(t))?s:[],n])}return[...e.entries()]},[F,s]),T=q&&n.find(e=>e.id===q.agent_id),Z=k?S-k.length:0;return(0,t.jsx)("div",{className:"page full",children:!y||(null==a?void 0:a.length)?a&&!a.length?(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(g.pp,{title:e("sessions.empty.title"),body:e("sessions.empty.body"),action:(0,t.jsx)(l(),{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)(g.DO,{value:x,onChange:j,placeholder:e("sessions.searchPlaceholder"),label:e("sessions.searchLabel")}),(0,t.jsx)(g.$q,{value:f,onChange:w,options:[{id:"all",label:e("common.all")},...Object.keys(m.xq).map(e=>({id:e,label:m.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")}),O.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==q?void 0:q.session_id)===s.session_id,onClick:()=>_(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)(g.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,m.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,h.RP)(s.usage)>0&&" \xb7 ".concat((0,h.yj)((0,h.RP)(s.usage))," ").concat(e("stats.tokens")),null!==s.cost&&" \xb7 ≈ ".concat((0,h.F0)(s.cost))]})]},s.agent_id+s.session_id)})]},n)}),a&&a.length>0&&!F.length&&(0,t.jsx)("p",{className:"muted small pad-m",children:e("sessions.noMatch")})]})]}),q?(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:q.agent_name}),(0,t.jsxs)("div",{className:"muted small mono ellipsis",children:[(0,m._1)(q.cwd)," \xb7 ",q.session_id]})]}),T&&(0,t.jsx)(l(),{className:"btn sm primary",href:"/agents/".concat(T.id),children:e("sessions.openAgent")})]}),(0,t.jsx)("div",{className:"transcript col sx-transcript",ref:M,children:null===k?(0,t.jsx)("p",{className:"muted",children:e("sessions.loading")}):0===k.length?(0,t.jsx)("p",{className:"muted",children:e("sessions.noMessages")}):(0,t.jsxs)(t.Fragment,{children:[Z>0&&(0,t.jsx)("button",{className:"btn sm push-c",onClick:()=>R(C+200),children:e("sessions.older",{count:Z})}),(0,t.jsx)(u.BZ,{msgs:k,agent:{id:q.agent_id,name:q.agent_name,provider:q.provider,role:q.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)(g.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:l=!0,onError:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(0,t.useRef)(e);r.current=e;let c=(0,t.useRef)(i);c.current=i,(0,t.useEffect)(()=>{let e;if(!n)return;let t=!1,i=0,o=!1,d=()=>{clearTimeout(e),t||(e=setTimeout(()=>void u(),s*Math.min(6,2**i)))},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 r.current(),i=0}catch(e){var s;0==i++&&(null==(s=c.current)||s.call(c,e))}finally{o=!1,d()}}},m=()=>{"visible"!==document.visibilityState||o||(clearTimeout(e),u())};return l?u(!0):d(),a&&document.addEventListener("visibilitychange",m),()=>{t=!0,clearTimeout(e),document.removeEventListener("visibilitychange",m)}},[s,n,a,l])}},61748:(e,s,n)=>{"use strict";n.d(s,{Z:()=>l});var t=n(34023);let a="hive-am:query";function l(e,s){let[n,l]=(0,t.useState)(s);return(0,t.useEffect)(()=>{let n=()=>{var n;return l(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),l(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()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[501],{3492:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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"}]])},12646:(e,s,l)=>{"use strict";l.d(s,{n:()=>A});var t=l(94799),n=l(34023),i=l(6458),a=l(53983),c=l(3492),d=l(98148),r=l(99579),o=l(55838),u=l(98938),h=l(52263),m=l(20555),k=l(91833),p=l(55712),y=l(71529),v=l(69654);function x(e,s,l,t){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",a=e.slice(s,l)||i;return e.slice(s-t.length,s)===t&&e.slice(l,l+n.length)===n&&s!==l?{value:e.slice(0,s-t.length)+a+e.slice(l+n.length),start:s-t.length,end:l-t.length}:{value:e.slice(0,s)+t+a+n+e.slice(l),start:s+t.length,end:s+t.length+a.length}}function b(e,s,l,t,n){let i=e.lastIndexOf("\n",s-1)+1,a=e.indexOf("\n",l),c=-1===a?e.length:a,d=e.slice(i,c).split("\n"),r=d.every(e=>n.test(e)),o=d.map((e,s)=>r?e.replace(n,""):t(s)+e.replace(n,"")).join("\n");return{value:e.slice(0,i)+o+e.slice(c),start:i,end:i+o.length}}let j=/^\s*[-*+] (\[[ x]\] )?/,f=/^\s*\d+\. /,g=/^#{1,6} /,w=/^> ?/;function A(e){let{value:s,onChange:l,placeholder:A,defaultView:N="split",minHeight:M=340,fill:C=!1}=e,{t:z}=(0,v.s9)(),q=(0,n.useRef)(null),[E,S]=(0,n.useState)(N),L=e=>{let s=q.current;if(!s)return;let t=e(s.value,s.selectionStart,s.selectionEnd);l(t.value),requestAnimationFrame(()=>{s.focus(),s.setSelectionRange(t.start,t.end)})},D=[{id:"h",icon:(0,t.jsx)(c.A,{size:15}),label:z("md.heading"),run:()=>L((e,s,l)=>b(e,s,l,()=>"## ",g))},{id:"b",icon:(0,t.jsx)(d.A,{size:15}),label:z("md.bold"),keys:"B",run:()=>L((e,s,l)=>x(e,s,l,"**","**",z("md.boldPh")))},{id:"i",icon:(0,t.jsx)(r.A,{size:15}),label:z("md.italic"),keys:"I",run:()=>L((e,s,l)=>x(e,s,l,"*","*",z("md.italicPh")))},{id:"c",icon:(0,t.jsx)(o.A,{size:15}),label:z("md.code"),run:()=>L((e,s,l)=>x(e,s,l,"`","`","code"))},{id:"cb",icon:(0,t.jsx)(u.A,{size:15}),label:z("md.codeBlock"),run:()=>L((e,s,l)=>x(e,s,l,"\n```\n","\n```\n","code"))},{id:"ul",icon:(0,t.jsx)(h.A,{size:15}),label:z("md.bullets"),run:()=>L((e,s,l)=>b(e,s,l,()=>"- ",j))},{id:"ol",icon:(0,t.jsx)(m.A,{size:15}),label:z("md.numbered"),run:()=>L((e,s,l)=>b(e,s,l,e=>"".concat(e+1,". "),f))},{id:"q",icon:(0,t.jsx)(k.A,{size:15}),label:z("md.quote"),run:()=>L((e,s,l)=>b(e,s,l,()=>"> ",w))},{id:"l",icon:(0,t.jsx)(p.A,{size:15}),label:z("md.link"),keys:"K",run:()=>L((e,s,l)=>{let t=e.slice(s,l)||z("md.linkPh"),n="[".concat(t,"](https://)");return{value:e.slice(0,s)+n+e.slice(l),start:s+t.length+3,end:s+t.length+11}})},{id:"hr",icon:(0,t.jsx)(y.A,{size:15}),label:z("md.rule"),run:()=>L((e,s,l)=>({value:e.slice(0,s)+"\n\n---\n\n"+e.slice(l),start:s+7,end:s+7}))}],O=s.trim()?s.trim().split(/\s+/).length:0;return(0,t.jsxs)("div",{className:"mde".concat(C?" fill":""),children:[(0,t.jsxs)("div",{className:"mde-bar",role:"toolbar","aria-label":z("md.toolbar"),children:[D.map(e=>(0,t.jsx)("button",{type:"button",className:"mde-btn",title:e.keys?"".concat(e.label," (Ctrl+").concat(e.keys,")"):e.label,"aria-label":e.label,onMouseDown:e=>e.preventDefault(),onClick:e.run,disabled:"preview"===E,children:e.icon},e.id)),(0,t.jsx)("span",{className:"grow"}),(0,t.jsx)("div",{className:"mde-views",role:"group",children:["write","split","preview"].map(e=>(0,t.jsx)("button",{type:"button",className:E===e?"on":"","aria-pressed":E===e,onClick:()=>S(e),children:z("md.view.".concat(e))},e))})]}),(0,t.jsxs)("div",{className:"mde-body v-".concat(E),style:{minHeight:M},children:["preview"!==E&&(0,t.jsx)("textarea",{ref:q,className:"mde-text mono",style:{minHeight:M},value:s,onChange:e=>l(e.target.value),onKeyDown:e=>{let s=e.currentTarget;if(e.ctrlKey||e.metaKey){let s=D.find(s=>s.keys&&s.keys.toLowerCase()===e.key.toLowerCase());if(s){e.preventDefault(),s.run();return}}if("Tab"===e.key){e.preventDefault(),L((s,l,t)=>{if(l===t&&!e.shiftKey)return{value:s.slice(0,l)+" "+s.slice(t),start:l+2,end:l+2};let n=s.lastIndexOf("\n",l-1)+1,i=s.indexOf("\n",t),a=-1===i?s.length:i,c=s.slice(n,a).split("\n").map(s=>e.shiftKey?s.replace(/^ {1,2}/,""):" "+s).join("\n");return{value:s.slice(0,n)+c+s.slice(a),start:n,end:n+c.length}});return}if("Enter"===e.key&&!e.shiftKey&&s.selectionStart===s.selectionEnd){let t=s.value,n=s.selectionStart,i=t.lastIndexOf("\n",n-1)+1,a=t.slice(i,n),c=/^(\s*)([-*+] (?:\[[ x]\] )?|(\d+)\. )(.*)$/.exec(a);if(!c)return;if(e.preventDefault(),!c[4]){l(t.slice(0,i)+t.slice(n)),requestAnimationFrame(()=>s.setSelectionRange(i,i));return}let d=c[3]?"".concat(c[1]).concat(Number(c[3])+1,". "):c[1]+c[2].replace("[x]","[ ]");l(t.slice(0,n)+"\n"+d+t.slice(n)),requestAnimationFrame(()=>{let e=n+1+d.length;s.setSelectionRange(e,e)})}},placeholder:A,spellCheck:!1}),"write"!==E&&(0,t.jsx)("div",{className:"mde-prev md",children:(0,t.jsx)(i.oz,{remarkPlugins:[a.A],children:s||z("skills.previewEmpty")})})]}),(0,t.jsxs)("div",{className:"mde-foot muted",children:[z("md.stats",{words:O,chars:s.length})," \xb7 ",z("md.tips")]})]})}},20353:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>k});var t=l(94799),n=l(34023),i=l(92947),a=l(97356),c=l(48538),d=l(3749),r=l(86606),o=l(73506),u=l(69654),h=l(12646),m=l(82397);function k(){var e,s,l,k;let{t:p}=(0,u.s9)(),{skills:y,refresh:v,ready:x}=(0,c.o0)(),b=(0,r.dj)(),[j,f]=(0,n.useState)(null),[g,w]=(0,n.useState)(""),[A,N]=(0,n.useState)({name:"",description:"",content:""}),[M,C]=(0,n.useState)({}),[z,q]=(0,n.useState)(""),[E,S]=(0,n.useState)(!1),[L,D]=(0,n.useState)(void 0);(0,n.useEffect)(()=>{d.FH.get("/skills/usage").then(C).catch(()=>void 0)},[y]),(0,n.useEffect)(()=>{null===j&&y.length&&f(y[0].id)},[y,j]),(0,n.useEffect)(()=>{if("new"===j)N({name:"",description:"",content:""});else{let e=y.find(e=>e.id===j);e&&N({name:e.name,description:e.description,content:e.content})}q("")},[j]);let O=(0,n.useMemo)(()=>y.filter(e=>!g||"".concat(e.name," ").concat(e.description).toLowerCase().includes(g.toLowerCase())),[y,g]),H=y.find(e=>e.id===j),F="new"===j?!!(A.name||A.content):!!H&&(H.name!==A.name||H.description!==A.description||H.content!==A.content);(0,o.h)(F);let T=e=>{e!==j&&(F?D(e):f(e))},V=async()=>{if(!A.name.trim())return void q(p("skills.err.name"));try{if("new"===j){let e=await d.FH.post("/skills",A);await v(["skills"]),f(e.id),b(p("skills.created"))}else await d.FH.patch("/skills/".concat(j),A),await v(["skills"]),b(p("skills.saved"));q("")}catch(e){q(e instanceof Error?e.message:p("edit.saveFailed"))}};return(0,t.jsxs)("div",{className:"page full",children:[x&&!y.length&&"new"!==j?(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(r.pp,{title:p("skills.empty.title"),body:p("skills.empty.body"),action:(0,t.jsxs)("button",{className:"btn primary",onClick:()=>f("new"),children:[(0,t.jsx)(i.A,{size:16}),p("skills.empty.create")]})})}):(0,t.jsxs)("div",{className:"sk-ws",children:[(0,t.jsxs)("aside",{className:"switcher","aria-label":p("nav.skills"),children:[(0,t.jsxs)("div",{className:"switcher-head",children:[(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("b",{className:"fa-title grow",children:p("nav.skills")}),(0,t.jsx)("button",{className:"btn ghost icon sm",onClick:()=>T("new"),"aria-label":p("skills.new"),title:p("skills.new"),children:(0,t.jsx)(i.A,{size:16})})]}),(0,t.jsx)(r.DO,{value:g,onChange:w,placeholder:p("skills.search"),label:p("skills.search")})]}),(0,t.jsxs)("div",{className:"switcher-list",children:["new"===j&&(0,t.jsxs)("button",{className:"sk-item","aria-current":"true",children:[(0,t.jsx)("b",{children:p("skills.new")}),(0,t.jsx)("span",{className:"muted small",children:p("skills.unsaved")})]}),O.map(e=>{var s,l,n,i;return(0,t.jsxs)("button",{className:"sk-item","aria-current":j===e.id,onClick:()=>T(e.id),children:[(0,t.jsx)("b",{children:e.name}),(0,t.jsx)("span",{className:"sk-desc",children:e.description||p("common.noDescription")}),(0,t.jsxs)("span",{className:"sk-meta",children:[p("skills.nAgents",{count:null!=(n=null==(s=M[e.id])?void 0:s.agents)?n:0})," \xb7 ",p("skills.nTypes",{count:null!=(i=null==(l=M[e.id])?void 0:l.types)?i:0})," \xb7 ~",(0,m.Aq)((0,m.NO)(e.content))," tokens"]})]},e.id)}),!O.length&&"new"!==j&&(0,t.jsx)("p",{className:"muted small pad-m",children:p("skills.noMatch",{query:g})})]})]}),j?(0,t.jsxs)("section",{className:"sk-main",children:[(0,t.jsxs)("header",{className:"sk-head",children:[(0,t.jsxs)("div",{className:"sk-fields",children:[(0,t.jsx)(r.D0,{label:p("form.name"),error:z,children:(0,t.jsx)("input",{className:"input",value:A.name,onChange:e=>N({...A,name:e.target.value}),placeholder:p("skills.name.placeholder")})}),(0,t.jsx)(r.D0,{label:p("types.description"),hint:p("skills.description.hint"),children:(0,t.jsx)("input",{className:"input",value:A.description,onChange:e=>N({...A,description:e.target.value})})})]}),(0,t.jsxs)("div",{className:"sk-actions",children:[H&&(0,t.jsxs)("button",{className:"btn danger",onClick:()=>S(!0),children:[(0,t.jsx)(a.A,{size:15}),p("common.delete")]}),F&&(0,t.jsx)("button",{className:"btn ghost",onClick:()=>{var e,s;if("new"===j)f(null!=(s=null==(e=y[0])?void 0:e.id)?s:null);else{if("new"===j)N({name:"",description:"",content:""});else{let e=y.find(e=>e.id===j);e&&N({name:e.name,description:e.description,content:e.content})}q("")}},children:p("common.discard")}),(0,t.jsx)("button",{className:"btn primary",disabled:!F,onClick:V,children:"new"===j?p("skills.create"):p("skills.save")})]})]}),(0,t.jsxs)("div",{className:"sk-editor",children:[(0,t.jsx)("label",{className:"label",children:p("skills.instructions")}),(0,t.jsx)(h.n,{fill:!0,value:A.content,onChange:e=>N({...A,content:e}),placeholder:p("skills.content.placeholder")})]})]}):(0,t.jsx)("section",{className:"sk-main sk-none",children:(0,t.jsx)("p",{className:"muted",children:p("skills.subtitle")})})]}),E&&H&&(0,t.jsx)(r.TM,{danger:!0,title:p("skills.deleteTitle",{name:H.name}),body:p("skills.deleteBody",{agents:p("skills.nAgents",{count:null!=(l=null==(e=M[H.id])?void 0:e.agents)?l:0}),types:p("skills.nTypes",{count:null!=(k=null==(s=M[H.id])?void 0:s.types)?k:0})}),cancelLabel:p("skills.keep"),confirmLabel:p("skills.delete"),onClose:()=>S(!1),onConfirm:async()=>{await d.FH.del("/skills/".concat(H.id)),await v(["skills","agents","types"]),f(null),b(p("skills.deleted"))}}),void 0!==L&&(0,t.jsx)(r.TM,{danger:!0,title:p("fa.unsaved.title"),body:p("fa.unsaved.body"),confirmLabel:p("fa.unsaved.discard"),cancelLabel:p("fa.unsaved.keep"),onClose:()=>D(void 0),onConfirm:()=>{f(L),D(void 0)}})]})}},20555:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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"}]])},52263:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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"}]])},53824:(e,s,l)=>{Promise.resolve().then(l.bind(l,20353))},55712:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},73506:(e,s,l)=>{"use strict";l.d(s,{h:()=>n});var t=l(34023);function n(e){(0,t.useEffect)(()=>{if(!e)return;let s=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[e])}},91833:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,839,408,89,358],()=>e(e.s=53824)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[501],{3492:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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"}]])},12646:(e,s,l)=>{"use strict";l.d(s,{n:()=>A});var t=l(94799),n=l(34023),i=l(6458),a=l(53983),c=l(3492),d=l(98148),r=l(99579),o=l(55838),u=l(98938),h=l(52263),m=l(20555),k=l(91833),p=l(55712),y=l(71529),v=l(69654);function x(e,s,l,t){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",a=e.slice(s,l)||i;return e.slice(s-t.length,s)===t&&e.slice(l,l+n.length)===n&&s!==l?{value:e.slice(0,s-t.length)+a+e.slice(l+n.length),start:s-t.length,end:l-t.length}:{value:e.slice(0,s)+t+a+n+e.slice(l),start:s+t.length,end:s+t.length+a.length}}function b(e,s,l,t,n){let i=e.lastIndexOf("\n",s-1)+1,a=e.indexOf("\n",l),c=-1===a?e.length:a,d=e.slice(i,c).split("\n"),r=d.every(e=>n.test(e)),o=d.map((e,s)=>r?e.replace(n,""):t(s)+e.replace(n,"")).join("\n");return{value:e.slice(0,i)+o+e.slice(c),start:i,end:i+o.length}}let j=/^\s*[-*+] (\[[ x]\] )?/,f=/^\s*\d+\. /,g=/^#{1,6} /,w=/^> ?/;function A(e){let{value:s,onChange:l,placeholder:A,defaultView:N="split",minHeight:M=340,fill:C=!1}=e,{t:z}=(0,v.s9)(),q=(0,n.useRef)(null),[E,S]=(0,n.useState)(N),L=e=>{let s=q.current;if(!s)return;let t=e(s.value,s.selectionStart,s.selectionEnd);l(t.value),requestAnimationFrame(()=>{s.focus(),s.setSelectionRange(t.start,t.end)})},D=[{id:"h",icon:(0,t.jsx)(c.A,{size:15}),label:z("md.heading"),run:()=>L((e,s,l)=>b(e,s,l,()=>"## ",g))},{id:"b",icon:(0,t.jsx)(d.A,{size:15}),label:z("md.bold"),keys:"B",run:()=>L((e,s,l)=>x(e,s,l,"**","**",z("md.boldPh")))},{id:"i",icon:(0,t.jsx)(r.A,{size:15}),label:z("md.italic"),keys:"I",run:()=>L((e,s,l)=>x(e,s,l,"*","*",z("md.italicPh")))},{id:"c",icon:(0,t.jsx)(o.A,{size:15}),label:z("md.code"),run:()=>L((e,s,l)=>x(e,s,l,"`","`","code"))},{id:"cb",icon:(0,t.jsx)(u.A,{size:15}),label:z("md.codeBlock"),run:()=>L((e,s,l)=>x(e,s,l,"\n```\n","\n```\n","code"))},{id:"ul",icon:(0,t.jsx)(h.A,{size:15}),label:z("md.bullets"),run:()=>L((e,s,l)=>b(e,s,l,()=>"- ",j))},{id:"ol",icon:(0,t.jsx)(m.A,{size:15}),label:z("md.numbered"),run:()=>L((e,s,l)=>b(e,s,l,e=>"".concat(e+1,". "),f))},{id:"q",icon:(0,t.jsx)(k.A,{size:15}),label:z("md.quote"),run:()=>L((e,s,l)=>b(e,s,l,()=>"> ",w))},{id:"l",icon:(0,t.jsx)(p.A,{size:15}),label:z("md.link"),keys:"K",run:()=>L((e,s,l)=>{let t=e.slice(s,l)||z("md.linkPh"),n="[".concat(t,"](https://)");return{value:e.slice(0,s)+n+e.slice(l),start:s+t.length+3,end:s+t.length+11}})},{id:"hr",icon:(0,t.jsx)(y.A,{size:15}),label:z("md.rule"),run:()=>L((e,s,l)=>({value:e.slice(0,s)+"\n\n---\n\n"+e.slice(l),start:s+7,end:s+7}))}],O=s.trim()?s.trim().split(/\s+/).length:0;return(0,t.jsxs)("div",{className:"mde".concat(C?" fill":""),children:[(0,t.jsxs)("div",{className:"mde-bar",role:"toolbar","aria-label":z("md.toolbar"),children:[D.map(e=>(0,t.jsx)("button",{type:"button",className:"mde-btn",title:e.keys?"".concat(e.label," (Ctrl+").concat(e.keys,")"):e.label,"aria-label":e.label,onMouseDown:e=>e.preventDefault(),onClick:e.run,disabled:"preview"===E,children:e.icon},e.id)),(0,t.jsx)("span",{className:"grow"}),(0,t.jsx)("div",{className:"mde-views",role:"group",children:["write","split","preview"].map(e=>(0,t.jsx)("button",{type:"button",className:E===e?"on":"","aria-pressed":E===e,onClick:()=>S(e),children:z("md.view.".concat(e))},e))})]}),(0,t.jsxs)("div",{className:"mde-body v-".concat(E),style:{minHeight:M},children:["preview"!==E&&(0,t.jsx)("textarea",{ref:q,className:"mde-text mono",style:{minHeight:M},value:s,onChange:e=>l(e.target.value),onKeyDown:e=>{let s=e.currentTarget;if(e.ctrlKey||e.metaKey){let s=D.find(s=>s.keys&&s.keys.toLowerCase()===e.key.toLowerCase());if(s){e.preventDefault(),s.run();return}}if("Tab"===e.key){e.preventDefault(),L((s,l,t)=>{if(l===t&&!e.shiftKey)return{value:s.slice(0,l)+" "+s.slice(t),start:l+2,end:l+2};let n=s.lastIndexOf("\n",l-1)+1,i=s.indexOf("\n",t),a=-1===i?s.length:i,c=s.slice(n,a).split("\n").map(s=>e.shiftKey?s.replace(/^ {1,2}/,""):" "+s).join("\n");return{value:s.slice(0,n)+c+s.slice(a),start:n,end:n+c.length}});return}if("Enter"===e.key&&!e.shiftKey&&s.selectionStart===s.selectionEnd){let t=s.value,n=s.selectionStart,i=t.lastIndexOf("\n",n-1)+1,a=t.slice(i,n),c=/^(\s*)([-*+] (?:\[[ x]\] )?|(\d+)\. )(.*)$/.exec(a);if(!c)return;if(e.preventDefault(),!c[4]){l(t.slice(0,i)+t.slice(n)),requestAnimationFrame(()=>s.setSelectionRange(i,i));return}let d=c[3]?"".concat(c[1]).concat(Number(c[3])+1,". "):c[1]+c[2].replace("[x]","[ ]");l(t.slice(0,n)+"\n"+d+t.slice(n)),requestAnimationFrame(()=>{let e=n+1+d.length;s.setSelectionRange(e,e)})}},placeholder:A,spellCheck:!1}),"write"!==E&&(0,t.jsx)("div",{className:"mde-prev md",children:(0,t.jsx)(i.oz,{remarkPlugins:[a.A],children:s||z("skills.previewEmpty")})})]}),(0,t.jsxs)("div",{className:"mde-foot muted",children:[z("md.stats",{words:O,chars:s.length})," \xb7 ",z("md.tips")]})]})}},20353:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>k});var t=l(94799),n=l(34023),i=l(92947),a=l(97356),c=l(48538),d=l(3749),r=l(10804),o=l(73506),u=l(69654),h=l(12646),m=l(82397);function k(){var e,s,l,k;let{t:p}=(0,u.s9)(),{skills:y,refresh:v,ready:x}=(0,c.o0)(),b=(0,r.dj)(),[j,f]=(0,n.useState)(null),[g,w]=(0,n.useState)(""),[A,N]=(0,n.useState)({name:"",description:"",content:""}),[M,C]=(0,n.useState)({}),[z,q]=(0,n.useState)(""),[E,S]=(0,n.useState)(!1),[L,D]=(0,n.useState)(void 0);(0,n.useEffect)(()=>{d.FH.get("/skills/usage").then(C).catch(()=>void 0)},[y]),(0,n.useEffect)(()=>{null===j&&y.length&&f(y[0].id)},[y,j]),(0,n.useEffect)(()=>{if("new"===j)N({name:"",description:"",content:""});else{let e=y.find(e=>e.id===j);e&&N({name:e.name,description:e.description,content:e.content})}q("")},[j]);let O=(0,n.useMemo)(()=>y.filter(e=>!g||"".concat(e.name," ").concat(e.description).toLowerCase().includes(g.toLowerCase())),[y,g]),H=y.find(e=>e.id===j),F="new"===j?!!(A.name||A.content):!!H&&(H.name!==A.name||H.description!==A.description||H.content!==A.content);(0,o.h)(F);let T=e=>{e!==j&&(F?D(e):f(e))},V=async()=>{if(!A.name.trim())return void q(p("skills.err.name"));try{if("new"===j){let e=await d.FH.post("/skills",A);await v(["skills"]),f(e.id),b(p("skills.created"))}else await d.FH.patch("/skills/".concat(j),A),await v(["skills"]),b(p("skills.saved"));q("")}catch(e){q(e instanceof Error?e.message:p("edit.saveFailed"))}};return(0,t.jsxs)("div",{className:"page full",children:[x&&!y.length&&"new"!==j?(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(r.pp,{title:p("skills.empty.title"),body:p("skills.empty.body"),action:(0,t.jsxs)("button",{className:"btn primary",onClick:()=>f("new"),children:[(0,t.jsx)(i.A,{size:16}),p("skills.empty.create")]})})}):(0,t.jsxs)("div",{className:"sk-ws",children:[(0,t.jsxs)("aside",{className:"switcher","aria-label":p("nav.skills"),children:[(0,t.jsxs)("div",{className:"switcher-head",children:[(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("b",{className:"fa-title grow",children:p("nav.skills")}),(0,t.jsx)("button",{className:"btn ghost icon sm",onClick:()=>T("new"),"aria-label":p("skills.new"),title:p("skills.new"),children:(0,t.jsx)(i.A,{size:16})})]}),(0,t.jsx)(r.DO,{value:g,onChange:w,placeholder:p("skills.search"),label:p("skills.search")})]}),(0,t.jsxs)("div",{className:"switcher-list",children:["new"===j&&(0,t.jsxs)("button",{className:"sk-item","aria-current":"true",children:[(0,t.jsx)("b",{children:p("skills.new")}),(0,t.jsx)("span",{className:"muted small",children:p("skills.unsaved")})]}),O.map(e=>{var s,l,n,i;return(0,t.jsxs)("button",{className:"sk-item","aria-current":j===e.id,onClick:()=>T(e.id),children:[(0,t.jsx)("b",{children:e.name}),(0,t.jsx)("span",{className:"sk-desc",children:e.description||p("common.noDescription")}),(0,t.jsxs)("span",{className:"sk-meta",children:[p("skills.nAgents",{count:null!=(n=null==(s=M[e.id])?void 0:s.agents)?n:0})," \xb7 ",p("skills.nTypes",{count:null!=(i=null==(l=M[e.id])?void 0:l.types)?i:0})," \xb7 ~",(0,m.Aq)((0,m.NO)(e.content))," tokens"]})]},e.id)}),!O.length&&"new"!==j&&(0,t.jsx)("p",{className:"muted small pad-m",children:p("skills.noMatch",{query:g})})]})]}),j?(0,t.jsxs)("section",{className:"sk-main",children:[(0,t.jsxs)("header",{className:"sk-head",children:[(0,t.jsxs)("div",{className:"sk-fields",children:[(0,t.jsx)(r.D0,{label:p("form.name"),error:z,children:(0,t.jsx)("input",{className:"input",value:A.name,onChange:e=>N({...A,name:e.target.value}),placeholder:p("skills.name.placeholder")})}),(0,t.jsx)(r.D0,{label:p("types.description"),hint:p("skills.description.hint"),children:(0,t.jsx)("input",{className:"input",value:A.description,onChange:e=>N({...A,description:e.target.value})})})]}),(0,t.jsxs)("div",{className:"sk-actions",children:[H&&(0,t.jsxs)("button",{className:"btn danger",onClick:()=>S(!0),children:[(0,t.jsx)(a.A,{size:15}),p("common.delete")]}),F&&(0,t.jsx)("button",{className:"btn ghost",onClick:()=>{var e,s;if("new"===j)f(null!=(s=null==(e=y[0])?void 0:e.id)?s:null);else{if("new"===j)N({name:"",description:"",content:""});else{let e=y.find(e=>e.id===j);e&&N({name:e.name,description:e.description,content:e.content})}q("")}},children:p("common.discard")}),(0,t.jsx)("button",{className:"btn primary",disabled:!F,onClick:V,children:"new"===j?p("skills.create"):p("skills.save")})]})]}),(0,t.jsxs)("div",{className:"sk-editor",children:[(0,t.jsx)("label",{className:"label",children:p("skills.instructions")}),(0,t.jsx)(h.n,{fill:!0,value:A.content,onChange:e=>N({...A,content:e}),placeholder:p("skills.content.placeholder")})]})]}):(0,t.jsx)("section",{className:"sk-main sk-none",children:(0,t.jsx)("p",{className:"muted",children:p("skills.subtitle")})})]}),E&&H&&(0,t.jsx)(r.TM,{danger:!0,title:p("skills.deleteTitle",{name:H.name}),body:p("skills.deleteBody",{agents:p("skills.nAgents",{count:null!=(l=null==(e=M[H.id])?void 0:e.agents)?l:0}),types:p("skills.nTypes",{count:null!=(k=null==(s=M[H.id])?void 0:s.types)?k:0})}),cancelLabel:p("skills.keep"),confirmLabel:p("skills.delete"),onClose:()=>S(!1),onConfirm:async()=>{await d.FH.del("/skills/".concat(H.id)),await v(["skills","agents","types"]),f(null),b(p("skills.deleted"))}}),void 0!==L&&(0,t.jsx)(r.TM,{danger:!0,title:p("fa.unsaved.title"),body:p("fa.unsaved.body"),confirmLabel:p("fa.unsaved.discard"),cancelLabel:p("fa.unsaved.keep"),onClose:()=>D(void 0),onConfirm:()=>{f(L),D(void 0)}})]})}},20555:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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"}]])},52263:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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"}]])},53824:(e,s,l)=>{Promise.resolve().then(l.bind(l,20353))},55712:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},73506:(e,s,l)=>{"use strict";l.d(s,{h:()=>n});var t=l(34023);function n(e){(0,t.useEffect)(()=>{if(!e)return;let s=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[e])}},91833:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(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,408,89,358],()=>e(e.s=53824)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[192],{3492:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>k});var a=t(94799),l=t(34023),i=t(12646),n=t(92947),r=t(97356),d=t(48538),o=t(3749),c=t(47890),p=t(86606),h=t(1517),y=t(69654),m=t(56072),u=t(73506);let x={name:"",description:"",role:"worker",provider:"claude",model:"",system_prompt:"",permission:"acceptEdits",skill_ids:[],skill_loads:{}};function k(){let{t:e}=(0,y.s9)(),{types:s,agents:t,skills:k,providers:j,refresh:v,ready:b}=(0,d.o0)(),g=(0,p.dj)(),[f,M]=(0,l.useState)(null),[A,N]=(0,l.useState)(""),[C,w]=(0,l.useState)(null),[_,z]=(0,l.useState)(null),[q,H]=(0,l.useState)(!1),D=(0,l.useRef)(""),S=e=>{D.current=JSON.stringify(e),M(e),N("")},V=!!f&&JSON.stringify(f)!==D.current;(0,u.h)(V);let L=()=>{V?H(!0):M(null)},T=async()=>{if(f){if(!f.name.trim())return void N(e("types.err.name"));try{f.id?await o.FH.patch("/types/".concat(f.id),f):await o.FH.post("/types",f),await v(["types"]),g(f.id?e("types.updated"):e("types.created")),M(null),N("")}catch(s){N(s instanceof Error?s.message:e("edit.saveFailed"))}}},E=(e,s)=>M(t=>t&&{...t,[e]:s});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(x),children:[(0,a.jsx)(n.A,{size:16}),e("types.new")]})]}),b&&!s.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(x),children:[(0,a.jsx)(n.A,{size:16}),e("types.empty.create")]})}):(0,a.jsx)("div",{className:"typegrid",children:s.map(s=>{let l=t.filter(e=>e.type_id===s.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[s.provider].color,queen:"orchestrator"===s.role,label:s.name.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("h3",{className:"fa-card-title",children:s.name}),(0,a.jsx)("div",{className:"row gap-s mt-xs",children:(0,a.jsx)(p.PW,{role:s.role})})]})]}),(0,a.jsx)("p",{className:"muted small m0 fa-desc",children:s.description||e("types.noDescription")}),(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsx)("span",{className:"chip",children:c.xq[s.provider].label}),(0,a.jsx)("span",{className:"chip",children:s.model||e("types.defaultModel")}),(0,a.jsx)("span",{className:"chip",children:e("types.skillsCount",{count:s.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({...s}),children:e("common.edit")}),(0,a.jsx)("button",{className:"btn sm primary",onClick:()=>z(s.id),children:e("newAgent.create")})]})]},s.id)})}),f&&(0,a.jsxs)(p._s,{title:f.id?e("types.editTitle",{name:f.name||e("types.typeWord")}):e("types.newTitle"),subtitle:e("types.drawerSubtitle"),onClose:L,footer:(0,a.jsxs)(a.Fragment,{children:[f.id&&(0,a.jsxs)("button",{className:"btn danger push-r",onClick:()=>{var e;return w(null!=(e=s.find(e=>e.id===f.id))?e:null)},children:[(0,a.jsx)(r.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:f.id?e("types.save"):e("types.create")})]}),children:[(0,a.jsx)(p.D0,{label:e("form.name"),error:A,children:(0,a.jsx)("input",{className:"input",value:f.name,onChange:e=>E("name",e.target.value),placeholder:e("types.name.placeholder"),autoFocus:!0})}),(0,a.jsx)(p.D0,{label:e("types.description"),hint:e("types.description.hint"),children:(0,a.jsx)("input",{className:"input",value:f.description,onChange:e=>E("description",e.target.value)})}),(0,a.jsx)(p.D0,{label:e("form.role"),children:(0,a.jsx)(p.$q,{value:f.role,onChange:e=>E("role",e),options:[{id:"worker",label:e("role.worker")},{id:"orchestrator",label:e("role.orchestrator")}]})}),(0,a.jsx)(p.D0,{label:e("form.provider"),children:(0,a.jsx)(p.YO,{value:f.provider,onChange:e=>M({...f,provider:e,model:""}),providers:j})}),(0,a.jsx)(p.CD,{provider:f.provider,value:f.model,onChange:e=>E("model",e)}),(0,a.jsx)(p.en,{value:f.permission,onChange:e=>E("permission",e)}),(0,a.jsx)(p.D0,{label:e("form.systemPrompt"),hint:e("types.chars",{count:f.system_prompt.length,n:(0,m._E)(f.system_prompt.length)}),children:(0,a.jsx)(i.n,{value:f.system_prompt,onChange:e=>E("system_prompt",e),minHeight:260})}),(0,a.jsx)(p.D0,{label:e("form.skills"),children:(0,a.jsx)(p.kV,{skills:k,value:f.skill_ids,loads:f.skill_loads,onChange:(e,s)=>M({...f,skill_ids:e,skill_loads:s})})})]}),C&&(0,a.jsx)(p.TM,{danger:!0,title:e("types.deleteTitle",{name:C.name}),body:e("types.deleteBody"),cancelLabel:e("types.keep"),confirmLabel:e("types.delete"),onClose:()=>w(null),onConfirm:async()=>{await o.FH.del("/types/".concat(C.id)),await v(["types","agents"]),M(null),g(e("types.deleted"))}}),q&&(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:()=>H(!1),onConfirm:()=>M(null)}),_&&(0,a.jsx)(h.b,{presetTypeId:_,onClose:()=>z(null)})]})}},20555:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{Promise.resolve().then(t.bind(t,11108))},52263:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},91833:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,839,517,408,89,358],()=>e(e.s=32021)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[192],{3492:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>k});var a=t(94799),l=t(34023),i=t(12646),n=t(92947),r=t(97356),d=t(48538),o=t(3749),c=t(47890),p=t(10804),h=t(1517),y=t(69654),m=t(56072),u=t(73506);let x={name:"",description:"",role:"worker",provider:"claude",model:"",system_prompt:"",permission:"acceptEdits",skill_ids:[],skill_loads:{}};function k(){let{t:e}=(0,y.s9)(),{types:s,agents:t,skills:k,providers:j,refresh:v,ready:b}=(0,d.o0)(),g=(0,p.dj)(),[f,M]=(0,l.useState)(null),[A,N]=(0,l.useState)(""),[C,w]=(0,l.useState)(null),[_,z]=(0,l.useState)(null),[q,H]=(0,l.useState)(!1),D=(0,l.useRef)(""),S=e=>{D.current=JSON.stringify(e),M(e),N("")},V=!!f&&JSON.stringify(f)!==D.current;(0,u.h)(V);let L=()=>{V?H(!0):M(null)},T=async()=>{if(f){if(!f.name.trim())return void N(e("types.err.name"));try{f.id?await o.FH.patch("/types/".concat(f.id),f):await o.FH.post("/types",f),await v(["types"]),g(f.id?e("types.updated"):e("types.created")),M(null),N("")}catch(s){N(s instanceof Error?s.message:e("edit.saveFailed"))}}},E=(e,s)=>M(t=>t&&{...t,[e]:s});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(x),children:[(0,a.jsx)(n.A,{size:16}),e("types.new")]})]}),b&&!s.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(x),children:[(0,a.jsx)(n.A,{size:16}),e("types.empty.create")]})}):(0,a.jsx)("div",{className:"typegrid",children:s.map(s=>{let l=t.filter(e=>e.type_id===s.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[s.provider].color,queen:"orchestrator"===s.role,label:s.name.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("h3",{className:"fa-card-title",children:s.name}),(0,a.jsx)("div",{className:"row gap-s mt-xs",children:(0,a.jsx)(p.PW,{role:s.role})})]})]}),(0,a.jsx)("p",{className:"muted small m0 fa-desc",children:s.description||e("types.noDescription")}),(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsx)("span",{className:"chip",children:c.xq[s.provider].label}),(0,a.jsx)("span",{className:"chip",children:s.model||e("types.defaultModel")}),(0,a.jsx)("span",{className:"chip",children:e("types.skillsCount",{count:s.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({...s}),children:e("common.edit")}),(0,a.jsx)("button",{className:"btn sm primary",onClick:()=>z(s.id),children:e("newAgent.create")})]})]},s.id)})}),f&&(0,a.jsxs)(p._s,{title:f.id?e("types.editTitle",{name:f.name||e("types.typeWord")}):e("types.newTitle"),subtitle:e("types.drawerSubtitle"),onClose:L,footer:(0,a.jsxs)(a.Fragment,{children:[f.id&&(0,a.jsxs)("button",{className:"btn danger push-r",onClick:()=>{var e;return w(null!=(e=s.find(e=>e.id===f.id))?e:null)},children:[(0,a.jsx)(r.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:f.id?e("types.save"):e("types.create")})]}),children:[(0,a.jsx)(p.D0,{label:e("form.name"),error:A,children:(0,a.jsx)("input",{className:"input",value:f.name,onChange:e=>E("name",e.target.value),placeholder:e("types.name.placeholder"),autoFocus:!0})}),(0,a.jsx)(p.D0,{label:e("types.description"),hint:e("types.description.hint"),children:(0,a.jsx)("input",{className:"input",value:f.description,onChange:e=>E("description",e.target.value)})}),(0,a.jsx)(p.D0,{label:e("form.role"),children:(0,a.jsx)(p.$q,{value:f.role,onChange:e=>E("role",e),options:[{id:"worker",label:e("role.worker")},{id:"orchestrator",label:e("role.orchestrator")}]})}),(0,a.jsx)(p.D0,{label:e("form.provider"),children:(0,a.jsx)(p.YO,{value:f.provider,onChange:e=>M({...f,provider:e,model:""}),providers:j})}),(0,a.jsx)(p.CD,{provider:f.provider,value:f.model,onChange:e=>E("model",e)}),(0,a.jsx)(p.en,{value:f.permission,onChange:e=>E("permission",e)}),(0,a.jsx)(p.D0,{label:e("form.systemPrompt"),hint:e("types.chars",{count:f.system_prompt.length,n:(0,m._E)(f.system_prompt.length)}),children:(0,a.jsx)(i.n,{value:f.system_prompt,onChange:e=>E("system_prompt",e),minHeight:260})}),(0,a.jsx)(p.D0,{label:e("form.skills"),children:(0,a.jsx)(p.kV,{skills:k,value:f.skill_ids,loads:f.skill_loads,onChange:(e,s)=>M({...f,skill_ids:e,skill_loads:s})})})]}),C&&(0,a.jsx)(p.TM,{danger:!0,title:e("types.deleteTitle",{name:C.name}),body:e("types.deleteBody"),cancelLabel:e("types.keep"),confirmLabel:e("types.delete"),onClose:()=>w(null),onConfirm:async()=>{await o.FH.del("/types/".concat(C.id)),await v(["types","agents"]),M(null),g(e("types.deleted"))}}),q&&(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:()=>H(!1),onConfirm:()=>M(null)}),_&&(0,a.jsx)(h.b,{presetTypeId:_,onClose:()=>z(null)})]})}},20555:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{Promise.resolve().then(t.bind(t,11108))},52263:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},91833:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(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()}]);