@sleep2agi/agent-network-dashboard 0.1.0-preview.3 → 0.1.0-preview.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/diagnostics/route-bundle-stats.json +6 -6
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/admin.html +1 -1
- package/.next/server/app/admin.rsc +1 -1
- package/.next/server/app/admin.segments/_full.segment.rsc +1 -1
- package/.next/server/app/admin.segments/_head.segment.rsc +1 -1
- package/.next/server/app/admin.segments/_index.segment.rsc +1 -1
- package/.next/server/app/admin.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/admin.segments/admin.segment.rsc +1 -1
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +1 -1
- package/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/.next/server/app/index.html +2 -2
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +1 -1
- package/.next/server/app/login.segments/_full.segment.rsc +1 -1
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +1 -1
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/logs.html +1 -1
- package/.next/server/app/logs.rsc +1 -1
- package/.next/server/app/logs.segments/_full.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_index.segment.rsc +1 -1
- package/.next/server/app/logs.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
- package/.next/server/app/messages.html +1 -1
- package/.next/server/app/messages.rsc +1 -1
- package/.next/server/app/messages.segments/_full.segment.rsc +1 -1
- package/.next/server/app/messages.segments/_head.segment.rsc +1 -1
- package/.next/server/app/messages.segments/_index.segment.rsc +1 -1
- package/.next/server/app/messages.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/messages.segments/messages.segment.rsc +1 -1
- package/.next/server/app/node/page_client-reference-manifest.js +1 -1
- package/.next/server/app/node.html +2 -2
- package/.next/server/app/node.rsc +2 -2
- package/.next/server/app/node.segments/_full.segment.rsc +2 -2
- package/.next/server/app/node.segments/_head.segment.rsc +1 -1
- package/.next/server/app/node.segments/_index.segment.rsc +1 -1
- package/.next/server/app/node.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/node.segments/node.segment.rsc +1 -1
- package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/nodes.html +2 -2
- package/.next/server/app/nodes.rsc +2 -2
- package/.next/server/app/nodes.segments/_full.segment.rsc +2 -2
- package/.next/server/app/nodes.segments/_head.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/_index.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/nodes.segments/nodes.segment.rsc +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/networks.html +1 -1
- package/.next/server/app/settings/networks.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +1 -1
- package/.next/server/app/settings/networks.segments/settings.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.html +1 -1
- package/.next/server/app/settings/tokens.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +1 -1
- package/.next/server/app/settings/tokens.segments/settings.segment.rsc +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +1 -1
- package/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/app/tasks.html +1 -1
- package/.next/server/app/tasks.rsc +1 -1
- package/.next/server/app/tasks.segments/_full.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/_head.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/_index.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/tasks.segments/tasks.segment.rsc +1 -1
- package/.next/server/chunks/ssr/_0s2kgzl._.js +1 -1
- package/.next/server/chunks/ssr/_0s2kgzl._.js.map +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/{00lj3.so.3xcl.js → 03qq_1ze1j3x_.js} +1 -1
- package/.next/static/chunks/{11tov78a0ymt9.js → 0e4dwg687ga5q.js} +1 -1
- package/.next/static/chunks/{0gjidgcgd2ibn.js → 0ga7wt1a18fpq.js} +1 -1
- package/.next/trace +2 -2
- package/.next/trace-build +1 -1
- package/app/components/TaskChatPanel.tsx +4 -2
- package/package.json +1 -1
- /package/.next/static/{fkJPKTF2q7UWKqbDE1FlR → lgag_dfMO-AGdtcyMHSLe}/_buildManifest.js +0 -0
- /package/.next/static/{fkJPKTF2q7UWKqbDE1FlR → lgag_dfMO-AGdtcyMHSLe}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{fkJPKTF2q7UWKqbDE1FlR → lgag_dfMO-AGdtcyMHSLe}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var a=e.i(47167);e.r(16015);var r=e.r(71645),n=r&&"object"==typeof r&&"default"in r?r:{default:r},i=void 0!==a.default&&a.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,s=t.name,a=void 0===s?"stylesheet":s,r=t.optimizeForSpeed,n=void 0===r?i:r;d(l(a),"`name` must be a string"),this._name=a,this._deletedRulePlaceholder="#"+a+"-deleted-rule____{}",d("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(d(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var a=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,a))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(a){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var a=this._tags[e];d(a,"old rule at index `"+e+"` not found"),a.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&d(l(t),"makeStyleTag accepts only strings as second parameter");var a=document.createElement("style");this._nonce&&a.setAttribute("nonce",this._nonce),a.type="text/css",a.setAttribute("data-"+e,""),t&&a.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return s?r.insertBefore(a,s):r.appendChild(a),a},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var a=t[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),a=e+s;return u[a]||(u[a]="jsx-"+c(e+"-"+s)),u[a]}function x(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,a=void 0===s?null:s,r=t.optimizeForSpeed,n=void 0!==r&&r;this._sheet=a||new o({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),a&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),a=s.styleId,r=s.rules;if(a in this._instancesCounts){this._instancesCounts[a]+=1;return}var n=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[a]=n,this._instancesCounts[a]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var a=this._fromServer&&this._fromServer[s];a?(a.parentNode.removeChild(a),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],a=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:a}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,a=e.id;if(s){var r=h(a,s);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return x(r,e)}):[x(r,t)]}}return{styleId:h(a),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function f(){return new m}function g(){return r.useContext(p)}p.displayName="StyleSheetContext";var b=n.default.useInsertionEffect||n.default.useLayoutEffect,y="u">typeof window?f():void 0;function v(e){var t=y||g();return t&&("u"<typeof window?t.add(e):b(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,a=r.useContext(p),i=r.useState(function(){return a||t||f()})[0];return n.default.createElement(p.Provider,{value:i},s)},s.createStyleRegistry=f,s.style=v,s.useStyleRegistry=g},21373,(e,t,s)=>{t.exports=e.r(98547).style},58442,e=>{"use strict";var t=e.i(43476),s=e.i(21373),a=e.i(71645),r=e.i(18150);let n=["created","delivered","running","replied"],i={created:"bg-gray-400",delivered:"bg-blue-400",running:"bg-green-400",replied:"bg-purple-400",failed:"bg-red-400",closed:"bg-gray-500"};function l({status:e}){let s=n.indexOf(e),a="failed"===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[n.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full transition-all duration-700 ${a?0===r?"bg-red-400":"bg-gray-700":r<=s?i[e]||"bg-gray-600":"bg-gray-700"}`}),r<n.length-1&&(0,t.jsx)("div",{className:`w-4 h-px transition-colors duration-700 ${a?"bg-red-800":r<s?"bg-gray-500":"bg-gray-800"}`})]},e)),(0,t.jsx)("span",{className:`text-[10px] ml-1.5 font-medium ${a?"text-red-400":"replied"===e?"text-purple-400":"running"===e?"text-green-400":"text-gray-500"}`,children:e}),("running"===e||"delivered"===e)&&(0,t.jsxs)("span",{className:"ml-1",children:[(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse"}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.2s"}}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.4s"}})]})]})}function o({text:e}){if(!e)return(0,t.jsx)("span",{className:"text-gray-600 italic",children:"No content"});let s=e.split(/(```[\s\S]*?```|`[^`\n]+`|\*\*[^*]+\*\*)/g);return(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:s.map((e,s)=>{if(e.startsWith("```")&&e.endsWith("```")){let a=e.slice(3,-3),r=a.match(/^(\w+)\n/)?.[1]||"",n=r?a.slice(r.length+1):a;return(0,t.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-[#1a1a2a]",children:[r&&(0,t.jsx)("div",{className:"bg-[#0a0a15] px-3 py-1 text-[10px] text-gray-500 border-b border-[#1a1a2a]",children:r}),(0,t.jsx)("pre",{className:"bg-[#050510] px-3 py-2 text-[11px] text-green-300 overflow-x-auto",children:n})]},s)}return e.startsWith("`")&&e.endsWith("`")?(0,t.jsx)("code",{className:"bg-[#0a0a15] rounded px-1.5 py-0.5 text-cyan-300 text-[11px] border border-[#1a1a2a]",children:e.slice(1,-1)},s):e.startsWith("**")&&e.endsWith("**")?(0,t.jsx)("strong",{className:"text-white font-semibold",children:e.slice(2,-2)},s):(0,t.jsx)("span",{children:e},s)})})}e.s(["TaskChatPanel",0,function({alias:e,onClose:n,inline:i,availableNodes:d}){let[c,u]=(0,a.useState)([]),[h,x]=(0,a.useState)(""),[m,p]=(0,a.useState)("normal"),[f,g]=(0,a.useState)(!1),[b,y]=(0,a.useState)(new Set),[v,j]=(0,a.useState)(!1),[w,S]=(0,a.useState)(e),[_,N]=(0,a.useState)(!1),[k,C]=(0,a.useState)(""),[R,z]=(0,a.useState)([]),F=(0,a.useRef)(null),T=(0,a.useRef)(null);(0,a.useEffect)(()=>{d?z(d):fetch("/api/hub/status").then(e=>e.json()).then(e=>{z((e.sessions||[]).filter(e=>"offline"!==e.status).map(e=>e.alias))}).catch(()=>{})},[d]),(0,a.useEffect)(()=>{S(e)},[e]);let I=(0,a.useCallback)(async()=>{try{let t=await fetch(`/api/hub/tasks?to_name=${encodeURIComponent(e)}&limit=30`),s=await t.json();s.tasks&&u(s.tasks.reverse())}catch{}finally{j(!0)}},[e]);(0,a.useEffect)(()=>{u([]),j(!1),I(),setTimeout(()=>T.current?.focus(),300)},[e,I]),(0,a.useEffect)(()=>{F.current?.scrollIntoView({behavior:"smooth"})},[c]),(0,a.useEffect)(()=>{if(0===b.size)return;let e=Date.now(),t=setInterval(async()=>{if(Date.now()-e>12e4){y(new Set),clearInterval(t);return}for(let e of b)try{let t=await fetch(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`),s=await t.json();if(s.tasks?.[0]){let t=s.tasks[0];u(s=>s.map(s=>s.task_id===e?{...s,...t}:s)),["replied","failed","closed","expired","cancelled"].includes(t.status)&&y(t=>{let s=new Set(t);return s.delete(e),s})}}catch{}},2e3);return()=>clearInterval(t)},[b]);let $=async()=>{if(!h.trim()||f)return;let e=h.trim(),t=w,s=e.match(/^@(\S+)\s+([\s\S]+)/);if(s){let a=R.find(e=>e.toLowerCase()===s[1].toLowerCase());a&&(t=a,e=s[2])}g(!0),x(""),N(!1),T.current&&(T.current.style.height="auto");try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),a=await s.json();if(a.ok){let s={task_id:a.message_id||`tmp-${Date.now()}`,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,s]),a.message_id&&y(e=>new Set(e).add(a.message_id))}}catch{}g(!1),T.current?.focus()},E=R.filter(t=>t!==e&&t.toLowerCase().includes(k)).slice(0,8),A=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!v&&(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}),v&&0===c.length&&(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)("div",{className:"text-3xl mb-3",children:"💬"}),(0,t.jsx)("div",{className:"text-gray-500 text-sm",children:"Start a conversation"}),(0,t.jsxs)("div",{className:"text-gray-600 text-xs mt-1",children:["Send a task to ",e]})]}),c.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-cyan-500/8 border border-cyan-500/15 rounded-2xl rounded-br-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.content})}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-1.5 gap-3",children:[(0,t.jsx)(l,{status:e.status}),(0,t.jsx)("span",{className:"text-[9px] text-gray-600 shrink-0",children:(0,r.timeAgo)(e.created_at)})]})]})}),e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-green-500/8 border border-green-500/15 rounded-2xl rounded-bl-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 font-medium mb-1.5",children:e.to_name}),(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.result})})]})}),"running"===e.status&&!e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsx)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-2xl rounded-bl-md px-4 py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.15s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.3s"}})]})})})]},e.task_id)),(0,t.jsx)("div",{ref:F})]}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] bg-[#0d0d1a] px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 relative",children:[_&&E.length>0&&(0,t.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-[#111128] border border-[#2a2a4a] rounded-lg shadow-xl shadow-black/50 overflow-hidden z-10 max-h-48 overflow-y-auto",children:E.map(e=>(0,t.jsxs)("button",{onClick:()=>{let t,s;return t=h.lastIndexOf("@"),s=h.slice(0,t),void(x(`${s}@${e} `),N(!1),T.current?.focus())},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-cyan-500/10 transition-colors",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0"}),(0,t.jsx)("span",{className:"text-gray-300",children:e})]},e))}),(0,t.jsx)("textarea",{ref:T,value:h,onChange:e=>{var t;(e=>{x(e);let t=e.lastIndexOf("@");if(t>=0&&(0===t||" "===e[t-1]||"\n"===e[t-1])){let s=e.slice(t+1);if(!s.includes(" ")&&!s.includes("\n")){C(s.toLowerCase()),N(!0);return}}N(!1)})(e.target.value),(t=e.target).style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),$()),"Escape"===e.key&&N(!1)},placeholder:`Message ${e}...`,rows:1,className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-2.5 pr-16 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none transition-colors"}),(0,t.jsx)("div",{className:"absolute right-2 bottom-1.5 flex items-center gap-1",children:(0,t.jsxs)("select",{value:m,onChange:e=>p(e.target.value),className:"bg-transparent text-[9px] text-gray-600 focus:outline-none cursor-pointer",children:[(0,t.jsx)("option",{value:"normal",children:"N"}),(0,t.jsx)("option",{value:"high",children:"H"}),(0,t.jsx)("option",{value:"low",children:"L"})]})})]}),(0,t.jsx)("button",{onClick:$,disabled:f||!h.trim(),className:"p-2.5 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white rounded-xl transition-all shrink-0 active:scale-95",children:f?(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})})})]}),(0,t.jsxs)("div",{className:"flex justify-between text-[9px] text-gray-700 mt-1.5",children:[(0,t.jsx)("span",{children:h.includes("@")?`Sending to: ${w}`:"Type @ to mention another node"}),(0,t.jsx)("span",{children:"⌘+Enter"})]})]})]});return i?(0,t.jsx)("div",{className:"flex flex-col h-full",children:A}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:n,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-4 py-3 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500/30 to-blue-500/30 flex items-center justify-center text-xs font-bold text-cyan-300",children:e.slice(0,2)}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:e}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:b.size>0?"Processing...":"Ready"})]})]}),(0,t.jsx)("button",{onClick:n,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),A]}),(0,t.jsx)(s.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}])},53136,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(18566),r=e.i(22016),n=e.i(58442),i=e.i(18150);function l({tmuxName:e}){let[a,r]=(0,s.useState)(""),[n,i]=(0,s.useState)(!1),[o,d]=(0,s.useState)(!1),c=async()=>{i(!0);try{let t=await fetch(`/api/hub/tmux?name=${encodeURIComponent(e)}`),s=await t.json();r(s.output||s.error||"No output")}catch{r("Failed to fetch")}i(!1)};return(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300",children:["Terminal (",e,")"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{onClick:c,disabled:n,className:"text-xs text-cyan-400 hover:text-cyan-300 disabled:text-gray-600",children:n?"Loading...":"Capture"}),a&&(0,t.jsx)("button",{onClick:()=>d(!o),className:"text-xs text-gray-500 hover:text-gray-300",children:o?"Collapse":"Expand"})]})]}),a&&(0,t.jsx)("pre",{className:`text-[11px] text-green-300 bg-[#050510] rounded-lg px-3 py-2 border border-[#1a1a2a] overflow-x-auto whitespace-pre font-mono ${o?"max-h-96":"max-h-32"} overflow-y-auto`,children:a}),!a&&(0,t.jsx)("p",{className:"text-xs text-gray-600",children:"Click Capture to view terminal output"})]})}function o(){let e=(0,a.useSearchParams)().get("alias")||"",[n,i]=(0,s.useState)(null),[l,o]=(0,s.useState)([]),[c,u]=(0,s.useState)(0),[h,x]=(0,s.useState)(""),[m,p]=(0,s.useState)(""),[f,g]=(0,s.useState)(!1),b=(0,s.useCallback)(async()=>{if(e)try{let t=await fetch(`/api/hub/session?alias=${encodeURIComponent(e)}`),s=await t.json();s.session&&i(s.session),s.inbox&&o(s.inbox),u(s.sse||0),x("")}catch(e){x(e instanceof Error?e.message:"fetch failed")}},[e]);(0,s.useEffect)(()=>{b();let e=setInterval(b,5e3);return()=>clearInterval(e)},[b]);let[y,v]=(0,s.useState)(""),j=async()=>{if(m.trim()&&e){g(!0),v("");try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:m})}),s=await t.json();s.ok?(p(""),setTimeout(b,2e3)):v(s.error||"Send failed")}catch(e){v(e instanceof Error?e.message:"Send failed")}g(!1)}};if(!e)return(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono flex items-center justify-center",children:(0,t.jsxs)("p",{className:"text-gray-500",children:["No alias specified. ",(0,t.jsx)(r.default,{href:"/",className:"text-blue-400 hover:underline",children:"Back to dashboard"})]})});let w=n?.status==="working"?"text-green-400":n?.status==="idle"?"text-blue-400":"text-gray-500";return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)(r.default,{href:"/nodes",className:"text-gray-500 hover:text-gray-300 text-sm lg:ml-0 ml-10",children:"← Nodes"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:`inline-block w-3 h-3 rounded-full ${c>0?n?.status==="working"?"bg-green-500 animate-pulse":"bg-emerald-400":"bg-gray-500"}`}),(0,t.jsx)("h1",{className:"text-2xl font-bold text-white",children:e}),(0,t.jsx)("span",{className:`text-sm ${w}`,children:n?.status||"unknown"})]})]}),h&&(0,t.jsx)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-2 rounded-lg mb-6 text-sm",children:h}),(0,t.jsx)(d,{alias:e,session:n,sse:c,sendMsg:m,setSendMsg:p,sending:f,sendTask:j,sendError:y})]})}function d({alias:e,session:a,sse:r,sendMsg:i,setSendMsg:o,sending:c,sendTask:h,sendError:x}){let[m,p]=(0,s.useState)("chat"),[f,g]=(0,s.useState)([]),[b,y]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{"events"!==m||b||fetch("/api/hub/task-events?limit=50").then(e=>e.json()).then(e=>{g(e.events||[]),y(!0)}).catch(()=>y(!0))},[m,b]),(0,t.jsxs)("div",{className:"bg-[#0d0d1a] border border-[#2a2a4a] rounded-xl overflow-hidden h-[calc(100vh-140px)] flex flex-col",children:[(0,t.jsx)("div",{className:"flex border-b border-[#2a2a4a] bg-[#0a0a15] shrink-0",children:["chat","events","info"].map(e=>(0,t.jsx)("button",{onClick:()=>p(e),className:`px-5 py-3 text-sm font-medium border-b-2 transition-colors ${m===e?"border-cyan-400 text-cyan-300":"border-transparent text-gray-500 hover:text-gray-300"}`,children:"chat"===e?"💬 Chat":"events"===e?"📋 Events":"📊 Info"},e))}),(0,t.jsxs)("div",{className:"flex-1 overflow-hidden",children:["chat"===m&&(0,t.jsx)(n.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0}),"events"===m&&(0,t.jsx)(u,{events:f,loading:!b}),"info"===m&&(0,t.jsxs)("div",{className:"p-4 overflow-y-auto h-full space-y-4 max-w-2xl",children:[(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Node Info"}),(0,t.jsx)("div",{className:"space-y-2 text-xs",children:[{label:"Node ID",value:a?.node_id,alwaysShow:!0},{label:"Session ID",value:a?.session_id,alwaysShow:!0},{label:"Resume ID",value:a?.resume_id,alwaysShow:!0},{label:"Alias",value:a?.alias,alwaysShow:!0},{label:"Agent",value:a?.agent,alwaysShow:!0},{label:"Model",value:a?.model,alwaysShow:!0},{label:"Version",value:a?.version},{label:"Server",value:a?.server,alwaysShow:!0},{label:"Hostname",value:a?.hostname,alwaysShow:!0},{label:"IP",value:a?.ip,alwaysShow:!0},{label:"Project",value:a?.project_dir},{label:"Config",value:a?.config_path,alwaysShow:!0},{label:"Channels",value:a?.channels?.length?Array.isArray(a.channels)?a.channels.join(", "):a.channels:null,alwaysShow:!0},{label:"Tmux",value:a?.tmux_name},{label:"SSE",value:r>0?`Connected (${r})`:"Disconnected",alwaysShow:!0},{label:"Progress",value:a?.progress?`${a.progress}%`:null},{label:"Score",value:a?.score},{label:"Last Seen",value:a?.last_seen_at,alwaysShow:!0},{label:"Registered",value:a?.registered_at,alwaysShow:!0},{label:"Updated",value:a?.updated_at,alwaysShow:!0}].map(({label:e,value:s,alwaysShow:a})=>s||a?(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{className:"text-gray-500 shrink-0",children:e}),(0,t.jsx)("span",{className:"text-gray-300 truncate max-w-[200px]",title:s?String(s):"--",children:s?String(s):"--"})]},e):null)})]}),a?.task&&(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Current Task"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap",children:a.task})]}),a?.output&&(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Last Output"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap max-h-48 overflow-y-auto",children:a.output})]}),(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Send Task"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&h(),placeholder:`Send task to ${e}...`,className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-blue-500 focus:outline-none"}),(0,t.jsx)("button",{onClick:h,disabled:c||!i.trim(),className:"px-3 py-2 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-700 text-white text-xs rounded transition-colors",children:c?"...":"Send"})]}),x&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:x})]}),a?.tmux_name&&(0,t.jsx)(l,{tmuxName:a.tmux_name})]})]})]})}let c={delivered:{dot:"bg-blue-400",line:"bg-blue-500/30",icon:"📬"},acked:{dot:"bg-yellow-400",line:"bg-yellow-500/30",icon:"✅"},running:{dot:"bg-green-400",line:"bg-green-500/30",icon:"⚡"},replied:{dot:"bg-purple-400",line:"bg-purple-500/30",icon:"💬"},failed:{dot:"bg-red-400",line:"bg-red-500/30",icon:"❌"},created:{dot:"bg-gray-400",line:"bg-gray-500/30",icon:"📝"}};function u({events:e,loading:s}){if(s)return(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})});if(0===e.length)return(0,t.jsx)("div",{className:"text-center py-12 text-gray-600 text-xs",children:"No task events yet"});let a=new Map;return e.forEach(e=>{let t=e.task_id||`ungrouped-${e.id}`,s=a.get(t)||[];s.push(e),a.set(t,s)}),(0,t.jsx)("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[...a.entries()].map(([e,s])=>(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"text-[10px] text-gray-600 mb-3 truncate",children:["Task: ",e.slice(0,20),"..."]}),(0,t.jsxs)("div",{className:"relative pl-6",children:[(0,t.jsx)("div",{className:"absolute left-[9px] top-2 bottom-2 w-0.5 bg-[#1a1a2a]"}),s.map((e,s)=>{let a=c[e.to_status]||c.created;return(0,t.jsxs)("div",{className:"relative pb-4 last:pb-0",children:[(0,t.jsx)("div",{className:`absolute -left-6 top-0.5 w-[18px] h-[18px] rounded-full ${a.dot} flex items-center justify-center text-[9px] z-10 border-2 border-[#111128]`,children:a.icon.length<=2?a.icon:""}),(0,t.jsxs)("div",{className:"ml-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`text-xs font-medium ${"failed"===e.to_status?"text-red-400":"replied"===e.to_status?"text-purple-400":"text-gray-300"}`,children:e.event_type}),e.from_status&&(0,t.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.from_status," → ",e.to_status]}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600 ml-auto",children:(0,i.timeAgo)(e.created_at)})]}),e.detail&&(0,t.jsxs)("div",{className:"text-[11px] text-gray-500 mt-0.5 truncate",children:[e.detail.slice(0,50),e.detail.length>50?"...":""]})]})]},e.id)})]})]},e))})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono",children:"Loading..."}),children:(0,t.jsx)(o,{})})}])}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var a=e.i(47167);e.r(16015);var r=e.r(71645),n=r&&"object"==typeof r&&"default"in r?r:{default:r},i=void 0!==a.default&&a.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,s=t.name,a=void 0===s?"stylesheet":s,r=t.optimizeForSpeed,n=void 0===r?i:r;d(l(a),"`name` must be a string"),this._name=a,this._deletedRulePlaceholder="#"+a+"-deleted-rule____{}",d("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(d(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var a=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,a))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(a){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var a=this._tags[e];d(a,"old rule at index `"+e+"` not found"),a.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&d(l(t),"makeStyleTag accepts only strings as second parameter");var a=document.createElement("style");this._nonce&&a.setAttribute("nonce",this._nonce),a.type="text/css",a.setAttribute("data-"+e,""),t&&a.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return s?r.insertBefore(a,s):r.appendChild(a),a},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var a=t[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),a=e+s;return u[a]||(u[a]="jsx-"+c(e+"-"+s)),u[a]}function x(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,a=void 0===s?null:s,r=t.optimizeForSpeed,n=void 0!==r&&r;this._sheet=a||new o({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),a&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),a=s.styleId,r=s.rules;if(a in this._instancesCounts){this._instancesCounts[a]+=1;return}var n=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[a]=n,this._instancesCounts[a]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var a=this._fromServer&&this._fromServer[s];a?(a.parentNode.removeChild(a),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],a=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:a}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,a=e.id;if(s){var r=h(a,s);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return x(r,e)}):[x(r,t)]}}return{styleId:h(a),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function f(){return new m}function g(){return r.useContext(p)}p.displayName="StyleSheetContext";var b=n.default.useInsertionEffect||n.default.useLayoutEffect,y="u">typeof window?f():void 0;function v(e){var t=y||g();return t&&("u"<typeof window?t.add(e):b(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,a=r.useContext(p),i=r.useState(function(){return a||t||f()})[0];return n.default.createElement(p.Provider,{value:i},s)},s.createStyleRegistry=f,s.style=v,s.useStyleRegistry=g},21373,(e,t,s)=>{t.exports=e.r(98547).style},58442,e=>{"use strict";var t=e.i(43476),s=e.i(21373),a=e.i(71645),r=e.i(18150);let n=["created","delivered","running","replied"],i={created:"bg-gray-400",delivered:"bg-blue-400",running:"bg-green-400",replied:"bg-purple-400",failed:"bg-red-400",closed:"bg-gray-500"};function l({status:e}){let s=n.indexOf(e),a="failed"===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[n.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full transition-all duration-700 ${a?0===r?"bg-red-400":"bg-gray-700":r<=s?i[e]||"bg-gray-600":"bg-gray-700"}`}),r<n.length-1&&(0,t.jsx)("div",{className:`w-4 h-px transition-colors duration-700 ${a?"bg-red-800":r<s?"bg-gray-500":"bg-gray-800"}`})]},e)),(0,t.jsx)("span",{className:`text-[10px] ml-1.5 font-medium ${a?"text-red-400":"replied"===e?"text-purple-400":"running"===e?"text-green-400":"text-gray-500"}`,children:e}),("running"===e||"delivered"===e)&&(0,t.jsxs)("span",{className:"ml-1",children:[(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse"}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.2s"}}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.4s"}})]})]})}function o({text:e}){if(!e)return(0,t.jsx)("span",{className:"text-gray-600 italic",children:"No content"});let s=e.split(/(```[\s\S]*?```|`[^`\n]+`|\*\*[^*]+\*\*)/g);return(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:s.map((e,s)=>{if(e.startsWith("```")&&e.endsWith("```")){let a=e.slice(3,-3),r=a.match(/^(\w+)\n/)?.[1]||"",n=r?a.slice(r.length+1):a;return(0,t.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-[#1a1a2a]",children:[r&&(0,t.jsx)("div",{className:"bg-[#0a0a15] px-3 py-1 text-[10px] text-gray-500 border-b border-[#1a1a2a]",children:r}),(0,t.jsx)("pre",{className:"bg-[#050510] px-3 py-2 text-[11px] text-green-300 overflow-x-auto",children:n})]},s)}return e.startsWith("`")&&e.endsWith("`")?(0,t.jsx)("code",{className:"bg-[#0a0a15] rounded px-1.5 py-0.5 text-cyan-300 text-[11px] border border-[#1a1a2a]",children:e.slice(1,-1)},s):e.startsWith("**")&&e.endsWith("**")?(0,t.jsx)("strong",{className:"text-white font-semibold",children:e.slice(2,-2)},s):(0,t.jsx)("span",{children:e},s)})})}e.s(["TaskChatPanel",0,function({alias:e,onClose:n,inline:i,availableNodes:d}){let[c,u]=(0,a.useState)([]),[h,x]=(0,a.useState)(""),[m,p]=(0,a.useState)("normal"),[f,g]=(0,a.useState)(!1),[b,y]=(0,a.useState)(new Set),[v,j]=(0,a.useState)(!1),[w,S]=(0,a.useState)(e),[_,N]=(0,a.useState)(!1),[k,C]=(0,a.useState)(""),[R,z]=(0,a.useState)([]),F=(0,a.useRef)(null),T=(0,a.useRef)(null);(0,a.useEffect)(()=>{d?z(d):fetch("/api/hub/status").then(e=>e.json()).then(e=>{z((e.sessions||[]).filter(e=>"offline"!==e.status).map(e=>e.alias))}).catch(()=>{})},[d]),(0,a.useEffect)(()=>{S(e)},[e]);let E=(0,a.useCallback)(async()=>{try{let t=await fetch(`/api/hub/tasks?to_name=${encodeURIComponent(e)}&limit=30`),s=await t.json();s.tasks&&u(s.tasks.reverse())}catch{}finally{j(!0)}},[e]);(0,a.useEffect)(()=>{u([]),j(!1),E(),setTimeout(()=>T.current?.focus(),300)},[e,E]),(0,a.useEffect)(()=>{F.current?.scrollIntoView({behavior:"smooth"})},[c]),(0,a.useEffect)(()=>{if(0===b.size)return;let e=Date.now(),t=setInterval(async()=>{if(Date.now()-e>12e4){y(new Set),clearInterval(t);return}for(let e of b)try{let t=await fetch(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`),s=await t.json();if(s.tasks?.[0]){let t=s.tasks[0];u(s=>s.map(s=>s.task_id===e?{...s,...t}:s)),["replied","failed","closed","expired","cancelled"].includes(t.status)&&y(t=>{let s=new Set(t);return s.delete(e),s})}}catch{}},2e3);return()=>clearInterval(t)},[b]);let I=async()=>{if(!h.trim()||f)return;let e=h.trim(),t=w,s=e.match(/^@(\S+)\s+([\s\S]+)/);if(s){let a=R.find(e=>e.toLowerCase()===s[1].toLowerCase());a&&(t=a,e=s[2])}g(!0),x(""),N(!1),T.current&&(T.current.style.height="auto");try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),a=await s.json();if(a.ok){let s={task_id:a.message_id||`tmp-${Date.now()}`,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,s]),a.message_id&&y(e=>new Set(e).add(a.message_id))}}catch{}g(!1),T.current?.focus()},$=R.filter(t=>t!==e&&t.toLowerCase().includes(k)).slice(0,8),A=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!v&&(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}),v&&0===c.length&&(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)("div",{className:"text-3xl mb-3",children:"💬"}),(0,t.jsx)("div",{className:"text-gray-500 text-sm",children:"Start a conversation"}),(0,t.jsxs)("div",{className:"text-gray-600 text-xs mt-1",children:["Send a task to ",e]})]}),c.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-cyan-500/8 border border-cyan-500/15 rounded-2xl rounded-br-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.content})}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-1.5 gap-3",children:[(0,t.jsx)(l,{status:e.status}),(0,t.jsx)("span",{className:"text-[9px] text-gray-600 shrink-0",children:(0,r.timeAgo)(e.created_at)})]})]})}),e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-green-500/8 border border-green-500/15 rounded-2xl rounded-bl-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 font-medium mb-1.5",children:e.to_name}),(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.result})})]})}),"running"===e.status&&!e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsx)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-2xl rounded-bl-md px-4 py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.15s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.3s"}})]})})})]},e.task_id)),(0,t.jsx)("div",{ref:F})]}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] bg-[#0d0d1a] px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 relative",children:[_&&$.length>0&&(0,t.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-[#111128] border border-[#2a2a4a] rounded-lg shadow-xl shadow-black/50 overflow-hidden z-10 max-h-48 overflow-y-auto",children:$.map(e=>(0,t.jsxs)("button",{onClick:()=>{let t,s;return t=h.lastIndexOf("@"),s=h.slice(0,t),void(x(`${s}@${e} `),N(!1),T.current?.focus())},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-cyan-500/10 transition-colors",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0"}),(0,t.jsx)("span",{className:"text-gray-300",children:e})]},e))}),(0,t.jsx)("textarea",{ref:T,value:h,onChange:e=>{var t;(e=>{x(e);let t=e.lastIndexOf("@");if(t>=0&&(0===t||" "===e[t-1]||"\n"===e[t-1])){let s=e.slice(t+1);if(!s.includes(" ")&&!s.includes("\n")){C(s.toLowerCase()),N(!0);return}}N(!1)})(e.target.value),(t=e.target).style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),I()),"Escape"===e.key&&N(!1)},placeholder:`Message ${e}...`,rows:1,className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-2.5 pr-16 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none transition-colors"}),(0,t.jsx)("div",{className:"absolute right-2 bottom-1.5 flex items-center gap-1",children:(0,t.jsxs)("select",{value:m,onChange:e=>p(e.target.value),className:"bg-transparent text-[9px] text-gray-600 focus:outline-none cursor-pointer",children:[(0,t.jsx)("option",{value:"normal",children:"N"}),(0,t.jsx)("option",{value:"high",children:"H"}),(0,t.jsx)("option",{value:"low",children:"L"})]})})]}),(0,t.jsx)("button",{onClick:I,disabled:f||!h.trim(),className:"p-2.5 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white rounded-xl transition-all shrink-0 active:scale-95",children:f?(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})})})]}),(0,t.jsxs)("div",{className:"flex justify-between text-[9px] text-gray-700 mt-1.5",children:[(0,t.jsx)("span",{children:h.includes("@")?`Sending to: ${w}`:"Type @ to mention another node"}),(0,t.jsx)("span",{children:"Enter to send · Shift+Enter for newline"})]})]})]});return i?(0,t.jsx)("div",{className:"flex flex-col h-full",children:A}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:n,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-4 py-3 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500/30 to-blue-500/30 flex items-center justify-center text-xs font-bold text-cyan-300",children:e.slice(0,2)}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:e}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:b.size>0?"Processing...":"Ready"})]})]}),(0,t.jsx)("button",{onClick:n,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),A]}),(0,t.jsx)(s.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}])},53136,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(18566),r=e.i(22016),n=e.i(58442),i=e.i(18150);function l({tmuxName:e}){let[a,r]=(0,s.useState)(""),[n,i]=(0,s.useState)(!1),[o,d]=(0,s.useState)(!1),c=async()=>{i(!0);try{let t=await fetch(`/api/hub/tmux?name=${encodeURIComponent(e)}`),s=await t.json();r(s.output||s.error||"No output")}catch{r("Failed to fetch")}i(!1)};return(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("h2",{className:"text-sm font-semibold text-gray-300",children:["Terminal (",e,")"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{onClick:c,disabled:n,className:"text-xs text-cyan-400 hover:text-cyan-300 disabled:text-gray-600",children:n?"Loading...":"Capture"}),a&&(0,t.jsx)("button",{onClick:()=>d(!o),className:"text-xs text-gray-500 hover:text-gray-300",children:o?"Collapse":"Expand"})]})]}),a&&(0,t.jsx)("pre",{className:`text-[11px] text-green-300 bg-[#050510] rounded-lg px-3 py-2 border border-[#1a1a2a] overflow-x-auto whitespace-pre font-mono ${o?"max-h-96":"max-h-32"} overflow-y-auto`,children:a}),!a&&(0,t.jsx)("p",{className:"text-xs text-gray-600",children:"Click Capture to view terminal output"})]})}function o(){let e=(0,a.useSearchParams)().get("alias")||"",[n,i]=(0,s.useState)(null),[l,o]=(0,s.useState)([]),[c,u]=(0,s.useState)(0),[h,x]=(0,s.useState)(""),[m,p]=(0,s.useState)(""),[f,g]=(0,s.useState)(!1),b=(0,s.useCallback)(async()=>{if(e)try{let t=await fetch(`/api/hub/session?alias=${encodeURIComponent(e)}`),s=await t.json();s.session&&i(s.session),s.inbox&&o(s.inbox),u(s.sse||0),x("")}catch(e){x(e instanceof Error?e.message:"fetch failed")}},[e]);(0,s.useEffect)(()=>{b();let e=setInterval(b,5e3);return()=>clearInterval(e)},[b]);let[y,v]=(0,s.useState)(""),j=async()=>{if(m.trim()&&e){g(!0),v("");try{let t=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:m})}),s=await t.json();s.ok?(p(""),setTimeout(b,2e3)):v(s.error||"Send failed")}catch(e){v(e instanceof Error?e.message:"Send failed")}g(!1)}};if(!e)return(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono flex items-center justify-center",children:(0,t.jsxs)("p",{className:"text-gray-500",children:["No alias specified. ",(0,t.jsx)(r.default,{href:"/",className:"text-blue-400 hover:underline",children:"Back to dashboard"})]})});let w=n?.status==="working"?"text-green-400":n?.status==="idle"?"text-blue-400":"text-gray-500";return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)(r.default,{href:"/nodes",className:"text-gray-500 hover:text-gray-300 text-sm lg:ml-0 ml-10",children:"← Nodes"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:`inline-block w-3 h-3 rounded-full ${c>0?n?.status==="working"?"bg-green-500 animate-pulse":"bg-emerald-400":"bg-gray-500"}`}),(0,t.jsx)("h1",{className:"text-2xl font-bold text-white",children:e}),(0,t.jsx)("span",{className:`text-sm ${w}`,children:n?.status||"unknown"})]})]}),h&&(0,t.jsx)("div",{className:"bg-red-900/20 border border-red-800/40 text-red-300 px-4 py-2 rounded-lg mb-6 text-sm",children:h}),(0,t.jsx)(d,{alias:e,session:n,sse:c,sendMsg:m,setSendMsg:p,sending:f,sendTask:j,sendError:y})]})}function d({alias:e,session:a,sse:r,sendMsg:i,setSendMsg:o,sending:c,sendTask:h,sendError:x}){let[m,p]=(0,s.useState)("chat"),[f,g]=(0,s.useState)([]),[b,y]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{"events"!==m||b||fetch("/api/hub/task-events?limit=50").then(e=>e.json()).then(e=>{g(e.events||[]),y(!0)}).catch(()=>y(!0))},[m,b]),(0,t.jsxs)("div",{className:"bg-[#0d0d1a] border border-[#2a2a4a] rounded-xl overflow-hidden h-[calc(100vh-140px)] flex flex-col",children:[(0,t.jsx)("div",{className:"flex border-b border-[#2a2a4a] bg-[#0a0a15] shrink-0",children:["chat","events","info"].map(e=>(0,t.jsx)("button",{onClick:()=>p(e),className:`px-5 py-3 text-sm font-medium border-b-2 transition-colors ${m===e?"border-cyan-400 text-cyan-300":"border-transparent text-gray-500 hover:text-gray-300"}`,children:"chat"===e?"💬 Chat":"events"===e?"📋 Events":"📊 Info"},e))}),(0,t.jsxs)("div",{className:"flex-1 overflow-hidden",children:["chat"===m&&(0,t.jsx)(n.TaskChatPanel,{alias:e,onClose:()=>{},inline:!0}),"events"===m&&(0,t.jsx)(u,{events:f,loading:!b}),"info"===m&&(0,t.jsxs)("div",{className:"p-4 overflow-y-auto h-full space-y-4 max-w-2xl",children:[(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Node Info"}),(0,t.jsx)("div",{className:"space-y-2 text-xs",children:[{label:"Node ID",value:a?.node_id,alwaysShow:!0},{label:"Session ID",value:a?.session_id,alwaysShow:!0},{label:"Resume ID",value:a?.resume_id,alwaysShow:!0},{label:"Alias",value:a?.alias,alwaysShow:!0},{label:"Agent",value:a?.agent,alwaysShow:!0},{label:"Model",value:a?.model,alwaysShow:!0},{label:"Version",value:a?.version},{label:"Server",value:a?.server,alwaysShow:!0},{label:"Hostname",value:a?.hostname,alwaysShow:!0},{label:"IP",value:a?.ip,alwaysShow:!0},{label:"Project",value:a?.project_dir},{label:"Config",value:a?.config_path,alwaysShow:!0},{label:"Channels",value:a?.channels?.length?Array.isArray(a.channels)?a.channels.join(", "):a.channels:null,alwaysShow:!0},{label:"Tmux",value:a?.tmux_name},{label:"SSE",value:r>0?`Connected (${r})`:"Disconnected",alwaysShow:!0},{label:"Progress",value:a?.progress?`${a.progress}%`:null},{label:"Score",value:a?.score},{label:"Last Seen",value:a?.last_seen_at,alwaysShow:!0},{label:"Registered",value:a?.registered_at,alwaysShow:!0},{label:"Updated",value:a?.updated_at,alwaysShow:!0}].map(({label:e,value:s,alwaysShow:a})=>s||a?(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{className:"text-gray-500 shrink-0",children:e}),(0,t.jsx)("span",{className:"text-gray-300 truncate max-w-[200px]",title:s?String(s):"--",children:s?String(s):"--"})]},e):null)})]}),a?.task&&(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Current Task"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap",children:a.task})]}),a?.output&&(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Last Output"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 whitespace-pre-wrap max-h-48 overflow-y-auto",children:a.output})]}),(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Send Task"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&h(),placeholder:`Send task to ${e}...`,className:"flex-1 bg-[#0a0a15] border border-[#2a2a4a] rounded px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-blue-500 focus:outline-none"}),(0,t.jsx)("button",{onClick:h,disabled:c||!i.trim(),className:"px-3 py-2 bg-blue-600 hover:bg-blue-500 disabled:bg-gray-700 text-white text-xs rounded transition-colors",children:c?"...":"Send"})]}),x&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:x})]}),a?.tmux_name&&(0,t.jsx)(l,{tmuxName:a.tmux_name})]})]})]})}let c={delivered:{dot:"bg-blue-400",line:"bg-blue-500/30",icon:"📬"},acked:{dot:"bg-yellow-400",line:"bg-yellow-500/30",icon:"✅"},running:{dot:"bg-green-400",line:"bg-green-500/30",icon:"⚡"},replied:{dot:"bg-purple-400",line:"bg-purple-500/30",icon:"💬"},failed:{dot:"bg-red-400",line:"bg-red-500/30",icon:"❌"},created:{dot:"bg-gray-400",line:"bg-gray-500/30",icon:"📝"}};function u({events:e,loading:s}){if(s)return(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})});if(0===e.length)return(0,t.jsx)("div",{className:"text-center py-12 text-gray-600 text-xs",children:"No task events yet"});let a=new Map;return e.forEach(e=>{let t=e.task_id||`ungrouped-${e.id}`,s=a.get(t)||[];s.push(e),a.set(t,s)}),(0,t.jsx)("div",{className:"p-4 overflow-y-auto h-full space-y-4",children:[...a.entries()].map(([e,s])=>(0,t.jsxs)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-xl p-4",children:[(0,t.jsxs)("div",{className:"text-[10px] text-gray-600 mb-3 truncate",children:["Task: ",e.slice(0,20),"..."]}),(0,t.jsxs)("div",{className:"relative pl-6",children:[(0,t.jsx)("div",{className:"absolute left-[9px] top-2 bottom-2 w-0.5 bg-[#1a1a2a]"}),s.map((e,s)=>{let a=c[e.to_status]||c.created;return(0,t.jsxs)("div",{className:"relative pb-4 last:pb-0",children:[(0,t.jsx)("div",{className:`absolute -left-6 top-0.5 w-[18px] h-[18px] rounded-full ${a.dot} flex items-center justify-center text-[9px] z-10 border-2 border-[#111128]`,children:a.icon.length<=2?a.icon:""}),(0,t.jsxs)("div",{className:"ml-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`text-xs font-medium ${"failed"===e.to_status?"text-red-400":"replied"===e.to_status?"text-purple-400":"text-gray-300"}`,children:e.event_type}),e.from_status&&(0,t.jsxs)("span",{className:"text-[10px] text-gray-600",children:[e.from_status," → ",e.to_status]}),(0,t.jsx)("span",{className:"text-[10px] text-gray-600 ml-auto",children:(0,i.timeAgo)(e.created_at)})]}),e.detail&&(0,t.jsxs)("div",{className:"text-[11px] text-gray-500 mt-0.5 truncate",children:[e.detail.slice(0,50),e.detail.length>50?"...":""]})]})]},e.id)})]})]},e))})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-6 font-mono",children:"Loading..."}),children:(0,t.jsx)(o,{})})}])}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},65822,e=>{"use strict";var t=e.i(83599),s=e.i(58963);let n=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function i(e,t){if(!t)return e;let s=e.includes("?")?"&":"?";return`${e}${s}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",n,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",n,r);return{health:e||null,error:s}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",n,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:a}=(0,s.useNetworkId)(),{data:l,error:o,isLoading:c}=(0,t.default)(i(`/api/hub/messages?limit=${e}`,a),n,r);return{messages:l?.messages||[],error:o,isLoading:c}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:a,error:l,isLoading:o}=(0,t.default)(i("/api/hub/status",e),n,r);return{sessions:a?.sessions||[],hint:a?._hint,error:l,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:a,error:l}=(0,t.default)(i("/api/hub/stats",e),n,r);return{stats:a?.ok?a:null,error:l}},"useTasks",0,function(e){let{networkId:a}=(0,s.useNetworkId)(),l=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:c,isLoading:d}=(0,t.default)(i(`/api/hub/tasks?${l}`,a),n,r);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:c,isLoading:d}}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var n=e.i(47167);e.r(16015);var r=e.r(71645),i=r&&"object"==typeof r&&"default"in r?r:{default:r},a=void 0!==n.default&&n.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,s=t.name,n=void 0===s?"stylesheet":s,r=t.optimizeForSpeed,i=void 0===r?a:r;c(l(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",c("boolean"==typeof i,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=i,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(a||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(c(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return a||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var n=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,n))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(n){a||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];c(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];c(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&c(l(t),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+e,""),t&&n.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return s?r.insertBefore(n,s):r.appendChild(n),n},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function c(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var d=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),n=e+s;return u[n]||(u[n]="jsx-"+d(e+"-"+s)),u[n]}function f(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,n=void 0===s?null:s,r=t.optimizeForSpeed,i=void 0!==r&&r;this._sheet=n||new o({name:"styled-jsx",optimizeForSpeed:i}),this._sheet.inject(),n&&"boolean"==typeof i&&(this._sheet.setOptimizeForSpeed(i),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),n=s.styleId,r=s.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var i=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=i,this._instancesCounts[n]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var n=this._fromServer&&this._fromServer[s];n?(n.parentNode.removeChild(n),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],n=e[1];return i.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,n=e.id;if(s){var r=h(n,s);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return f(r,e)}):[f(r,t)]}}return{styleId:h(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function x(){return new m}function g(){return r.useContext(p)}p.displayName="StyleSheetContext";var y=i.default.useInsertionEffect||i.default.useLayoutEffect,v="u">typeof window?x():void 0;function b(e){var t=v||g();return t&&("u"<typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}b.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,n=r.useContext(p),a=r.useState(function(){return n||t||x()})[0];return i.default.createElement(p.Provider,{value:a},s)},s.createStyleRegistry=x,s.style=b,s.useStyleRegistry=g},21373,(e,t,s)=>{t.exports=e.r(98547).style},58442,e=>{"use strict";var t=e.i(43476),s=e.i(21373),n=e.i(71645),r=e.i(18150);let i=["created","delivered","running","replied"],a={created:"bg-gray-400",delivered:"bg-blue-400",running:"bg-green-400",replied:"bg-purple-400",failed:"bg-red-400",closed:"bg-gray-500"};function l({status:e}){let s=i.indexOf(e),n="failed"===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[i.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full transition-all duration-700 ${n?0===r?"bg-red-400":"bg-gray-700":r<=s?a[e]||"bg-gray-600":"bg-gray-700"}`}),r<i.length-1&&(0,t.jsx)("div",{className:`w-4 h-px transition-colors duration-700 ${n?"bg-red-800":r<s?"bg-gray-500":"bg-gray-800"}`})]},e)),(0,t.jsx)("span",{className:`text-[10px] ml-1.5 font-medium ${n?"text-red-400":"replied"===e?"text-purple-400":"running"===e?"text-green-400":"text-gray-500"}`,children:e}),("running"===e||"delivered"===e)&&(0,t.jsxs)("span",{className:"ml-1",children:[(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse"}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.2s"}}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.4s"}})]})]})}function o({text:e}){if(!e)return(0,t.jsx)("span",{className:"text-gray-600 italic",children:"No content"});let s=e.split(/(```[\s\S]*?```|`[^`\n]+`|\*\*[^*]+\*\*)/g);return(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:s.map((e,s)=>{if(e.startsWith("```")&&e.endsWith("```")){let n=e.slice(3,-3),r=n.match(/^(\w+)\n/)?.[1]||"",i=r?n.slice(r.length+1):n;return(0,t.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-[#1a1a2a]",children:[r&&(0,t.jsx)("div",{className:"bg-[#0a0a15] px-3 py-1 text-[10px] text-gray-500 border-b border-[#1a1a2a]",children:r}),(0,t.jsx)("pre",{className:"bg-[#050510] px-3 py-2 text-[11px] text-green-300 overflow-x-auto",children:i})]},s)}return e.startsWith("`")&&e.endsWith("`")?(0,t.jsx)("code",{className:"bg-[#0a0a15] rounded px-1.5 py-0.5 text-cyan-300 text-[11px] border border-[#1a1a2a]",children:e.slice(1,-1)},s):e.startsWith("**")&&e.endsWith("**")?(0,t.jsx)("strong",{className:"text-white font-semibold",children:e.slice(2,-2)},s):(0,t.jsx)("span",{children:e},s)})})}e.s(["TaskChatPanel",0,function({alias:e,onClose:i,inline:a,availableNodes:c}){let[d,u]=(0,n.useState)([]),[h,f]=(0,n.useState)(""),[m,p]=(0,n.useState)("normal"),[x,g]=(0,n.useState)(!1),[y,v]=(0,n.useState)(new Set),[b,j]=(0,n.useState)(!1),[_,S]=(0,n.useState)(e),[w,N]=(0,n.useState)(!1),[k,R]=(0,n.useState)(""),[C,z]=(0,n.useState)([]),F=(0,n.useRef)(null),I=(0,n.useRef)(null);(0,n.useEffect)(()=>{c?z(c):fetch("/api/hub/status").then(e=>e.json()).then(e=>{z((e.sessions||[]).filter(e=>"offline"!==e.status).map(e=>e.alias))}).catch(()=>{})},[c]),(0,n.useEffect)(()=>{S(e)},[e]);let T=(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/hub/tasks?to_name=${encodeURIComponent(e)}&limit=30`),s=await t.json();s.tasks&&u(s.tasks.reverse())}catch{}finally{j(!0)}},[e]);(0,n.useEffect)(()=>{u([]),j(!1),T(),setTimeout(()=>I.current?.focus(),300)},[e,T]),(0,n.useEffect)(()=>{F.current?.scrollIntoView({behavior:"smooth"})},[d]),(0,n.useEffect)(()=>{if(0===y.size)return;let e=Date.now(),t=setInterval(async()=>{if(Date.now()-e>12e4){v(new Set),clearInterval(t);return}for(let e of y)try{let t=await fetch(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`),s=await t.json();if(s.tasks?.[0]){let t=s.tasks[0];u(s=>s.map(s=>s.task_id===e?{...s,...t}:s)),["replied","failed","closed","expired","cancelled"].includes(t.status)&&v(t=>{let s=new Set(t);return s.delete(e),s})}}catch{}},2e3);return()=>clearInterval(t)},[y]);let A=async()=>{if(!h.trim()||x)return;let e=h.trim(),t=_,s=e.match(/^@(\S+)\s+([\s\S]+)/);if(s){let n=C.find(e=>e.toLowerCase()===s[1].toLowerCase());n&&(t=n,e=s[2])}g(!0),f(""),N(!1),I.current&&(I.current.style.height="auto");try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),n=await s.json();if(n.ok){let s={task_id:n.message_id||`tmp-${Date.now()}`,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,s]),n.message_id&&v(e=>new Set(e).add(n.message_id))}}catch{}g(!1),I.current?.focus()},$=C.filter(t=>t!==e&&t.toLowerCase().includes(k)).slice(0,8),O=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!b&&(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}),b&&0===d.length&&(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)("div",{className:"text-3xl mb-3",children:"💬"}),(0,t.jsx)("div",{className:"text-gray-500 text-sm",children:"Start a conversation"}),(0,t.jsxs)("div",{className:"text-gray-600 text-xs mt-1",children:["Send a task to ",e]})]}),d.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-cyan-500/8 border border-cyan-500/15 rounded-2xl rounded-br-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.content})}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-1.5 gap-3",children:[(0,t.jsx)(l,{status:e.status}),(0,t.jsx)("span",{className:"text-[9px] text-gray-600 shrink-0",children:(0,r.timeAgo)(e.created_at)})]})]})}),e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-green-500/8 border border-green-500/15 rounded-2xl rounded-bl-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 font-medium mb-1.5",children:e.to_name}),(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.result})})]})}),"running"===e.status&&!e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsx)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-2xl rounded-bl-md px-4 py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.15s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.3s"}})]})})})]},e.task_id)),(0,t.jsx)("div",{ref:F})]}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] bg-[#0d0d1a] px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 relative",children:[w&&$.length>0&&(0,t.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-[#111128] border border-[#2a2a4a] rounded-lg shadow-xl shadow-black/50 overflow-hidden z-10 max-h-48 overflow-y-auto",children:$.map(e=>(0,t.jsxs)("button",{onClick:()=>{let t,s;return t=h.lastIndexOf("@"),s=h.slice(0,t),void(f(`${s}@${e} `),N(!1),I.current?.focus())},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-cyan-500/10 transition-colors",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0"}),(0,t.jsx)("span",{className:"text-gray-300",children:e})]},e))}),(0,t.jsx)("textarea",{ref:I,value:h,onChange:e=>{var t;(e=>{f(e);let t=e.lastIndexOf("@");if(t>=0&&(0===t||" "===e[t-1]||"\n"===e[t-1])){let s=e.slice(t+1);if(!s.includes(" ")&&!s.includes("\n")){R(s.toLowerCase()),N(!0);return}}N(!1)})(e.target.value),(t=e.target).style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),A()),"Escape"===e.key&&N(!1)},placeholder:`Message ${e}...`,rows:1,className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-2.5 pr-16 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none transition-colors"}),(0,t.jsx)("div",{className:"absolute right-2 bottom-1.5 flex items-center gap-1",children:(0,t.jsxs)("select",{value:m,onChange:e=>p(e.target.value),className:"bg-transparent text-[9px] text-gray-600 focus:outline-none cursor-pointer",children:[(0,t.jsx)("option",{value:"normal",children:"N"}),(0,t.jsx)("option",{value:"high",children:"H"}),(0,t.jsx)("option",{value:"low",children:"L"})]})})]}),(0,t.jsx)("button",{onClick:A,disabled:x||!h.trim(),className:"p-2.5 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white rounded-xl transition-all shrink-0 active:scale-95",children:x?(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})})})]}),(0,t.jsxs)("div",{className:"flex justify-between text-[9px] text-gray-700 mt-1.5",children:[(0,t.jsx)("span",{children:h.includes("@")?`Sending to: ${_}`:"Type @ to mention another node"}),(0,t.jsx)("span",{children:"⌘+Enter"})]})]})]});return a?(0,t.jsx)("div",{className:"flex flex-col h-full",children:O}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:i,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-4 py-3 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500/30 to-blue-500/30 flex items-center justify-center text-xs font-bold text-cyan-300",children:e.slice(0,2)}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:e}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:y.size>0?"Processing...":"Ready"})]})]}),(0,t.jsx)("button",{onClick:i,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),O]}),(0,t.jsx)(s.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}])}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},65822,e=>{"use strict";var t=e.i(83599),s=e.i(58963);let n=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function i(e,t){if(!t)return e;let s=e.includes("?")?"&":"?";return`${e}${s}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",n,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",n,r);return{health:e||null,error:s}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",n,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:a}=(0,s.useNetworkId)(),{data:l,error:o,isLoading:c}=(0,t.default)(i(`/api/hub/messages?limit=${e}`,a),n,r);return{messages:l?.messages||[],error:o,isLoading:c}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:a,error:l,isLoading:o}=(0,t.default)(i("/api/hub/status",e),n,r);return{sessions:a?.sessions||[],hint:a?._hint,error:l,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:a,error:l}=(0,t.default)(i("/api/hub/stats",e),n,r);return{stats:a?.ok?a:null,error:l}},"useTasks",0,function(e){let{networkId:a}=(0,s.useNetworkId)(),l=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:c,isLoading:d}=(0,t.default)(i(`/api/hub/tasks?${l}`,a),n,r);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:c,isLoading:d}}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var n=e.i(47167);e.r(16015);var r=e.r(71645),i=r&&"object"==typeof r&&"default"in r?r:{default:r},a=void 0!==n.default&&n.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,s=t.name,n=void 0===s?"stylesheet":s,r=t.optimizeForSpeed,i=void 0===r?a:r;c(l(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",c("boolean"==typeof i,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=i,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(a||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(c(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return a||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var n=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,n))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(n){a||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];c(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];c(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&c(l(t),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+e,""),t&&n.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return s?r.insertBefore(n,s):r.appendChild(n),n},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function c(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var d=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),n=e+s;return u[n]||(u[n]="jsx-"+d(e+"-"+s)),u[n]}function f(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,n=void 0===s?null:s,r=t.optimizeForSpeed,i=void 0!==r&&r;this._sheet=n||new o({name:"styled-jsx",optimizeForSpeed:i}),this._sheet.inject(),n&&"boolean"==typeof i&&(this._sheet.setOptimizeForSpeed(i),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),n=s.styleId,r=s.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var i=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=i,this._instancesCounts[n]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var n=this._fromServer&&this._fromServer[s];n?(n.parentNode.removeChild(n),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],n=e[1];return i.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,n=e.id;if(s){var r=h(n,s);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return f(r,e)}):[f(r,t)]}}return{styleId:h(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function x(){return new m}function g(){return r.useContext(p)}p.displayName="StyleSheetContext";var y=i.default.useInsertionEffect||i.default.useLayoutEffect,v="u">typeof window?x():void 0;function b(e){var t=v||g();return t&&("u"<typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}b.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,n=r.useContext(p),a=r.useState(function(){return n||t||x()})[0];return i.default.createElement(p.Provider,{value:a},s)},s.createStyleRegistry=x,s.style=b,s.useStyleRegistry=g},21373,(e,t,s)=>{t.exports=e.r(98547).style},58442,e=>{"use strict";var t=e.i(43476),s=e.i(21373),n=e.i(71645),r=e.i(18150);let i=["created","delivered","running","replied"],a={created:"bg-gray-400",delivered:"bg-blue-400",running:"bg-green-400",replied:"bg-purple-400",failed:"bg-red-400",closed:"bg-gray-500"};function l({status:e}){let s=i.indexOf(e),n="failed"===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[i.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full transition-all duration-700 ${n?0===r?"bg-red-400":"bg-gray-700":r<=s?a[e]||"bg-gray-600":"bg-gray-700"}`}),r<i.length-1&&(0,t.jsx)("div",{className:`w-4 h-px transition-colors duration-700 ${n?"bg-red-800":r<s?"bg-gray-500":"bg-gray-800"}`})]},e)),(0,t.jsx)("span",{className:`text-[10px] ml-1.5 font-medium ${n?"text-red-400":"replied"===e?"text-purple-400":"running"===e?"text-green-400":"text-gray-500"}`,children:e}),("running"===e||"delivered"===e)&&(0,t.jsxs)("span",{className:"ml-1",children:[(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse"}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.2s"}}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.4s"}})]})]})}function o({text:e}){if(!e)return(0,t.jsx)("span",{className:"text-gray-600 italic",children:"No content"});let s=e.split(/(```[\s\S]*?```|`[^`\n]+`|\*\*[^*]+\*\*)/g);return(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:s.map((e,s)=>{if(e.startsWith("```")&&e.endsWith("```")){let n=e.slice(3,-3),r=n.match(/^(\w+)\n/)?.[1]||"",i=r?n.slice(r.length+1):n;return(0,t.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-[#1a1a2a]",children:[r&&(0,t.jsx)("div",{className:"bg-[#0a0a15] px-3 py-1 text-[10px] text-gray-500 border-b border-[#1a1a2a]",children:r}),(0,t.jsx)("pre",{className:"bg-[#050510] px-3 py-2 text-[11px] text-green-300 overflow-x-auto",children:i})]},s)}return e.startsWith("`")&&e.endsWith("`")?(0,t.jsx)("code",{className:"bg-[#0a0a15] rounded px-1.5 py-0.5 text-cyan-300 text-[11px] border border-[#1a1a2a]",children:e.slice(1,-1)},s):e.startsWith("**")&&e.endsWith("**")?(0,t.jsx)("strong",{className:"text-white font-semibold",children:e.slice(2,-2)},s):(0,t.jsx)("span",{children:e},s)})})}e.s(["TaskChatPanel",0,function({alias:e,onClose:i,inline:a,availableNodes:c}){let[d,u]=(0,n.useState)([]),[h,f]=(0,n.useState)(""),[m,p]=(0,n.useState)("normal"),[x,g]=(0,n.useState)(!1),[y,v]=(0,n.useState)(new Set),[b,j]=(0,n.useState)(!1),[_,S]=(0,n.useState)(e),[w,N]=(0,n.useState)(!1),[k,R]=(0,n.useState)(""),[C,z]=(0,n.useState)([]),F=(0,n.useRef)(null),I=(0,n.useRef)(null);(0,n.useEffect)(()=>{c?z(c):fetch("/api/hub/status").then(e=>e.json()).then(e=>{z((e.sessions||[]).filter(e=>"offline"!==e.status).map(e=>e.alias))}).catch(()=>{})},[c]),(0,n.useEffect)(()=>{S(e)},[e]);let T=(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/hub/tasks?to_name=${encodeURIComponent(e)}&limit=30`),s=await t.json();s.tasks&&u(s.tasks.reverse())}catch{}finally{j(!0)}},[e]);(0,n.useEffect)(()=>{u([]),j(!1),T(),setTimeout(()=>I.current?.focus(),300)},[e,T]),(0,n.useEffect)(()=>{F.current?.scrollIntoView({behavior:"smooth"})},[d]),(0,n.useEffect)(()=>{if(0===y.size)return;let e=Date.now(),t=setInterval(async()=>{if(Date.now()-e>12e4){v(new Set),clearInterval(t);return}for(let e of y)try{let t=await fetch(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`),s=await t.json();if(s.tasks?.[0]){let t=s.tasks[0];u(s=>s.map(s=>s.task_id===e?{...s,...t}:s)),["replied","failed","closed","expired","cancelled"].includes(t.status)&&v(t=>{let s=new Set(t);return s.delete(e),s})}}catch{}},2e3);return()=>clearInterval(t)},[y]);let A=async()=>{if(!h.trim()||x)return;let e=h.trim(),t=_,s=e.match(/^@(\S+)\s+([\s\S]+)/);if(s){let n=C.find(e=>e.toLowerCase()===s[1].toLowerCase());n&&(t=n,e=s[2])}g(!0),f(""),N(!1),I.current&&(I.current.style.height="auto");try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),n=await s.json();if(n.ok){let s={task_id:n.message_id||`tmp-${Date.now()}`,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,s]),n.message_id&&v(e=>new Set(e).add(n.message_id))}}catch{}g(!1),I.current?.focus()},$=C.filter(t=>t!==e&&t.toLowerCase().includes(k)).slice(0,8),E=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!b&&(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}),b&&0===d.length&&(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)("div",{className:"text-3xl mb-3",children:"💬"}),(0,t.jsx)("div",{className:"text-gray-500 text-sm",children:"Start a conversation"}),(0,t.jsxs)("div",{className:"text-gray-600 text-xs mt-1",children:["Send a task to ",e]})]}),d.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-cyan-500/8 border border-cyan-500/15 rounded-2xl rounded-br-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.content})}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-1.5 gap-3",children:[(0,t.jsx)(l,{status:e.status}),(0,t.jsx)("span",{className:"text-[9px] text-gray-600 shrink-0",children:(0,r.timeAgo)(e.created_at)})]})]})}),e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-green-500/8 border border-green-500/15 rounded-2xl rounded-bl-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 font-medium mb-1.5",children:e.to_name}),(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.result})})]})}),"running"===e.status&&!e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsx)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-2xl rounded-bl-md px-4 py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.15s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.3s"}})]})})})]},e.task_id)),(0,t.jsx)("div",{ref:F})]}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] bg-[#0d0d1a] px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 relative",children:[w&&$.length>0&&(0,t.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-[#111128] border border-[#2a2a4a] rounded-lg shadow-xl shadow-black/50 overflow-hidden z-10 max-h-48 overflow-y-auto",children:$.map(e=>(0,t.jsxs)("button",{onClick:()=>{let t,s;return t=h.lastIndexOf("@"),s=h.slice(0,t),void(f(`${s}@${e} `),N(!1),I.current?.focus())},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-cyan-500/10 transition-colors",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0"}),(0,t.jsx)("span",{className:"text-gray-300",children:e})]},e))}),(0,t.jsx)("textarea",{ref:I,value:h,onChange:e=>{var t;(e=>{f(e);let t=e.lastIndexOf("@");if(t>=0&&(0===t||" "===e[t-1]||"\n"===e[t-1])){let s=e.slice(t+1);if(!s.includes(" ")&&!s.includes("\n")){R(s.toLowerCase()),N(!0);return}}N(!1)})(e.target.value),(t=e.target).style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),A()),"Escape"===e.key&&N(!1)},placeholder:`Message ${e}...`,rows:1,className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-2.5 pr-16 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none transition-colors"}),(0,t.jsx)("div",{className:"absolute right-2 bottom-1.5 flex items-center gap-1",children:(0,t.jsxs)("select",{value:m,onChange:e=>p(e.target.value),className:"bg-transparent text-[9px] text-gray-600 focus:outline-none cursor-pointer",children:[(0,t.jsx)("option",{value:"normal",children:"N"}),(0,t.jsx)("option",{value:"high",children:"H"}),(0,t.jsx)("option",{value:"low",children:"L"})]})})]}),(0,t.jsx)("button",{onClick:A,disabled:x||!h.trim(),className:"p-2.5 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white rounded-xl transition-all shrink-0 active:scale-95",children:x?(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})})})]}),(0,t.jsxs)("div",{className:"flex justify-between text-[9px] text-gray-700 mt-1.5",children:[(0,t.jsx)("span",{children:h.includes("@")?`Sending to: ${_}`:"Type @ to mention another node"}),(0,t.jsx)("span",{children:"Enter to send · Shift+Enter for newline"})]})]})]});return a?(0,t.jsx)("div",{className:"flex flex-col h-full",children:E}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:i,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-4 py-3 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500/30 to-blue-500/30 flex items-center justify-center text-xs font-bold text-cyan-300",children:e.slice(0,2)}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:e}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:y.size>0?"Processing...":"Ready"})]})]}),(0,t.jsx)("button",{onClick:i,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),E]}),(0,t.jsx)(s.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}])}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},65822,e=>{"use strict";var t=e.i(83599),s=e.i(58963);let n=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function a(e,t){if(!t)return e;let s=e.includes("?")?"&":"?";return`${e}${s}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",n,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",n,r);return{health:e||null,error:s}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",n,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:i}=(0,s.useNetworkId)(),{data:l,error:o,isLoading:d}=(0,t.default)(a(`/api/hub/messages?limit=${e}`,i),n,r);return{messages:l?.messages||[],error:o,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l,isLoading:o}=(0,t.default)(a("/api/hub/status",e),n,r);return{sessions:i?.sessions||[],hint:i?._hint,error:l,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l}=(0,t.default)(a("/api/hub/stats",e),n,r);return{stats:i?.ok?i:null,error:l}},"useTasks",0,function(e){let{networkId:i}=(0,s.useNetworkId)(),l=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:d,isLoading:c}=(0,t.default)(a(`/api/hub/tasks?${l}`,i),n,r);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:d,isLoading:c}}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var n=e.i(47167);e.r(16015);var r=e.r(71645),a=r&&"object"==typeof r&&"default"in r?r:{default:r},i=void 0!==n.default&&n.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,s=t.name,n=void 0===s?"stylesheet":s,r=t.optimizeForSpeed,a=void 0===r?i:r;d(l(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",d("boolean"==typeof a,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=a,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(d(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var n=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,n))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(n){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];d(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&d(l(t),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+e,""),t&&n.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return s?r.insertBefore(n,s):r.appendChild(n),n},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),n=e+s;return u[n]||(u[n]="jsx-"+c(e+"-"+s)),u[n]}function x(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,n=void 0===s?null:s,r=t.optimizeForSpeed,a=void 0!==r&&r;this._sheet=n||new o({name:"styled-jsx",optimizeForSpeed:a}),this._sheet.inject(),n&&"boolean"==typeof a&&(this._sheet.setOptimizeForSpeed(a),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),n=s.styleId,r=s.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var a=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=a,this._instancesCounts[n]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var n=this._fromServer&&this._fromServer[s];n?(n.parentNode.removeChild(n),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],n=e[1];return a.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,n=e.id;if(s){var r=h(n,s);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return x(r,e)}):[x(r,t)]}}return{styleId:h(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function g(){return new m}function f(){return r.useContext(p)}p.displayName="StyleSheetContext";var y=a.default.useInsertionEffect||a.default.useLayoutEffect,b="u">typeof window?g():void 0;function v(e){var t=b||f();return t&&("u"<typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,n=r.useContext(p),i=r.useState(function(){return n||t||g()})[0];return a.default.createElement(p.Provider,{value:i},s)},s.createStyleRegistry=g,s.style=v,s.useStyleRegistry=f},21373,(e,t,s)=>{t.exports=e.r(98547).style},58442,e=>{"use strict";var t=e.i(43476),s=e.i(21373),n=e.i(71645),r=e.i(18150);let a=["created","delivered","running","replied"],i={created:"bg-gray-400",delivered:"bg-blue-400",running:"bg-green-400",replied:"bg-purple-400",failed:"bg-red-400",closed:"bg-gray-500"};function l({status:e}){let s=a.indexOf(e),n="failed"===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[a.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full transition-all duration-700 ${n?0===r?"bg-red-400":"bg-gray-700":r<=s?i[e]||"bg-gray-600":"bg-gray-700"}`}),r<a.length-1&&(0,t.jsx)("div",{className:`w-4 h-px transition-colors duration-700 ${n?"bg-red-800":r<s?"bg-gray-500":"bg-gray-800"}`})]},e)),(0,t.jsx)("span",{className:`text-[10px] ml-1.5 font-medium ${n?"text-red-400":"replied"===e?"text-purple-400":"running"===e?"text-green-400":"text-gray-500"}`,children:e}),("running"===e||"delivered"===e)&&(0,t.jsxs)("span",{className:"ml-1",children:[(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse"}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.2s"}}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.4s"}})]})]})}function o({text:e}){if(!e)return(0,t.jsx)("span",{className:"text-gray-600 italic",children:"No content"});let s=e.split(/(```[\s\S]*?```|`[^`\n]+`|\*\*[^*]+\*\*)/g);return(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:s.map((e,s)=>{if(e.startsWith("```")&&e.endsWith("```")){let n=e.slice(3,-3),r=n.match(/^(\w+)\n/)?.[1]||"",a=r?n.slice(r.length+1):n;return(0,t.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-[#1a1a2a]",children:[r&&(0,t.jsx)("div",{className:"bg-[#0a0a15] px-3 py-1 text-[10px] text-gray-500 border-b border-[#1a1a2a]",children:r}),(0,t.jsx)("pre",{className:"bg-[#050510] px-3 py-2 text-[11px] text-green-300 overflow-x-auto",children:a})]},s)}return e.startsWith("`")&&e.endsWith("`")?(0,t.jsx)("code",{className:"bg-[#0a0a15] rounded px-1.5 py-0.5 text-cyan-300 text-[11px] border border-[#1a1a2a]",children:e.slice(1,-1)},s):e.startsWith("**")&&e.endsWith("**")?(0,t.jsx)("strong",{className:"text-white font-semibold",children:e.slice(2,-2)},s):(0,t.jsx)("span",{children:e},s)})})}e.s(["TaskChatPanel",0,function({alias:e,onClose:a,inline:i,availableNodes:d}){let[c,u]=(0,n.useState)([]),[h,x]=(0,n.useState)(""),[m,p]=(0,n.useState)("normal"),[g,f]=(0,n.useState)(!1),[y,b]=(0,n.useState)(new Set),[v,j]=(0,n.useState)(!1),[N,w]=(0,n.useState)(e),[S,_]=(0,n.useState)(!1),[k,C]=(0,n.useState)(""),[R,$]=(0,n.useState)([]),z=(0,n.useRef)(null),F=(0,n.useRef)(null);(0,n.useEffect)(()=>{d?$(d):fetch("/api/hub/status").then(e=>e.json()).then(e=>{$((e.sessions||[]).filter(e=>"offline"!==e.status).map(e=>e.alias))}).catch(()=>{})},[d]),(0,n.useEffect)(()=>{w(e)},[e]);let T=(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/hub/tasks?to_name=${encodeURIComponent(e)}&limit=30`),s=await t.json();s.tasks&&u(s.tasks.reverse())}catch{}finally{j(!0)}},[e]);(0,n.useEffect)(()=>{u([]),j(!1),T(),setTimeout(()=>F.current?.focus(),300)},[e,T]),(0,n.useEffect)(()=>{z.current?.scrollIntoView({behavior:"smooth"})},[c]),(0,n.useEffect)(()=>{if(0===y.size)return;let e=Date.now(),t=setInterval(async()=>{if(Date.now()-e>12e4){b(new Set),clearInterval(t);return}for(let e of y)try{let t=await fetch(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`),s=await t.json();if(s.tasks?.[0]){let t=s.tasks[0];u(s=>s.map(s=>s.task_id===e?{...s,...t}:s)),["replied","failed","closed","expired","cancelled"].includes(t.status)&&b(t=>{let s=new Set(t);return s.delete(e),s})}}catch{}},2e3);return()=>clearInterval(t)},[y]);let I=async()=>{if(!h.trim()||g)return;let e=h.trim(),t=N,s=e.match(/^@(\S+)\s+([\s\S]+)/);if(s){let n=R.find(e=>e.toLowerCase()===s[1].toLowerCase());n&&(t=n,e=s[2])}f(!0),x(""),_(!1),F.current&&(F.current.style.height="auto");try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),n=await s.json();if(n.ok){let s={task_id:n.message_id||`tmp-${Date.now()}`,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,s]),n.message_id&&b(e=>new Set(e).add(n.message_id))}}catch{}f(!1),F.current?.focus()},A=R.filter(t=>t!==e&&t.toLowerCase().includes(k)).slice(0,8),O=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!v&&(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}),v&&0===c.length&&(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)("div",{className:"text-3xl mb-3",children:"💬"}),(0,t.jsx)("div",{className:"text-gray-500 text-sm",children:"Start a conversation"}),(0,t.jsxs)("div",{className:"text-gray-600 text-xs mt-1",children:["Send a task to ",e]})]}),c.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-cyan-500/8 border border-cyan-500/15 rounded-2xl rounded-br-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.content})}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-1.5 gap-3",children:[(0,t.jsx)(l,{status:e.status}),(0,t.jsx)("span",{className:"text-[9px] text-gray-600 shrink-0",children:(0,r.timeAgo)(e.created_at)})]})]})}),e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-green-500/8 border border-green-500/15 rounded-2xl rounded-bl-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 font-medium mb-1.5",children:e.to_name}),(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.result})})]})}),"running"===e.status&&!e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsx)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-2xl rounded-bl-md px-4 py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.15s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.3s"}})]})})})]},e.task_id)),(0,t.jsx)("div",{ref:z})]}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] bg-[#0d0d1a] px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 relative",children:[S&&A.length>0&&(0,t.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-[#111128] border border-[#2a2a4a] rounded-lg shadow-xl shadow-black/50 overflow-hidden z-10 max-h-48 overflow-y-auto",children:A.map(e=>(0,t.jsxs)("button",{onClick:()=>{let t,s;return t=h.lastIndexOf("@"),s=h.slice(0,t),void(x(`${s}@${e} `),_(!1),F.current?.focus())},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-cyan-500/10 transition-colors",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0"}),(0,t.jsx)("span",{className:"text-gray-300",children:e})]},e))}),(0,t.jsx)("textarea",{ref:F,value:h,onChange:e=>{var t;(e=>{x(e);let t=e.lastIndexOf("@");if(t>=0&&(0===t||" "===e[t-1]||"\n"===e[t-1])){let s=e.slice(t+1);if(!s.includes(" ")&&!s.includes("\n")){C(s.toLowerCase()),_(!0);return}}_(!1)})(e.target.value),(t=e.target).style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),I()),"Escape"===e.key&&_(!1)},placeholder:`Message ${e}...`,rows:1,className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-2.5 pr-16 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none transition-colors"}),(0,t.jsx)("div",{className:"absolute right-2 bottom-1.5 flex items-center gap-1",children:(0,t.jsxs)("select",{value:m,onChange:e=>p(e.target.value),className:"bg-transparent text-[9px] text-gray-600 focus:outline-none cursor-pointer",children:[(0,t.jsx)("option",{value:"normal",children:"N"}),(0,t.jsx)("option",{value:"high",children:"H"}),(0,t.jsx)("option",{value:"low",children:"L"})]})})]}),(0,t.jsx)("button",{onClick:I,disabled:g||!h.trim(),className:"p-2.5 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white rounded-xl transition-all shrink-0 active:scale-95",children:g?(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})})})]}),(0,t.jsxs)("div",{className:"flex justify-between text-[9px] text-gray-700 mt-1.5",children:[(0,t.jsx)("span",{children:h.includes("@")?`Sending to: ${N}`:"Type @ to mention another node"}),(0,t.jsx)("span",{children:"⌘+Enter"})]})]})]});return i?(0,t.jsx)("div",{className:"flex flex-col h-full",children:O}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:a,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-4 py-3 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500/30 to-blue-500/30 flex items-center justify-center text-xs font-bold text-cyan-300",children:e.slice(0,2)}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:e}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:y.size>0?"Processing...":"Ready"})]})]}),(0,t.jsx)("button",{onClick:a,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),O]}),(0,t.jsx)(s.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}])},86688,e=>{"use strict";var t=e.i(43476),s=e.i(71645),n=e.i(22016),r=e.i(18150),a=e.i(65822),i=e.i(58442);let l={working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-blue-500/10 text-blue-300 border-blue-500/20",blocked:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",error:"bg-red-500/10 text-red-300 border-red-500/20",offline:"bg-gray-500/10 text-gray-500 border-gray-500/20"};e.s(["default",0,function(){let e,o,d,c,{sessions:u,isLoading:h}=(0,a.useSessions)(),{health:x}=(0,a.useHealth)(),m=x?.sse_sessions||{},[p,g]=(0,s.useState)(""),[f,y]=(0,s.useState)(""),[b,v]=(0,s.useState)("list"),[j,N]=(0,s.useState)({}),[w,S]=(0,s.useState)(null),[_,k]=(0,s.useState)({}),[C,R]=(0,s.useState)(null),$=u.map(e=>({...e,online:!!m[e.alias]})).filter(e=>"online"===p?e.online:"offline"===p?!e.online:!p||p===e.status).filter(e=>!f||e.alias.toLowerCase().includes(f.toLowerCase())||(e.agent||"").toLowerCase().includes(f.toLowerCase())).sort((e,t)=>!!t.online-!!e.online||("working"===t.status)-("working"===e.status)),z=u.filter(e=>m[e.alias]).length,F=e=>{S(t=>t===e?null:e),k(t=>({...t,[e]:{}}))},T=(e,t)=>{N(s=>({...s,[e]:t}))},I=async e=>{let t=j[e]?.trim()||"";if(t){k(t=>({...t,[e]:{sending:!0}}));try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:t})}),n=await s.json();if(!s.ok||n?.ok===!1)throw Error(n?.error||"Send failed");N(t=>({...t,[e]:""})),k(t=>({...t,[e]:{success:"Task sent"}})),S(null)}catch(t){k(s=>({...s,[e]:{error:t instanceof Error?t.message:"Send failed"}}))}}};return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Nodes"}),(0,t.jsxs)("span",{className:"text-xs bg-green-900/30 text-green-400 px-2 py-0.5 rounded-full border border-green-800/30",children:[z," online"]}),(0,t.jsxs)("span",{className:"text-xs bg-gray-900/30 text-gray-400 px-2 py-0.5 rounded-full border border-gray-800/30",children:[u.length," total"]})]}),u.length>0&&(e=$.filter(e=>e.online&&"working"===e.status).length,o=$.filter(e=>e.online&&"idle"===e.status).length,d=$.filter(e=>!e.online).length,c=$.length||1,(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-800",children:[e>0&&(0,t.jsx)("div",{className:"bg-green-500",style:{width:`${e/c*100}%`}}),o>0&&(0,t.jsx)("div",{className:"bg-cyan-500",style:{width:`${o/c*100}%`}}),d>0&&(0,t.jsx)("div",{className:"bg-gray-600",style:{width:`${d/c*100}%`}})]}),(0,t.jsxs)("div",{className:"flex gap-4 mt-1.5 text-[10px] text-gray-500",children:[e>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500 mr-1"}),e," working"]}),o>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-cyan-500 mr-1"}),o," idle"]}),d>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-gray-600 mr-1"}),d," offline"]})]})]})),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,t.jsx)("input",{type:"text",value:f,onChange:e=>y(e.target.value),placeholder:"Search nodes...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-48"}),(0,t.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white focus:border-blue-500/50 focus:outline-none",children:[(0,t.jsx)("option",{value:"",children:"All"}),(0,t.jsx)("option",{value:"online",children:"Online"}),(0,t.jsx)("option",{value:"offline",children:"Offline"}),(0,t.jsx)("option",{value:"working",children:"Working"}),(0,t.jsx)("option",{value:"idle",children:"Idle"}),(0,t.jsx)("option",{value:"blocked",children:"Blocked"}),(0,t.jsx)("option",{value:"error",children:"Error"})]}),(0,t.jsx)("div",{className:"ml-auto flex rounded-lg border border-[#2a2a4a] bg-[#111128] p-1 text-sm",children:["list","grid"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>v(e),className:`rounded-md px-3 py-1.5 transition-colors ${b===e?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"list"===e?"List":"Grid"},e))})]}),h?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(e=>(0,t.jsx)("div",{className:"h-16 bg-gray-800/20 rounded-lg"},e))}):0===$.length?(0,t.jsx)("div",{className:"text-center py-16 text-gray-600",children:"No nodes match your filters."}):"grid"===b?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:$.map(e=>{let s=e.online?e.status:"offline",a=_[e.alias]||{},i="number"==typeof e.progress?e.progress:0;return(0,t.jsxs)("div",{className:`relative overflow-hidden rounded-xl border border-[#2a2a4a] bg-[#111128] p-4 transition-colors ${!e.online?"opacity-60":""}`,children:[!e.online&&(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,t.jsx)("span",{className:"rotate-[-20deg] rounded-xl border border-white/10 bg-black/20 px-5 py-2 text-xl font-bold uppercase tracking-[0.35em] text-white/10",children:"Offline"})}),(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsx)(n.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,className:"min-w-0 flex-1 hover:text-cyan-300",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-base font-semibold text-white",children:e.alias}),(0,t.jsx)("span",{className:`shrink-0 rounded-md border px-2 py-0.5 text-[11px] ${l[s]||l.offline}`,children:s})]})}),(0,t.jsxs)("div",{className:"flex gap-1.5 shrink-0",children:[(0,t.jsx)("button",{type:"button",onClick:()=>R(e.alias),className:"rounded-lg border border-green-500/20 bg-green-500/10 px-3 py-1.5 text-xs text-green-300 transition-colors hover:bg-green-500/20",children:"Chat"}),(0,t.jsx)("button",{type:"button",onClick:()=>F(e.alias),className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-1.5 text-xs text-cyan-300 transition-colors hover:bg-cyan-500/20",children:"Task"})]})]}),(0,t.jsxs)("div",{className:"mt-3 space-y-2 text-xs text-gray-500",children:[(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{children:"Agent"}),(0,t.jsx)("span",{className:"truncate text-gray-300",children:e.agent||"--"})]}),(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{children:"Server"}),(0,t.jsx)("span",{className:"truncate text-gray-300",children:e.server||"--"})]}),(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{children:"Updated"}),(0,t.jsx)("span",{className:"text-gray-300",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)})]})]}),(0,t.jsx)("div",{className:"mt-3 rounded-lg border border-[#1a1a2a] bg-[#0a0a15] px-3 py-2 text-xs text-gray-400",children:e.task?e.task:"No current task"}),i>0&&i<100&&(0,t.jsx)("div",{className:"mt-3 h-1.5 overflow-hidden rounded-full bg-gray-800",children:(0,t.jsx)("div",{className:"h-1.5 rounded-full bg-cyan-400 transition-all",style:{width:`${i}%`}})}),w===e.alias&&(0,t.jsxs)("div",{className:"mt-4 space-y-2 rounded-lg border border-[#2a2a4a] bg-[#0a0a15] p-3",children:[(0,t.jsx)("input",{type:"text",value:j[e.alias]||"",onChange:t=>T(e.alias,t.target.value),onKeyDown:t=>"Enter"===t.key&&I(e.alias),placeholder:`Send task to ${e.alias}...`,className:"w-full rounded-lg border border-[#2a2a4a] bg-[#050510] px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500 focus:outline-none"}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>S(null),className:"rounded-lg border border-gray-700 px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200",children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(e.alias),disabled:a.sending||!(j[e.alias]||"").trim(),className:"rounded-lg bg-cyan-600 px-3 py-1.5 text-xs text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-700",children:a.sending?"Sending...":"Send"})]})]}),a.error&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:a.error}),a.success&&w!==e.alias&&(0,t.jsx)("div",{className:"mt-2 text-xs text-green-400",children:a.success})]},e.alias)})}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-12 gap-2 px-4 py-2 text-xs text-gray-600 uppercase",children:[(0,t.jsx)("div",{className:"col-span-1",children:"Status"}),(0,t.jsx)("div",{className:"col-span-2",children:"Alias"}),(0,t.jsx)("div",{className:"col-span-2",children:"Agent"}),(0,t.jsx)("div",{className:"col-span-2",children:"Server"}),(0,t.jsx)("div",{className:"col-span-2",children:"Current Task"}),(0,t.jsx)("div",{className:"col-span-1",children:"Updated"}),(0,t.jsx)("div",{className:"col-span-2 text-right",children:"Actions"})]}),$.map(e=>{let s=e.online?e.status:"offline",a=_[e.alias]||{};return(0,t.jsxs)("div",{className:`rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 transition-colors hover:border-[#3a3a5a] ${!e.online?"opacity-50":""}`,children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-12 gap-2 items-center",children:[(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${l[s]||l.offline}`,children:s})}),(0,t.jsx)("div",{className:"col-span-2 min-w-0",children:(0,t.jsx)(n.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,className:"truncate text-sm font-medium text-white hover:text-cyan-300",children:e.alias})}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-400",children:e.agent||"--"}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-400",children:e.server||"--"}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-500",children:e.task||"--"}),(0,t.jsx)("div",{className:"col-span-1 text-xs text-gray-500",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)}),(0,t.jsxs)("div",{className:"col-span-2 flex justify-end gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>R(e.alias),className:"rounded-lg border border-green-500/20 bg-green-500/10 px-2 py-1 text-xs text-green-300 hover:bg-green-500/20",children:"Chat"}),(0,t.jsx)("button",{type:"button",onClick:()=>F(e.alias),className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-2 py-1 text-xs text-cyan-300 hover:bg-cyan-500/20",children:"Task"})]})]}),(0,t.jsxs)("div",{className:"sm:hidden space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)(n.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,className:"truncate text-sm font-medium text-white hover:text-cyan-300",children:e.alias}),(0,t.jsx)("span",{className:`shrink-0 text-xs px-2 py-0.5 rounded-md border ${l[s]||l.offline}`,children:s})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:[e.agent||"--"," · ",(0,r.timeAgo)(e.last_seen_at||e.updated_at)]}),e.task&&(0,t.jsx)("div",{className:"truncate text-xs text-gray-500",children:e.task}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>R(e.alias),className:"flex-1 rounded-lg border border-green-500/20 bg-green-500/10 px-3 py-2 text-xs text-green-300 hover:bg-green-500/20",children:"Chat"}),(0,t.jsx)("button",{type:"button",onClick:()=>F(e.alias),className:"flex-1 rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-300 hover:bg-cyan-500/20",children:"Send Task"})]})]}),w===e.alias&&(0,t.jsxs)("div",{className:"mt-3 space-y-2 border-t border-[#2a2a4a] pt-3",children:[(0,t.jsx)("input",{type:"text",value:j[e.alias]||"",onChange:t=>T(e.alias,t.target.value),onKeyDown:t=>"Enter"===t.key&&I(e.alias),placeholder:`Send task to ${e.alias}...`,className:"w-full rounded-lg border border-[#2a2a4a] bg-[#0a0a15] px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500 focus:outline-none"}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>S(null),className:"rounded-lg border border-gray-700 px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200",children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(e.alias),disabled:a.sending||!(j[e.alias]||"").trim(),className:"rounded-lg bg-cyan-600 px-3 py-1.5 text-xs text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-700",children:a.sending?"Sending...":"Send"})]})]}),a.error&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:a.error}),a.success&&w!==e.alias&&(0,t.jsx)("div",{className:"mt-2 text-xs text-green-400",children:a.success})]},e.alias)})]}),C&&(0,t.jsx)(i.TaskChatPanel,{alias:C,onClose:()=>R(null)})]})}])}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18150,e=>{"use strict";e.s(["formatUptime",0,function(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60);return t>0?`${t}h ${s}m`:`${s}m`},"timeAgo",0,function(e){if(!e)return"--";let t=Math.floor((Date.now()-new Date(e.replace(" ","T")+"Z").getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}])},65822,e=>{"use strict";var t=e.i(83599),s=e.i(58963);let n=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},r={refreshInterval:5e3,dedupingInterval:3e3};function a(e,t){if(!t)return e;let s=e.includes("?")?"&":"?";return`${e}${s}network_id=${encodeURIComponent(t)}`}e.s(["useAnetConfig",0,function(){let{data:e}=(0,t.default)("/api/anet/config",n,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",n,r);return{health:e||null,error:s}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",n,{refreshInterval:6e4});return{license:e?.ok?e:null,error:s}},"useMessages",0,function(e=100){let{networkId:i}=(0,s.useNetworkId)(),{data:l,error:o,isLoading:d}=(0,t.default)(a(`/api/hub/messages?limit=${e}`,i),n,r);return{messages:l?.messages||[],error:o,isLoading:d}},"useSessions",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l,isLoading:o}=(0,t.default)(a("/api/hub/status",e),n,r);return{sessions:i?.sessions||[],hint:i?._hint,error:l,isLoading:o}},"useStats",0,function(){let{networkId:e}=(0,s.useNetworkId)(),{data:i,error:l}=(0,t.default)(a("/api/hub/stats",e),n,r);return{stats:i?.ok?i:null,error:l}},"useTasks",0,function(e){let{networkId:i}=(0,s.useNetworkId)(),l=new URLSearchParams({limit:"100",...e}).toString(),{data:o,error:d,isLoading:c}=(0,t.default)(a(`/api/hub/tasks?${l}`,i),n,r);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:d,isLoading:c}}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var n=e.i(47167);e.r(16015);var r=e.r(71645),a=r&&"object"==typeof r&&"default"in r?r:{default:r},i=void 0!==n.default&&n.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},o=function(){function e(e){var t=void 0===e?{}:e,s=t.name,n=void 0===s?"stylesheet":s,r=t.optimizeForSpeed,a=void 0===r?i:r;d(l(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",d("boolean"==typeof a,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=a,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var o="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=o?o.getAttribute("content"):null}var t,s=e.prototype;return s.setOptimizeForSpeed=function(e){d("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),d(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.inject=function(){var e=this;if(d(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(d(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var n=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,n))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(n){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var n=this._tags[e];d(n,"old rule at index `"+e+"` not found"),n.textContent=t}return e},s.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];d(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},s.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&d(l(t),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+e,""),t&&n.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return s?r.insertBefore(n,s):r.appendChild(n),n},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function d(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),n=e+s;return u[n]||(u[n]="jsx-"+c(e+"-"+s)),u[n]}function x(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var m=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,n=void 0===s?null:s,r=t.optimizeForSpeed,a=void 0!==r&&r;this._sheet=n||new o({name:"styled-jsx",optimizeForSpeed:a}),this._sheet.inject(),n&&"boolean"==typeof a&&(this._sheet.setOptimizeForSpeed(a),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var s=this.getIdAndRules(e),n=s.styleId,r=s.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var a=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[n]=a,this._instancesCounts[n]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var n=this._fromServer&&this._fromServer[s];n?(n.parentNode.removeChild(n),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],n=e[1];return a.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,n=e.id;if(s){var r=h(n,s);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return x(r,e)}):[x(r,t)]}}return{styleId:h(n),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function g(){return new m}function f(){return r.useContext(p)}p.displayName="StyleSheetContext";var y=a.default.useInsertionEffect||a.default.useLayoutEffect,b="u">typeof window?g():void 0;function v(e){var t=b||f();return t&&("u"<typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}v.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,n=r.useContext(p),i=r.useState(function(){return n||t||g()})[0];return a.default.createElement(p.Provider,{value:i},s)},s.createStyleRegistry=g,s.style=v,s.useStyleRegistry=f},21373,(e,t,s)=>{t.exports=e.r(98547).style},58442,e=>{"use strict";var t=e.i(43476),s=e.i(21373),n=e.i(71645),r=e.i(18150);let a=["created","delivered","running","replied"],i={created:"bg-gray-400",delivered:"bg-blue-400",running:"bg-green-400",replied:"bg-purple-400",failed:"bg-red-400",closed:"bg-gray-500"};function l({status:e}){let s=a.indexOf(e),n="failed"===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[a.map((e,r)=>(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("div",{className:`w-2 h-2 rounded-full transition-all duration-700 ${n?0===r?"bg-red-400":"bg-gray-700":r<=s?i[e]||"bg-gray-600":"bg-gray-700"}`}),r<a.length-1&&(0,t.jsx)("div",{className:`w-4 h-px transition-colors duration-700 ${n?"bg-red-800":r<s?"bg-gray-500":"bg-gray-800"}`})]},e)),(0,t.jsx)("span",{className:`text-[10px] ml-1.5 font-medium ${n?"text-red-400":"replied"===e?"text-purple-400":"running"===e?"text-green-400":"text-gray-500"}`,children:e}),("running"===e||"delivered"===e)&&(0,t.jsxs)("span",{className:"ml-1",children:[(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse"}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.2s"}}),(0,t.jsx)("span",{className:"inline-block w-1 h-1 rounded-full bg-green-400 animate-pulse ml-0.5",style:{animationDelay:"0.4s"}})]})]})}function o({text:e}){if(!e)return(0,t.jsx)("span",{className:"text-gray-600 italic",children:"No content"});let s=e.split(/(```[\s\S]*?```|`[^`\n]+`|\*\*[^*]+\*\*)/g);return(0,t.jsx)("div",{className:"whitespace-pre-wrap break-words leading-relaxed",children:s.map((e,s)=>{if(e.startsWith("```")&&e.endsWith("```")){let n=e.slice(3,-3),r=n.match(/^(\w+)\n/)?.[1]||"",a=r?n.slice(r.length+1):n;return(0,t.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-[#1a1a2a]",children:[r&&(0,t.jsx)("div",{className:"bg-[#0a0a15] px-3 py-1 text-[10px] text-gray-500 border-b border-[#1a1a2a]",children:r}),(0,t.jsx)("pre",{className:"bg-[#050510] px-3 py-2 text-[11px] text-green-300 overflow-x-auto",children:a})]},s)}return e.startsWith("`")&&e.endsWith("`")?(0,t.jsx)("code",{className:"bg-[#0a0a15] rounded px-1.5 py-0.5 text-cyan-300 text-[11px] border border-[#1a1a2a]",children:e.slice(1,-1)},s):e.startsWith("**")&&e.endsWith("**")?(0,t.jsx)("strong",{className:"text-white font-semibold",children:e.slice(2,-2)},s):(0,t.jsx)("span",{children:e},s)})})}e.s(["TaskChatPanel",0,function({alias:e,onClose:a,inline:i,availableNodes:d}){let[c,u]=(0,n.useState)([]),[h,x]=(0,n.useState)(""),[m,p]=(0,n.useState)("normal"),[g,f]=(0,n.useState)(!1),[y,b]=(0,n.useState)(new Set),[v,j]=(0,n.useState)(!1),[N,w]=(0,n.useState)(e),[S,_]=(0,n.useState)(!1),[k,C]=(0,n.useState)(""),[R,$]=(0,n.useState)([]),z=(0,n.useRef)(null),F=(0,n.useRef)(null);(0,n.useEffect)(()=>{d?$(d):fetch("/api/hub/status").then(e=>e.json()).then(e=>{$((e.sessions||[]).filter(e=>"offline"!==e.status).map(e=>e.alias))}).catch(()=>{})},[d]),(0,n.useEffect)(()=>{w(e)},[e]);let T=(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/hub/tasks?to_name=${encodeURIComponent(e)}&limit=30`),s=await t.json();s.tasks&&u(s.tasks.reverse())}catch{}finally{j(!0)}},[e]);(0,n.useEffect)(()=>{u([]),j(!1),T(),setTimeout(()=>F.current?.focus(),300)},[e,T]),(0,n.useEffect)(()=>{z.current?.scrollIntoView({behavior:"smooth"})},[c]),(0,n.useEffect)(()=>{if(0===y.size)return;let e=Date.now(),t=setInterval(async()=>{if(Date.now()-e>12e4){b(new Set),clearInterval(t);return}for(let e of y)try{let t=await fetch(`/api/hub/tasks?task_id=${encodeURIComponent(e)}`),s=await t.json();if(s.tasks?.[0]){let t=s.tasks[0];u(s=>s.map(s=>s.task_id===e?{...s,...t}:s)),["replied","failed","closed","expired","cancelled"].includes(t.status)&&b(t=>{let s=new Set(t);return s.delete(e),s})}}catch{}},2e3);return()=>clearInterval(t)},[y]);let I=async()=>{if(!h.trim()||g)return;let e=h.trim(),t=N,s=e.match(/^@(\S+)\s+([\s\S]+)/);if(s){let n=R.find(e=>e.toLowerCase()===s[1].toLowerCase());n&&(t=n,e=s[2])}f(!0),x(""),_(!1),F.current&&(F.current.style.height="auto");try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),n=await s.json();if(n.ok){let s={task_id:n.message_id||`tmp-${Date.now()}`,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,s]),n.message_id&&b(e=>new Set(e).add(n.message_id))}}catch{}f(!1),F.current?.focus()},A=R.filter(t=>t!==e&&t.toLowerCase().includes(k)).slice(0,8),E=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!v&&(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-cyan-500/30 border-t-cyan-500 rounded-full animate-spin"})}),v&&0===c.length&&(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)("div",{className:"text-3xl mb-3",children:"💬"}),(0,t.jsx)("div",{className:"text-gray-500 text-sm",children:"Start a conversation"}),(0,t.jsxs)("div",{className:"text-gray-600 text-xs mt-1",children:["Send a task to ",e]})]}),c.map((e,s)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-cyan-500/8 border border-cyan-500/15 rounded-2xl rounded-br-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.content})}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-1.5 gap-3",children:[(0,t.jsx)(l,{status:e.status}),(0,t.jsx)("span",{className:"text-[9px] text-gray-600 shrink-0",children:(0,r.timeAgo)(e.created_at)})]})]})}),e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"max-w-[85%] bg-green-500/8 border border-green-500/15 rounded-2xl rounded-bl-md px-4 py-2.5 shadow-sm",children:[(0,t.jsx)("div",{className:"text-[10px] text-green-400 font-medium mb-1.5",children:e.to_name}),(0,t.jsx)("div",{className:"text-[13px] text-gray-200",children:(0,t.jsx)(o,{text:e.result})})]})}),"running"===e.status&&!e.result&&(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsx)("div",{className:"bg-[#111128] border border-[#2a2a4a] rounded-2xl rounded-bl-md px-4 py-3",children:(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.15s"}}),(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 animate-bounce",style:{animationDelay:"0.3s"}})]})})})]},e.task_id)),(0,t.jsx)("div",{ref:z})]}),(0,t.jsxs)("div",{className:"border-t border-[#2a2a4a] bg-[#0d0d1a] px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex-1 relative",children:[S&&A.length>0&&(0,t.jsx)("div",{className:"absolute bottom-full left-0 right-0 mb-1 bg-[#111128] border border-[#2a2a4a] rounded-lg shadow-xl shadow-black/50 overflow-hidden z-10 max-h-48 overflow-y-auto",children:A.map(e=>(0,t.jsxs)("button",{onClick:()=>{let t,s;return t=h.lastIndexOf("@"),s=h.slice(0,t),void(x(`${s}@${e} `),_(!1),F.current?.focus())},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-left hover:bg-cyan-500/10 transition-colors",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0"}),(0,t.jsx)("span",{className:"text-gray-300",children:e})]},e))}),(0,t.jsx)("textarea",{ref:F,value:h,onChange:e=>{var t;(e=>{x(e);let t=e.lastIndexOf("@");if(t>=0&&(0===t||" "===e[t-1]||"\n"===e[t-1])){let s=e.slice(t+1);if(!s.includes(" ")&&!s.includes("\n")){C(s.toLowerCase()),_(!0);return}}_(!1)})(e.target.value),(t=e.target).style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),I()),"Escape"===e.key&&_(!1)},placeholder:`Message ${e}...`,rows:1,className:"w-full bg-[#111128] border border-[#2a2a4a] rounded-xl px-4 py-2.5 pr-16 text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none resize-none transition-colors"}),(0,t.jsx)("div",{className:"absolute right-2 bottom-1.5 flex items-center gap-1",children:(0,t.jsxs)("select",{value:m,onChange:e=>p(e.target.value),className:"bg-transparent text-[9px] text-gray-600 focus:outline-none cursor-pointer",children:[(0,t.jsx)("option",{value:"normal",children:"N"}),(0,t.jsx)("option",{value:"high",children:"H"}),(0,t.jsx)("option",{value:"low",children:"L"})]})})]}),(0,t.jsx)("button",{onClick:I,disabled:g||!h.trim(),className:"p-2.5 bg-cyan-600 hover:bg-cyan-500 disabled:bg-gray-800 disabled:text-gray-600 text-white rounded-xl transition-all shrink-0 active:scale-95",children:g?(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,t.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5"})})})]}),(0,t.jsxs)("div",{className:"flex justify-between text-[9px] text-gray-700 mt-1.5",children:[(0,t.jsx)("span",{children:h.includes("@")?`Sending to: ${N}`:"Type @ to mention another node"}),(0,t.jsx)("span",{children:"Enter to send · Shift+Enter for newline"})]})]})]});return i?(0,t.jsx)("div",{className:"flex flex-col h-full",children:E}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{onClick:a,className:"jsx-c3e56cbc81656d9 fixed inset-0 bg-black/30 z-40 lg:hidden"}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 fixed top-0 right-0 h-full w-full lg:w-[500px] bg-[#0a0a1a] border-l border-[#2a2a4a] z-50 flex flex-col shadow-2xl shadow-black/60 animate-slide-in",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center justify-between px-4 py-3 border-b border-[#2a2a4a] bg-[#0d0d1a]",children:[(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9 flex items-center gap-3",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 w-8 h-8 rounded-full bg-gradient-to-br from-cyan-500/30 to-blue-500/30 flex items-center justify-center text-xs font-bold text-cyan-300",children:e.slice(0,2)}),(0,t.jsxs)("div",{className:"jsx-c3e56cbc81656d9",children:[(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-sm font-semibold text-white",children:e}),(0,t.jsx)("div",{className:"jsx-c3e56cbc81656d9 text-[10px] text-gray-500",children:y.size>0?"Processing...":"Ready"})]})]}),(0,t.jsx)("button",{onClick:a,className:"jsx-c3e56cbc81656d9 text-gray-500 hover:text-white p-1.5 rounded-lg hover:bg-[#1a1a2a]",children:(0,t.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-c3e56cbc81656d9 w-5 h-5",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12",className:"jsx-c3e56cbc81656d9"})})})]}),E]}),(0,t.jsx)(s.default,{id:"c3e56cbc81656d9",children:"@keyframes slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}"})]})}])},86688,e=>{"use strict";var t=e.i(43476),s=e.i(71645),n=e.i(22016),r=e.i(18150),a=e.i(65822),i=e.i(58442);let l={working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-blue-500/10 text-blue-300 border-blue-500/20",blocked:"bg-yellow-500/10 text-yellow-300 border-yellow-500/20",error:"bg-red-500/10 text-red-300 border-red-500/20",offline:"bg-gray-500/10 text-gray-500 border-gray-500/20"};e.s(["default",0,function(){let e,o,d,c,{sessions:u,isLoading:h}=(0,a.useSessions)(),{health:x}=(0,a.useHealth)(),m=x?.sse_sessions||{},[p,g]=(0,s.useState)(""),[f,y]=(0,s.useState)(""),[b,v]=(0,s.useState)("list"),[j,N]=(0,s.useState)({}),[w,S]=(0,s.useState)(null),[_,k]=(0,s.useState)({}),[C,R]=(0,s.useState)(null),$=u.map(e=>({...e,online:!!m[e.alias]})).filter(e=>"online"===p?e.online:"offline"===p?!e.online:!p||p===e.status).filter(e=>!f||e.alias.toLowerCase().includes(f.toLowerCase())||(e.agent||"").toLowerCase().includes(f.toLowerCase())).sort((e,t)=>!!t.online-!!e.online||("working"===t.status)-("working"===e.status)),z=u.filter(e=>m[e.alias]).length,F=e=>{S(t=>t===e?null:e),k(t=>({...t,[e]:{}}))},T=(e,t)=>{N(s=>({...s,[e]:t}))},I=async e=>{let t=j[e]?.trim()||"";if(t){k(t=>({...t,[e]:{sending:!0}}));try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:e,task:t})}),n=await s.json();if(!s.ok||n?.ok===!1)throw Error(n?.error||"Send failed");N(t=>({...t,[e]:""})),k(t=>({...t,[e]:{success:"Task sent"}})),S(null)}catch(t){k(s=>({...s,[e]:{error:t instanceof Error?t.message:"Send failed"}}))}}};return(0,t.jsxs)("div",{className:"min-h-screen bg-[#0a0a1a] text-gray-100 p-4 sm:p-6 font-mono",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white lg:ml-0 ml-10",children:"Nodes"}),(0,t.jsxs)("span",{className:"text-xs bg-green-900/30 text-green-400 px-2 py-0.5 rounded-full border border-green-800/30",children:[z," online"]}),(0,t.jsxs)("span",{className:"text-xs bg-gray-900/30 text-gray-400 px-2 py-0.5 rounded-full border border-gray-800/30",children:[u.length," total"]})]}),u.length>0&&(e=$.filter(e=>e.online&&"working"===e.status).length,o=$.filter(e=>e.online&&"idle"===e.status).length,d=$.filter(e=>!e.online).length,c=$.length||1,(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-800",children:[e>0&&(0,t.jsx)("div",{className:"bg-green-500",style:{width:`${e/c*100}%`}}),o>0&&(0,t.jsx)("div",{className:"bg-cyan-500",style:{width:`${o/c*100}%`}}),d>0&&(0,t.jsx)("div",{className:"bg-gray-600",style:{width:`${d/c*100}%`}})]}),(0,t.jsxs)("div",{className:"flex gap-4 mt-1.5 text-[10px] text-gray-500",children:[e>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500 mr-1"}),e," working"]}),o>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-cyan-500 mr-1"}),o," idle"]}),d>0&&(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-gray-600 mr-1"}),d," offline"]})]})]})),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 mb-6",children:[(0,t.jsx)("input",{type:"text",value:f,onChange:e=>y(e.target.value),placeholder:"Search nodes...",className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white placeholder-gray-600 focus:border-blue-500/50 focus:outline-none w-48"}),(0,t.jsxs)("select",{value:p,onChange:e=>g(e.target.value),className:"bg-[#111128] border border-[#2a2a4a] rounded-lg px-3 py-2 text-sm text-white focus:border-blue-500/50 focus:outline-none",children:[(0,t.jsx)("option",{value:"",children:"All"}),(0,t.jsx)("option",{value:"online",children:"Online"}),(0,t.jsx)("option",{value:"offline",children:"Offline"}),(0,t.jsx)("option",{value:"working",children:"Working"}),(0,t.jsx)("option",{value:"idle",children:"Idle"}),(0,t.jsx)("option",{value:"blocked",children:"Blocked"}),(0,t.jsx)("option",{value:"error",children:"Error"})]}),(0,t.jsx)("div",{className:"ml-auto flex rounded-lg border border-[#2a2a4a] bg-[#111128] p-1 text-sm",children:["list","grid"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>v(e),className:`rounded-md px-3 py-1.5 transition-colors ${b===e?"bg-cyan-500/10 text-cyan-300":"text-gray-500 hover:text-gray-200"}`,children:"list"===e?"List":"Grid"},e))})]}),h?(0,t.jsx)("div",{className:"animate-pulse space-y-2",children:[1,2,3,4].map(e=>(0,t.jsx)("div",{className:"h-16 bg-gray-800/20 rounded-lg"},e))}):0===$.length?(0,t.jsx)("div",{className:"text-center py-16 text-gray-600",children:"No nodes match your filters."}):"grid"===b?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:$.map(e=>{let s=e.online?e.status:"offline",a=_[e.alias]||{},i="number"==typeof e.progress?e.progress:0;return(0,t.jsxs)("div",{className:`relative overflow-hidden rounded-xl border border-[#2a2a4a] bg-[#111128] p-4 transition-colors ${!e.online?"opacity-60":""}`,children:[!e.online&&(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,t.jsx)("span",{className:"rotate-[-20deg] rounded-xl border border-white/10 bg-black/20 px-5 py-2 text-xl font-bold uppercase tracking-[0.35em] text-white/10",children:"Offline"})}),(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsx)(n.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,className:"min-w-0 flex-1 hover:text-cyan-300",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-base font-semibold text-white",children:e.alias}),(0,t.jsx)("span",{className:`shrink-0 rounded-md border px-2 py-0.5 text-[11px] ${l[s]||l.offline}`,children:s})]})}),(0,t.jsxs)("div",{className:"flex gap-1.5 shrink-0",children:[(0,t.jsx)("button",{type:"button",onClick:()=>R(e.alias),className:"rounded-lg border border-green-500/20 bg-green-500/10 px-3 py-1.5 text-xs text-green-300 transition-colors hover:bg-green-500/20",children:"Chat"}),(0,t.jsx)("button",{type:"button",onClick:()=>F(e.alias),className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-1.5 text-xs text-cyan-300 transition-colors hover:bg-cyan-500/20",children:"Task"})]})]}),(0,t.jsxs)("div",{className:"mt-3 space-y-2 text-xs text-gray-500",children:[(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{children:"Agent"}),(0,t.jsx)("span",{className:"truncate text-gray-300",children:e.agent||"--"})]}),(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{children:"Server"}),(0,t.jsx)("span",{className:"truncate text-gray-300",children:e.server||"--"})]}),(0,t.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,t.jsx)("span",{children:"Updated"}),(0,t.jsx)("span",{className:"text-gray-300",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)})]})]}),(0,t.jsx)("div",{className:"mt-3 rounded-lg border border-[#1a1a2a] bg-[#0a0a15] px-3 py-2 text-xs text-gray-400",children:e.task?e.task:"No current task"}),i>0&&i<100&&(0,t.jsx)("div",{className:"mt-3 h-1.5 overflow-hidden rounded-full bg-gray-800",children:(0,t.jsx)("div",{className:"h-1.5 rounded-full bg-cyan-400 transition-all",style:{width:`${i}%`}})}),w===e.alias&&(0,t.jsxs)("div",{className:"mt-4 space-y-2 rounded-lg border border-[#2a2a4a] bg-[#0a0a15] p-3",children:[(0,t.jsx)("input",{type:"text",value:j[e.alias]||"",onChange:t=>T(e.alias,t.target.value),onKeyDown:t=>"Enter"===t.key&&I(e.alias),placeholder:`Send task to ${e.alias}...`,className:"w-full rounded-lg border border-[#2a2a4a] bg-[#050510] px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500 focus:outline-none"}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>S(null),className:"rounded-lg border border-gray-700 px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200",children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(e.alias),disabled:a.sending||!(j[e.alias]||"").trim(),className:"rounded-lg bg-cyan-600 px-3 py-1.5 text-xs text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-700",children:a.sending?"Sending...":"Send"})]})]}),a.error&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:a.error}),a.success&&w!==e.alias&&(0,t.jsx)("div",{className:"mt-2 text-xs text-green-400",children:a.success})]},e.alias)})}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-12 gap-2 px-4 py-2 text-xs text-gray-600 uppercase",children:[(0,t.jsx)("div",{className:"col-span-1",children:"Status"}),(0,t.jsx)("div",{className:"col-span-2",children:"Alias"}),(0,t.jsx)("div",{className:"col-span-2",children:"Agent"}),(0,t.jsx)("div",{className:"col-span-2",children:"Server"}),(0,t.jsx)("div",{className:"col-span-2",children:"Current Task"}),(0,t.jsx)("div",{className:"col-span-1",children:"Updated"}),(0,t.jsx)("div",{className:"col-span-2 text-right",children:"Actions"})]}),$.map(e=>{let s=e.online?e.status:"offline",a=_[e.alias]||{};return(0,t.jsxs)("div",{className:`rounded-lg border border-[#2a2a4a] bg-[#111128] px-4 py-3 transition-colors hover:border-[#3a3a5a] ${!e.online?"opacity-50":""}`,children:[(0,t.jsxs)("div",{className:"hidden sm:grid sm:grid-cols-12 gap-2 items-center",children:[(0,t.jsx)("div",{className:"col-span-1",children:(0,t.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-md border ${l[s]||l.offline}`,children:s})}),(0,t.jsx)("div",{className:"col-span-2 min-w-0",children:(0,t.jsx)(n.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,className:"truncate text-sm font-medium text-white hover:text-cyan-300",children:e.alias})}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-400",children:e.agent||"--"}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-400",children:e.server||"--"}),(0,t.jsx)("div",{className:"col-span-2 truncate text-xs text-gray-500",children:e.task||"--"}),(0,t.jsx)("div",{className:"col-span-1 text-xs text-gray-500",children:(0,r.timeAgo)(e.last_seen_at||e.updated_at)}),(0,t.jsxs)("div",{className:"col-span-2 flex justify-end gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>R(e.alias),className:"rounded-lg border border-green-500/20 bg-green-500/10 px-2 py-1 text-xs text-green-300 hover:bg-green-500/20",children:"Chat"}),(0,t.jsx)("button",{type:"button",onClick:()=>F(e.alias),className:"rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-2 py-1 text-xs text-cyan-300 hover:bg-cyan-500/20",children:"Task"})]})]}),(0,t.jsxs)("div",{className:"sm:hidden space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)(n.default,{href:`/node?alias=${encodeURIComponent(e.alias)}`,className:"truncate text-sm font-medium text-white hover:text-cyan-300",children:e.alias}),(0,t.jsx)("span",{className:`shrink-0 text-xs px-2 py-0.5 rounded-md border ${l[s]||l.offline}`,children:s})]}),(0,t.jsxs)("div",{className:"text-xs text-gray-500",children:[e.agent||"--"," · ",(0,r.timeAgo)(e.last_seen_at||e.updated_at)]}),e.task&&(0,t.jsx)("div",{className:"truncate text-xs text-gray-500",children:e.task}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>R(e.alias),className:"flex-1 rounded-lg border border-green-500/20 bg-green-500/10 px-3 py-2 text-xs text-green-300 hover:bg-green-500/20",children:"Chat"}),(0,t.jsx)("button",{type:"button",onClick:()=>F(e.alias),className:"flex-1 rounded-lg border border-cyan-500/20 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-300 hover:bg-cyan-500/20",children:"Send Task"})]})]}),w===e.alias&&(0,t.jsxs)("div",{className:"mt-3 space-y-2 border-t border-[#2a2a4a] pt-3",children:[(0,t.jsx)("input",{type:"text",value:j[e.alias]||"",onChange:t=>T(e.alias,t.target.value),onKeyDown:t=>"Enter"===t.key&&I(e.alias),placeholder:`Send task to ${e.alias}...`,className:"w-full rounded-lg border border-[#2a2a4a] bg-[#0a0a15] px-3 py-2 text-xs text-white placeholder-gray-600 focus:border-cyan-500 focus:outline-none"}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>S(null),className:"rounded-lg border border-gray-700 px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200",children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(e.alias),disabled:a.sending||!(j[e.alias]||"").trim(),className:"rounded-lg bg-cyan-600 px-3 py-1.5 text-xs text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-700",children:a.sending?"Sending...":"Send"})]})]}),a.error&&(0,t.jsx)("div",{className:"mt-2 text-xs text-red-400",children:a.error}),a.success&&w!==e.alias&&(0,t.jsx)("div",{className:"mt-2 text-xs text-green-400",children:a.success})]},e.alias)})]}),C&&(0,t.jsx)(i.TaskChatPanel,{alias:C,onClose:()=>R(null)})]})}])}]);
|