@sleep2agi/agent-network-dashboard 0.6.3-preview.3 → 0.6.3-preview.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/.next/BUILD_COMMIT +1 -1
  2. package/.next/BUILD_ID +1 -1
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/diagnostics/route-bundle-stats.json +12 -11
  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/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +2 -2
  15. package/.next/server/app/_not-found.rsc +2 -2
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/.next/server/app/admin/page.js.nft.json +1 -1
  23. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  24. package/.next/server/app/admin.html +2 -2
  25. package/.next/server/app/admin.rsc +3 -3
  26. package/.next/server/app/admin.segments/_full.segment.rsc +3 -3
  27. package/.next/server/app/admin.segments/_head.segment.rsc +1 -1
  28. package/.next/server/app/admin.segments/_index.segment.rsc +2 -2
  29. package/.next/server/app/admin.segments/_tree.segment.rsc +2 -2
  30. package/.next/server/app/admin.segments/admin/__PAGE__.segment.rsc +2 -2
  31. package/.next/server/app/admin.segments/admin.segment.rsc +1 -1
  32. package/.next/server/app/index.html +2 -2
  33. package/.next/server/app/index.rsc +3 -3
  34. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  35. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  36. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  37. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  38. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  39. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  40. package/.next/server/app/login.html +2 -2
  41. package/.next/server/app/login.rsc +3 -3
  42. package/.next/server/app/login.segments/_full.segment.rsc +3 -3
  43. package/.next/server/app/login.segments/_head.segment.rsc +1 -1
  44. package/.next/server/app/login.segments/_index.segment.rsc +2 -2
  45. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  46. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  47. package/.next/server/app/login.segments/login.segment.rsc +1 -1
  48. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  49. package/.next/server/app/logs.html +2 -2
  50. package/.next/server/app/logs.rsc +2 -2
  51. package/.next/server/app/logs.segments/_full.segment.rsc +2 -2
  52. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  53. package/.next/server/app/logs.segments/_index.segment.rsc +2 -2
  54. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  55. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
  56. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  57. package/.next/server/app/messages/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app/messages.html +2 -2
  59. package/.next/server/app/messages.rsc +3 -3
  60. package/.next/server/app/messages.segments/_full.segment.rsc +3 -3
  61. package/.next/server/app/messages.segments/_head.segment.rsc +1 -1
  62. package/.next/server/app/messages.segments/_index.segment.rsc +2 -2
  63. package/.next/server/app/messages.segments/_tree.segment.rsc +2 -2
  64. package/.next/server/app/messages.segments/messages/__PAGE__.segment.rsc +2 -2
  65. package/.next/server/app/messages.segments/messages.segment.rsc +1 -1
  66. package/.next/server/app/node/page_client-reference-manifest.js +1 -1
  67. package/.next/server/app/node.html +2 -2
  68. package/.next/server/app/node.rsc +2 -2
  69. package/.next/server/app/node.segments/_full.segment.rsc +2 -2
  70. package/.next/server/app/node.segments/_head.segment.rsc +1 -1
  71. package/.next/server/app/node.segments/_index.segment.rsc +2 -2
  72. package/.next/server/app/node.segments/_tree.segment.rsc +2 -2
  73. package/.next/server/app/node.segments/node/__PAGE__.segment.rsc +1 -1
  74. package/.next/server/app/node.segments/node.segment.rsc +1 -1
  75. package/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
  76. package/.next/server/app/nodes.html +2 -2
  77. package/.next/server/app/nodes.rsc +3 -3
  78. package/.next/server/app/nodes.segments/_full.segment.rsc +3 -3
  79. package/.next/server/app/nodes.segments/_head.segment.rsc +1 -1
  80. package/.next/server/app/nodes.segments/_index.segment.rsc +2 -2
  81. package/.next/server/app/nodes.segments/_tree.segment.rsc +2 -2
  82. package/.next/server/app/nodes.segments/nodes/__PAGE__.segment.rsc +2 -2
  83. package/.next/server/app/nodes.segments/nodes.segment.rsc +1 -1
  84. package/.next/server/app/page_client-reference-manifest.js +1 -1
  85. package/.next/server/app/server-logs/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app/server-logs.html +2 -2
  87. package/.next/server/app/server-logs.rsc +2 -2
  88. package/.next/server/app/server-logs.segments/_full.segment.rsc +2 -2
  89. package/.next/server/app/server-logs.segments/_head.segment.rsc +1 -1
  90. package/.next/server/app/server-logs.segments/_index.segment.rsc +2 -2
  91. package/.next/server/app/server-logs.segments/_tree.segment.rsc +2 -2
  92. package/.next/server/app/server-logs.segments/server-logs/__PAGE__.segment.rsc +1 -1
  93. package/.next/server/app/server-logs.segments/server-logs.segment.rsc +1 -1
  94. package/.next/server/app/servers/page_client-reference-manifest.js +1 -1
  95. package/.next/server/app/servers.html +2 -2
  96. package/.next/server/app/servers.rsc +2 -2
  97. package/.next/server/app/servers.segments/_full.segment.rsc +2 -2
  98. package/.next/server/app/servers.segments/_head.segment.rsc +1 -1
  99. package/.next/server/app/servers.segments/_index.segment.rsc +2 -2
  100. package/.next/server/app/servers.segments/_tree.segment.rsc +2 -2
  101. package/.next/server/app/servers.segments/servers/__PAGE__.segment.rsc +1 -1
  102. package/.next/server/app/servers.segments/servers.segment.rsc +1 -1
  103. package/.next/server/app/settings/networks/page_client-reference-manifest.js +1 -1
  104. package/.next/server/app/settings/networks.html +2 -2
  105. package/.next/server/app/settings/networks.rsc +2 -2
  106. package/.next/server/app/settings/networks.segments/_full.segment.rsc +2 -2
  107. package/.next/server/app/settings/networks.segments/_head.segment.rsc +1 -1
  108. package/.next/server/app/settings/networks.segments/_index.segment.rsc +2 -2
  109. package/.next/server/app/settings/networks.segments/_tree.segment.rsc +2 -2
  110. package/.next/server/app/settings/networks.segments/settings/networks/__PAGE__.segment.rsc +1 -1
  111. package/.next/server/app/settings/networks.segments/settings/networks.segment.rsc +1 -1
  112. package/.next/server/app/settings/networks.segments/settings.segment.rsc +1 -1
  113. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/settings/tokens/page_client-reference-manifest.js +1 -1
  115. package/.next/server/app/settings/tokens.html +2 -2
  116. package/.next/server/app/settings/tokens.rsc +2 -2
  117. package/.next/server/app/settings/tokens.segments/_full.segment.rsc +2 -2
  118. package/.next/server/app/settings/tokens.segments/_head.segment.rsc +1 -1
  119. package/.next/server/app/settings/tokens.segments/_index.segment.rsc +2 -2
  120. package/.next/server/app/settings/tokens.segments/_tree.segment.rsc +2 -2
  121. package/.next/server/app/settings/tokens.segments/settings/tokens/__PAGE__.segment.rsc +1 -1
  122. package/.next/server/app/settings/tokens.segments/settings/tokens.segment.rsc +1 -1
  123. package/.next/server/app/settings/tokens.segments/settings.segment.rsc +1 -1
  124. package/.next/server/app/settings.html +2 -2
  125. package/.next/server/app/settings.rsc +3 -3
  126. package/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  127. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  128. package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  129. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  130. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  131. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  132. package/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  133. package/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  134. package/.next/server/app/tasks.html +2 -2
  135. package/.next/server/app/tasks.rsc +2 -2
  136. package/.next/server/app/tasks.segments/_full.segment.rsc +2 -2
  137. package/.next/server/app/tasks.segments/_head.segment.rsc +1 -1
  138. package/.next/server/app/tasks.segments/_index.segment.rsc +2 -2
  139. package/.next/server/app/tasks.segments/_tree.segment.rsc +2 -2
  140. package/.next/server/app/tasks.segments/tasks/__PAGE__.segment.rsc +1 -1
  141. package/.next/server/app/tasks.segments/tasks.segment.rsc +1 -1
  142. package/.next/server/chunks/[root-of-the-server]__0jg663w._.js +1 -1
  143. package/.next/server/chunks/[root-of-the-server]__0jg663w._.js.map +1 -1
  144. package/.next/server/chunks/ssr/[root-of-the-server]__0-n_oet._.js +1 -1
  145. package/.next/server/chunks/ssr/[root-of-the-server]__0-n_oet._.js.map +1 -1
  146. package/.next/server/chunks/ssr/[root-of-the-server]__0jgx8j4._.js +1 -1
  147. package/.next/server/chunks/ssr/[root-of-the-server]__0jgx8j4._.js.map +1 -1
  148. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0_vh2hn._.js +1 -1
  149. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0_vh2hn._.js.map +1 -1
  150. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0a352ge._.js +1 -1
  151. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0a352ge._.js.map +1 -1
  152. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0k0.-6z._.js +1 -1
  153. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0k0.-6z._.js.map +1 -1
  154. package/.next/server/chunks/ssr/dashboard-pr4-338_app_12jui6l._.js +3 -0
  155. package/.next/server/chunks/ssr/dashboard-pr4-338_app_12jui6l._.js.map +1 -0
  156. package/.next/server/chunks/ssr/dashboard-pr4-338_app_nodes_page_tsx_0.1qp86._.js +2 -2
  157. package/.next/server/chunks/ssr/dashboard-pr4-338_app_nodes_page_tsx_0.1qp86._.js.map +1 -1
  158. package/.next/server/middleware-build-manifest.js +3 -3
  159. package/.next/server/pages/404.html +2 -2
  160. package/.next/server/pages/500.html +1 -1
  161. package/.next/static/chunks/01.7wksc03ge7.js +1 -0
  162. package/.next/static/chunks/{1238uy.r8ebu0.js → 05ludq~vmjrpi.js} +1 -1
  163. package/.next/static/chunks/0nt58h_jnn298.js +2 -0
  164. package/.next/static/chunks/0~qpo2.zfv914.css +1 -0
  165. package/.next/static/chunks/10-herg8p2_u0.js +1 -0
  166. package/.next/static/chunks/{0r4f9a-1h0l8n.js → 1162nvfdeg.tg.js} +2 -2
  167. package/.next/static/chunks/11as~l5x7cdjy.js +1 -0
  168. package/.next/static/chunks/{0dzyz0tl5mmyh.js → 14eb0vbqm-0fq.js} +1 -1
  169. package/.next/trace +2 -2
  170. package/.next/trace-build +1 -1
  171. package/app/api/anet/node-lifecycle/route.ts +54 -5
  172. package/app/components/CreateNodeWizard.tsx +70 -24
  173. package/app/components/HostSupervisorPicker.tsx +6 -3
  174. package/app/components/NodeLifecycleMenu.tsx +436 -0
  175. package/app/components/types.ts +4 -0
  176. package/app/lib/hooks.ts +22 -0
  177. package/app/nodes/page.tsx +42 -2
  178. package/package.json +1 -1
  179. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0l07md.._.js +0 -3
  180. package/.next/server/chunks/ssr/dashboard-pr4-338_app_0l07md.._.js.map +0 -1
  181. package/.next/static/chunks/0okyajjiuijbh.css +0 -1
  182. package/.next/static/chunks/0zezb.fc41oyb.js +0 -1
  183. package/.next/static/chunks/0zta~z4xpak8b.js +0 -2
  184. package/.next/static/chunks/10rif2p3a6hdl.js +0 -1
  185. /package/.next/static/{S9Q_U9UD2ZJQPBZjZgrZy → 3WnbjoWrJbRnQkx4ilgVm}/_buildManifest.js +0 -0
  186. /package/.next/static/{S9Q_U9UD2ZJQPBZjZgrZy → 3WnbjoWrJbRnQkx4ilgVm}/_clientMiddlewareManifest.js +0 -0
  187. /package/.next/static/{S9Q_U9UD2ZJQPBZjZgrZy → 3WnbjoWrJbRnQkx4ilgVm}/_ssgManifest.js +0 -0
@@ -3,7 +3,7 @@
3
3
  3:I[48967,["/_next/static/chunks/0z7gm7mwxvgm7.js","/_next/static/chunks/0kn_928z6zi9y.js","/_next/static/chunks/0rxx2o22fr4zs.js","/_next/static/chunks/0ejar-4yts1fh.js","/_next/static/chunks/0w7j11ubgyq01.js"],"default"]
4
4
  6:I[67692,["/_next/static/chunks/0z7gm7mwxvgm7.js","/_next/static/chunks/0kn_928z6zi9y.js","/_next/static/chunks/0rxx2o22fr4zs.js","/_next/static/chunks/0ejar-4yts1fh.js"],"OutletBoundary"]
5
5
  7:"$Sreact.suspense"
6
- 0:{"rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/0w7j11ubgyq01.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"isPartial":false,"staleTime":300,"varyParams":null,"buildId":"S9Q_U9UD2ZJQPBZjZgrZy"}
6
+ 0:{"rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/0w7j11ubgyq01.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"isPartial":false,"staleTime":300,"varyParams":null,"buildId":"3WnbjoWrJbRnQkx4ilgVm"}
7
7
  4:{}
8
8
  5:"$0:rsc:props:children:0:props:serverProvidedParams:params"
9
9
  8:null
@@ -2,4 +2,4 @@
2
2
  2:I[17510,["/_next/static/chunks/0z7gm7mwxvgm7.js","/_next/static/chunks/0kn_928z6zi9y.js","/_next/static/chunks/0rxx2o22fr4zs.js","/_next/static/chunks/0ejar-4yts1fh.js"],"default"]
3
3
  3:I[30200,["/_next/static/chunks/0z7gm7mwxvgm7.js","/_next/static/chunks/0kn_928z6zi9y.js","/_next/static/chunks/0rxx2o22fr4zs.js","/_next/static/chunks/0ejar-4yts1fh.js"],"default"]
4
4
  4:[]
5
- 0:{"rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"isPartial":false,"staleTime":300,"varyParams":"$W4","buildId":"S9Q_U9UD2ZJQPBZjZgrZy"}
5
+ 0:{"rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"isPartial":false,"staleTime":300,"varyParams":"$W4","buildId":"3WnbjoWrJbRnQkx4ilgVm"}
@@ -1,3 +1,3 @@
1
- module.exports=[50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},46204,e=>{"use strict";var t=e.i(69450);function r(){return process.env.COMMHUB_URL||"http://127.0.0.1:9200"}async function n(e,n){let a=`${r()}${e}`,s={},o=n?.headers;if(!o?.Authorization)try{let e=await (0,t.getV3UserToken)();e&&(s={Authorization:`Bearer ${e}`})}catch{}return fetch(a,{...n,headers:{...s,...n?.headers},next:{revalidate:0}})}r(),e.s(["hubFetch",0,n])},43963,e=>{"use strict";var t=e.i(46204);async function r(){try{let e=await (0,t.hubFetch)("/api/auth/me");if(e.ok&&(e.headers.get("content-type")||"").includes("application/json")){let t=await e.json();return t.current_network?.network_id||t.networks?.[0]?.network_id||null}}catch{}return null}async function n(e){let t;if((e.headers.get("content-type")||"").includes("application/json"))t=await e.json();else{let r=(await e.text()).split("\n").filter(e=>e.startsWith("data:")).map(e=>e.slice(5).trim()).filter(Boolean),n=r[r.length-1];if(!n)throw Error("empty MCP SSE response");t=JSON.parse(n)}let r=t;if(r.error)throw Error(r.error.message||"MCP error");let n=r.result?.content?.[0]?.text;if("string"!=typeof n)throw Error("MCP result missing content text");try{return JSON.parse(n)}catch{return{ok:!0,text:n}}}e.s(["callMcp",0,function(e,r){return(0,t.hubFetch)("/mcp",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":"2025-03-26"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:e,arguments:r}})})},"parseMcpEnvelope",0,n,"resolveDefaultNetworkId",0,r])},46869,e=>{"use strict";var t=e.i(10845),r=e.i(31666),n=e.i(42349),a=e.i(81692),s=e.i(64460),o=e.i(94903),i=e.i(53622),l=e.i(94293),u=e.i(13241),d=e.i(27832),p=e.i(36456),c=e.i(50252),h=e.i(62682),f=e.i(56947),x=e.i(41800),v=e.i(93695);e.i(63313);var R=e.i(38068),w=e.i(69450),m=e.i(43963);let g=["restart","rename"];async function y(e){let t,r,n=await (0,w.requireDashboardAuth)();if(n)return n;try{t=await e.json()}catch{return Response.json({error:"invalid JSON body"},{status:400})}let a=t.node_id;if(!a)return Response.json({error:"node_id required"},{status:400});let s=t.action;if(!s||!g.includes(s))return Response.json({error:`action must be one of: ${g.join(", ")}`},{status:400});let o=t.network_id||await (0,m.resolveDefaultNetworkId)(),i={node_id:a,...o?{network_id:o}:{}};if("restart"===s)r="restart_node";else{let e=(t.new_name||"").trim();if(!e)return Response.json({error:"new_name required for rename"},{status:400});r="rename_node",i.new_name=e}try{let e=await (0,m.callMcp)(r,i);if(e.ok){let t=await (0,m.parseMcpEnvelope)(e);return Response.json({ok:!0,action:s,node_id:a,result:t})}if(404===e.status||501===e.status)return Response.json({ok:!1,unconfirmed:!0,action:s,node_id:a,error:`hub tool '${r}' not available (${e.status})`},{status:501});return Response.json({ok:!1,action:s,error:`hub ${e.status}`,status:e.status},{status:502})}catch(e){return Response.json({ok:!1,action:s,node_id:a,error:e instanceof Error?e.message:String(e)},{status:502})}}e.s(["POST",0,y],27262);var E=e.i(27262);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/anet/node-lifecycle/route",pathname:"/api/anet/node-lifecycle",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/dashboard-pr4-338/app/api/anet/node-lifecycle/route.ts",nextConfigOutput:"",userland:E,...{}}),{workAsyncStorage:b,workUnitAsyncStorage:_,serverHooks:k}=C;async function A(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),C.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/anet/node-lifecycle/route";w=w.replace(/\/index$/,"")||"/";let m=await C.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:g,params:y,nextConfig:E,parsedUrl:b,isDraftMode:_,prerenderManifest:k,routerServerContext:A,isOnDemandRevalidate:j,revalidateOnlyGenerated:N,resolvedPathname:P,clientReferenceManifest:S,serverActionsManifest:T}=m,q=(0,i.normalizeAppPath)(w),O=!!(k.dynamicRoutes[q]||k.routes[P]),M=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,b,!1):t.end("This page could not be found"),null);if(O&&!_){let e=!!k.routes[P],t=k.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await M();throw new v.NoFallbackError}}let U=null;!O||C.isDev||_||(U="/index"===(U=P)?"/":U);let H=!0===C.isDev||!O,I=O&&!H;T&&S&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:S,serverActionsManifest:T});let D=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),B=!!(null==A?void 0:A.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),L=(0,a.getRequestMeta)(e,"incrementalCache")||await C.getIncrementalCache(e,E,k,K);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let V={params:y,previewProps:k.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:L,cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>C.onRequestError(e,t,n,a,A)},sharedContext:{buildId:g}},J=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),z=u.NextRequestAdapter.fromNodeNextRequest(J,(0,u.signalFromNodeResponse)(t));try{let a,o=async e=>C.handle(z,V).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${D} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${D} ${w}`)}),i=async a=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!K&&j&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(a);e.fetchMetrics=V.renderOpts.fetchMetrics;let i=V.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let l=V.renderOpts.collectedTags;if(!O)return await (0,c.sendResponse)(J,W,s,V.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==V.renderOpts.collectedRevalidate&&!(V.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&V.renderOpts.collectedRevalidate,n=void 0===V.renderOpts.collectedExpire||V.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:V.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:j})},!1,A),t}},u=await C.handleResponse({req:e,nextConfig:E,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:k,isRoutePPREnabled:!1,isOnDemandRevalidate:j,revalidateOnlyGenerated:N,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!O)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(i=u.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",j?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),_&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&O||d.delete(x.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(J,W,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};B&&F?await i(F):(a=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${w}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},i),void 0,!B))}catch(t){if(t instanceof v.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:j})},!1,A),O)throw t;return await (0,c.sendResponse)(J,W,new Response(null,{status:500})),null}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:_})},"routeModule",0,C,"serverHooks",0,k,"workAsyncStorage",0,b,"workUnitAsyncStorage",0,_],46869)}];
1
+ module.exports=[50227,(e,t,r)=>{t.exports=e.x("node:path",()=>require("node:path"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},46204,e=>{"use strict";var t=e.i(69450);function r(){return process.env.COMMHUB_URL||"http://127.0.0.1:9200"}async function n(e,n){let a=`${r()}${e}`,o={},s=n?.headers;if(!s?.Authorization)try{let e=await (0,t.getV3UserToken)();e&&(o={Authorization:`Bearer ${e}`})}catch{}return fetch(a,{...n,headers:{...o,...n?.headers},next:{revalidate:0}})}r(),e.s(["hubFetch",0,n])},43963,e=>{"use strict";var t=e.i(46204);async function r(){try{let e=await (0,t.hubFetch)("/api/auth/me");if(e.ok&&(e.headers.get("content-type")||"").includes("application/json")){let t=await e.json();return t.current_network?.network_id||t.networks?.[0]?.network_id||null}}catch{}return null}async function n(e){let t;if((e.headers.get("content-type")||"").includes("application/json"))t=await e.json();else{let r=(await e.text()).split("\n").filter(e=>e.startsWith("data:")).map(e=>e.slice(5).trim()).filter(Boolean),n=r[r.length-1];if(!n)throw Error("empty MCP SSE response");t=JSON.parse(n)}let r=t;if(r.error)throw Error(r.error.message||"MCP error");let n=r.result?.content?.[0]?.text;if("string"!=typeof n)throw Error("MCP result missing content text");try{return JSON.parse(n)}catch{return{ok:!0,text:n}}}e.s(["callMcp",0,function(e,r){return(0,t.hubFetch)("/mcp",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":"2025-03-26"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:e,arguments:r}})})},"parseMcpEnvelope",0,n,"resolveDefaultNetworkId",0,r])},46869,e=>{"use strict";var t=e.i(10845),r=e.i(31666),n=e.i(42349),a=e.i(81692),o=e.i(64460),s=e.i(94903),i=e.i(53622),l=e.i(94293),d=e.i(13241),u=e.i(27832),c=e.i(36456),p=e.i(50252),h=e.i(62682),f=e.i(56947),m=e.i(41800),x=e.i(93695);e.i(63313);var R=e.i(38068),v=e.i(69450),g=e.i(43963);let w=["restart","rename","stop","delete"];async function y(e){let t,r,n=await (0,v.requireDashboardAuth)();if(n)return n;try{t=await e.json()}catch{return Response.json({error:"invalid JSON body"},{status:400})}let a=t.node_id;if(!a)return Response.json({error:"node_id required"},{status:400});let o=t.action;if(!o||!w.includes(o))return Response.json({error:`action must be one of: ${w.join(", ")}`},{status:400});let s=t.network_id||await (0,g.resolveDefaultNetworkId)(),i={node_id:a,...s?{network_id:s}:{}};if("restart"===o)r="restart_node";else if("rename"===o){let e=(t.new_name||"").trim();if(!e)return Response.json({error:"new_name required for rename"},{status:400});r="rename_node",i.new_name=e}else if("stop"===o)r="stop_node",i.child_node_id=a,delete i.node_id,!0===t.force&&(i.force=!0),"number"==typeof t.grace_seconds&&(i.grace_seconds=t.grace_seconds);else{if("delete"!==o)return Response.json({error:`unhandled action: ${o}`},{status:500});let e=(t.confirm_alias||"").trim();if(!e)return Response.json({error:"confirm_alias required for delete (must equal node alias)"},{status:400});r="delete_node",i.child_node_id=a,delete i.node_id,i.confirm_alias=e,!0===t.force&&(i.force=!0),"number"==typeof t.grace_seconds&&(i.grace_seconds=t.grace_seconds),!1===t.delete_config&&(i.delete_config=!1)}try{let e=await (0,g.callMcp)(r,i);if(e.ok){let t=await (0,g.parseMcpEnvelope)(e);if(t&&"object"==typeof t&&!1===t.ok)return Response.json({...t,action:o,node_id:a},{status:409});return Response.json({ok:!0,action:o,node_id:a,result:t})}if(404===e.status||501===e.status)return Response.json({ok:!1,unconfirmed:!0,action:o,node_id:a,error:`hub tool '${r}' not available (${e.status})`},{status:501});return Response.json({ok:!1,action:o,error:`hub ${e.status}`,status:e.status},{status:502})}catch(e){return Response.json({ok:!1,action:o,node_id:a,error:e instanceof Error?e.message:String(e)},{status:502})}}e.s(["POST",0,y],27262);var _=e.i(27262);let E=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/anet/node-lifecycle/route",pathname:"/api/anet/node-lifecycle",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/dashboard-pr4-338/app/api/anet/node-lifecycle/route.ts",nextConfigOutput:"",userland:_,...{}}),{workAsyncStorage:b,workUnitAsyncStorage:C,serverHooks:j}=E;async function k(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),E.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/anet/node-lifecycle/route";v=v.replace(/\/index$/,"")||"/";let g=await E.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:w,params:y,nextConfig:_,parsedUrl:b,isDraftMode:C,prerenderManifest:j,routerServerContext:k,isOnDemandRevalidate:A,revalidateOnlyGenerated:N,resolvedPathname:P,clientReferenceManifest:S,serverActionsManifest:q}=g,T=(0,i.normalizeAppPath)(v),O=!!(j.dynamicRoutes[T]||j.routes[P]),M=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,b,!1):t.end("This page could not be found"),null);if(O&&!C){let e=!!j.routes[P],t=j.dynamicRoutes[T];if(t&&!1===t.fallback&&!e){if(_.adapterPath)return await M();throw new x.NoFallbackError}}let U=null;!O||E.isDev||C||(U="/index"===(U=P)?"/":U);let H=!0===E.isDev||!O,I=O&&!H;q&&S&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:S,serverActionsManifest:q});let $=e.method||"GET",D=(0,o.getTracer)(),F=D.getActiveScopeSpan(),B=!!(null==k?void 0:k.isWrappedByNextServer),K=!!(0,a.getRequestMeta)(e,"minimalMode"),L=(0,a.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,_,j,K);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let V={params:y,previewProps:j.preview,renderOpts:{experimental:{authInterrupts:!!_.experimental.authInterrupts},cacheComponents:!!_.cacheComponents,supportsDynamicResponse:H,incrementalCache:L,cacheLifeProfiles:_.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>E.onRequestError(e,t,n,a,k)},sharedContext:{buildId:w}},J=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),z=d.NextRequestAdapter.fromNodeNextRequest(J,(0,d.signalFromNodeResponse)(t));try{let a,s=async e=>E.handle(z,V).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=D.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${$} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",n),a.updateName(t))}else e.updateName(`${$} ${v}`)}),i=async a=>{var o,i;let l=async({previousCacheEntry:r})=>{try{if(!K&&A&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await s(a);e.fetchMetrics=V.renderOpts.fetchMetrics;let i=V.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let l=V.renderOpts.collectedTags;if(!O)return await (0,p.sendResponse)(J,W,o,V.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==V.renderOpts.collectedRevalidate&&!(V.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&V.renderOpts.collectedRevalidate,n=void 0===V.renderOpts.collectedExpire||V.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:V.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:A})},!1,k),t}},d=await E.handleResponse({req:e,nextConfig:_,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:N,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!O)return null;if((null==d||null==(o=d.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",A?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return K&&O||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,f.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(J,W,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};B&&F?await i(F):(a=D.getActiveScopeSpan(),await D.withPropagatedContext(e.headers,()=>D.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${v}`,kind:o.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},i),void 0,!B))}catch(t){if(t instanceof x.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:T,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:A})},!1,k),O)throw t;return await (0,p.sendResponse)(J,W,new Response(null,{status:500})),null}}e.s(["handler",0,k,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:C})},"routeModule",0,E,"serverHooks",0,j,"workAsyncStorage",0,b,"workUnitAsyncStorage",0,C],46869)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0jg663w._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../dashboard-pr4-338/app/lib/hub.ts","../../../../dashboard-pr4-338/app/lib/hub-mcp.ts","../../../../dashboard-pr4-338/app/api/anet/node-lifecycle/route.ts","../../../../dashboard-pr4-338/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { getV3UserToken } from './dashboard-auth';\n\nfunction getHubUrl() {\n return process.env.COMMHUB_URL || 'http://127.0.0.1:9200';\n}\n\nexport const HUB_URL = getHubUrl();\n\nexport function hubHeaders(): Record<string, string> {\n return {};\n}\n\n/**\n * Fetch from CommHub. Uses the browser session's V3 user token when available.\n * Dashboard is a thin proxy and does not fall back to a service/master token.\n */\nexport async function hubFetch(path: string, init?: RequestInit): Promise<Response> {\n const url = `${getHubUrl()}${path}`;\n\n // Build auth: prefer V3 token cookie unless caller supplied Authorization.\n let authHeader: Record<string, string> = {};\n\n // Only try V3 token if no Authorization already in init.headers\n const initHeaders = init?.headers as Record<string, string> | undefined;\n if (!initHeaders?.['Authorization']) {\n try {\n const userToken = await getV3UserToken();\n if (userToken) {\n authHeader = { 'Authorization': `Bearer ${userToken}` };\n }\n } catch {\n // cookies() not available in this context, ignore\n }\n\n }\n\n return fetch(url, {\n ...init,\n headers: { ...authHeader, ...init?.headers },\n next: { revalidate: 0 },\n } as RequestInit);\n}\n","import { hubFetch } from './hub';\n\n/**\n * Shared hub MCP (JSON-RPC tools/call) helpers for the node-config /\n * node-lifecycle / node-create proxies. The hub MCP endpoint answers with\n * either application/json or text/event-stream; in both cases the tool payload\n * is JSON in result.content[0].text. Mirrors the shape #260/#262 PR C established.\n */\n\nexport const HUB_MCP_PATH = '/mcp';\nexport const MCP_PROTOCOL_VERSION = '2025-03-26';\n\nfunction isJson(res: Response): boolean {\n return (res.headers.get('content-type') || '').includes('application/json');\n}\n\n/**\n * Resolve the user's default network_id from the hub profile, forwarding the\n * browser V3 token via hubFetch. Needed because a V3 user token often has a\n * null current_network, and node MCP tools require an explicit network_id\n * (else they 'permission_denied: network_id required'). Mirrors the resolution\n * in /api/auth/v3 and the PR C node-config fix (02dde66). Returns null if the\n * profile can't be read; callers should surface that rather than silently fail.\n */\nexport async function resolveDefaultNetworkId(): Promise<string | null> {\n try {\n const meRes = await hubFetch('/api/auth/me');\n if (meRes.ok && (meRes.headers.get('content-type') || '').includes('application/json')) {\n const me = (await meRes.json()) as {\n current_network?: { network_id?: string };\n networks?: Array<{ network_id?: string }>;\n };\n return me.current_network?.network_id || me.networks?.[0]?.network_id || null;\n }\n } catch {\n /* fall through → null */\n }\n return null;\n}\n\nexport function mcpEnvelope(tool: string, args: Record<string, unknown>) {\n return {\n jsonrpc: '2.0',\n id: 1,\n method: 'tools/call',\n params: { name: tool, arguments: args },\n };\n}\n\n/**\n * POST a tools/call to the hub MCP endpoint, forwarding the browser V3 token\n * via hubFetch. Returns the raw Response so callers can branch on status.\n */\nexport function callMcp(tool: string, args: Record<string, unknown>): Promise<Response> {\n return hubFetch(HUB_MCP_PATH, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json, text/event-stream',\n 'MCP-Protocol-Version': MCP_PROTOCOL_VERSION,\n },\n body: JSON.stringify(mcpEnvelope(tool, args)),\n });\n}\n\n/**\n * Parse an MCP tools/call response (json or SSE) → the JSON tool payload.\n * Throws on MCP-level error or malformed envelope.\n */\nexport async function parseMcpEnvelope(res: Response): Promise<unknown> {\n let envelope: unknown;\n if (isJson(res)) {\n envelope = await res.json();\n } else {\n const raw = await res.text();\n const dataLines = raw\n .split('\\n')\n .filter(l => l.startsWith('data:'))\n .map(l => l.slice(5).trim())\n .filter(Boolean);\n const last = dataLines[dataLines.length - 1];\n if (!last) throw new Error('empty MCP SSE response');\n envelope = JSON.parse(last);\n }\n const env = envelope as { error?: { message?: string }; result?: { content?: Array<{ text?: string }> } };\n if (env.error) throw new Error(env.error.message || 'MCP error');\n const text = env.result?.content?.[0]?.text;\n if (typeof text !== 'string') throw new Error('MCP result missing content text');\n try {\n return JSON.parse(text);\n } catch {\n return { ok: true, text };\n }\n}\n","import { requireDashboardAuth } from '@/app/lib/dashboard-auth';\nimport { callMcp, parseMcpEnvelope, resolveDefaultNetworkId } from '@/app/lib/hub-mcp';\n\n/**\n * Per-node lifecycle actions proxy (node-lifecycle UI M1 — restart / rename;\n * delete is a disabled placeholder until RFC-027). Thin MCP proxy to the hub\n * using the browser session's V3 user token (hubFetch), mirroring the shape\n * the node-config route (#260/#262 PR C) established:\n *\n * POST { node_id, action: 'restart' } → restart_node (RFC-024, shipped)\n * POST { node_id, action: 'rename', new_name: string } → rename_node (⚠️ contract Q1)\n *\n * Contract is the hub MCP endpoint at HUB_MCP_PATH (JSON-RPC tools/call),\n * which returns either application/json or text/event-stream; in both cases\n * the tool payload is JSON in result.content[0].text.\n *\n * OPEN CONTRACT QUESTIONS (asked 通信龙/工程马, gate the final wiring):\n * Q1 rename: does a hub MCP tool exist (assumed `rename_node`)? If not,\n * 工程马 adds it RFC-024-style; until confirmed, rename returns a flagged\n * `unconfirmed` response (NOT fake success) so the UI can show \"pending backend\".\n * Q3 restart completion: how is restart take-effect confirmed — reuse the\n * RFC-024 config_revision poll, or a dedicated status? For now we return\n * the raw restart_node result and let the client poll node status back to\n * online (same pattern as PR C's apply-lifecycle). Adjust once answered.\n *\n * ⚠️ Per 通信龙: never mock fake success. On hub error / unconfirmed tool we\n * surface the real failure so the UI never lies about a node having restarted.\n */\n\nconst MCP_TOOL_RESTART = 'restart_node';\nconst MCP_TOOL_RENAME = 'rename_node'; // ⚠️ Q1 — confirm hub-side tool name before relying on this\n\nconst ACTIONS = ['restart', 'rename'] as const;\ntype Action = (typeof ACTIONS)[number];\n\nexport async function POST(req: Request) {\n const authFailure = await requireDashboardAuth();\n if (authFailure) return authFailure;\n\n let body: { node_id?: string; action?: string; new_name?: string; network_id?: string };\n try {\n body = await req.json();\n } catch {\n return Response.json({ error: 'invalid JSON body' }, { status: 400 });\n }\n\n const nodeId = body.node_id;\n if (!nodeId) return Response.json({ error: 'node_id required' }, { status: 400 });\n\n const action = body.action as Action | undefined;\n if (!action || !ACTIONS.includes(action)) {\n return Response.json({ error: `action must be one of: ${ACTIONS.join(', ')}` }, { status: 400 });\n }\n\n // node MCP tools require an explicit network_id (V3 token current_network may\n // be null). Prefer the caller's, else resolve the user's default from /api/auth/me.\n const networkId = body.network_id || (await resolveDefaultNetworkId());\n\n // Build the MCP tool + arguments per action.\n let tool: string;\n const args: Record<string, unknown> = {\n node_id: nodeId,\n ...(networkId ? { network_id: networkId } : {}),\n };\n\n if (action === 'restart') {\n tool = MCP_TOOL_RESTART;\n } else {\n // rename\n const newName = (body.new_name || '').trim();\n if (!newName) return Response.json({ error: 'new_name required for rename' }, { status: 400 });\n tool = MCP_TOOL_RENAME;\n args.new_name = newName;\n }\n\n try {\n const res = await callMcp(tool, args);\n if (res.ok) {\n const result = await parseMcpEnvelope(res);\n return Response.json({ ok: true, action, node_id: nodeId, result });\n }\n // Hub reached but tool not available (e.g. rename_node not deployed yet → Q1).\n if (res.status === 404 || res.status === 501) {\n return Response.json(\n {\n ok: false,\n unconfirmed: true,\n action,\n node_id: nodeId,\n error: `hub tool '${tool}' not available (${res.status})`,\n },\n { status: 501 },\n );\n }\n return Response.json({ ok: false, action, error: `hub ${res.status}`, status: res.status }, { status: 502 });\n } catch (e: unknown) {\n // Honest failure — never report a fake success.\n return Response.json(\n {\n ok: false,\n action,\n node_id: nodeId,\n error: e instanceof Error ? e.message : String(e),\n },\n { status: 502 },\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/anet/node-lifecycle/route\",\n pathname: \"/api/anet/node-lifecycle\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/dashboard-pr4-338/app/api/anet/node-lifecycle/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/anet/node-lifecycle/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["getHubUrl","process","env","COMMHUB_URL","HUB_URL","hubHeaders","hubFetch","path","init","url","authHeader","initHeaders","headers","userToken","fetch","next","revalidate","HUB_MCP_PATH","MCP_PROTOCOL_VERSION","isJson","res","get","includes","resolveDefaultNetworkId","meRes","ok","me","json","current_network","network_id","networks","mcpEnvelope","tool","args","jsonrpc","id","method","params","name","arguments","callMcp","Accept","body","JSON","stringify","parseMcpEnvelope","envelope","raw","text","dataLines","split","filter","l","startsWith","map","slice","trim","Boolean","last","length","Error","parse","error","message","result","content","MCP_TOOL_RESTART","MCP_TOOL_RENAME","ACTIONS","POST","req","nodeId","authFailure","Response","status","node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AM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[3]}
1
+ {"version":3,"sources":["../../../../dashboard-pr4-338/app/lib/hub.ts","../../../../dashboard-pr4-338/app/lib/hub-mcp.ts","../../../../dashboard-pr4-338/app/api/anet/node-lifecycle/route.ts","../../../../dashboard-pr4-338/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { getV3UserToken } from './dashboard-auth';\n\nfunction getHubUrl() {\n return process.env.COMMHUB_URL || 'http://127.0.0.1:9200';\n}\n\nexport const HUB_URL = getHubUrl();\n\nexport function hubHeaders(): Record<string, string> {\n return {};\n}\n\n/**\n * Fetch from CommHub. Uses the browser session's V3 user token when available.\n * Dashboard is a thin proxy and does not fall back to a service/master token.\n */\nexport async function hubFetch(path: string, init?: RequestInit): Promise<Response> {\n const url = `${getHubUrl()}${path}`;\n\n // Build auth: prefer V3 token cookie unless caller supplied Authorization.\n let authHeader: Record<string, string> = {};\n\n // Only try V3 token if no Authorization already in init.headers\n const initHeaders = init?.headers as Record<string, string> | undefined;\n if (!initHeaders?.['Authorization']) {\n try {\n const userToken = await getV3UserToken();\n if (userToken) {\n authHeader = { 'Authorization': `Bearer ${userToken}` };\n }\n } catch {\n // cookies() not available in this context, ignore\n }\n\n }\n\n return fetch(url, {\n ...init,\n headers: { ...authHeader, ...init?.headers },\n next: { revalidate: 0 },\n } as RequestInit);\n}\n","import { hubFetch } from './hub';\n\n/**\n * Shared hub MCP (JSON-RPC tools/call) helpers for the node-config /\n * node-lifecycle / node-create proxies. The hub MCP endpoint answers with\n * either application/json or text/event-stream; in both cases the tool payload\n * is JSON in result.content[0].text. Mirrors the shape #260/#262 PR C established.\n */\n\nexport const HUB_MCP_PATH = '/mcp';\nexport const MCP_PROTOCOL_VERSION = '2025-03-26';\n\nfunction isJson(res: Response): boolean {\n return (res.headers.get('content-type') || '').includes('application/json');\n}\n\n/**\n * Resolve the user's default network_id from the hub profile, forwarding the\n * browser V3 token via hubFetch. Needed because a V3 user token often has a\n * null current_network, and node MCP tools require an explicit network_id\n * (else they 'permission_denied: network_id required'). Mirrors the resolution\n * in /api/auth/v3 and the PR C node-config fix (02dde66). Returns null if the\n * profile can't be read; callers should surface that rather than silently fail.\n */\nexport async function resolveDefaultNetworkId(): Promise<string | null> {\n try {\n const meRes = await hubFetch('/api/auth/me');\n if (meRes.ok && (meRes.headers.get('content-type') || '').includes('application/json')) {\n const me = (await meRes.json()) as {\n current_network?: { network_id?: string };\n networks?: Array<{ network_id?: string }>;\n };\n return me.current_network?.network_id || me.networks?.[0]?.network_id || null;\n }\n } catch {\n /* fall through → null */\n }\n return null;\n}\n\nexport function mcpEnvelope(tool: string, args: Record<string, unknown>) {\n return {\n jsonrpc: '2.0',\n id: 1,\n method: 'tools/call',\n params: { name: tool, arguments: args },\n };\n}\n\n/**\n * POST a tools/call to the hub MCP endpoint, forwarding the browser V3 token\n * via hubFetch. Returns the raw Response so callers can branch on status.\n */\nexport function callMcp(tool: string, args: Record<string, unknown>): Promise<Response> {\n return hubFetch(HUB_MCP_PATH, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json, text/event-stream',\n 'MCP-Protocol-Version': MCP_PROTOCOL_VERSION,\n },\n body: JSON.stringify(mcpEnvelope(tool, args)),\n });\n}\n\n/**\n * Parse an MCP tools/call response (json or SSE) → the JSON tool payload.\n * Throws on MCP-level error or malformed envelope.\n */\nexport async function parseMcpEnvelope(res: Response): Promise<unknown> {\n let envelope: unknown;\n if (isJson(res)) {\n envelope = await res.json();\n } else {\n const raw = await res.text();\n const dataLines = raw\n .split('\\n')\n .filter(l => l.startsWith('data:'))\n .map(l => l.slice(5).trim())\n .filter(Boolean);\n const last = dataLines[dataLines.length - 1];\n if (!last) throw new Error('empty MCP SSE response');\n envelope = JSON.parse(last);\n }\n const env = envelope as { error?: { message?: string }; result?: { content?: Array<{ text?: string }> } };\n if (env.error) throw new Error(env.error.message || 'MCP error');\n const text = env.result?.content?.[0]?.text;\n if (typeof text !== 'string') throw new Error('MCP result missing content text');\n try {\n return JSON.parse(text);\n } catch {\n return { ok: true, text };\n }\n}\n","import { requireDashboardAuth } from '@/app/lib/dashboard-auth';\nimport { callMcp, parseMcpEnvelope, resolveDefaultNetworkId } from '@/app/lib/hub-mcp';\n\n/**\n * Per-node lifecycle actions proxy (node-lifecycle UI M1 — restart / rename;\n * delete is a disabled placeholder until RFC-027). Thin MCP proxy to the hub\n * using the browser session's V3 user token (hubFetch), mirroring the shape\n * the node-config route (#260/#262 PR C) established:\n *\n * POST { node_id, action: 'restart' } → restart_node (RFC-024, shipped)\n * POST { node_id, action: 'rename', new_name: string } → rename_node (⚠️ contract Q1)\n *\n * Contract is the hub MCP endpoint at HUB_MCP_PATH (JSON-RPC tools/call),\n * which returns either application/json or text/event-stream; in both cases\n * the tool payload is JSON in result.content[0].text.\n *\n * OPEN CONTRACT QUESTIONS (asked 通信龙/工程马, gate the final wiring):\n * Q1 rename: does a hub MCP tool exist (assumed `rename_node`)? If not,\n * 工程马 adds it RFC-024-style; until confirmed, rename returns a flagged\n * `unconfirmed` response (NOT fake success) so the UI can show \"pending backend\".\n * Q3 restart completion: how is restart take-effect confirmed — reuse the\n * RFC-024 config_revision poll, or a dedicated status? For now we return\n * the raw restart_node result and let the client poll node status back to\n * online (same pattern as PR C's apply-lifecycle). Adjust once answered.\n *\n * ⚠️ Per 通信龙: never mock fake success. On hub error / unconfirmed tool we\n * surface the real failure so the UI never lies about a node having restarted.\n */\n\nconst MCP_TOOL_RESTART = 'restart_node';\nconst MCP_TOOL_RENAME = 'rename_node'; // ⚠️ Q1 — confirm hub-side tool name before relying on this\n// RFC-027 PR2 — stop/delete lifecycle. daemon_node_id is auto-resolved\n// hub-side from child_node_id (PR2 prereq); dashboard doesn't pass it.\nconst MCP_TOOL_STOP = 'stop_node';\nconst MCP_TOOL_DELETE = 'delete_node';\n\nconst ACTIONS = ['restart', 'rename', 'stop', 'delete'] as const;\ntype Action = (typeof ACTIONS)[number];\n\nexport async function POST(req: Request) {\n const authFailure = await requireDashboardAuth();\n if (authFailure) return authFailure;\n\n let body: {\n node_id?: string;\n action?: string;\n new_name?: string;\n network_id?: string;\n // RFC-027 PR2 stop/delete:\n confirm_alias?: string; // delete only — must equal node alias byte-exact\n force?: boolean; // both — override in-flight refuse + audit\n grace_seconds?: number; // both — SIGTERM grace before SIGKILL (5-60s, default 10)\n delete_config?: boolean; // delete only — false keeps config dir, default true backs up\n };\n try {\n body = await req.json();\n } catch {\n return Response.json({ error: 'invalid JSON body' }, { status: 400 });\n }\n\n const nodeId = body.node_id;\n if (!nodeId) return Response.json({ error: 'node_id required' }, { status: 400 });\n\n const action = body.action as Action | undefined;\n if (!action || !ACTIONS.includes(action)) {\n return Response.json({ error: `action must be one of: ${ACTIONS.join(', ')}` }, { status: 400 });\n }\n\n // node MCP tools require an explicit network_id (V3 token current_network may\n // be null). Prefer the caller's, else resolve the user's default from /api/auth/me.\n const networkId = body.network_id || (await resolveDefaultNetworkId());\n\n // Build the MCP tool + arguments per action.\n let tool: string;\n const args: Record<string, unknown> = {\n node_id: nodeId,\n ...(networkId ? { network_id: networkId } : {}),\n };\n\n if (action === 'restart') {\n tool = MCP_TOOL_RESTART;\n } else if (action === 'rename') {\n const newName = (body.new_name || '').trim();\n if (!newName) return Response.json({ error: 'new_name required for rename' }, { status: 400 });\n tool = MCP_TOOL_RENAME;\n args.new_name = newName;\n } else if (action === 'stop') {\n // RFC-027 §2.2 stop_node. daemon_node_id auto-resolves hub-side.\n tool = MCP_TOOL_STOP;\n args.child_node_id = nodeId;\n delete args.node_id;\n if (body.force === true) args.force = true;\n if (typeof body.grace_seconds === 'number') args.grace_seconds = body.grace_seconds;\n } else if (action === 'delete') {\n // RFC-027 §2.2 delete_node. confirm_alias REQUIRED + must match.\n const confirmAlias = (body.confirm_alias || '').trim();\n if (!confirmAlias) return Response.json({ error: 'confirm_alias required for delete (must equal node alias)' }, { status: 400 });\n tool = MCP_TOOL_DELETE;\n args.child_node_id = nodeId;\n delete args.node_id;\n args.confirm_alias = confirmAlias;\n if (body.force === true) args.force = true;\n if (typeof body.grace_seconds === 'number') args.grace_seconds = body.grace_seconds;\n if (body.delete_config === false) args.delete_config = false;\n } else {\n // exhaustive; the ACTIONS check above catches unknown actions first\n return Response.json({ error: `unhandled action: ${action}` }, { status: 500 });\n }\n\n try {\n const res = await callMcp(tool, args);\n if (res.ok) {\n const result = await parseMcpEnvelope(res) as Record<string, unknown>;\n // RFC-027 PR2 (通信龙 explicit): structured errors from the hub tool\n // payload (node_not_active / cannot_delete_daemon / node_busy_in_flight\n // / confirm_alias_mismatch / forbidden_cross_tenant ...) MUST surface\n // as-is to the user — don't wrap them as outer ok:true with a hidden\n // result.ok:false. Promote the inner ok + error to the outer envelope\n // so the dashboard can render the real message.\n if (result && typeof result === 'object' && (result as { ok?: boolean }).ok === false) {\n // Bubble hub's structured payload to a 409 (action refused, e.g.\n // in-flight/cross-tenant/wrong-confirm) so the dashboard can branch\n // on error code without parsing 200-with-ok:false.\n return Response.json(\n { ...result, action, node_id: nodeId },\n { status: 409 },\n );\n }\n return Response.json({ ok: true, action, node_id: nodeId, result });\n }\n // Hub reached but tool not available (e.g. rename_node not deployed yet → Q1).\n if (res.status === 404 || res.status === 501) {\n return Response.json(\n {\n ok: false,\n unconfirmed: true,\n action,\n node_id: nodeId,\n error: `hub tool '${tool}' not available (${res.status})`,\n },\n { status: 501 },\n );\n }\n return Response.json({ ok: false, action, error: `hub ${res.status}`, status: res.status }, { status: 502 });\n } catch (e: unknown) {\n // Honest failure — never report a fake success.\n return Response.json(\n {\n ok: false,\n action,\n node_id: nodeId,\n error: e instanceof Error ? e.message : String(e),\n },\n { status: 502 },\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/anet/node-lifecycle/route\",\n pathname: \"/api/anet/node-lifecycle\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/dashboard-pr4-338/app/api/anet/node-lifecycle/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/anet/node-lifecycle/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["getHubUrl","process","env","COMMHUB_URL","HUB_URL","hubHeaders","hubFetch","path","init","url","authHeader","initHeaders","headers","userToken","fetch","next","revalidate","HUB_MCP_PATH","MCP_PROTOCOL_VERSION","isJson","res","get","includes","resolveDefaultNetworkId","meRes","ok","me","json","current_network","network_id","networks","mcpEnvelope","tool","args","jsonrpc","id","method","params","name","arguments","callMcp","Accept","body","JSON","stringify","parseMcpEnvelope","envelope","raw","text","dataLines","split","filter","l","startsWith","map","slice","trim","Boolean","last","length","Error","parse","error","message","result","content","MCP_TOOL_RESTART","MCP_TOOL_RENAME","MCP_TOOL_DELETE","MCP_TOOL_STOP","ACTIONS","POST","req","authFailure","Response","join","status","nodeId","node_id","action","networkId","child_node_id","newName","force","new_name","confirmAlias","grace_seconds","confirm_alias","delete_config","unconfirmed","e","String"],"mappings":"wjCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEA,SAASA,IACP,OAAOC,QAAQC,GAAG,CAACC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,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[3]}
@@ -1,3 +1,3 @@
1
- module.exports=[50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},42221,a=>{"use strict";var b=a.i(12453);a.s(["previewContent",0,function(a){return a&&a.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(a){return(0,b.relativeAgo)(a)??"--"}])},70049,a=>{"use strict";var b=a.i(51653);let c=[180,200,220,270,300,330,30,90];function d(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)>>>0;let d=c[b%c.length];return{bg:`hsl(${d} 55% 22%)`,ring:`hsl(${d} 60% 45%)`,text:`hsl(${d} 80% 78%)`}}function e(a){return a?(a.trim().match(/[\p{L}\p{N}]/u)?.[0]||a.trim()[0]||"·").toUpperCase():"·"}a.s(["AliasAvatar",0,function({alias:a,size:c=28,className:f=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(a))return(0,b.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${f}`,style:{width:c,height:c,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:a,"aria-hidden":!0});let g=d(a),h=Math.max(9,Math.round(.42*c));return(0,b.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${f}`,style:{width:c,height:c,fontSize:h,backgroundColor:g.bg,borderColor:g.ring,color:g.text},title:a,"aria-hidden":!0,children:e(a)})},"aliasAvatarColors",0,d,"aliasInitial",0,e])},80182,a=>{"use strict";var b=a.i(51653),c=a.i(85895),d=a.i(73391);let e={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function f({variant:a,size:c}){let d={width:c,height:c},e={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"nodes":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,b.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,b.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,b.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,b.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,b.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,b.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,b.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,b.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,b.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,b.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,b.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,b.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,b.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,b.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,b.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,b.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,b.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,b.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,b.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,b.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function g({variant:a="generic",title:c,sub:h,cta:i,compact:j=!1}){let k=e[a],l=c??k.title,m=h??k.sub;return(0,b.jsxs)("div",{className:`text-center ${j?"py-8":"py-16"} px-4`,role:"status",children:[(0,b.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,b.jsx)(f,{variant:a,size:j?40:56})}),(0,b.jsx)("h3",{className:`font-medium text-gray-300 ${j?"text-sm":"text-base"}`,children:l}),m&&(0,b.jsx)("p",{className:`text-gray-500 ${j?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:m}),i&&(0,b.jsx)("div",{className:"mt-4",children:i.href?(0,b.jsxs)(d.default,{href:i.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[i.label,(0,b.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,b.jsxs)("button",{onClick:i.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[i.label,(0,b.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function h({children:a}){return(0,b.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#26262b] bg-[#161618] shadow-lg shadow-black/20",children:a})}function i({cmd:a}){let[d,e]=(0,c.useState)(!1),f=async()=>{try{await navigator.clipboard.writeText(a),e(!0),setTimeout(()=>e(!1),1800)}catch{}};return(0,b.jsxs)("div",{className:"anet-empty-cmd flex items-start sm:items-center gap-2 bg-[#0e0e10] border border-[#26262b] rounded-lg pl-4 pr-1.5 py-1.5 text-xs sm:text-sm",children:[(0,b.jsx)("code",{className:"text-cyan-300 font-mono select-all min-w-0 break-all sm:break-normal",children:a}),(0,b.jsx)("button",{type:"button",onClick:f,"aria-label":d?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] transition-colors",children:d?(0,b.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,b.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,b.jsxs)("span",{className:"flex items-center gap-1",children:[(0,b.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,b.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}a.s(["EmptyState",0,g,"NodesEmptyState",0,function({hint:a,taskHistoryCount:c=0}){return a?.global_count?(0,b.jsx)(h,{children:(0,b.jsx)(g,{variant:"nodes",title:"No agents in this network",sub:`Server has ${a.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):c>0?(0,b.jsx)(h,{children:(0,b.jsx)(g,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${c.toLocaleString()} task${1===c?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,b.jsx)(h,{children:(0,b.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,b.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,b.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,b.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,b.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,b.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,b.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,b.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,b.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,b.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,b.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,b.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,b.jsx)("div",{className:"mt-4 inline-block",children:(0,b.jsx)(i,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,b.jsx)("p",{className:"text-gray-600 text-xs mt-3 max-w-md mx-auto",children:"Once the agent connects, it appears here automatically within a few seconds — no refresh needed."}),(0,b.jsx)("div",{className:"mt-3",children:(0,b.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,b.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},30396,a=>{"use strict";a.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-gray-500/10 text-gray-300 border-gray-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"},"SESSION_STATUS_TEXT_CLASS",0,{working:"text-green-400",idle:"text-gray-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-gray-400",acked:"bg-gray-300",running:"bg-green-500",replied:"bg-gray-400",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-gray-600",expired:"bg-gray-600"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-gray-500/10 text-gray-300 border-gray-500/20",acked:"bg-gray-500/10 text-gray-300 border-gray-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-gray-500/10 text-gray-300 border-gray-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-gray-500/10 text-gray-500 border-gray-500/20",expired:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#9ca3af",acked:"#9ca3af",running:"#4ade80",replied:"#9ca3af",closed:"#6b7280",failed:"#f87171",cancelled:"#6b7280",expired:"#6b7280"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},28644,a=>{"use strict";var b=a.i(67784),c=a.i(436);let d=async a=>{let b=await fetch(a);if(401===b.status)throw window.location.assign("/login"),Error("unauthorized");return b.json()},e={refreshInterval:5e3,dedupingInterval:3e3};function f(a,b){if(!b)return a;let c=a.includes("?")?"&":"?";return`${a}${c}network_id=${encodeURIComponent(b)}`}a.s(["useAnetConfig",0,function(){let{data:a}=(0,b.default)("/api/anet/config",d,{refreshInterval:3e4});return{config:a||null}},"useHealth",0,function(){let{data:a,error:c}=(0,b.default)("/api/hub/health",d,e);return{health:a||null,error:c}},"useMessages",0,function(a=100){let{networkId:g}=(0,c.useNetworkId)(),{data:h,error:i,isLoading:j}=(0,b.default)(f(`/api/hub/messages?limit=${a}`,g),d,{...e,keepPreviousData:!0});return{messages:h?.messages||[],error:i,isLoading:j}},"useSessions",0,function(){let{networkId:a}=(0,c.useNetworkId)(),{data:g,error:h,isLoading:i}=(0,b.default)(f("/api/hub/status",a),d,e);return{sessions:g?.sessions||[],hint:g?._hint,error:h,isLoading:i}},"useStats",0,function(){let{networkId:a}=(0,c.useNetworkId)(),{data:g,error:h}=(0,b.default)(f("/api/hub/stats",a),d,e);return{stats:g?.ok?g:null,error:h}},"useTasks",0,function(a){let{networkId:g}=(0,c.useNetworkId)(),h=new URLSearchParams({limit:"100",...a}).toString(),{data:i,error:j,isLoading:k}=(0,b.default)(f(`/api/hub/tasks?${h}`,g),d,e);return{tasks:i?.tasks||[],count:i?.count??0,source:i?.source,error:j,isLoading:k}}])},89526,a=>{"use strict";var b=a.i(51653),c=a.i(85895);a.s(["useCollapsibleSearch",0,function({value:a,onChange:d,placeholder:e="Search…",label:f="Search",enabled:g=!0}){let[h,i]=(0,c.useState)(!1),j=(0,c.useCallback)(()=>{d(""),i(!1)},[d]);return{Button:(0,c.useCallback)(()=>{if(!g)return(0,b.jsx)(b.Fragment,{});let c=h||a;return(0,b.jsxs)("button",{type:"button",onClick:()=>i(a=>!a),"aria-label":h?`Close ${f.toLowerCase()}`:`Open ${f.toLowerCase()}`,"aria-pressed":h,title:h?`Close ${f.toLowerCase()}`:f,className:`relative shrink-0 inline-flex items-center justify-center rounded-full border w-9 h-9 transition-colors ${c?"border-cyan-500/40 bg-cyan-500/10 text-cyan-300":"border-[#26262b] bg-[#161618] text-gray-400 hover:text-gray-200 hover:border-[#3a3a41]"}`,children:[(0,b.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a&&!h&&(0,b.jsx)("span",{"aria-hidden":!0,className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-cyan-400 ring-2 ring-[#0b0b0d]"})]})},[h,a,f,g]),Row:(0,c.useCallback)(()=>g&&(h||a)?(0,b.jsxs)("div",{className:"mb-3 sm:mb-4 flex items-center gap-2",children:[(0,b.jsx)("input",{type:"text",value:a,onChange:a=>d(a.target.value),onKeyDown:a=>{"Escape"===a.key&&j()},placeholder:e,autoFocus:h,className:"flex-1 bg-[#161618] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,b.jsx)("button",{type:"button",onClick:j,className:"shrink-0 text-xs text-gray-500 hover:text-gray-300 px-2 py-2","aria-label":"Clear and close search",children:"Cancel"})]}):null,[h,a,d,e,j,g]),value:a,reset:j}}])}];
1
+ module.exports=[50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},42221,a=>{"use strict";var b=a.i(12453);a.s(["previewContent",0,function(a){return a&&a.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\s+/g," ").trim()||"--"},"timeAgo",0,function(a){return(0,b.relativeAgo)(a)??"--"}])},70049,a=>{"use strict";var b=a.i(51653);let c=[180,200,220,270,300,330,30,90];function d(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)>>>0;let d=c[b%c.length];return{bg:`hsl(${d} 55% 22%)`,ring:`hsl(${d} 60% 45%)`,text:`hsl(${d} 80% 78%)`}}function e(a){return a?(a.trim().match(/[\p{L}\p{N}]/u)?.[0]||a.trim()[0]||"·").toUpperCase():"·"}a.s(["AliasAvatar",0,function({alias:a,size:c=28,className:f=""}){if(/\bgrok\b|grok-build|grok测试员|grok-demo/i.test(a))return(0,b.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border border-emerald-500/45 bg-emerald-950/70 shrink-0 ${f}`,style:{width:c,height:c,backgroundImage:"url(/vendors/grok.svg)",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"68% 68%"},title:a,"aria-hidden":!0});let g=d(a),h=Math.max(9,Math.round(.42*c));return(0,b.jsx)("span",{className:`anet-alias-avatar inline-flex items-center justify-center rounded-full border shrink-0 font-semibold ${f}`,style:{width:c,height:c,fontSize:h,backgroundColor:g.bg,borderColor:g.ring,color:g.text},title:a,"aria-hidden":!0,children:e(a)})},"aliasAvatarColors",0,d,"aliasInitial",0,e])},80182,a=>{"use strict";var b=a.i(51653),c=a.i(85895),d=a.i(73391);let e={nodes:{title:"No agents in this network",sub:"Agent sessions will appear here once they connect to the CommHub."},tasks:{title:"No tasks yet",sub:"Tasks will appear here when agents send them via CommHub."},messages:{title:"No messages",sub:"Messages between agents will appear here."},logs:{title:"No audit logs",sub:"Events will appear here when users register, login, or perform actions."},tokens:{title:"No API tokens",sub:"Create one to authenticate CLI tools and external integrations."},networks:{title:"No networks found",sub:"Create one or sign in with V3 auth to see your networks."},generic:{title:"Nothing here yet",sub:"Data will appear here once available."}};function f({variant:a,size:c}){let d={width:c,height:c},e={fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"nodes":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"32",cy:"14",r:"4"}),(0,b.jsx)("circle",{cx:"14",cy:"44",r:"4"}),(0,b.jsx)("circle",{cx:"50",cy:"44",r:"4"}),(0,b.jsx)("line",{x1:"32",y1:"18",x2:"14",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,b.jsx)("line",{x1:"32",y1:"18",x2:"50",y2:"40",strokeDasharray:"3 3",opacity:"0.6"}),(0,b.jsx)("line",{x1:"18",y1:"44",x2:"46",y2:"44",strokeDasharray:"3 3",opacity:"0.6"})]})});case"tasks":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("rect",{x:"14",y:"14",width:"36",height:"6",rx:"1.5"}),(0,b.jsx)("rect",{x:"14",y:"26",width:"36",height:"6",rx:"1.5",opacity:"0.6"}),(0,b.jsx)("rect",{x:"14",y:"38",width:"36",height:"6",rx:"1.5",opacity:"0.35"})]})});case"messages":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("path",{d:"M14 18 h36 a3 3 0 0 1 3 3 v18 a3 3 0 0 1 -3 3 h-18 l-8 6 v-6 h-10 a3 3 0 0 1 -3 -3 v-18 a3 3 0 0 1 3 -3 z"}),(0,b.jsx)("line",{x1:"22",y1:"28",x2:"42",y2:"28",opacity:"0.5"}),(0,b.jsx)("line",{x1:"22",y1:"34",x2:"36",y2:"34",opacity:"0.5"})]})});case"logs":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("path",{d:"M18 12 h22 l8 8 v32 a2 2 0 0 1 -2 2 h-28 a2 2 0 0 1 -2 -2 v-38 a2 2 0 0 1 2 -2 z"}),(0,b.jsx)("path",{d:"M40 12 v8 h8",opacity:"0.6"}),(0,b.jsx)("line",{x1:"24",y1:"32",x2:"40",y2:"32",opacity:"0.55"}),(0,b.jsx)("line",{x1:"24",y1:"38",x2:"40",y2:"38",opacity:"0.4"}),(0,b.jsx)("line",{x1:"24",y1:"44",x2:"34",y2:"44",opacity:"0.25"})]})});case"tokens":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"22",cy:"32",r:"8"}),(0,b.jsx)("line",{x1:"30",y1:"32",x2:"54",y2:"32"}),(0,b.jsx)("line",{x1:"44",y1:"32",x2:"44",y2:"38"}),(0,b.jsx)("line",{x1:"50",y1:"32",x2:"50",y2:"40"})]})});case"networks":return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"32",cy:"32",r:"18"}),(0,b.jsx)("ellipse",{cx:"32",cy:"32",rx:"18",ry:"9",opacity:"0.55"}),(0,b.jsx)("line",{x1:"14",y1:"32",x2:"50",y2:"32",opacity:"0.55"}),(0,b.jsx)("line",{x1:"32",y1:"14",x2:"32",y2:"50",opacity:"0.55"})]})});default:return(0,b.jsx)("svg",{viewBox:"0 0 64 64",...d,children:(0,b.jsxs)("g",{...e,children:[(0,b.jsx)("circle",{cx:"32",cy:"32",r:"14",strokeDasharray:"3 3",opacity:"0.6"}),(0,b.jsx)("circle",{cx:"32",cy:"32",r:"3"})]})})}}function g({variant:a="generic",title:c,sub:h,cta:i,compact:j=!1}){let k=e[a],l=c??k.title,m=h??k.sub;return(0,b.jsxs)("div",{className:`text-center ${j?"py-8":"py-16"} px-4`,role:"status",children:[(0,b.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,b.jsx)(f,{variant:a,size:j?40:56})}),(0,b.jsx)("h3",{className:`font-medium text-gray-300 ${j?"text-sm":"text-base"}`,children:l}),m&&(0,b.jsx)("p",{className:`text-gray-500 ${j?"text-xs mt-1.5":"text-sm mt-2"} max-w-md mx-auto leading-relaxed`,children:m}),i&&(0,b.jsx)("div",{className:"mt-4",children:i.href?(0,b.jsxs)(d.default,{href:i.href,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[i.label,(0,b.jsx)("span",{"aria-hidden":!0,children:"→"})]}):(0,b.jsxs)("button",{onClick:i.onClick,className:"inline-flex items-center gap-1.5 text-sm font-medium text-cyan-400 hover:text-cyan-300",children:[i.label,(0,b.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})}function h({children:a}){return(0,b.jsx)("div",{className:"max-w-2xl mx-auto rounded-xl border border-[#26262b] bg-[#161618] shadow-lg shadow-black/20",children:a})}function i({cmd:a}){let[d,e]=(0,c.useState)(!1),f=async()=>{try{await navigator.clipboard.writeText(a),e(!0),setTimeout(()=>e(!1),1800)}catch{}};return(0,b.jsxs)("div",{className:"anet-empty-cmd flex items-start sm:items-center gap-2 bg-[#0e0e10] border border-[#26262b] rounded-lg pl-4 pr-1.5 py-1.5 text-xs sm:text-sm",children:[(0,b.jsx)("code",{className:"text-cyan-300 font-mono select-all min-w-0 break-all sm:break-normal",children:a}),(0,b.jsx)("button",{type:"button",onClick:f,"aria-label":d?"Copied":"Copy command",className:"shrink-0 rounded-md px-2 py-1.5 text-[11px] text-gray-500 hover:text-gray-200 hover:bg-[#1c1c1f] transition-colors",children:d?(0,b.jsxs)("span",{className:"flex items-center gap-1 text-green-400",children:[(0,b.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,b.jsx)("path",{d:"M20 6 9 17l-5-5"})}),"Copied"]}):(0,b.jsxs)("span",{className:"flex items-center gap-1",children:[(0,b.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,b.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]})}a.s(["EmptyState",0,g,"NodesEmptyState",0,function({hint:a,taskHistoryCount:c=0}){return a?.global_count?(0,b.jsx)(h,{children:(0,b.jsx)(g,{variant:"nodes",title:"No agents in this network",sub:`Server has ${a.global_count} nodes globally, but none are registered to the current network. Switch network or contact admin.`})}):c>0?(0,b.jsx)(h,{children:(0,b.jsx)(g,{variant:"nodes",title:"No agents online",sub:`Every agent in this network is currently offline. ${c.toLocaleString()} task${1===c?"":"s"} in history — they may have finished their work or disconnected.`,cta:{label:"View task history",href:"/tasks"}})}):(0,b.jsx)(h,{children:(0,b.jsxs)("div",{className:"text-center py-16 px-4",role:"status",children:[(0,b.jsx)("div",{className:"anet-empty-glyph inline-flex items-center justify-center mb-4 text-gray-500","aria-hidden":!0,children:(0,b.jsx)("svg",{viewBox:"0 0 64 64",width:56,height:56,children:(0,b.jsxs)("g",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",children:[(0,b.jsx)("rect",{x:"10",y:"20",width:"44",height:"28",rx:"2"}),(0,b.jsx)("rect",{x:"20",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,b.jsx)("rect",{x:"32",y:"32",width:"6",height:"8",opacity:"0.5"}),(0,b.jsx)("rect",{x:"44",y:"32",width:"4",height:"8",opacity:"0.5"}),(0,b.jsx)("line",{x1:"10",y1:"26",x2:"54",y2:"26",opacity:"0.4"}),(0,b.jsx)("circle",{cx:"14",cy:"23",r:"0.8",fill:"currentColor"})]})})}),(0,b.jsx)("h3",{className:"font-medium text-gray-300 text-base",children:"Spin up your first agent"}),(0,b.jsx)("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:"Run this in a fresh terminal to register an agent with this CommHub:"}),(0,b.jsx)("div",{className:"mt-4 inline-block",children:(0,b.jsx)(i,{cmd:"npx --yes @sleep2agi/agent-network init"})}),(0,b.jsx)("p",{className:"text-gray-600 text-xs mt-3 max-w-md mx-auto",children:"Once the agent connects, it appears here automatically within a few seconds — no refresh needed."}),(0,b.jsx)("div",{className:"mt-3",children:(0,b.jsxs)("a",{href:"https://anet.sh",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-cyan-300",children:["Full quickstart guide",(0,b.jsx)("span",{"aria-hidden":!0,children:"→"})]})})]})})}])},30396,a=>{"use strict";a.s(["SESSION_STATUS_CHIP_CLASS",0,{working:"bg-green-500/10 text-green-300 border-green-500/20",idle:"bg-gray-500/10 text-gray-300 border-gray-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"},"SESSION_STATUS_TEXT_CLASS",0,{working:"text-green-400",idle:"text-gray-400",blocked:"text-yellow-400",error:"text-red-400",offline:"text-gray-500"},"STATUS_BAR_CLASS",0,{created:"bg-gray-500",delivered:"bg-gray-400",acked:"bg-gray-300",running:"bg-green-500",replied:"bg-gray-400",closed:"bg-gray-600",failed:"bg-red-500",cancelled:"bg-gray-600",expired:"bg-gray-600"},"STATUS_CHIP_CLASS",0,{created:"bg-gray-500/10 text-gray-400 border-gray-500/20",delivered:"bg-gray-500/10 text-gray-300 border-gray-500/20",acked:"bg-gray-500/10 text-gray-300 border-gray-500/20",running:"bg-green-500/10 text-green-300 border-green-500/20",replied:"bg-gray-500/10 text-gray-300 border-gray-500/20",closed:"bg-gray-500/10 text-gray-500 border-gray-500/20",failed:"bg-red-500/10 text-red-300 border-red-500/20",cancelled:"bg-gray-500/10 text-gray-500 border-gray-500/20",expired:"bg-gray-500/10 text-gray-500 border-gray-500/20"},"STATUS_DOT_HEX",0,{created:"#9ca3af",delivered:"#9ca3af",acked:"#9ca3af",running:"#4ade80",replied:"#9ca3af",closed:"#6b7280",failed:"#f87171",cancelled:"#6b7280",expired:"#6b7280"},"TASK_STATUSES",0,["created","delivered","acked","running","replied","closed","failed","cancelled","expired"]])},28644,a=>{"use strict";var b=a.i(67784),c=a.i(436);let d=async a=>{let b=await fetch(a);if(401===b.status)throw window.location.assign("/login"),Error("unauthorized");return b.json()},e={refreshInterval:5e3,dedupingInterval:3e3};function f(a,b){if(!b)return a;let c=a.includes("?")?"&":"?";return`${a}${c}network_id=${encodeURIComponent(b)}`}a.s(["useAnetConfig",0,function(){let{data:a}=(0,b.default)("/api/anet/config",d,{refreshInterval:3e4});return{config:a||null}},"useHealth",0,function(){let{data:a,error:c}=(0,b.default)("/api/hub/health",d,e);return{health:a||null,error:c}},"useMessages",0,function(a=100){let{networkId:g}=(0,c.useNetworkId)(),{data:h,error:i,isLoading:j}=(0,b.default)(f(`/api/hub/messages?limit=${a}`,g),d,{...e,keepPreviousData:!0});return{messages:h?.messages||[],error:i,isLoading:j}},"useNodeLifecycle",0,function(){let{networkId:a}=(0,c.useNetworkId)(),{data:g,error:h}=(0,b.default)(f("/api/hub/nodes",a),d,e),i={},j={};for(let a of g?.nodes??[])a.alias&&"string"==typeof a.lifecycle_state&&(i[a.alias]=a.lifecycle_state),a.alias&&"string"==typeof a.node_id&&(j[a.alias]=a.node_id);return{lifecycleByAlias:i,nodeIdByAlias:j,error:h}},"useSessions",0,function(){let{networkId:a}=(0,c.useNetworkId)(),{data:g,error:h,isLoading:i}=(0,b.default)(f("/api/hub/status",a),d,e);return{sessions:g?.sessions||[],hint:g?._hint,error:h,isLoading:i}},"useStats",0,function(){let{networkId:a}=(0,c.useNetworkId)(),{data:g,error:h}=(0,b.default)(f("/api/hub/stats",a),d,e);return{stats:g?.ok?g:null,error:h}},"useTasks",0,function(a){let{networkId:g}=(0,c.useNetworkId)(),h=new URLSearchParams({limit:"100",...a}).toString(),{data:i,error:j,isLoading:k}=(0,b.default)(f(`/api/hub/tasks?${h}`,g),d,e);return{tasks:i?.tasks||[],count:i?.count??0,source:i?.source,error:j,isLoading:k}}])},89526,a=>{"use strict";var b=a.i(51653),c=a.i(85895);a.s(["useCollapsibleSearch",0,function({value:a,onChange:d,placeholder:e="Search…",label:f="Search",enabled:g=!0}){let[h,i]=(0,c.useState)(!1),j=(0,c.useCallback)(()=>{d(""),i(!1)},[d]);return{Button:(0,c.useCallback)(()=>{if(!g)return(0,b.jsx)(b.Fragment,{});let c=h||a;return(0,b.jsxs)("button",{type:"button",onClick:()=>i(a=>!a),"aria-label":h?`Close ${f.toLowerCase()}`:`Open ${f.toLowerCase()}`,"aria-pressed":h,title:h?`Close ${f.toLowerCase()}`:f,className:`relative shrink-0 inline-flex items-center justify-center rounded-full border w-9 h-9 transition-colors ${c?"border-cyan-500/40 bg-cyan-500/10 text-cyan-300":"border-[#26262b] bg-[#161618] text-gray-400 hover:text-gray-200 hover:border-[#3a3a41]"}`,children:[(0,b.jsx)("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),a&&!h&&(0,b.jsx)("span",{"aria-hidden":!0,className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-cyan-400 ring-2 ring-[#0b0b0d]"})]})},[h,a,f,g]),Row:(0,c.useCallback)(()=>g&&(h||a)?(0,b.jsxs)("div",{className:"mb-3 sm:mb-4 flex items-center gap-2",children:[(0,b.jsx)("input",{type:"text",value:a,onChange:a=>d(a.target.value),onKeyDown:a=>{"Escape"===a.key&&j()},placeholder:e,autoFocus:h,className:"flex-1 bg-[#161618] border border-[#26262b] rounded-lg px-3 py-2 text-base sm:text-sm text-white placeholder-gray-600 focus:border-cyan-500/40 focus:outline-none"}),(0,b.jsx)("button",{type:"button",onClick:j,className:"shrink-0 text-xs text-gray-500 hover:text-gray-300 px-2 py-2","aria-label":"Clear and close search",children:"Cancel"})]}):null,[h,a,d,e,j,g]),value:a,reset:j}}])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0-n_oet._.js.map