@sleep2agi/agent-network-dashboard 0.1.0-preview.4 → 0.1.0-preview.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/diagnostics/route-bundle-stats.json +6 -6
  5. package/.next/fallback-build-manifest.json +3 -3
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found.html +1 -1
  14. package/.next/server/app/_not-found.rsc +1 -1
  15. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  16. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/.next/server/app/admin.html +1 -1
  22. package/.next/server/app/admin.rsc +1 -1
  23. package/.next/server/app/admin.segments/_full.segment.rsc +1 -1
  24. package/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  25. package/.next/server/app/admin.segments/_index.segment.rsc +1 -1
  26. package/.next/server/app/admin.segments/_tree.segment.rsc +1 -1
  27. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +1 -1
  28. package/.next/server/app/admin.segments/admin.segment.rsc +1 -1
  29. package/.next/server/app/docs.html +1 -1
  30. package/.next/server/app/docs.rsc +1 -1
  31. package/.next/server/app/docs.segments/_full.segment.rsc +1 -1
  32. package/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  33. package/.next/server/app/docs.segments/_index.segment.rsc +1 -1
  34. package/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
  35. package/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  36. package/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  37. package/.next/server/app/index.html +2 -2
  38. package/.next/server/app/index.rsc +2 -2
  39. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  40. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  41. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  42. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  43. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  44. package/.next/server/app/login.html +1 -1
  45. package/.next/server/app/login.rsc +1 -1
  46. package/.next/server/app/login.segments/_full.segment.rsc +1 -1
  47. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  48. package/.next/server/app/login.segments/_index.segment.rsc +1 -1
  49. package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  50. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  51. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  52. package/.next/server/app/logs.html +1 -1
  53. package/.next/server/app/logs.rsc +1 -1
  54. package/.next/server/app/logs.segments/_full.segment.rsc +1 -1
  55. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  56. package/.next/server/app/logs.segments/_index.segment.rsc +1 -1
  57. package/.next/server/app/logs.segments/_tree.segment.rsc +1 -1
  58. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
  59. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  60. package/.next/server/app/messages.html +1 -1
  61. package/.next/server/app/messages.rsc +1 -1
  62. package/.next/server/app/messages.segments/_full.segment.rsc +1 -1
  63. package/.next/server/app/messages.segments/_head.segment.rsc +1 -1
  64. package/.next/server/app/messages.segments/_index.segment.rsc +1 -1
  65. package/.next/server/app/messages.segments/_tree.segment.rsc +1 -1
  66. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +1 -1
  67. package/.next/server/app/messages.segments/messages.segment.rsc +1 -1
  68. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app/node.html +2 -2
  70. package/.next/server/app/node.rsc +2 -2
  71. package/.next/server/app/node.segments/_full.segment.rsc +2 -2
  72. package/.next/server/app/node.segments/_head.segment.rsc +1 -1
  73. package/.next/server/app/node.segments/_index.segment.rsc +1 -1
  74. package/.next/server/app/node.segments/_tree.segment.rsc +1 -1
  75. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +2 -2
  76. package/.next/server/app/node.segments/node.segment.rsc +1 -1
  77. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  78. package/.next/server/app/nodes.html +2 -2
  79. package/.next/server/app/nodes.rsc +2 -2
  80. package/.next/server/app/nodes.segments/_full.segment.rsc +2 -2
  81. package/.next/server/app/nodes.segments/_head.segment.rsc +1 -1
  82. package/.next/server/app/nodes.segments/_index.segment.rsc +1 -1
  83. package/.next/server/app/nodes.segments/_tree.segment.rsc +1 -1
  84. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +2 -2
  85. package/.next/server/app/nodes.segments/nodes.segment.rsc +1 -1
  86. package/.next/server/app/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/settings/networks.html +1 -1
  88. package/.next/server/app/settings/networks.rsc +1 -1
  89. package/.next/server/app/settings/networks.segments/_full.segment.rsc +1 -1
  90. package/.next/server/app/settings/networks.segments/_head.segment.rsc +1 -1
  91. package/.next/server/app/settings/networks.segments/_index.segment.rsc +1 -1
  92. package/.next/server/app/settings/networks.segments/_tree.segment.rsc +1 -1
  93. package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +1 -1
  94. package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +1 -1
  95. package/.next/server/app/settings/networks.segments/settings.segment.rsc +1 -1
  96. package/.next/server/app/settings/tokens.html +1 -1
  97. package/.next/server/app/settings/tokens.rsc +1 -1
  98. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +1 -1
  99. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +1 -1
  100. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +1 -1
  101. package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +1 -1
  102. package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +1 -1
  103. package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +1 -1
  104. package/.next/server/app/settings/tokens.segments/settings.segment.rsc +1 -1
  105. package/.next/server/app/settings.html +1 -1
  106. package/.next/server/app/settings.rsc +1 -1
  107. package/.next/server/app/settings.segments/_full.segment.rsc +1 -1
  108. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  109. package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  110. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  111. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
  112. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  113. package/.next/server/app/tasks.html +1 -1
  114. package/.next/server/app/tasks.rsc +1 -1
  115. package/.next/server/app/tasks.segments/_full.segment.rsc +1 -1
  116. package/.next/server/app/tasks.segments/_head.segment.rsc +1 -1
  117. package/.next/server/app/tasks.segments/_index.segment.rsc +1 -1
  118. package/.next/server/app/tasks.segments/_tree.segment.rsc +1 -1
  119. package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +1 -1
  120. package/.next/server/app/tasks.segments/tasks.segment.rsc +1 -1
  121. package/.next/server/chunks/ssr/_0s2kgzl._.js +1 -1
  122. package/.next/server/chunks/ssr/_0s2kgzl._.js.map +1 -1
  123. package/.next/server/middleware-build-manifest.js +3 -3
  124. package/.next/server/pages/404.html +1 -1
  125. package/.next/server/pages/500.html +1 -1
  126. package/.next/static/chunks/06f76ht~w6c6c.js +1 -0
  127. package/.next/static/chunks/0g5j6.4xxjqd3.js +1 -0
  128. package/.next/static/chunks/15cp_p75shcm9.js +1 -0
  129. package/.next/trace +2 -2
  130. package/.next/trace-build +1 -1
  131. package/app/components/TaskChatPanel.tsx +34 -17
  132. package/package.json +1 -1
  133. package/.next/static/chunks/03qq_1ze1j3x_.js +0 -1
  134. package/.next/static/chunks/0e4dwg687ga5q.js +0 -1
  135. package/.next/static/chunks/0ga7wt1a18fpq.js +0 -1
  136. /package/.next/static/{lgag_dfMO-AGdtcyMHSLe → oE1CQfUPxWRF4qxM7LJ_r}/_buildManifest.js +0 -0
  137. /package/.next/static/{lgag_dfMO-AGdtcyMHSLe → oE1CQfUPxWRF4qxM7LJ_r}/_clientMiddlewareManifest.js +0 -0
  138. /package/.next/static/{lgag_dfMO-AGdtcyMHSLe → oE1CQfUPxWRF4qxM7LJ_r}/_ssgManifest.js +0 -0
@@ -0,0 +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,T]=(0,a.useState)([]),z=(0,a.useRef)(null),F=(0,a.useRef)(null);(0,a.useEffect)(()=>{d?T(d):fetch("/api/hub/status").then(e=>e.json()).then(e=>{T((e.sessions||[]).filter(e=>"offline"!==e.status).map(e=>e.alias))}).catch(()=>{})},[d]),(0,a.useEffect)(()=>{S(e)},[e]);let $=(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),$(),setTimeout(()=>F.current?.focus(),300)},[e,$]),(0,a.useEffect)(()=>{z.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 E=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),F.current&&(F.current.style.height="auto");let a=`tmp-${Date.now()}`,r={task_id:a,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,r]);try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),r=await s.json().catch(()=>({ok:!1,error:`HTTP ${s.status}`}));if(r.ok&&r.message_id)u(e=>e.map(e=>e.task_id===a?{...e,task_id:r.message_id,status:"delivered"}:e)),y(e=>new Set(e).add(r.message_id));else{let e=r.error||r.detail||`send failed (status ${s.status})`;u(t=>t.map(t=>t.task_id===a?{...t,status:"failed",result:`❌ ${e}`}:t))}}catch(t){let e=t instanceof Error?t.message:String(t);u(t=>t.map(t=>t.task_id===a?{...t,status:"failed",result:`❌ network error: ${e}`}:t))}g(!1),F.current?.focus()},I=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: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:[_&&I.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:I.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),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()),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(),E()),"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:E,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,{})})}])}]);
@@ -0,0 +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 r=async e=>{let t=await fetch(e);if(401===t.status)throw window.location.assign("/login"),Error("unauthorized");return t.json()},n={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",r,{refreshInterval:3e4});return{config:e||null}},"useHealth",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/health",r,n);return{health:e||null,error:s}},"useLicense",0,function(){let{data:e,error:s}=(0,t.default)("/api/hub/license",r,{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),r,n);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),r,n);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),r,n);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),r,n);return{tasks:o?.tasks||[],count:o?.count??0,source:o?.source,error:c,isLoading:d}}])},16015,(e,t,s)=>{},98547,(e,t,s)=>{var r=e.i(47167);e.r(16015);var n=e.r(71645),i=n&&"object"==typeof n&&"default"in n?n:{default:n},a=void 0!==r.default&&r.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,r=void 0===s?"stylesheet":s,n=t.optimizeForSpeed,i=void 0===n?a:n;c(l(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-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 r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}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(r){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 r=this._tags[e];c(r,"old rule at index `"+e+"` not found"),r.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 r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var n=document.head||document.getElementsByTagName("head")[0];return s?n.insertBefore(r,s):n.appendChild(r),r},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(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),r=e+s;return u[r]||(u[r]="jsx-"+d(e+"-"+s)),u[r]}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,r=void 0===s?null:s,n=t.optimizeForSpeed,i=void 0!==n&&n;this._sheet=r||new o({name:"styled-jsx",optimizeForSpeed:i}),this._sheet.inject(),r&&"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),r=s.styleId,n=s.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var i=n.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=i,this._instancesCounts[r]=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 r=this._fromServer&&this._fromServer[s];r?(r.parentNode.removeChild(r),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],r=e[1];return i.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,r=e.id;if(s){var n=h(r,s);return{styleId:n,rules:Array.isArray(t)?t.map(function(e){return f(n,e)}):[f(n,t)]}}return{styleId:h(r),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=n.createContext(null);function x(){return new m}function g(){return n.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,r=n.useContext(p),a=n.useState(function(){return r||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),r=e.i(71645),n=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),r="failed"===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[i.map((e,n)=>(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 ${r?0===n?"bg-red-400":"bg-gray-700":n<=s?a[e]||"bg-gray-600":"bg-gray-700"}`}),n<i.length-1&&(0,t.jsx)("div",{className:`w-4 h-px transition-colors duration-700 ${r?"bg-red-800":n<s?"bg-gray-500":"bg-gray-800"}`})]},e)),(0,t.jsx)("span",{className:`text-[10px] ml-1.5 font-medium ${r?"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 r=e.slice(3,-3),n=r.match(/^(\w+)\n/)?.[1]||"",i=n?r.slice(n.length+1):r;return(0,t.jsxs)("div",{className:"my-2 rounded-lg overflow-hidden border border-[#1a1a2a]",children:[n&&(0,t.jsx)("div",{className:"bg-[#0a0a15] px-3 py-1 text-[10px] text-gray-500 border-b border-[#1a1a2a]",children:n}),(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,r.useState)([]),[h,f]=(0,r.useState)(""),[m,p]=(0,r.useState)("normal"),[x,g]=(0,r.useState)(!1),[y,v]=(0,r.useState)(new Set),[b,j]=(0,r.useState)(!1),[_,S]=(0,r.useState)(e),[w,N]=(0,r.useState)(!1),[k,R]=(0,r.useState)(""),[C,z]=(0,r.useState)([]),F=(0,r.useRef)(null),I=(0,r.useRef)(null);(0,r.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,r.useEffect)(()=>{S(e)},[e]);let T=(0,r.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,r.useEffect)(()=>{u([]),j(!1),T(),setTimeout(()=>I.current?.focus(),300)},[e,T]),(0,r.useEffect)(()=>{F.current?.scrollIntoView({behavior:"smooth"})},[d]),(0,r.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 $=async()=>{if(!h.trim()||x)return;let e=h.trim(),t=_,s=e.match(/^@(\S+)\s+([\s\S]+)/);if(s){let r=C.find(e=>e.toLowerCase()===s[1].toLowerCase());r&&(t=r,e=s[2])}g(!0),f(""),N(!1),I.current&&(I.current.style.height="auto");let r=`tmp-${Date.now()}`,n={task_id:r,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,n]);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().catch(()=>({ok:!1,error:`HTTP ${s.status}`}));if(n.ok&&n.message_id)u(e=>e.map(e=>e.task_id===r?{...e,task_id:n.message_id,status:"delivered"}:e)),v(e=>new Set(e).add(n.message_id));else{let e=n.error||n.detail||`send failed (status ${s.status})`;u(t=>t.map(t=>t.task_id===r?{...t,status:"failed",result:`❌ ${e}`}:t))}}catch(t){let e=t instanceof Error?t.message:String(t);u(t=>t.map(t=>t.task_id===r?{...t,status:"failed",result:`❌ network error: ${e}`}:t))}g(!1),I.current?.focus()},A=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,n.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&&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(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(),$()),"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: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}"})]})}])}]);
@@ -0,0 +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),[w,N]=(0,n.useState)(e),[S,_]=(0,n.useState)(!1),[k,C]=(0,n.useState)(""),[R,$]=(0,n.useState)([]),z=(0,n.useRef)(null),T=(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)(()=>{N(e)},[e]);let F=(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),F(),setTimeout(()=>T.current?.focus(),300)},[e,F]),(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=w,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),T.current&&(T.current.style.height="auto");let n=`tmp-${Date.now()}`,r={task_id:n,from_name:"Dashboard",to_name:t,status:"created",priority:m,content:e,result:"",created_at:new Date().toISOString()};u(e=>[...e,r]);try{let s=await fetch("/api/hub/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({alias:t,task:e,priority:m})}),r=await s.json().catch(()=>({ok:!1,error:`HTTP ${s.status}`}));if(r.ok&&r.message_id)u(e=>e.map(e=>e.task_id===n?{...e,task_id:r.message_id,status:"delivered"}:e)),b(e=>new Set(e).add(r.message_id));else{let e=r.error||r.detail||`send failed (status ${s.status})`;u(t=>t.map(t=>t.task_id===n?{...t,status:"failed",result:`❌ ${e}`}:t))}}catch(t){let e=t instanceof Error?t.message:String(t);u(t=>t.map(t=>t.task_id===n?{...t,status:"failed",result:`❌ network error: ${e}`}:t))}f(!1),T.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),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()),_(!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: ${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: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,w]=(0,s.useState)({}),[N,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,T=e=>{S(t=>t===e?null:e),k(t=>({...t,[e]:{}}))},F=(e,t)=>{w(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");w(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:()=>T(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}%`}})}),N===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=>F(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&&N!==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:()=>T(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:()=>T(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"})]})]}),N===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=>F(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&&N!==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)})]})}])}]);
package/.next/trace CHANGED
@@ -1,2 +1,2 @@
1
- [{"name":"generate-buildid","duration":3809,"timestamp":1665201318600,"id":4,"parentId":1,"tags":{},"startTime":1777639301765,"traceId":"0a7723eb8b5e5622"},{"name":"load-custom-routes","duration":3171,"timestamp":1665201323382,"id":5,"parentId":1,"tags":{},"startTime":1777639301770,"traceId":"0a7723eb8b5e5622"},{"name":"create-dist-dir","duration":870,"timestamp":1665201326705,"id":6,"parentId":1,"tags":{},"startTime":1777639301773,"traceId":"0a7723eb8b5e5622"},{"name":"clean","duration":129385,"timestamp":1665201333528,"id":7,"parentId":1,"tags":{},"startTime":1777639301780,"traceId":"0a7723eb8b5e5622"},{"name":"discover-routes","duration":71057,"timestamp":1665201669996,"id":8,"parentId":1,"tags":{},"startTime":1777639302116,"traceId":"0a7723eb8b5e5622"},{"name":"create-root-mapping","duration":573,"timestamp":1665201741219,"id":9,"parentId":1,"tags":{},"startTime":1777639302188,"traceId":"0a7723eb8b5e5622"},{"name":"generate-route-types","duration":109902,"timestamp":1665201750782,"id":10,"parentId":1,"tags":{},"startTime":1777639302197,"traceId":"0a7723eb8b5e5622"},{"name":"public-dir-conflict-check","duration":868,"timestamp":1665201860896,"id":11,"parentId":1,"tags":{},"startTime":1777639302307,"traceId":"0a7723eb8b5e5622"},{"name":"generate-routes-manifest","duration":22814,"timestamp":1665201863952,"id":12,"parentId":1,"tags":{},"startTime":1777639302310,"traceId":"0a7723eb8b5e5622"},{"name":"run-turbopack","duration":46325478,"timestamp":1665201913096,"id":14,"parentId":1,"tags":{},"startTime":1777639302359,"traceId":"0a7723eb8b5e5622"},{"name":"turbopack-build-events","duration":566,"timestamp":1665203215633,"id":15,"parentId":1,"tags":{},"startTime":1777639303662,"traceId":"0a7723eb8b5e5622"},{"name":"run-typescript","duration":48798993,"timestamp":1665248304495,"id":16,"parentId":1,"tags":{},"startTime":1777639348751,"traceId":"0a7723eb8b5e5622"},{"name":"generate-required-server-files","duration":10432,"timestamp":1665297108427,"id":18,"parentId":1,"tags":{},"startTime":1777639397555,"traceId":"0a7723eb8b5e5622"},{"name":"check-static-error-page","duration":228069,"timestamp":1665297666535,"id":20,"parentId":19,"tags":{},"startTime":1777639398113,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":2631407,"timestamp":1665297914902,"id":61,"parentId":22,"tags":{},"startTime":1777639398361,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":2813378,"timestamp":1665297733309,"id":22,"parentId":19,"tags":{"page":"/_global-error"},"startTime":1777639398180,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3501376,"timestamp":1665297912940,"id":60,"parentId":21,"tags":{},"startTime":1777639398359,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3701008,"timestamp":1665297713630,"id":21,"parentId":19,"tags":{"page":"/_not-found"},"startTime":1777639398160,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3565234,"timestamp":1665297915722,"id":63,"parentId":26,"tags":{},"startTime":1777639398362,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3704283,"timestamp":1665297776838,"id":26,"parentId":19,"tags":{"page":"/api/auth/logout"},"startTime":1777639398223,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3579531,"timestamp":1665297915303,"id":62,"parentId":25,"tags":{},"startTime":1777639398362,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3719137,"timestamp":1665297775821,"id":25,"parentId":19,"tags":{"page":"/api/auth/login"},"startTime":1777639398222,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3607860,"timestamp":1665297916563,"id":66,"parentId":29,"tags":{},"startTime":1777639398363,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3740403,"timestamp":1665297784137,"id":29,"parentId":19,"tags":{"page":"/api/hub/auth"},"startTime":1777639398230,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3645742,"timestamp":1665297916425,"id":65,"parentId":28,"tags":{},"startTime":1777639398363,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3778754,"timestamp":1665297783485,"id":28,"parentId":19,"tags":{"page":"/api/hub/audit-log"},"startTime":1777639398230,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3665920,"timestamp":1665297930193,"id":68,"parentId":32,"tags":{},"startTime":1777639398377,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3797436,"timestamp":1665297798799,"id":32,"parentId":19,"tags":{"page":"/api/hub/health"},"startTime":1777639398245,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3735518,"timestamp":1665297928792,"id":67,"parentId":30,"tags":{},"startTime":1777639398375,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3875421,"timestamp":1665297789344,"id":30,"parentId":19,"tags":{"page":"/api/hub/broadcast"},"startTime":1777639398236,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3770451,"timestamp":1665297932913,"id":70,"parentId":34,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3903968,"timestamp":1665297799614,"id":34,"parentId":19,"tags":{"page":"/api/hub/license"},"startTime":1777639398246,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3814159,"timestamp":1665297932982,"id":71,"parentId":35,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3944664,"timestamp":1665297802801,"id":35,"parentId":19,"tags":{"page":"/api/hub/messages"},"startTime":1777639398249,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3864906,"timestamp":1665297932352,"id":69,"parentId":33,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":3998622,"timestamp":1665297799316,"id":33,"parentId":19,"tags":{"page":"/api/hub/inbox"},"startTime":1777639398246,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3892947,"timestamp":1665297915831,"id":64,"parentId":27,"tags":{},"startTime":1777639398362,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4026639,"timestamp":1665297782274,"id":27,"parentId":19,"tags":{"page":"/api/auth/v3"},"startTime":1777639398229,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3900023,"timestamp":1665297933118,"id":74,"parentId":38,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4021951,"timestamp":1665297812414,"id":38,"parentId":19,"tags":{"page":"/api/hub/register"},"startTime":1777639398259,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3923431,"timestamp":1665297933099,"id":73,"parentId":37,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4046675,"timestamp":1665297809921,"id":37,"parentId":19,"tags":{"page":"/api/hub/nodes"},"startTime":1777639398256,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3925647,"timestamp":1665297933057,"id":72,"parentId":36,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4049995,"timestamp":1665297808775,"id":36,"parentId":19,"tags":{"page":"/api/hub/networks"},"startTime":1777639398255,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3931000,"timestamp":1665297933133,"id":75,"parentId":39,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4048725,"timestamp":1665297815505,"id":39,"parentId":19,"tags":{"page":"/api/hub/send"},"startTime":1777639398262,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3960947,"timestamp":1665297933253,"id":78,"parentId":42,"tags":{},"startTime":1777639398380,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4076665,"timestamp":1665297824112,"id":42,"parentId":19,"tags":{"page":"/api/hub/status"},"startTime":1777639398270,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3971328,"timestamp":1665297933140,"id":76,"parentId":40,"tags":{},"startTime":1777639398379,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4081910,"timestamp":1665297822641,"id":40,"parentId":19,"tags":{"page":"/api/hub/session"},"startTime":1777639398269,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3978624,"timestamp":1665297933228,"id":77,"parentId":41,"tags":{},"startTime":1777639398380,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4088083,"timestamp":1665297823828,"id":41,"parentId":19,"tags":{"page":"/api/hub/stats"},"startTime":1777639398270,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3985647,"timestamp":1665297933260,"id":79,"parentId":43,"tags":{},"startTime":1777639398380,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4094411,"timestamp":1665297824646,"id":43,"parentId":19,"tags":{"page":"/api/hub/task-events"},"startTime":1777639398271,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4000601,"timestamp":1665297933272,"id":80,"parentId":44,"tags":{},"startTime":1777639398380,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4108598,"timestamp":1665297825346,"id":44,"parentId":19,"tags":{"page":"/api/hub/tasks"},"startTime":1777639398272,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4001260,"timestamp":1665297933296,"id":82,"parentId":46,"tags":{},"startTime":1777639398380,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4109000,"timestamp":1665297825648,"id":46,"parentId":19,"tags":{"page":"/api/hub/tokens"},"startTime":1777639398272,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3978568,"timestamp":1665297969162,"id":84,"parentId":24,"tags":{},"startTime":1777639398416,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4208445,"timestamp":1665297739536,"id":24,"parentId":19,"tags":{"page":"/api/anet/config"},"startTime":1777639398186,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4021558,"timestamp":1665297933308,"id":83,"parentId":48,"tags":{},"startTime":1777639398380,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4124782,"timestamp":1665297830894,"id":48,"parentId":19,"tags":{"page":"/favicon.ico"},"startTime":1777639398277,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4025912,"timestamp":1665297933289,"id":81,"parentId":45,"tags":{},"startTime":1777639398380,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4134408,"timestamp":1665297825544,"id":45,"parentId":19,"tags":{"page":"/api/hub/tmux"},"startTime":1777639398272,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3988623,"timestamp":1665297971721,"id":85,"parentId":31,"tags":{},"startTime":1777639398418,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4165914,"timestamp":1665297797855,"id":31,"parentId":19,"tags":{"page":"/api/hub/events"},"startTime":1777639398244,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3895632,"timestamp":1665298104142,"id":88,"parentId":50,"tags":{},"startTime":1777639398550,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4166068,"timestamp":1665297835273,"id":50,"parentId":19,"tags":{"page":"/logs"},"startTime":1777639398282,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3929961,"timestamp":1665298104158,"id":89,"parentId":51,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4198346,"timestamp":1665297835894,"id":51,"parentId":19,"tags":{"page":"/messages"},"startTime":1777639398282,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":3985955,"timestamp":1665298104168,"id":90,"parentId":52,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4253623,"timestamp":1665297836574,"id":52,"parentId":19,"tags":{"page":"/node"},"startTime":1777639398283,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4007230,"timestamp":1665298104180,"id":91,"parentId":53,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4274574,"timestamp":1665297836933,"id":53,"parentId":19,"tags":{"page":"/nodes"},"startTime":1777639398283,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4087787,"timestamp":1665298104193,"id":92,"parentId":55,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4347597,"timestamp":1665297844965,"id":55,"parentId":19,"tags":{"page":"/settings/networks"},"startTime":1777639398291,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4256139,"timestamp":1665298104201,"id":93,"parentId":57,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4491032,"timestamp":1665297869411,"id":57,"parentId":19,"tags":{"page":"/settings/tokens"},"startTime":1777639398316,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4333517,"timestamp":1665298104212,"id":94,"parentId":58,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4552246,"timestamp":1665297885635,"id":58,"parentId":19,"tags":{"page":"/tasks/[id]"},"startTime":1777639398332,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4364621,"timestamp":1665298104223,"id":95,"parentId":59,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4582812,"timestamp":1665297886280,"id":59,"parentId":19,"tags":{"page":"/tasks"},"startTime":1777639398333,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4401394,"timestamp":1665298102831,"id":86,"parentId":23,"tags":{},"startTime":1777639398550,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4768923,"timestamp":1665297735477,"id":23,"parentId":19,"tags":{"page":"/admin"},"startTime":1777639398182,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4437432,"timestamp":1665298104232,"id":96,"parentId":47,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4715434,"timestamp":1665297826335,"id":47,"parentId":19,"tags":{"page":"/docs"},"startTime":1777639398273,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4438297,"timestamp":1665298104249,"id":97,"parentId":54,"tags":{},"startTime":1777639398551,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4704557,"timestamp":1665297838081,"id":54,"parentId":19,"tags":{"page":"/"},"startTime":1777639398284,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4489889,"timestamp":1665298104081,"id":87,"parentId":49,"tags":{},"startTime":1777639398550,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4762441,"timestamp":1665297831761,"id":49,"parentId":19,"tags":{"page":"/login"},"startTime":1777639398278,"traceId":"0a7723eb8b5e5622"},{"name":"is-page-static","duration":4502611,"timestamp":1665298138507,"id":98,"parentId":56,"tags":{},"startTime":1777639398585,"traceId":"0a7723eb8b5e5622"},{"name":"check-page","duration":4795440,"timestamp":1665297845747,"id":56,"parentId":19,"tags":{"page":"/settings"},"startTime":1777639398292,"traceId":"0a7723eb8b5e5622"},{"name":"static-check","duration":4994342,"timestamp":1665297648071,"id":19,"parentId":1,"tags":{},"startTime":1777639398094,"traceId":"0a7723eb8b5e5622"},{"name":"write-routes-manifest","duration":2165,"timestamp":1665302710971,"id":100,"parentId":1,"tags":{},"startTime":1777639403157,"traceId":"0a7723eb8b5e5622"},{"name":"load-dotenv","duration":84,"timestamp":1665302783844,"id":103,"parentId":102,"tags":{},"startTime":1777639403230,"traceId":"0a7723eb8b5e5622"},{"name":"run-export-path-map","duration":2293,"timestamp":1665302816043,"id":104,"parentId":102,"tags":{},"startTime":1777639403262,"traceId":"0a7723eb8b5e5622"},{"name":"next-export","duration":4430130,"timestamp":1665302780545,"id":102,"parentId":1,"tags":{},"startTime":1777639403227,"traceId":"0a7723eb8b5e5622"},{"name":"move-exported-app-not-found-","duration":14242,"timestamp":1665307247634,"id":105,"parentId":101,"tags":{},"startTime":1777639407694,"traceId":"0a7723eb8b5e5622"},{"name":"move-exported-app-global-error-","duration":5811,"timestamp":1665307262458,"id":106,"parentId":101,"tags":{},"startTime":1777639407709,"traceId":"0a7723eb8b5e5622"},{"name":"static-generation","duration":4537854,"timestamp":1665302748062,"id":101,"parentId":1,"tags":{},"startTime":1777639403194,"traceId":"0a7723eb8b5e5622"},{"name":"write-routes-manifest","duration":4210,"timestamp":1665307286648,"id":107,"parentId":1,"tags":{},"startTime":1777639407733,"traceId":"0a7723eb8b5e5622"}]
2
- [{"name":"print-tree-view","duration":28249,"timestamp":1665307492744,"id":108,"parentId":1,"tags":{},"startTime":1777639407939,"traceId":"0a7723eb8b5e5622"},{"name":"write-route-bundle-stats","duration":103691,"timestamp":1665307521214,"id":109,"parentId":1,"tags":{},"startTime":1777639407968,"traceId":"0a7723eb8b5e5622"},{"name":"telemetry-flush","duration":1671,"timestamp":1665307625521,"id":110,"parentId":1,"tags":{},"startTime":1777639408072,"traceId":"0a7723eb8b5e5622"},{"name":"next-build","duration":106460487,"timestamp":1665201166781,"id":1,"tags":{"buildMode":"default","version":"16.2.3","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1777639301613,"traceId":"0a7723eb8b5e5622"}]
1
+ [{"name":"generate-buildid","duration":1302,"timestamp":1666551533195,"id":4,"parentId":1,"tags":{},"startTime":1777640651980,"traceId":"13b8052596fb4797"},{"name":"load-custom-routes","duration":7373,"timestamp":1666551535280,"id":5,"parentId":1,"tags":{},"startTime":1777640651982,"traceId":"13b8052596fb4797"},{"name":"create-dist-dir","duration":745,"timestamp":1666551542818,"id":6,"parentId":1,"tags":{},"startTime":1777640651989,"traceId":"13b8052596fb4797"},{"name":"clean","duration":442105,"timestamp":1666551548038,"id":7,"parentId":1,"tags":{},"startTime":1777640651994,"traceId":"13b8052596fb4797"},{"name":"discover-routes","duration":239368,"timestamp":1666552513728,"id":8,"parentId":1,"tags":{},"startTime":1777640652960,"traceId":"13b8052596fb4797"},{"name":"create-root-mapping","duration":5297,"timestamp":1666552753195,"id":9,"parentId":1,"tags":{},"startTime":1777640653200,"traceId":"13b8052596fb4797"},{"name":"generate-route-types","duration":288054,"timestamp":1666552769259,"id":10,"parentId":1,"tags":{},"startTime":1777640653216,"traceId":"13b8052596fb4797"},{"name":"public-dir-conflict-check","duration":638,"timestamp":1666553057530,"id":11,"parentId":1,"tags":{},"startTime":1777640653504,"traceId":"13b8052596fb4797"},{"name":"generate-routes-manifest","duration":66505,"timestamp":1666553058710,"id":12,"parentId":1,"tags":{},"startTime":1777640653505,"traceId":"13b8052596fb4797"},{"name":"run-turbopack","duration":88192542,"timestamp":1666553210888,"id":14,"parentId":1,"tags":{},"startTime":1777640653657,"traceId":"13b8052596fb4797"},{"name":"turbopack-build-events","duration":171,"timestamp":1666556786343,"id":15,"parentId":1,"tags":{},"startTime":1777640657233,"traceId":"13b8052596fb4797"},{"name":"run-typescript","duration":67839397,"timestamp":1666641423694,"id":16,"parentId":1,"tags":{},"startTime":1777640741870,"traceId":"13b8052596fb4797"},{"name":"generate-required-server-files","duration":27084,"timestamp":1666709286080,"id":18,"parentId":1,"tags":{},"startTime":1777640809732,"traceId":"13b8052596fb4797"},{"name":"check-static-error-page","duration":420132,"timestamp":1666710160523,"id":20,"parentId":19,"tags":{},"startTime":1777640810607,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":5283146,"timestamp":1666710629431,"id":61,"parentId":22,"tags":{},"startTime":1777640811076,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":5727574,"timestamp":1666710185180,"id":22,"parentId":19,"tags":{"page":"/_global-error"},"startTime":1777640810632,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6549130,"timestamp":1666710643153,"id":62,"parentId":25,"tags":{},"startTime":1777640811090,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":6947995,"timestamp":1666710244510,"id":25,"parentId":19,"tags":{"page":"/api/auth/login"},"startTime":1777640810691,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6626278,"timestamp":1666710618905,"id":60,"parentId":21,"tags":{},"startTime":1777640811065,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7069487,"timestamp":1666710175784,"id":21,"parentId":19,"tags":{"page":"/_not-found"},"startTime":1777640810622,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6638094,"timestamp":1666710644306,"id":63,"parentId":26,"tags":{},"startTime":1777640811091,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7033739,"timestamp":1666710249405,"id":26,"parentId":19,"tags":{"page":"/api/auth/logout"},"startTime":1777640810696,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6702856,"timestamp":1666710645679,"id":66,"parentId":29,"tags":{},"startTime":1777640811092,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7090555,"timestamp":1666710258183,"id":29,"parentId":19,"tags":{"page":"/api/hub/auth"},"startTime":1777640810705,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6728330,"timestamp":1666710645213,"id":64,"parentId":27,"tags":{},"startTime":1777640811092,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7121786,"timestamp":1666710251923,"id":27,"parentId":19,"tags":{"page":"/api/auth/v3"},"startTime":1777640810702,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6734788,"timestamp":1666710645744,"id":67,"parentId":30,"tags":{},"startTime":1777640811092,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7105162,"timestamp":1666710275527,"id":30,"parentId":19,"tags":{"page":"/api/hub/broadcast"},"startTime":1777640810722,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6761135,"timestamp":1666710645827,"id":68,"parentId":32,"tags":{},"startTime":1777640811092,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7122626,"timestamp":1666710284609,"id":32,"parentId":19,"tags":{"page":"/api/hub/health"},"startTime":1777640810731,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6776993,"timestamp":1666710646048,"id":69,"parentId":33,"tags":{},"startTime":1777640811092,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7135149,"timestamp":1666710288024,"id":33,"parentId":19,"tags":{"page":"/api/hub/inbox"},"startTime":1777640810734,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6779466,"timestamp":1666710646139,"id":70,"parentId":34,"tags":{},"startTime":1777640811092,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7132407,"timestamp":1666710293261,"id":34,"parentId":19,"tags":{"page":"/api/hub/license"},"startTime":1777640810740,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6806648,"timestamp":1666710646162,"id":71,"parentId":35,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7158699,"timestamp":1666710294293,"id":35,"parentId":19,"tags":{"page":"/api/hub/messages"},"startTime":1777640810741,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6811196,"timestamp":1666710646471,"id":72,"parentId":36,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7150648,"timestamp":1666710307152,"id":36,"parentId":19,"tags":{"page":"/api/hub/networks"},"startTime":1777640810754,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6828954,"timestamp":1666710646520,"id":73,"parentId":37,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7157933,"timestamp":1666710317632,"id":37,"parentId":19,"tags":{"page":"/api/hub/nodes"},"startTime":1777640810764,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6857651,"timestamp":1666710646542,"id":75,"parentId":39,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7183982,"timestamp":1666710320326,"id":39,"parentId":19,"tags":{"page":"/api/hub/send"},"startTime":1777640810767,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6868076,"timestamp":1666710646533,"id":74,"parentId":38,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7195883,"timestamp":1666710318840,"id":38,"parentId":19,"tags":{"page":"/api/hub/register"},"startTime":1777640810765,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6882819,"timestamp":1666710645601,"id":65,"parentId":28,"tags":{},"startTime":1777640811092,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7271272,"timestamp":1666710257241,"id":28,"parentId":19,"tags":{"page":"/api/hub/audit-log"},"startTime":1777640810704,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6896131,"timestamp":1666710646550,"id":76,"parentId":40,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7221284,"timestamp":1666710321649,"id":40,"parentId":19,"tags":{"page":"/api/hub/session"},"startTime":1777640810768,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6908713,"timestamp":1666710646563,"id":77,"parentId":41,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7233332,"timestamp":1666710322099,"id":41,"parentId":19,"tags":{"page":"/api/hub/stats"},"startTime":1777640810768,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6931245,"timestamp":1666710646579,"id":79,"parentId":43,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7254235,"timestamp":1666710323870,"id":43,"parentId":19,"tags":{"page":"/api/hub/task-events"},"startTime":1777640810770,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6945269,"timestamp":1666710646571,"id":78,"parentId":42,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7268735,"timestamp":1666710323201,"id":42,"parentId":19,"tags":{"page":"/api/hub/status"},"startTime":1777640810770,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6953999,"timestamp":1666710646587,"id":80,"parentId":44,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7275456,"timestamp":1666710325234,"id":44,"parentId":19,"tags":{"page":"/api/hub/tasks"},"startTime":1777640810772,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6971819,"timestamp":1666710646603,"id":82,"parentId":46,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7260374,"timestamp":1666710358154,"id":46,"parentId":19,"tags":{"page":"/api/hub/tokens"},"startTime":1777640810805,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6972640,"timestamp":1666710646595,"id":81,"parentId":45,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7261673,"timestamp":1666710357655,"id":45,"parentId":19,"tags":{"page":"/api/hub/tmux"},"startTime":1777640810804,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6964997,"timestamp":1666710686278,"id":84,"parentId":24,"tags":{},"startTime":1777640811133,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7462563,"timestamp":1666710188832,"id":24,"parentId":19,"tags":{"page":"/api/anet/config"},"startTime":1777640810635,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6970363,"timestamp":1666710688232,"id":85,"parentId":31,"tags":{},"startTime":1777640811135,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7382087,"timestamp":1666710276643,"id":31,"parentId":19,"tags":{"page":"/api/hub/events"},"startTime":1777640810723,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":7015052,"timestamp":1666710646610,"id":83,"parentId":48,"tags":{},"startTime":1777640811093,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7246656,"timestamp":1666710415152,"id":48,"parentId":19,"tags":{"page":"/favicon.ico"},"startTime":1777640810862,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6789451,"timestamp":1666710926811,"id":86,"parentId":23,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7529970,"timestamp":1666710186484,"id":23,"parentId":19,"tags":{"page":"/admin"},"startTime":1777640810633,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6837938,"timestamp":1666710926930,"id":89,"parentId":51,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7242923,"timestamp":1666710522670,"id":51,"parentId":19,"tags":{"page":"/messages"},"startTime":1777640810969,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6891089,"timestamp":1666710926943,"id":90,"parentId":52,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7293927,"timestamp":1666710524202,"id":52,"parentId":19,"tags":{"page":"/node"},"startTime":1777640810971,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6931934,"timestamp":1666710926922,"id":88,"parentId":50,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7338923,"timestamp":1666710520890,"id":50,"parentId":19,"tags":{"page":"/logs"},"startTime":1777640810967,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6935634,"timestamp":1666710926951,"id":91,"parentId":53,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7336198,"timestamp":1666710526644,"id":53,"parentId":19,"tags":{"page":"/nodes"},"startTime":1777640810973,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6985895,"timestamp":1666710926963,"id":92,"parentId":55,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7360307,"timestamp":1666710552666,"id":55,"parentId":19,"tags":{"page":"/settings/networks"},"startTime":1777640810999,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":6989396,"timestamp":1666710926975,"id":93,"parentId":57,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7362349,"timestamp":1666710554527,"id":57,"parentId":19,"tags":{"page":"/settings/tokens"},"startTime":1777640811001,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":7013743,"timestamp":1666710926905,"id":87,"parentId":49,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7502199,"timestamp":1666710438602,"id":49,"parentId":19,"tags":{"page":"/login"},"startTime":1777640810885,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":7026280,"timestamp":1666710926995,"id":95,"parentId":59,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7374446,"timestamp":1666710580371,"id":59,"parentId":19,"tags":{"page":"/tasks"},"startTime":1777640811027,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":7047420,"timestamp":1666710926982,"id":94,"parentId":58,"tags":{},"startTime":1777640811373,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7396101,"timestamp":1666710579995,"id":58,"parentId":19,"tags":{"page":"/tasks/[id]"},"startTime":1777640811026,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":7055165,"timestamp":1666710927626,"id":97,"parentId":54,"tags":{},"startTime":1777640811374,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7454320,"timestamp":1666710528587,"id":54,"parentId":19,"tags":{"page":"/"},"startTime":1777640810975,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":7062104,"timestamp":1666710927580,"id":96,"parentId":47,"tags":{},"startTime":1777640811374,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7631347,"timestamp":1666710358475,"id":47,"parentId":19,"tags":{"page":"/docs"},"startTime":1777640810805,"traceId":"13b8052596fb4797"},{"name":"is-page-static","duration":7075641,"timestamp":1666710927649,"id":98,"parentId":56,"tags":{},"startTime":1777640811374,"traceId":"13b8052596fb4797"},{"name":"check-page","duration":7449762,"timestamp":1666710553590,"id":56,"parentId":19,"tags":{"page":"/settings"},"startTime":1777640811000,"traceId":"13b8052596fb4797"},{"name":"static-check","duration":7850448,"timestamp":1666710153018,"id":19,"parentId":1,"tags":{},"startTime":1777640810599,"traceId":"13b8052596fb4797"},{"name":"write-routes-manifest","duration":1153,"timestamp":1666718025199,"id":100,"parentId":1,"tags":{},"startTime":1777640818472,"traceId":"13b8052596fb4797"},{"name":"load-dotenv","duration":541,"timestamp":1666718102816,"id":103,"parentId":102,"tags":{},"startTime":1777640818549,"traceId":"13b8052596fb4797"},{"name":"run-export-path-map","duration":1302,"timestamp":1666718121274,"id":104,"parentId":102,"tags":{},"startTime":1777640818568,"traceId":"13b8052596fb4797"},{"name":"next-export","duration":4093279,"timestamp":1666718099708,"id":102,"parentId":1,"tags":{},"startTime":1777640818546,"traceId":"13b8052596fb4797"},{"name":"move-exported-app-not-found-","duration":2061,"timestamp":1666722224660,"id":105,"parentId":101,"tags":{},"startTime":1777640822671,"traceId":"13b8052596fb4797"},{"name":"move-exported-app-global-error-","duration":2116,"timestamp":1666722227108,"id":106,"parentId":101,"tags":{},"startTime":1777640822674,"traceId":"13b8052596fb4797"},{"name":"static-generation","duration":4168265,"timestamp":1666718068478,"id":101,"parentId":1,"tags":{},"startTime":1777640818515,"traceId":"13b8052596fb4797"},{"name":"write-routes-manifest","duration":1311,"timestamp":1666722237607,"id":107,"parentId":1,"tags":{},"startTime":1777640822684,"traceId":"13b8052596fb4797"}]
2
+ [{"name":"print-tree-view","duration":18902,"timestamp":1666722337638,"id":108,"parentId":1,"tags":{},"startTime":1777640822784,"traceId":"13b8052596fb4797"},{"name":"write-route-bundle-stats","duration":82899,"timestamp":1666722356590,"id":109,"parentId":1,"tags":{},"startTime":1777640822803,"traceId":"13b8052596fb4797"},{"name":"telemetry-flush","duration":658,"timestamp":1666722439565,"id":110,"parentId":1,"tags":{},"startTime":1777640822886,"traceId":"13b8052596fb4797"},{"name":"next-build","duration":171239219,"timestamp":1666551201086,"id":1,"tags":{"buildMode":"default","version":"16.2.3","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1777640651647,"traceId":"13b8052596fb4797"}]
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-turbopack","duration":46325478,"timestamp":1665201913096,"id":14,"parentId":1,"tags":{},"startTime":1777639302359,"traceId":"0a7723eb8b5e5622"},{"name":"turbopack-build-events","duration":566,"timestamp":1665203215633,"id":15,"parentId":1,"tags":{},"startTime":1777639303662,"traceId":"0a7723eb8b5e5622"},{"name":"run-typescript","duration":48798993,"timestamp":1665248304495,"id":16,"parentId":1,"tags":{},"startTime":1777639348751,"traceId":"0a7723eb8b5e5622"},{"name":"static-check","duration":4994342,"timestamp":1665297648071,"id":19,"parentId":1,"tags":{},"startTime":1777639398094,"traceId":"0a7723eb8b5e5622"},{"name":"static-generation","duration":4537854,"timestamp":1665302748062,"id":101,"parentId":1,"tags":{},"startTime":1777639403194,"traceId":"0a7723eb8b5e5622"},{"name":"telemetry-flush","duration":1671,"timestamp":1665307625521,"id":110,"parentId":1,"tags":{},"startTime":1777639408072,"traceId":"0a7723eb8b5e5622"},{"name":"next-build","duration":106460487,"timestamp":1665201166781,"id":1,"tags":{"buildMode":"default","version":"16.2.3","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1777639301613,"traceId":"0a7723eb8b5e5622"}]
1
+ [{"name":"run-turbopack","duration":88192542,"timestamp":1666553210888,"id":14,"parentId":1,"tags":{},"startTime":1777640653657,"traceId":"13b8052596fb4797"},{"name":"turbopack-build-events","duration":171,"timestamp":1666556786343,"id":15,"parentId":1,"tags":{},"startTime":1777640657233,"traceId":"13b8052596fb4797"},{"name":"run-typescript","duration":67839397,"timestamp":1666641423694,"id":16,"parentId":1,"tags":{},"startTime":1777640741870,"traceId":"13b8052596fb4797"},{"name":"static-check","duration":7850448,"timestamp":1666710153018,"id":19,"parentId":1,"tags":{},"startTime":1777640810599,"traceId":"13b8052596fb4797"},{"name":"static-generation","duration":4168265,"timestamp":1666718068478,"id":101,"parentId":1,"tags":{},"startTime":1777640818515,"traceId":"13b8052596fb4797"},{"name":"telemetry-flush","duration":658,"timestamp":1666722439565,"id":110,"parentId":1,"tags":{},"startTime":1777640822886,"traceId":"13b8052596fb4797"},{"name":"next-build","duration":171239219,"timestamp":1666551201086,"id":1,"tags":{"buildMode":"default","version":"16.2.3","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1777640651647,"traceId":"13b8052596fb4797"}]
@@ -193,30 +193,47 @@ export function TaskChatPanel({ alias, onClose, inline, availableNodes }: TaskCh
193
193
  setShowMentions(false);
194
194
  if (textareaRef.current) textareaRef.current.style.height = 'auto';
195
195
 
196
+ // Optimistic echo first so the user always sees their message in history
197
+ // even if the network call fails or the server returns ok:false. Earlier
198
+ // version only added on data.ok=true → silent failures looked like
199
+ // 'tasks get swallowed'.
200
+ const localTaskId = `tmp-${Date.now()}`;
201
+ const optimistic: ChatTask = {
202
+ task_id: localTaskId,
203
+ from_name: 'Dashboard',
204
+ to_name: sendTo,
205
+ status: 'created',
206
+ priority,
207
+ content: taskContent,
208
+ result: '',
209
+ created_at: new Date().toISOString(),
210
+ };
211
+ setMessages(prev => [...prev, optimistic]);
212
+
196
213
  try {
197
214
  const res = await fetch('/api/hub/send', {
198
215
  method: 'POST',
199
216
  headers: { 'Content-Type': 'application/json' },
200
217
  body: JSON.stringify({ alias: sendTo, task: taskContent, priority }),
201
218
  });
202
- const data = await res.json();
203
- if (data.ok) {
204
- const newMsg: ChatTask = {
205
- task_id: data.message_id || `tmp-${Date.now()}`,
206
- from_name: 'Dashboard',
207
- to_name: sendTo,
208
- status: 'created',
209
- priority,
210
- content: taskContent,
211
- result: '',
212
- created_at: new Date().toISOString(),
213
- };
214
- setMessages(prev => [...prev, newMsg]);
215
- if (data.message_id) {
216
- setPollingIds(prev => new Set(prev).add(data.message_id));
217
- }
219
+ const data = await res.json().catch(() => ({ ok: false, error: `HTTP ${res.status}` }));
220
+ if (data.ok && data.message_id) {
221
+ setMessages(prev => prev.map(m =>
222
+ m.task_id === localTaskId ? { ...m, task_id: data.message_id, status: 'delivered' } : m,
223
+ ));
224
+ setPollingIds(prev => new Set(prev).add(data.message_id));
225
+ } else {
226
+ const reason = data.error || data.detail || `send failed (status ${res.status})`;
227
+ setMessages(prev => prev.map(m =>
228
+ m.task_id === localTaskId ? { ...m, status: 'failed', result: `❌ ${reason}` } : m,
229
+ ));
218
230
  }
219
- } catch {}
231
+ } catch (e: unknown) {
232
+ const msg = e instanceof Error ? e.message : String(e);
233
+ setMessages(prev => prev.map(m =>
234
+ m.task_id === localTaskId ? { ...m, status: 'failed', result: `❌ network error: ${msg}` } : m,
235
+ ));
236
+ }
220
237
  setSending(false);
221
238
  textareaRef.current?.focus();
222
239
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network-dashboard",
3
- "version": "0.1.0-preview.4",
3
+ "version": "0.1.0-preview.5",
4
4
  "description": "Agent Network Dashboard — Web UI for managing AI Agent networks",
5
5
  "scripts": {
6
6
  "dev": "next dev",
@@ -1 +0,0 @@
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,{})})}])}]);