@sapienx/agentos 0.6.9 → 0.6.10

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 (167) hide show
  1. package/bundle/.next/BUILD_ID +1 -1
  2. package/bundle/.next/app-path-routes-manifest.json +17 -17
  3. package/bundle/.next/build-manifest.json +3 -3
  4. package/bundle/.next/prerender-manifest.json +3 -3
  5. package/bundle/.next/react-loadable-manifest.json +2 -2
  6. package/bundle/.next/required-server-files.json +1 -1
  7. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/bundle/.next/server/app/_global-error.html +1 -1
  9. package/bundle/.next/server/app/_global-error.rsc +1 -1
  10. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/bundle/.next/server/app/_not-found/page.js +3 -3
  17. package/bundle/.next/server/app/_not-found/page.js.nft.json +1 -1
  18. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/bundle/.next/server/app/_not-found.html +1 -12
  20. package/bundle/.next/server/app/_not-found.rsc +17 -16
  21. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +17 -16
  22. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  23. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +6 -5
  24. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  25. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  26. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  27. package/bundle/.next/server/app/accounts/page.js +1 -1
  28. package/bundle/.next/server/app/accounts/page.js.nft.json +1 -1
  29. package/bundle/.next/server/app/accounts/page_client-reference-manifest.js +1 -1
  30. package/bundle/.next/server/app/agents/page.js +1 -1
  31. package/bundle/.next/server/app/agents/page.js.nft.json +1 -1
  32. package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  33. package/bundle/.next/server/app/api/accounts/access-rules/route.js.nft.json +1 -1
  34. package/bundle/.next/server/app/api/accounts/browser-profiles/route.js.nft.json +1 -1
  35. package/bundle/.next/server/app/api/accounts/login-targets/route.js.nft.json +1 -1
  36. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
  37. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  38. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  39. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  40. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js.nft.json +1 -1
  41. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  42. package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
  43. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
  44. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  45. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  46. package/bundle/.next/server/app/api/openclaw/capabilities/route.js.nft.json +1 -1
  47. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js.nft.json +1 -1
  48. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  49. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
  50. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  51. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  52. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  53. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  54. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  55. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  56. package/bundle/.next/server/app/api/settings/config-pacing/route.js.nft.json +1 -1
  57. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  58. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
  59. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  60. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  61. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  62. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  63. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
  64. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  65. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  66. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
  67. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
  68. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
  69. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
  70. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
  71. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route.js.nft.json +1 -1
  72. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  73. package/bundle/.next/server/app/dashboard/page.js +1 -1
  74. package/bundle/.next/server/app/dashboard/page.js.nft.json +1 -1
  75. package/bundle/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  76. package/bundle/.next/server/app/files/page.js +1 -1
  77. package/bundle/.next/server/app/files/page.js.nft.json +1 -1
  78. package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -1
  79. package/bundle/.next/server/app/integrations/page.js +1 -1
  80. package/bundle/.next/server/app/integrations/page.js.nft.json +1 -1
  81. package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -1
  82. package/bundle/.next/server/app/mission-control/page.js +1 -1
  83. package/bundle/.next/server/app/mission-control/page.js.nft.json +1 -1
  84. package/bundle/.next/server/app/mission-control/page_client-reference-manifest.js +1 -1
  85. package/bundle/.next/server/app/models/page.js +1 -1
  86. package/bundle/.next/server/app/models/page.js.nft.json +1 -1
  87. package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -1
  88. package/bundle/.next/server/app/page.js +1 -1
  89. package/bundle/.next/server/app/page.js.nft.json +1 -1
  90. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  91. package/bundle/.next/server/app/settings/page.js +1 -1
  92. package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
  93. package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  94. package/bundle/.next/server/app/tasks/page.js +1 -1
  95. package/bundle/.next/server/app/tasks/page.js.nft.json +1 -1
  96. package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  97. package/bundle/.next/server/app-paths-manifest.json +17 -17
  98. package/bundle/.next/server/chunks/4391.js +2 -2
  99. package/bundle/.next/server/chunks/{4669.js → 4834.js} +2 -2
  100. package/bundle/.next/server/chunks/4983.js +2 -2
  101. package/bundle/.next/server/chunks/5110.js +185 -0
  102. package/bundle/.next/server/chunks/7042.js +7 -0
  103. package/bundle/.next/server/chunks/824.js +1 -0
  104. package/bundle/.next/server/middleware-build-manifest.js +1 -1
  105. package/bundle/.next/server/middleware-react-loadable-manifest.js +1 -1
  106. package/bundle/.next/server/pages/404.html +1 -12
  107. package/bundle/.next/server/pages/500.html +1 -1
  108. package/bundle/.next/server/server-reference-manifest.json +1 -1
  109. package/bundle/.next/static/chunks/2083-287b5acfe58cc550.js +1 -0
  110. package/bundle/.next/static/chunks/2125-ee3186e76863c0c0.js +3 -0
  111. package/bundle/.next/static/chunks/213.55cf232b18b53b9d.js +1 -0
  112. package/bundle/.next/static/chunks/5922-bd40755edb9a1242.js +174 -0
  113. package/bundle/.next/static/chunks/{7442-2b8d98ced8731710.js → 7442-f6bbc0b14b5ca5e5.js} +10 -10
  114. package/bundle/.next/static/chunks/7469-ff14d7391de81fa9.js +9 -0
  115. package/bundle/.next/static/chunks/{1541-0173f72615d06e6b.js → 8194-5ee9cc305aa8dd38.js} +3 -3
  116. package/bundle/.next/static/chunks/app/accounts/page-6f089a76941d46ab.js +1 -0
  117. package/bundle/.next/static/chunks/app/agents/page-eff12bdae5519ed3.js +1 -0
  118. package/bundle/.next/static/chunks/app/dashboard/page-a99b8eca6b1e54fc.js +1 -0
  119. package/bundle/.next/static/chunks/app/files/page-dc5dbcbc430f1568.js +1 -0
  120. package/bundle/.next/static/chunks/app/integrations/page-c50b4f2501b6495e.js +1 -0
  121. package/bundle/.next/static/chunks/app/layout-b44a6304aeb11e7d.js +1 -0
  122. package/bundle/.next/static/chunks/app/mission-control/page-67cbc591f6f65db0.js +1 -0
  123. package/bundle/.next/static/chunks/app/models/page-ccff5c274d4abb63.js +1 -0
  124. package/bundle/.next/static/chunks/app/page-b8446d01f241e969.js +1 -0
  125. package/bundle/.next/static/chunks/app/settings/page-b03e77b48df03a1b.js +1 -0
  126. package/bundle/.next/static/chunks/app/tasks/page-cf025219a3c875cf.js +1 -0
  127. package/bundle/.next/static/chunks/webpack-82d9aaa9ef1f9bdf.js +1 -0
  128. package/bundle/.next/static/css/2f74db4938189dc1.css +3 -0
  129. package/bundle/public/android-chrome-192x192.png +0 -0
  130. package/bundle/public/android-chrome-512x512.png +0 -0
  131. package/bundle/public/apple-touch-icon.png +0 -0
  132. package/bundle/public/assets/logo.png +0 -0
  133. package/bundle/public/assets/logo.webm +0 -0
  134. package/bundle/public/assets/logo.webp +0 -0
  135. package/bundle/public/assets/logoold.png +0 -0
  136. package/bundle/public/assets/logoold.webm +0 -0
  137. package/bundle/public/assets/logoold.webp +0 -0
  138. package/bundle/public/favicon-16x16.png +0 -0
  139. package/bundle/public/favicon-32x32.png +0 -0
  140. package/bundle/public/favicon-48x48.png +0 -0
  141. package/bundle/public/favicon.ico +0 -0
  142. package/bundle/public/site.webmanifest +2 -2
  143. package/bundle/server.js +1 -1
  144. package/package.json +1 -1
  145. package/bundle/.next/server/chunks/1089.js +0 -7
  146. package/bundle/.next/server/chunks/5086.js +0 -185
  147. package/bundle/.next/server/chunks/7825.js +0 -1
  148. package/bundle/.next/static/chunks/2083-7ecb4068386ea635.js +0 -1
  149. package/bundle/.next/static/chunks/2125-d862b19ddebfd33a.js +0 -3
  150. package/bundle/.next/static/chunks/4137.19010bab7fabf352.js +0 -1
  151. package/bundle/.next/static/chunks/5922-c50d9d6d73494e4a.js +0 -174
  152. package/bundle/.next/static/chunks/616-340cd4ffce07ad95.js +0 -9
  153. package/bundle/.next/static/chunks/app/accounts/page-70d61db66c3fa8ff.js +0 -1
  154. package/bundle/.next/static/chunks/app/agents/page-bcd6692c103acc4b.js +0 -1
  155. package/bundle/.next/static/chunks/app/dashboard/page-3ddf5f111de57314.js +0 -1
  156. package/bundle/.next/static/chunks/app/files/page-5d16dd2ab89a7ef8.js +0 -1
  157. package/bundle/.next/static/chunks/app/integrations/page-c82fe844b92dcc3c.js +0 -1
  158. package/bundle/.next/static/chunks/app/layout-a58705d0aa0318d2.js +0 -1
  159. package/bundle/.next/static/chunks/app/mission-control/page-047cf8ddbc5eb449.js +0 -1
  160. package/bundle/.next/static/chunks/app/models/page-5a77bb7553c260a3.js +0 -1
  161. package/bundle/.next/static/chunks/app/page-3948952c415f5a8f.js +0 -1
  162. package/bundle/.next/static/chunks/app/settings/page-377344c48b7c3b7a.js +0 -1
  163. package/bundle/.next/static/chunks/app/tasks/page-5eebfe2b85dbe24d.js +0 -1
  164. package/bundle/.next/static/chunks/webpack-6bcec8d8f296d9ef.js +0 -1
  165. package/bundle/.next/static/css/1ec545644e12b517.css +0 -3
  166. /package/bundle/.next/static/{jgRmll3iX_XVNwRhKs8U9 → 9xNgkJTOL7J6_GGDUZWeG}/_buildManifest.js +0 -0
  167. /package/bundle/.next/static/{jgRmll3iX_XVNwRhKs8U9 → 9xNgkJTOL7J6_GGDUZWeG}/_ssgManifest.js +0 -0
@@ -1,7 +1,7 @@
1
1
  exports.id=4391,exports.ids=[4391],exports.modules={5590:(a,b,c)=>{Promise.resolve().then(c.bind(c,69772))},42542:(a,b,c)=>{Promise.resolve().then(c.bind(c,97281))},69772:(a,b,c)=>{"use strict";c.d(b,{MissionControlShell:()=>dh});var d=c(3814),e=c(13002),f=c(56815),g=c(6247),h=c(46856),i=c(14447),j=c(82425),k=c(11917),l=c(74234),m=c(57531),n=c(18570),o=c(58664),p=c(97950),q=c(45821),r=c(75367),s=c(84086),t=c(97078),u=c(80990),v=c(74952),w=c(43081),x=c(90665),y=c(32905);let z="mission-control-recent-prompts";function A({snapshot:a,surfaceTheme:b,activeWorkspaceId:c,selectedNodeId:e,composeIntent:f,isComposerActive:h,onTargetAgentChange:i,onTargetAgentSelect:j,onComposerActiveChange:q,onRefresh:G,onOpenWorkspaceCreate:H,onOpenWorkspaceChannels:I,onMissionDispatchStart:J,onMissionDispatchFailure:K,onMissionResponse:L,onAgentCreationPending:M,onAgentCreatedVisible:N}){var O,P;let Q,R,[S,T]=(0,g.useState)(""),[U,V]=(0,g.useState)(""),[W,X]=(0,g.useState)("medium"),[Y,Z]=(0,g.useState)(!1),[$,_]=(0,g.useState)(!1),[aa,ab]=(0,g.useState)(!1),[ac,ad]=(0,g.useState)(!1),[ae,af]=(0,g.useState)(!1),[ag,ah]=(0,g.useState)(!1),[ai,aj]=(0,g.useState)(!1),[ak,al]=(0,g.useState)(null),am=(0,g.useRef)(null);(0,g.useRef)(null);let an=(0,g.useRef)(null);(0,g.useRef)(null);let ao=(0,g.useRef)(!1);(0,g.useRef)(null);let ap=a.workspaces.find(a=>a.id===c)??a.workspaces[0],aq=a.agents.filter(a=>!ap||a.workspaceId===ap.id),ar=aq.find(a=>a.id===U)??aq[0]??null,as=ar?(0,x.CK)(ar):null,at=ar?.id??null,au=aq.map(a=>({label:(0,x.CK)(a),value:a.id})),av=(O=ap?.id??c??null,P=at,O||P?`mission-control-composer-draft:${O??"global"}:${P??"unassigned"}`:null),aw=!!(S.trim()&&at&&!Y),ax=as?`Compose for ${as}...`:"Compose a mission...",ay=((Q=[]).push({id:"workspace-create",label:"Create workspace",action:"open-workspace-create"}),R=new Set,Q.filter(a=>{let b=`${a.action||"mission"}:${a.mission?.trim().toLowerCase()||a.label.toLowerCase()}`;return!R.has(b)&&(R.add(b),!0)}).slice(0,3)),az=ay.length>0,aA=!h&&!aa&&0===S.trim().length&&null===ak,aB=ac&&(!ae||Y)&&aA,aC=ag&&aA||aB||!ac&&!ae&&aA,aD=async a=>{let b=a.mission.trim();if(!b)return;Z(!0),ah(!0);let d=a.agentId||at,e=Date.now(),f=globalThis.crypto?.randomUUID?.()||`dispatch:${e}`,g=new AbortController;ao.current=!0,T(""),al(null),ab(!1),af(!1),q?.(!1),d&&J({requestId:f,mission:b,agentId:d,workspaceId:ap?.id??c??null,submittedAt:e,abortController:g});try{var h;let i=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:g.signal,body:JSON.stringify({...a,mission:b})}),j=await i.json();if(!i.ok||j.error)throw Error(j.error||"OpenClaw rejected the mission.");L(j,{requestId:f}),av&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(av),d&&function(a){let b=[a,...(function(){try{let a=globalThis.localStorage.getItem(z);if(!a)return[];let b=JSON.parse(a);if(!Array.isArray(b))return[];return b.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.mission&&"string"==typeof a.agentId&&"string"==typeof a.agentName&&"number"==typeof a.submittedAt).slice(0,6)}catch{return[]}})().filter(b=>b.mission.trim()!==a.mission.trim()||b.agentId!==a.agentId||b.workspaceId!==a.workspaceId)].slice(0,6);try{globalThis.localStorage.setItem(z,JSON.stringify(b))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${e}`,mission:b,agentId:d,agentName:as??"Agent",workspaceId:ap?.id??c,workspaceName:ap?.name??null,submittedAt:e});let k="string"==typeof j.meta?.outputDirRelative?`${j.status} via ${j.agentId} \xb7 ${j.meta.outputDirRelative}`:`${j.status} via ${j.agentId}`,l="stalled"===j.status&&(h=j.summary,"string"==typeof h&&(/No transcript file was found for this runtime session/i.test(h)||/No transcript entries were found for this runtime/i.test(h)));"stalled"!==j.status||l?w.o.success(l?"Mission is running silently.":"Mission queued in OpenClaw.",{description:l?"AgentOS is waiting for the first transcript update.":k}):w.o.error("Mission could not start.",{description:j.summary||k}),G().catch(()=>null)}catch(a){if(a instanceof DOMException&&"AbortError"===a.name)return;K(f,a instanceof Error?a.message:"Unknown mission error."),T(b),al(ak),ab(aa),ah(!1),af(!0),q?.(!0),requestAnimationFrame(()=>{am.current?.focus(),am.current?.setSelectionRange(b.length,b.length)}),w.o.error("Mission dispatch failed.",{description:a instanceof Error?a.message:"Unknown mission error."})}finally{Z(!1)}},aE=(a,b={})=>{ah(!1),b.thinking&&X(b.thinking),T(c=>{var d,e;let f,g;return"replace"===b.mode?a:(d=c,e=a,f=d.trim(),g=e.trim(),f?g?`${f}
2
2
 
3
- ${g}`:f:g)}),requestAnimationFrame(()=>{am.current?.focus();let a=am.current?.value??"";am.current?.setSelectionRange(a.length,a.length)})};return(0,d.jsx)("div",{className:(0,y.cn)("mx-auto w-full transition-[width,max-width] duration-300",aC&&"max-w-[360px]",aB&&"lg:w-[360px]"),onMouseEnter:()=>{ac&&!Y&&af(!0)},onMouseLeave:()=>{ac&&!Y&&af(!1)},children:(0,d.jsx)(r.N,{initial:!1,mode:"wait",children:aC?(0,d.jsx)(s.P.button,{type:"button",initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.98},disabled:Y,onFocus:()=>{Y||af(!0)},onClick:()=>{Y||(ah(!1),af(!0),requestAnimationFrame(()=>{am.current?.focus()}))},className:"w-full overflow-hidden rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2 text-left shadow-[0_24px_72px_rgba(0,0,0,0.22)] isolate",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.9),rgba(11,17,28,0.88))] px-3 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,d.jsx)("span",{className:"inline-flex h-7 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-2.5 text-[11px] text-slate-300",children:as||"No agent"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:Y?"Creating task...":ax}),(0,d.jsxs)("span",{className:"inline-flex h-8 items-center rounded-full bg-white px-3 text-[12px] font-medium text-slate-950",children:[Y?(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(l.A,{className:"mr-1.5 h-3.5 w-3.5"}),Y?"Creating":"Create task"]})]})},"collapsed"):(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.985},className:"overflow-hidden rounded-[26px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2.5 shadow-[0_24px_72px_rgba(0,0,0,0.26)] isolate",children:[(0,d.jsx)(r.N,{initial:!1,children:ak?(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-[12px] text-slate-400",children:[(0,d.jsxs)("span",{className:"truncate",children:["From ",ak.sourceLabel]}),(0,d.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>aE(ak.mission,{mode:"replace"}),children:"Replace"}),(0,d.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>aE(ak.mission),children:"Append"}),(0,d.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition-colors hover:bg-white/[0.06] hover:text-white",onClick:()=>al(null),"aria-label":"Dismiss runtime suggestion",children:(0,d.jsx)(m.A,{className:"h-3.5 w-3.5"})})]}):null}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[22px] border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.92),rgba(10,16,26,0.9))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] transition-all duration-200",h&&"border-white/[0.14] bg-[linear-gradient(180deg,rgba(24,34,50,0.94),rgba(12,18,30,0.92))] shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]"),onFocusCapture:()=>{ah(!1),q?.(!0)},onBlurCapture:a=>{let b=a.relatedTarget;b instanceof Node&&a.currentTarget.contains(b)||(q?.(!1),ac||0!==S.trim().length||aa||null!==ak||af(!1))},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[ar?(0,d.jsx)(B,{value:U,options:au,onChange:a=>{ah(!1),V(a),j?.(a)}}):(0,d.jsx)(F,{children:"No agent"}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,d.jsx)(D,{label:"Refresh AgentOS",onClick:async()=>{_(!0),await G(),_(!1)},children:$?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(D,{label:"Create workspace",onClick:H,children:(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(D,{label:"Composer settings",onClick:()=>ab(a=>!a),active:aa||"medium"!==W,children:(0,d.jsxs)("span",{className:"relative inline-flex",children:[(0,d.jsx)(p.A,{className:"h-3.5 w-3.5"}),"medium"!==W?(0,d.jsx)("span",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-white/80"}):null]})})]})]}),(0,d.jsx)("div",{className:"px-2.5 pt-0.5",children:(0,d.jsx)(v.T,{ref:am,value:S,onChange:a=>{ah(!1),T(a.target.value)},onKeyDown:async a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aw&&at&&await aD({mission:S,agentId:at,workspaceId:c??void 0,thinking:W}))},placeholder:ax,className:"min-h-[50px] max-h-[150px] resize-none overflow-y-auto border-0 bg-transparent px-0 py-0.5 text-[15px] leading-[1.6] text-white placeholder:text-[#f6eee5]/60 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})}),(0,d.jsxs)("div",{className:"flex items-end justify-between gap-2.5 px-2.5 pb-2.5 pt-1.5",children:[(0,d.jsx)(r.N,{initial:!1,children:az?(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[ay.map(a=>(0,d.jsx)(E,{label:a.label,onClick:()=>{"open-workspace-create"===a.action?H():a.mission&&aE(a.mission,{thinking:a.thinking})}},a.id)),ap?(0,d.jsx)(t.O,{snapshot:a,defaultWorkspaceId:ap.id,onRefresh:G,onAgentCreationPending:M,onAgentCreated:a=>{an.current=a,V(a)},onAgentCreatedVisible:N,surfaceTheme:b,trigger:(0,d.jsx)("button",{type:"button",className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:"+ Create Agent"})}):null,ai&&ap?(0,d.jsx)("button",{type:"button",onClick:()=>I(),className:"inline-flex h-8 items-center rounded-full border border-cyan-300/18 bg-cyan-400/[0.1] px-3 text-[12px] text-cyan-50 transition-all hover:border-cyan-300/28 hover:bg-cyan-400/[0.14] hover:text-white",children:"Manage Surfaces"}):null]}):(0,d.jsx)("div",{})}),(0,d.jsxs)(u.$,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!aw,onClick:async()=>{at&&await aD({mission:S,agentId:at,workspaceId:c??void 0,thinking:W})},children:[Y?(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(l.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,d.jsx)(r.N,{initial:!1,children:aa?(0,d.jsx)(s.P.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},className:"mt-2 flex justify-end",children:(0,d.jsxs)("div",{className:"w-full max-w-[232px] rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(14,20,31,0.96),rgba(10,15,24,0.94))] p-3 shadow-[0_16px_32px_rgba(0,0,0,0.22)]",children:[(0,d.jsx)("p",{className:"text-[11px] text-slate-300",children:"Thinking"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(C,{ariaLabel:"Select thinking level",value:W,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:a=>X(a)})}),(0,d.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{ah(!1),T(""),X("medium"),al(null),ao.current=!0,av&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(av)},children:"Clear draft"})]})}):null})]},"expanded")})})}function B({value:a,options:b,onChange:c}){let e=b.find(b=>b.value===a)??b[0],f=b.length>1;return(0,d.jsxs)("div",{className:"relative inline-flex items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[f?(0,d.jsx)("select",{"aria-label":"Select mission agent",value:e?.value??"",onChange:a=>c(a.target.value),className:"h-8 appearance-none bg-transparent pl-3 pr-8 text-[12px] outline-none",children:b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}):(0,d.jsx)("span",{className:"px-3 text-[12px]",children:e?.label||"No agent"}),f?(0,d.jsx)(q.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function C({ariaLabel:a,value:b,options:c,onChange:e}){let f=c.find(a=>a.value===b)??c[0];return(0,d.jsxs)("div",{className:"relative inline-flex w-full items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[(0,d.jsx)("select",{"aria-label":a,value:f?.value??"",onChange:a=>e(a.target.value),className:"h-9 w-full appearance-none bg-transparent pl-3 pr-9 text-[12px] outline-none",children:c.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,d.jsx)(q.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function D({label:a,active:b=!1,onClick:c,children:e}){return(0,d.jsx)("button",{type:"button","aria-label":a,title:a,onClick:c,className:(0,y.cn)("inline-flex h-8 w-8 items-center justify-center rounded-full border border-transparent text-slate-400 transition-all hover:border-white/[0.08] hover:bg-white/[0.06] hover:text-white",b&&"border-white/[0.08] bg-white/[0.06] text-white"),children:e})}function E({label:a,onClick:b}){return(0,d.jsx)("button",{type:"button",onClick:b,className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:a})}function F({children:a}){return(0,d.jsx)("div",{className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300",children:a})}var G=c(91698),H=c(69484),I=c(25393),J=c(4645),K=c(68428),L=c(95127),M=c(96493),N=c(65474),O=c(32956),P=c(73596),Q=c(57825),R=c(29849),S=c(59777),T=c(31002);let U=/https?:\/\/[^\s<>"'`)\]]+/g,V=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,W=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,X=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function Y({text:a,className:b,url:c,filePath:e,displayPath:f,basePath:g,compact:h=!1}){let i=function(a,b){let c=new Set;for(let d of(b&&c.add(b),a.matchAll(U)))d[0]&&c.add(d[0]);return[...c]}(a,c),j=function(a){let b=new Set;for(let c of a.matchAll(V))c[0]&&b.add(c[0]);return[...b]}(a),k=function(a,b,c){var d,e;let f,g,h=[],i=(d=b,e=c,f=Z(d),g=Z(e),f&&g&&f.startsWith("/")?{path:f.replace(/\/+$/,""),label:g.replace(/\/+$/,"")}:null),j=(a,b)=>{let c=function(a,b){let c=Z(a);if(!c)return null;if(c.startsWith("/")||!b)return c;if(c===b.label)return b.path;let d=`${b.label}/`;if(!c.startsWith(d))return c;let e=c.slice(d.length).replace(/^\/+/,"");return e?`${b.path}/${e}`:b.path}(a,i),d=Z(b||a);c&&d&&(h.some(a=>Z(a.path)===c||Z(a.label)===d)||h.push({path:c,label:d}))};for(let d of(b&&j(b,c||b),a.matchAll(X))){let a=Z(d[1]);a&&j(a,a)}for(let b of a.matchAll(W)){let a=Z(b[1]);a&&j(a,a)}return h}(a,e,f);return(0,d.jsxs)("div",{className:(0,y.cn)("space-y-2",h&&"space-y-1.5"),children:[(0,d.jsx)("p",{className:(0,y.cn)("whitespace-pre-wrap break-words",b),children:function(a){let b=Array.from(a.matchAll(U));if(0===b.length)return a;let c=[],e=0;for(let[f]of b){let b=a.indexOf(f,e);b>e&&c.push(a.slice(e,b)),c.push((0,d.jsx)("a",{href:f,target:"_blank",rel:"noreferrer",className:"nodrag nopan text-cyan-100 underline decoration-cyan-200/45 underline-offset-2 transition-colors hover:text-cyan-50 hover:decoration-cyan-100",onClick:a=>a.stopPropagation(),children:f},`${f}:${b}`)),e=b+f.length}return e<a.length&&c.push(a.slice(e)),c}(a)}),i.length>0||j.length>0||k.length>0?(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[i.map(a=>(0,d.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:(0,y.cn)("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-cyan-300/16 bg-cyan-400/[0.08] px-2 py-1 text-[10px] text-cyan-100 transition-colors hover:border-cyan-200/30 hover:bg-cyan-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,d.jsx)(S.A,{className:(0,y.cn)("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:function(a){try{let b=new URL(a);return`${b.hostname}${"/"===b.pathname?"":b.pathname}`}catch{return a}}(a)})]},a)),j.map(a=>(0,d.jsxs)("a",{href:`mailto:${a}`,className:(0,y.cn)("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-sky-300/16 bg-sky-400/[0.08] px-2 py-1 text-[10px] text-sky-50 transition-colors hover:border-sky-200/30 hover:bg-sky-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,d.jsx)(S.A,{className:(0,y.cn)("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:a})]},a)),k.map(a=>(0,d.jsxs)("button",{type:"button",className:(0,y.cn)("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-emerald-300/16 bg-emerald-400/[0.08] px-2 py-1 text-[10px] text-emerald-50 transition-colors hover:border-emerald-200/30 hover:bg-emerald-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:b=>{b.stopPropagation(),$(a.path,g)},children:[(0,d.jsx)(T.A,{className:(0,y.cn)("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:(0,x.$7)(a.label)})]},`${a.path}:${a.label}`))]}):null]})}function Z(a){let b=a?.trim();return b?b.replace(/[.,:;]+$/g,""):null}async function $(a,b){try{let c=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,basePath:b??null})}),d=await c.json();if(!c.ok)throw Error(d.error||"Unable to reveal file.");Q.oR.success("Revealed file.",{description:(0,x.$7)(a)})}catch(a){Q.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}var _=c(61727);function aa(a){let b="string"==typeof a.key?a.key.trim():"",c="string"==typeof a.dispatchId?a.dispatchId.trim():"";return b||c||a.id}function ab(a){let b=a.metadata.reviewedAt;return"string"==typeof b&&b.trim().length>0?b:null}function ac(a){let b=a.metadata.reviewAction;return"string"==typeof b&&b.trim().length>0?b:null}function ad(a,b={}){var c;let d,e="accepted"===(c=d=a.metadata.reviewStatus)||"continued"===c||"retried"===c||"dismissed"===c?d:null;return"continued"!==e?e:!function(a,b={}){let c=ab(a),d=c?Date.parse(c):NaN;return!(!Number.isNaN(d)&&function(a,b){if(!a)return!1;let c=Date.parse(a);return!Number.isNaN(c)&&c>b}(b.latestEvidenceAt,d))&&(!!b.hasLiveActivity||!Number.isNaN(d)&&(b.nowMs??Date.now())-d<12e4)}(a,b)?null:e}function ae(a){switch(a){case"accepted":return"accepted";case"continued":return"continuing";case"retried":return"retry drafted";case"dismissed":return"dismissed"}}function af(a){switch(a){case"accepted":return"An operator accepted the captured result. The original warning remains available for audit.";case"continued":return"OpenClaw accepted a continuation in the existing task session.";case"retried":return"An operator drafted a retry from the original mission.";case"dismissed":return"An operator dismissed this review item without accepting the captured result."}}var ag=c(5813),ah=c(92078);let ai=["Focus on tests","Prioritize UI polish","Avoid changing public API","Continue from the latest failure"];function aj({className:a,...b}){return(0,d.jsx)(ag.E,{...b,className:(0,y.cn)("!h-4 !px-1.5 !py-0 !text-[8px] !leading-none !tracking-[0.1em] !whitespace-nowrap",a)})}function ak(a){return(0,d.jsx)(al,{...a},a.selectedNodeId??"overview")}function al({snapshot:a,surfaceTheme:b,selectedNodeId:c,activeTaskCard:e,agentDetailFocus:f,lastMission:h,onRefresh:i,onSnapshotChange:j,onConfigureAgentCapabilities:k,onConnectModelProvider:l,onAbortTask:m,collapsed:n,onToggleCollapsed:o,activeTab:p,onActiveTabChange:q}){let t=(0,x.hv)(a.generatedAt),u=a.workspaces.find(a=>a.id===c),v=a.agents.find(a=>a.id===c),w=a.tasks.find(a=>a.id===c),z=w&&e?.taskId===w.id?e:null,A=a.runtimes.find(a=>a.id===c),B=a.models.find(a=>a.id===c),C=!!w?.metadata.optimistic,D=u||v||w||A||B||null,E=A?.id??null,F=w?.id??null,M=w&&"string"==typeof w.dispatchId?w.dispatchId:null,{runtimeOutput:N,runtimeOutputError:O}=function(){let[a,b]=(0,g.useState)(null),[c,d]=(0,g.useState)(null);return{runtimeOutput:a,runtimeOutputError:c}}(),P=(0,g.useMemo)(()=>{var a;return C&&w?{task:a=w,runs:[],outputs:[],liveFeed:function(a){let b=new Map;for(let c of[...aA(a.metadata.optimisticEvents),...aA(a.metadata.reviewEvents)])b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))}(a),createdFiles:[],warnings:aI(a)||"stalled"===a.status&&!aH(a.subtitle)?[a.subtitle]:[],integrity:az(a)}:null},[C,w]),Q=!!F&&(!C||!!M),{taskDetail:S,taskDetailError:T,taskDetailNotice:U}=function({selectedTaskId:a,canStreamTaskDetail:b,selectedTaskDispatchId:c}){let[d,e]=(0,g.useState)(null),[f,h]=(0,g.useState)(null),[i,j]=(0,g.useState)(null);return{taskDetail:d,taskDetailError:f,taskDetailNotice:i}}({selectedTaskId:F,canStreamTaskDetail:Q,selectedTaskDispatchId:M}),V=N&&N.runtimeId===E?N:null,W=O?.runtimeId===E?O.message:null,X=S&&(S.task.id===F||M&&"string"==typeof S.task.dispatchId&&S.task.dispatchId===M)?S:null,Y=T?.taskId===F?T.message:null,Z=U?.taskId===F?U.message:null,$=function(a,b){var c,d,e;if(!a||!b||null===b.followUpIndex)return a;let f=function(a,b){let c=a.runId?.trim();if(c){let a=b.filter(a=>{let b;return a.runId===c||a.id===c||("string"==typeof(b=a.metadata.runId)&&b.trim().length>0?b.trim():null)===c});if(a.length>0)return a.sort((a,b)=>am(b.updatedAt)-am(a.updatedAt))}let d=a.createdAt?Date.parse(a.createdAt):NaN,e=a.sessionId?.trim();return b.filter(a=>{let b=am(a.updatedAt),c=Number.isNaN(d)||0===b||b>=d-5e3,f=!e||a.sessionId===e||a.key.includes(e);return c&&f}).sort((a,b)=>am(b.updatedAt)-am(a.updatedAt))}(b,a.runs),g=(c=f).find(a=>an(a))??c.find(a=>"completed"===a.status)??c[0]??null,h=a.outputs.filter(a=>f.some(b=>b.id===a.runtimeId)),i=(d=h).find(a=>a.finalText?.trim())??d.find(a=>a.errorMessage?.trim())??d[0]??null,j=function(a,b,c){if(b.length>0){let a=new Set(b.map(a=>a.id));return c.filter(b=>!!(b.runtimeId&&a.has(b.runtimeId)))}let d=a.createdAt?Date.parse(a.createdAt):NaN;return Number.isNaN(d)?[]:c.filter(a=>{let b=Date.parse(a.timestamp);return!Number.isNaN(b)&&b>=d-5e3})}(b,f,a.liveFeed),k=j.length>0?j:[(e=b,{id:`follow-up-${e.cardNumber}-accepted`,kind:"user",timestamp:e.createdAt??new Date().toISOString(),title:"Follow-up accepted",detail:e.message||"OpenClaw accepted the follow-up for the existing session.",runtimeId:e.runId??void 0})],l=h.length>0?aZ(h.flatMap(a=>a.createdFiles)):aZ(f.flatMap(a=>aX(a))),m=h.length>0?ao(h.flatMap(a=>a.warnings)):ao(f.flatMap(a=>aY(a))),n=function(a,b,c){switch(a){case"queued":case"running":case"idle":case"completed":case"stalled":case"cancelled":return a;default:return b?.finalText||c.summary?"completed":"running"}}(g?.status??b.status,i,b),o=i?.finalText?.trim()||b.summary?.trim()||null,p=ao([...f.flatMap(a=>a.toolNames??[]),...h.flatMap(a=>a.items.map(a=>a.toolName).filter(a=>!!a))]);return{...a,task:{...a.task,title:b.message||`Follow-up ${b.cardNumber-1}`,mission:b.message??a.task.mission,subtitle:o||(g&&an(g)?g.subtitle:null)||("running"===n||"queued"===n?"Follow-up is running in the existing OpenClaw session.":a.task.subtitle),status:n,updatedAt:g?.updatedAt??a.task.updatedAt,primaryRuntimeId:g?.id??a.task.primaryRuntimeId,runtimeIds:f.map(a=>a.id),sessionIds:ao([b.sessionId??"",...f.map(a=>a.sessionId??"")]),runIds:ao([b.runId??"",...f.map(a=>a.runId??"")]),runtimeCount:Math.max(f.length,+!!b.runId),updateCount:k.length,liveRunCount:+("running"===n||"queued"===n),artifactCount:l.length,warningCount:m.length,tokenUsage:function(a){let b=a.map(a=>a.tokenUsage).filter(a=>!!a);if(0!==b.length)return b.reduce((a,b)=>({input:a.input+(b?.input??0),output:a.output+(b?.output??0),total:a.total+(b?.total??0),cacheRead:(a.cacheRead??0)+(b?.cacheRead??0)}),{input:0,output:0,total:0,cacheRead:0})}(f),metadata:{...a.task.metadata,resultPreview:o??(g&&an(g)?g.subtitle:null)??"Waiting for follow-up output.",finalResponseText:o,finalResponseRuntimeId:g?.id??null,turnCount:Math.max(new Set(f.map(a=>a.runId??a.id)).size,+!!b.runId),sessionCount:ao([b.sessionId??"",...f.map(a=>a.sessionId??"")]).length,followUpCardNumber:b.cardNumber,followUpMessage:b.message??null}},runs:f,outputs:h,liveFeed:k,createdFiles:l,warnings:m,integrity:{...a.integrity,finalResponseText:o,finalResponseSource:o?"runtime":"none",outputFileCount:l.length,transcriptTurnCount:h.reduce((a,b)=>a+b.items.length,0)||f.length,matchingTranscriptTurnCount:h.reduce((a,b)=>a+b.items.length,0),toolNames:p,issues:o?[]:a.integrity.issues,status:o?"verified":a.integrity.status}}}(X??P,z),aa=Q&&!X&&!Y,ab=!!E&&!V&&!W,ac=!!v,ad=!!(A||w),ae=!!(A||w),af=("chat"!==p||ac)&&("output"!==p||ad)&&("files"!==p||ae)?p:"overview",ag="chat"===af&&!!v,ah=w?"Feed":"Output",ai=u?.name||(v?(0,x.CK)(v):null)||(z?(0,x.$m)(z.message||`Follow-up ${z.cardNumber-1}`,48)||"Follow-up":w?(0,x.$m)(w.title||w.mission||"Task",48)||"Task":null)||(A?(0,x.$m)(A.title||"Run",48)||"Run":null)||B?.name||"Gateway overview",ak=u?"workspace":v?"agent":w?z?`follow-up ${z.cardNumber}`:"task":A?"run":B?"model":"selection",at=(0,g.useMemo)(()=>[{id:"overview",label:"Overview",icon:G.A,enabled:!0},{id:"chat",label:"Chat",icon:H.A,enabled:ac},{id:"output",label:ah,icon:I.A,enabled:ad},{id:"files",label:"Files",icon:J.A,enabled:ae},{id:"raw",label:"Raw",icon:K.A,enabled:!0}],[ah,ac,ae,ad]);return(0,d.jsxs)("div",{className:"panel-surface panel-glow flex h-full flex-row-reverse overflow-hidden rounded-none border border-r-0 border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl",children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex h-full shrink-0 flex-col items-center bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(3,6,12,0.98))] px-1.5 py-2",n?"w-full":"w-[60px] border-l border-white/[0.08]"),children:[(0,d.jsx)(_.A,{label:"Inspector",side:"left",surfaceTheme:b,panelCollapsed:n,children:(0,d.jsx)("button",{type:"button","aria-label":n?"Expand inspector":"Collapse inspector",onClick:o,className:"flex h-9 w-9 items-center justify-center rounded-[8px] border border-cyan-300/18 bg-cyan-400/[0.1] shadow-[0_8px_18px_rgba(34,211,238,0.14)] transition-all hover:border-cyan-200/24 hover:bg-cyan-400/[0.14]",children:(0,d.jsx)(I.A,{className:"h-3.5 w-3.5 text-cyan-200"})})}),(0,d.jsx)("div",{className:"mt-3.5 flex flex-1 flex-col items-center gap-1",children:at.map(a=>(0,d.jsx)(aO,{icon:a.icon,label:a.label,active:af===a.id,surfaceTheme:b,panelCollapsed:n,tooltipSide:"left",disabled:!a.enabled,onClick:()=>{a.enabled&&(q(a.id),n&&o())}},a.id))}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-col items-center gap-0.5",children:[(0,d.jsx)(aj,{variant:"muted",className:"h-4 min-w-[28px] rounded-full px-1 py-0 text-[8px] leading-none tracking-[0.12em]",children:D?"live":"idle"}),n?(0,d.jsx)("p",{className:"max-w-[44px] truncate text-center text-[8px] uppercase tracking-[0.14em] text-slate-500",children:ak}):null]})]}),n?null:(0,d.jsx)("div",{className:"min-w-0 flex-1 bg-[linear-gradient(180deg,rgba(6,10,18,0.96),rgba(3,6,14,0.98))]",children:(0,d.jsxs)("div",{className:(0,y.cn)("mission-scroll flex h-full min-h-0 flex-col overscroll-contain",ag?"overflow-hidden":"overflow-y-auto"),children:[(0,d.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] px-3 pb-2 pt-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-[9px] font-medium uppercase tracking-[0.24em] text-slate-500",children:"Inspector"}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("h2",{className:"min-w-0 truncate font-display text-[1.02rem] leading-5 text-white",children:ai}),(0,d.jsx)(aj,{variant:"muted",className:"shrink-0 h-4 px-1.5 py-0 text-[8px] leading-none tracking-[0.1em]",children:ak})]}),(0,d.jsx)("p",{className:"mt-1 truncate text-[11px] leading-4 text-slate-400",children:w?`${w.runtimeCount} runs \xb7 ${w.liveRunCount} live \xb7 ${(0,x.fw)(w.updatedAt,t)}`:A?`Run ${(0,x.m_)(A.runId||A.id,10)} \xb7 ${A.status} \xb7 ${(0,x.fw)(A.updatedAt,t)}`:v?`${v.activeRuntimeIds.length} active runs`:u?`${u.agentIds.length} agents attached`:B?`${B.provider} model`:"Live gateway context"})]}),(0,d.jsx)("div",{className:"hidden h-8 w-8 shrink-0 items-center justify-center rounded-none border border-white/10 bg-white/[0.04] text-cyan-200 sm:flex",children:(0,d.jsx)(I.A,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("div",{className:"mt-2 flex flex-nowrap gap-1 overflow-x-auto pb-0.5",children:at.filter(a=>a.enabled).map(a=>(0,d.jsx)(aP,{label:a.label,active:af===a.id,onClick:()=>q(a.id)},a.id))})]}),(0,d.jsx)("div",{className:(0,y.cn)("flex-1 p-3",ag&&"min-h-0 overflow-hidden"),children:(0,d.jsx)(r.N,{mode:"wait",children:(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:(0,y.cn)("space-y-3.5",ag&&"flex h-full min-h-0 flex-col space-y-0"),children:["overview"===af?(0,d.jsxs)(d.Fragment,{children:[u?(0,d.jsx)(aq,{snapshot:a,workspaceId:u.id}):null,v?(0,d.jsx)(ar,{snapshot:a,agentId:v.id,focusSection:f,onConfigureAgentCapabilities:k}):null,w?(0,d.jsx)(as,{snapshot:a,task:w,taskId:w.id,taskDetail:$,taskDetailLoading:aa,taskDetailError:Y,taskDetailNotice:Z,onAbortTask:m,onControlComplete:i}):null,A?(0,d.jsx)(aK,{snapshot:a,runtimeId:A.id,runtimeOutput:V,runtimeOutputLoading:ab,runtimeOutputError:W}):null,B?(0,d.jsx)(aN,{snapshot:a,modelId:B.id}):null,D?null:(0,d.jsx)(ap,{snapshot:a,lastMission:h})]}):null,v?(0,d.jsx)("div",{className:(0,y.cn)("min-h-0 flex-1",ag?"block":"hidden"),"aria-hidden":!ag,children:(0,d.jsx)(R.d,{agent:v,snapshot:a,surfaceTheme:b,isVisible:ag,onRefresh:i,onSnapshotChange:j,onConnectModelProvider:l})}):null,"output"===af&&w?(0,d.jsx)(av,{task:w,basePath:ax(a,w,$?.runs),taskDetail:$,taskDetailLoading:aa,taskDetailError:Y,taskDetailNotice:Z,onAbortTask:m,onControlComplete:i}):null,"output"===af&&A?(0,d.jsx)(aM,{runtime:A,basePath:a.workspaces.find(a=>a.id===A.workspaceId)?.path,runtimeOutput:V,runtimeOutputLoading:ab,runtimeOutputError:W}):null,"files"===af&&w?(0,d.jsx)(aw,{snapshot:a,task:w,taskDetail:$}):null,"files"===af&&A?(0,d.jsx)(aL,{runtime:A,runtimeOutput:V}):null,"raw"===af?(0,d.jsx)("pre",{className:"overflow-x-auto rounded-[18px] border border-white/[0.08] bg-slate-950/[0.72] p-3 text-[11px] leading-5 text-slate-300",children:JSON.stringify(w&&$?$:A&&V?{runtime:A,output:V}:D||a,null,2)}):null]},c||"overview")})}),ag?null:(0,d.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-3",children:(0,d.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-3.5 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,d.jsx)(L.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:w?`${w.runtimeCount} runs`:A?`Run ${(0,x.m_)(A.runId||A.id,10)}`:v?`${v.activeRuntimeIds.length} active runs`:u?`${u.agentIds.length} agents`:B?B.provider:"Gateway overview"}),(0,d.jsxs)("p",{className:"mt-1 text-[12px] text-slate-400",children:[ak," \xb7"," ",w?`${$?.liveFeed.length??0} live feed events`:A?`${V?.items.length??0} transcript entries`:v?`${v.activeRuntimeIds.length} tracked runs`:u?`${u.agentIds.length} attached`:`${a.presence.length} live beacons`]})]})]})})})]})})]})}function am(a){return"number"!=typeof a||!Number.isFinite(a)||a<=0?0:a>1e12?a:1e3*a}function an(a){let b=a.subtitle.trim().toLowerCase();return!!(b&&!["chat","agent","sessions.changed","session.message","openclaw runtime event","gateway runtime event"].includes(b))}function ao(a){return Array.from(new Set(a.map(a=>a.trim()).filter(Boolean)))}function ap({snapshot:a,lastMission:b}){let c=(0,x.hv)(a.generatedAt),e=a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable?"passed"===a.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:L.A,title:"Gateway health",value:a.diagnostics.health,children:[(0,d.jsx)("p",{children:a.diagnostics.gatewayUrl}),(0,d.jsx)("p",{children:a.diagnostics.dashboardUrl})]}),(0,d.jsxs)(aQ,{icon:J.A,title:"Runtime preflight",value:e,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:a.diagnostics.runtime.stateRoot}),(0,d.jsx)("p",{children:a.diagnostics.runtime.sessionStores.length>0?`${a.diagnostics.runtime.sessionStores.filter(a=>a.writable).length}/${a.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),a.diagnostics.runtime.smokeTest.checkedAt?(0,d.jsxs)("p",{children:["Smoke test ",a.diagnostics.runtime.smokeTest.status," \xb7"," ",a.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",(0,x.fw)(Date.parse(a.diagnostics.runtime.smokeTest.checkedAt),c)]}):(0,d.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),a.diagnostics.runtime.issues[0]?(0,d.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:a.diagnostics.runtime.issues[0]}):null]}),(0,d.jsxs)(aQ,{icon:I.A,title:"Presence beacons",value:String(a.presence.length),children:[0===a.presence.length?(0,d.jsx)("p",{children:"No live presence payloads."}):null,a.presence.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsx)("div",{className:"text-[13px] text-white",children:a.host}),(0,d.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[a.ip," \xb7 ",a.platform," \xb7 ",a.version]})]},a.ts))]}),b?(0,d.jsxs)(aQ,{icon:M.A,title:"Last mission",value:b.status,children:[(0,d.jsx)("p",{className:"text-sm text-white",children:b.summary}),(0,d.jsx)("p",{className:"font-mono text-xs text-slate-500",children:b.runId?`Run ${b.runId}`:`Dispatch ${b.dispatchId??"pending"}`}),"string"==typeof b.meta?.outputDirRelative?(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:b.meta.outputDirRelative}):null,b.payloads[0]?.text?(0,d.jsx)("div",{className:"rounded-[14px] border border-cyan-400/15 bg-cyan-400/8 px-3 py-2 text-[13px] text-cyan-50",children:b.payloads[0].text}):null]}):null]})}function aq({snapshot:a,workspaceId:b}){let c=(0,x.hv)(a.generatedAt),e=a.workspaces.find(a=>a.id===b),f=a.agents.filter(a=>a.workspaceId===b),g=e?e.modelIds.map(b=>a.models.find(a=>a.id===b)?.name||b):[],h=a.runtimes.filter(a=>a.workspaceId===b||e?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0));if(!e)return null;let i=h.filter(a=>"running"===a.status||"queued"===a.status||"idle"===a.status),j=h[0]??null,k=aZ(h.flatMap(aX)).slice(0,8),l=e.bootstrap.coreFiles.every(a=>a.present)&&e.bootstrap.projectShell.every(a=>a.present)?"ready":e.bootstrap.coreFiles.some(a=>a.present)||e.bootstrap.projectShell.some(a=>a.present)?"partial":"thin",m=Array.from(new Set(f.flatMap(a=>a.observedTools??[]))),n=0===f.length?"no agents":e.capabilities.workspaceOnlyAgentCount===f.length?"workspace-only":0===e.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:J.A,title:"Overview",value:e.health,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,x.$7)(e.path)}),(0,d.jsx)(aT,{items:[{label:"Agents",value:String(f.length)},{label:"Models",value:String(e.modelIds.length)},{label:"Runs",value:String(h.length)},{label:"Sessions",value:String(e.totalSessions)}]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,d.jsx)(aV,{emptyLabel:"No models attached",items:g,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:f.map(a=>(0,d.jsx)(aj,{variant:a.isDefault?"default":"muted",children:(0,x.CK)(a)},a.id))})]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Bootstrap",value:l,children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(aj,{variant:e.bootstrap.template?"default":"muted",children:e.bootstrap.template||"template unknown"}),(0,d.jsx)(aj,{variant:e.bootstrap.sourceMode?"muted":"warning",children:e.bootstrap.sourceMode||"source unknown"}),e.bootstrap.agentTemplate?(0,d.jsx)(aj,{variant:"muted",children:e.bootstrap.agentTemplate}):null]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,d.jsx)(aU,{items:e.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,d.jsx)(aU,{items:[...e.bootstrap.optionalFiles,...e.bootstrap.folders]})]}),e.bootstrap.contextFiles?.length?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Context docs"}),(0,d.jsx)(aU,{items:e.bootstrap.contextFiles})]}):null,(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Project shell"}),(0,d.jsx)(aU,{items:e.bootstrap.projectShell})]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Capabilities",value:n,children:[(0,d.jsxs)("p",{children:[e.capabilities.workspaceOnlyAgentCount,"/",f.length," agents are configured with"," ",(0,d.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,d.jsx)(aV,{emptyLabel:"No explicit skills",items:e.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,d.jsx)(aV,{emptyLabel:"No local SKILL.md scaffolds",items:e.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,d.jsx)(aV,{emptyLabel:"No explicit tools configured",items:e.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,d.jsx)(aV,{emptyLabel:"No runtime tool calls recovered yet",items:m,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,d.jsxs)(aQ,{icon:I.A,title:"Activity",value:`${i.length} live`,children:[(0,d.jsxs)("p",{children:[h.length," tracked runs across ",e.totalSessions," recorded sessions."]}),(0,d.jsx)("p",{children:j?`Latest update ${(0,x.fw)(j.updatedAt,c)}`:"No runtime activity has been recorded yet."}),h.length>0?(0,d.jsx)("div",{className:"space-y-2 pt-1",children:h.slice(0,3).map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,d.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[a.subtitle," \xb7 ",(0,x.m_)(a.runId||a.id,10)]})]}),(0,d.jsx)(aj,{variant:(0,x.Uu)(a.status),children:a.status})]},a.id))}):null,(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,d.jsx)("div",{className:"space-y-2",children:f.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:(0,x.CK)(a)}),(0,d.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.currentAction})]}),(0,d.jsx)(aj,{variant:"engaged"===a.status?"default":"offline"===a.status?"danger":"muted",children:a.status})]},a.id))})]})]}),(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(k.length),children:(0,d.jsx)(aS,{files:k,basePath:e.path,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function ar({snapshot:a,agentId:b,focusSection:c,onConfigureAgentCapabilities:e}){let f=(0,x.hv)(a.generatedAt),h=a.agents.find(a=>a.id===b),i=a.workspaces.find(a=>a.id===h?.workspaceId),j=a.models.find(a=>a.id===h?.modelId),k=(0,g.useRef)(null),l=(0,g.useRef)(null),m=(0,g.useRef)(null),n=h?.observedTools??[],o=h?.skills??[],p=(h?.tools??[]).filter(a=>"fs.workspaceOnly"!==a),q=h?.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[],t=h?(0,ah.Cf)(h.policy.preset):null,v=o.length>0?o:t?.skillIds??[],w=p.length>0?p:t?.tools??[],z=h?[{label:"Preset",value:(0,ah._P)(h.policy.preset)},{label:"Missing tools",value:(0,ah.zR)(h.policy.missingToolBehavior)},{label:"Install scope",value:(0,ah.UJ)(h.policy.installScope)},{label:"File access",value:(0,ah.bQ)(h.policy.fileAccess)},{label:"Network",value:(0,ah.Bw)(h.policy.networkAccess)}]:[],A=a.runtimes.filter(a=>h?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),[B,C]=(0,g.useState)(null),D=aZ(A.flatMap(aX)).slice(0,8);return h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:M.A,title:"Agent identity",value:h.id,children:[(0,d.jsx)("p",{children:(0,x.CK)(h)}),(0,d.jsx)("p",{children:h.identity.emoji?`${h.identity.emoji} \xb7 ${h.identity.theme??"theme unset"}`:"No identity emoji"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[h.isDefault?(0,d.jsx)(aj,{variant:"default",children:"default agent"}):null,(0,d.jsx)(aj,{variant:(0,ah.Cf)(h.policy.preset).badgeVariant,children:(0,ah._P)(h.policy.preset)}),h.identity.source?(0,d.jsx)(aj,{variant:"muted",children:h.identity.source}):null]})]}),(0,d.jsxs)(aQ,{icon:J.A,title:"Workspace",value:i?.name||"n/a",children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,x.$7)(h.workspacePath)}),(0,d.jsxs)("p",{children:[h.sessionCount," recorded sessions"]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Model assignment",value:j?.name||h.modelId,children:[(0,d.jsx)("p",{children:j?`${j.provider} \xb7 ${(0,x.FO)(j.contextWindow)} ctx`:"Model metadata unavailable"}),(0,d.jsx)("p",{children:j?.available===!1?"Currently unavailable":j?.local?"Local model route":"Remote model route"})]}),(0,d.jsx)(aQ,{icon:M.A,title:"Agent summary",value:(0,ah._P)(h.policy.preset),actions:(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{e?.(h.id,"tools"===c?"tools":"skills")},className:"h-7 rounded-full px-2.5 text-[11px]",children:[(0,d.jsx)(N.A,{className:"mr-1 h-3 w-3"}),"Edit"]}),children:(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"w-full",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Purpose"}),(0,d.jsx)("div",{className:"w-full rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:(0,d.jsx)("p",{className:"text-[13px] leading-5 text-slate-200",children:h.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."})})]}),(0,d.jsxs)("div",{ref:k,className:(0,y.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","skills"===c&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,d.jsxs)(aj,{variant:"muted",children:[v.length," active"]})]}),(0,d.jsx)(aV,{emptyLabel:"No skills available",items:v,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{ref:l,className:(0,y.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","tools"===c&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[q.length>0?(0,d.jsxs)(aj,{variant:"success",children:[(0,d.jsx)(O.A,{className:"mr-1 h-3 w-3"}),"policy locked"]}):null,(0,d.jsxs)(aj,{variant:"muted",children:[w.length," active"]})]})]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(aV,{emptyLabel:"No tools available",items:w,emptyVariant:"muted",itemVariant:"warning"}),q.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Policy locked"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:q.map(a=>(0,d.jsxs)(aj,{variant:"success",children:[(0,d.jsx)(O.A,{className:"mr-1 h-3 w-3"}),a]},a))}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-slate-500",children:"This capability is derived from the agent policy and cannot be removed here."})]}):null,n.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed"}),(0,d.jsx)(aV,{emptyLabel:"No runtime tool calls recovered yet",items:n,emptyVariant:"muted",itemVariant:"default"})]}):null]})]}),(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-3",children:[(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:t?.description??"No policy description available."}),(0,d.jsxs)("div",{className:"mt-3 grid gap-1.5 text-[13px] text-slate-300",children:[z.map(a=>(0,d.jsxs)("p",{children:[a.label,": ",(0,d.jsx)("span",{className:"text-white",children:a.value})]},a.label)),h.profile.outputPreference?(0,d.jsxs)("p",{children:["Output preference: ",(0,d.jsx)("span",{className:"text-white",children:h.profile.outputPreference})]}):null]})]})]})}),(0,d.jsxs)(aQ,{icon:L.A,title:"Runtime posture",value:h.status,children:[(0,d.jsx)("p",{children:h.currentAction}),(0,d.jsxs)("p",{children:["Last active ",(0,x.fw)(h.lastActiveAt,f)]}),(0,d.jsx)("p",{children:h.heartbeat.enabled?`Heartbeat ${h.heartbeat.every}`:"Heartbeat disabled"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(aj,{variant:h.heartbeat.enabled?"success":"muted",children:h.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof h.heartbeat.everyMs?(0,d.jsxs)(aj,{variant:"muted",children:[Math.round(h.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,d.jsx)("div",{ref:m,className:"scroll-mt-4",children:(0,d.jsxs)(aQ,{icon:I.A,title:"Activity history",value:String(A.length),className:(0,y.cn)("sessions"===c&&"border-cyan-300/25 bg-[linear-gradient(180deg,rgba(12,25,37,0.92),rgba(8,13,24,0.88))] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("p",{children:[h.sessionCount," recorded sessions overall."]}),(0,d.jsx)("p",{children:A.length>0?`${A.length} history item${1===A.length?"":"s"} recovered from the latest agent activity.`:"No linked runtime records were recovered for this agent in the current snapshot."}),h.sessionCount>A.length?(0,d.jsxs)("p",{className:"text-[12px] text-slate-500",children:[h.sessionCount-A.length," session",h.sessionCount-A.length==1?"":"s"," do not have recovered runtime data yet."]}):null,A.length>0?(0,d.jsx)("div",{className:"space-y-2.5 pt-1",children:A.map(a=>{var b,c;let e=B===a.id,g=function(a){switch(a){case"session":return"Direct chat";case"turn":return"Conversation";case"cron":return"Scheduled";default:return"Unknown source"}}(a.source),h=function(a){if(a.taskId)return"Task";switch(a.source){case"session":return"Chat";case"turn":return"Run";case"cron":return"Scheduled";default:return"Activity"}}(a),i=a.sessionId?`session ${(0,x.m_)(a.sessionId,10)}`:a.runId?`run ${(0,x.m_)(a.runId,10)}`:"session n/a",j="number"!=typeof(b=a.tokenUsage?.total)||Number.isNaN(b)?"0 Tokens":b>=1e3?`${Math.round(b/1e3)}K Tokens`:`${b} Tokens`,k="number"!=typeof(c=a.updatedAt)||Number.isNaN(c)?"No time":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(c));return(0,d.jsxs)("div",{className:(0,y.cn)("overflow-hidden rounded-[14px] border bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] transition-all",e?"border-cyan-300/22 shadow-[0_0_0_1px_rgba(34,211,238,0.08)]":"border-white/[0.08]"),children:[(0,d.jsxs)("button",{type:"button","aria-expanded":e,className:"nodrag nopan flex w-full flex-col gap-2 px-3 py-2.5 text-left transition-colors hover:bg-white/[0.03]",onClick:()=>{C(b=>b===a.id?null:a.id)},onPointerDown:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)(aj,{variant:(0,x.Uu)(a.status),children:a.status}),(0,d.jsx)(aj,{variant:a.tokenUsage?.total?"default":"muted",children:j})]}),(0,d.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,d.jsx)("p",{className:"line-clamp-2 text-[13px] leading-5 text-white",children:a.title}),(0,d.jsx)("p",{className:"line-clamp-2 text-[12px] leading-5 text-slate-300",children:a.subtitle})]}),(0,d.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[(0,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("p",{className:"truncate text-[9px] uppercase tracking-[0.18em] text-slate-500",children:[h," \xb7 ",i]})}),(0,d.jsx)("p",{className:"shrink-0 text-right text-[9px] uppercase tracking-[0.18em] text-slate-500",children:k})]})]}),(0,d.jsx)(r.N,{initial:!1,children:e?(0,d.jsx)(s.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18},className:"overflow-hidden border-t border-white/[0.08]",children:(0,d.jsxs)("div",{className:"space-y-3 px-3 py-3",children:[(0,d.jsx)(aT,{items:[{label:"Source",value:g},{label:"Status",value:a.status},{label:"Updated",value:(0,x.fw)(a.updatedAt,f)},{label:"Key",value:(0,x.m_)(a.key,12)}]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[a.sessionId?(0,d.jsxs)(aj,{variant:"muted",children:["session ",(0,x.m_)(a.sessionId,12)]}):null,a.runId?(0,d.jsxs)(aj,{variant:"muted",children:["run ",(0,x.m_)(a.runId,12)]}):null,a.taskId?(0,d.jsxs)(aj,{variant:"muted",children:["task ",(0,x.m_)(a.taskId,12)]}):null,a.modelId?(0,d.jsxs)(aj,{variant:"muted",children:["model ",(0,x.m_)(a.modelId,12)]}):null]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Preview"}),(0,d.jsx)("div",{className:"rounded-[12px] border border-white/[0.08] bg-white/[0.03] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a.subtitle})})]}),a.toolNames?.length?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,d.jsx)(aV,{emptyLabel:"No tool names recorded",items:a.toolNames,emptyVariant:"muted",itemVariant:"warning"})]}):null]})}):null})]},a.id)})}):null]})}),(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(D.length),children:(0,d.jsx)(aS,{files:D,basePath:h.workspacePath,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,d.jsxs)(aQ,{icon:M.A,title:"Capabilities",value:`${h.skills.length} skills`,children:[(0,d.jsx)(aV,{emptyLabel:"No explicit skills",items:h.skills,emptyVariant:"muted",itemVariant:"muted"}),(0,d.jsxs)("div",{className:"pt-1",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,d.jsx)(aV,{emptyLabel:"No explicit tools configured",items:h.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,d.jsxs)("div",{className:"pt-1",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,d.jsx)(aV,{emptyLabel:"No runtime tool calls recovered yet",items:n,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function as({snapshot:a,task:b,taskId:c,taskDetail:e,taskDetailLoading:f,taskDetailError:g,taskDetailNotice:h,onAbortTask:i,onControlComplete:j}){var k,l,m,n,o;let p,q=a.tasks.find(a=>a.id===c)??b,r=e?.task?(k=e.task,l=q,0===Object.keys(p=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(a=>[a,l.metadata[a]]).filter(([,a])=>void 0!==a))).length?k:{...k,metadata:{...k.metadata,...p}}):q,s=aI(r),t=e?.runs??a.runtimes.filter(a=>b?.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),u=ax(a,r,t),v=ay(a,r,t),w=a.agents.find(a=>a.id===r?.primaryAgentId),y=aZ(e?.createdFiles??t.flatMap(a=>aX(a))),z=e?.warnings??[];if(!b)return null;let A=e?.integrity??az(b),B=aB(r),C=("string"==typeof(m=r).metadata.routedMission?m.metadata.routedMission.trim():"")||aB(m),D=(n=B,o=C,aE(n)!==aE(o)),E=aC(r),F=aD(r.metadata.sessionCount,r.sessionIds.length),G=aD(r.metadata.turnCount,t.length),H=(e?.liveFeed??[]).filter(a=>aG(a)).sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)),M=function(a){for(let b of a)if("string"==typeof b.filePath&&"string"==typeof b.displayPath)return{path:b.filePath,displayPath:b.displayPath};return null}(H);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:J.A,title:"Mission",value:s?"aborted":r.status,children:[(0,d.jsx)(aR,{label:"Original prompt",text:B,basePath:u}),(0,d.jsx)(aR,{label:"Sent to OpenClaw",text:D?C:"Same as original prompt.",basePath:u,subtle:!D}),(0,d.jsx)(aR,{label:"Latest task output",text:E||"Waiting for the first OpenClaw update.",basePath:u,subtle:!E}),(0,d.jsx)(aT,{items:[{label:"Sessions",value:String(F)},{label:"Turns",value:String(G)},{label:"Runs",value:String(r.runtimeCount)},{label:"Files",value:String(r.artifactCount)},{label:"Live",value:String(r.liveRunCount)},{label:"Tools",value:String(A.toolNames.length)}]}),(0,d.jsx)(au,{task:r,onAbortTask:i,onControlComplete:j}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[v?(0,d.jsx)(aj,{variant:"muted",children:v.name}):null,w?(0,d.jsx)(aj,{variant:"default",children:(0,x.CK)(w)}):null,r.dispatchId?(0,d.jsxs)(aj,{variant:"muted",children:["dispatch ",(0,x.m_)(r.dispatchId,8)]}):null,s?(0,d.jsx)(aj,{variant:"danger",children:"aborted"}):null]}),f&&!e?(0,d.jsx)("p",{children:"Connecting live task feed…"}):null,g?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:g}):null,h?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:h}):null]}),(0,d.jsx)(at,{task:r,integrity:A,basePath:u,latestEvidenceAt:([...e?.liveFeed??[]].reverse().find(a=>"assistant"===a.kind||"tool"===a.kind||"artifact"===a.kind)??null)?.timestamp??null}),(0,d.jsxs)(aQ,{icon:I.A,title:"Runner logs",value:String(H.length),children:[M?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Log file"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:M.displayPath,className:"text-[12.5px] leading-5 text-slate-100",filePath:M.path,displayPath:M.displayPath,basePath:u})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:"Only meaningful runner diagnostics are shown here. OpenClaw bootstrap debug noise is hidden."})]}):null,0===H.length?(0,d.jsx)("p",{children:"No meaningful dispatch runner diagnostics have been captured for this task yet."}):(0,d.jsx)("div",{className:"max-h-[300px] space-y-2 overflow-y-auto pr-1",children:H.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"flex min-w-0 items-center gap-2",children:(0,d.jsx)(aj,{variant:a$(a.kind,a.isError),children:a.title})}),(0,d.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,x.fw)(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("pre",{className:"mt-2 whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-slate-100",children:a.detail})]},a.id))})]}),(0,d.jsxs)(aQ,{icon:I.A,title:"Runs",value:String(t.length),children:[0===t.length?(0,d.jsx)("p",{children:"No OpenClaw runs have been grouped into this task yet."}):null,(0,d.jsx)("div",{className:"space-y-2",children:t.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,d.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.subtitle})]}),(0,d.jsx)(aj,{variant:(0,x.Uu)(a.status),children:a.status})]},a.id))})]}),(0,d.jsx)(aQ,{icon:K.A,title:"Artifacts",value:String(y.length),children:(0,d.jsx)(aS,{files:y,basePath:u,emptyLabel:"This task has not produced a detectable file artifact yet."})}),z.length>0?(0,d.jsx)(aQ,{icon:L.A,title:"Warnings",value:String(z.length),children:(0,d.jsx)(aW,{items:z,emptyLabel:"No warnings detected."})}):null]})}function at({task:a,integrity:b,basePath:c,latestEvidenceAt:e}){let f=aI(a),g=!!a.metadata.optimistic&&!f&&"stalled"!==a.status,h=b.issues.find(a=>"missing-final-response"===a.id),i=b.issues.find(a=>"partial-final-response"===a.id),j=!!(b.finalResponseText||b.outputFileCount>0||b.transcriptTurnCount>0||b.matchingTranscriptTurnCount>0||b.toolNames.length>0),k=ad(a,{hasLiveActivity:"running"===a.status||"queued"===a.status||a.liveRunCount>0,latestEvidenceAt:e}),l=ac(a),m=ab(a),n=k?af(k):f?"This task was aborted by an operator. Captured evidence may be incomplete.":g?"OpenClaw accepted this task. Session, tool, and file evidence will appear here as soon as the first runtime reports in.":h?h.detail:i?i.detail:"verified"===b.status?"AgentOS found a matching transcript and the captured result looks internally consistent.":b.sessionMismatch?"The linked transcript belongs to a different mission or stale session, so this completion cannot be trusted yet.":b.issues.some(a=>"empty-output-dir"===a.id)?"The task is marked completed, but the expected deliverables are missing from the output folder.":"error"===b.status?"The captured evidence does not line up with the requested mission.":"AgentOS recovered partial evidence, but this result still needs operator review.";return(0,d.jsxs)(aQ,{icon:L.A,title:"Result integrity",value:k?ae(k):f?"aborted":i?"needs review":"stalled"!==a.status||b.finalResponseText?g?"pending":b.status:j?"needs review":"waiting output",children:[(0,d.jsx)("p",{children:n}),k?(0,d.jsxs)("div",{className:"rounded-[14px] border border-emerald-400/16 bg-emerald-400/[0.06] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-emerald-100/80",children:"Operator review"}),(0,d.jsxs)("p",{className:"mt-2 text-[12px] leading-5 text-emerald-50",children:[l||ae(k),m?` \xb7 ${(0,x.fw)(Date.parse(m))}`:""]})]}):null,(0,d.jsx)(aT,{items:[{label:"Output files",value:String(b.outputFileCount)},{label:"Transcript turns",value:String(b.transcriptTurnCount)},{label:"Matched turns",value:String(b.matchingTranscriptTurnCount)},{label:"Tools",value:String(b.toolNames.length)},{label:"Emails",value:String(b.emails.length)}]}),b.outputDir||b.outputDirRelative?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:b.outputDirRelative||b.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:b.outputDir,displayPath:b.outputDirRelative||b.outputDir,basePath:c})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:b.outputDirExists?`${b.outputFileCount} file${1===b.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsxs)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:["Final response ","none"!==b.finalResponseSource?`(${b.finalResponseSource})`:""]}),i?(0,d.jsx)("p",{className:"mt-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:i.detail}):null,(0,d.jsx)("div",{className:"mt-2",children:b.finalResponseText?(0,d.jsx)(Y,{text:b.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100",basePath:c}):(0,d.jsx)("p",{className:"text-[12.5px] leading-5 text-slate-400",children:"No final response was captured."})})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Recovered tools"}),b.toolNames.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:b.toolNames.map(a=>(0,d.jsx)(aj,{variant:"muted",children:a},a))}):(0,d.jsx)("p",{children:"No tool calls were recovered from a matching transcript turn."})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Detected emails"}),b.emails.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:b.emails.map(a=>(0,d.jsx)(aj,{variant:"muted",children:a},a))}):(0,d.jsx)("p",{children:"No email addresses were detected in the captured result."})]}),b.dispatchSessionId?(0,d.jsxs)("p",{className:"font-mono text-xs text-slate-400",children:["session ",(0,x.m_)(b.dispatchSessionId,12),b.sessionMismatch?" \xb7 mismatch detected":""]}):null,b.issues.length>0?(0,d.jsxs)("div",{className:"rounded-[14px] border border-amber-400/16 bg-amber-400/[0.06] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-amber-100/80",children:"Review issues"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(aW,{items:b.issues.map(a=>`${a.title}: ${a.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function au({task:a,onAbortTask:b,onControlComplete:c}){var e;let[f,h]=(0,g.useState)(null),[i,j]=(0,g.useState)(""),[k,l]=(0,g.useState)(null),m=aJ(e=a)||e.liveRunCount>0,n=!!b&&aJ(a),o=i.trim();if(!m)return null;let p=a=>{h(b=>b===a?null:a),j("")},q=async()=>{if(f&&o&&!k){l(f);try{let d=await fetch(`/api/tasks/${encodeURIComponent(a.id)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:f,message:o,dispatchId:a.dispatchId??null})}),e=await d.json().catch(()=>null);if(!d.ok){var b;throw Error(((b=e)&&"object"==typeof b?"string"==typeof b.error?b.error:"string"==typeof b.message?b.message:null:null)||"Unable to update the running task.")}Q.oR.success("steer"===f?"Steer request sent.":"Context added to session."),h(null),j(""),c?.()}catch(a){Q.oR.error("steer"===f?"Steer request failed.":"Context injection failed.",{description:a instanceof Error?a.message:"Unknown control error."})}finally{l(null)}}};return(0,d.jsxs)("div",{className:"rounded-[14px] border border-cyan-300/12 bg-cyan-400/[0.05] p-2.5",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)(u.$,{type:"button",variant:"destructive",size:"sm",disabled:!n,className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>{n&&b?.(a)},children:[(0,d.jsx)(P.A,{className:"h-3.5 w-3.5"}),"Stop"]}),(0,d.jsxs)(u.$,{type:"button",variant:"steer"===f?"default":"secondary",size:"sm",className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>p("steer"),children:[(0,d.jsx)(N.A,{className:"h-3.5 w-3.5"}),"Steer"]}),(0,d.jsxs)(u.$,{type:"button",variant:"inject"===f?"default":"secondary",size:"sm",className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>p("inject"),children:[(0,d.jsx)(H.A,{className:"h-3.5 w-3.5"}),"Add context"]})]}),f?(0,d.jsxs)("div",{className:"mt-2.5 space-y-2",children:[(0,d.jsx)(v.T,{value:i,disabled:!!k,rows:3,maxLength:4e3,placeholder:"steer"===f?"Focus on tests":"Inject this note/reference into the running session",className:"min-h-[76px] rounded-[12px] px-3 py-2 text-[12px] leading-5",onChange:a=>j(a.target.value)}),"steer"===f?(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ai.map(a=>(0,d.jsx)("button",{type:"button",disabled:!!k,className:"rounded-full border border-white/[0.08] bg-white/[0.04] px-2 py-1 text-[10px] text-slate-300 transition-colors hover:border-cyan-300/25 hover:text-cyan-50 disabled:cursor-not-allowed disabled:opacity-60",onClick:()=>j(a),children:a},a))}):null,(0,d.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,d.jsx)(u.$,{type:"button",variant:"ghost",size:"sm",disabled:!!k,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>{h(null),j("")},children:"Cancel"}),(0,d.jsx)(u.$,{type:"button",variant:"default",size:"sm",disabled:!o||!!k,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>void q(),children:k?"Sending...":"steer"===f?"Send steer":"Add context"})]})]}):null]})}function av({task:a,basePath:b,taskDetail:c,taskDetailLoading:e,taskDetailError:f,taskDetailNotice:g,onAbortTask:h,onControlComplete:i}){if(e&&!c)return(0,d.jsxs)(aQ,{icon:I.A,title:"Live feed",value:"connecting",children:[(0,d.jsx)(au,{task:a,onAbortTask:h,onControlComplete:i}),(0,d.jsx)("p",{children:"Connecting to the task feed…"})]});if(f&&!c)return(0,d.jsxs)(aQ,{icon:I.A,title:"Live feed",value:"error",children:[(0,d.jsx)(au,{task:a,onAbortTask:h,onControlComplete:i}),(0,d.jsx)("p",{children:f})]});let j=(function(...a){let b=new Map;for(let c of a.flat())b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))})(c?.liveFeed??[],aA(a.metadata.reviewEvents)).filter(a=>!aG(a)),k=c?.integrity??az(a);return(0,d.jsxs)(aQ,{icon:I.A,title:"Live feed",value:String(j.length),children:[(0,d.jsx)(au,{task:c?.task??a,onAbortTask:h,onControlComplete:i}),f?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:f}):null,g?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:g}):null,k.issues.length>0?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:k.issues[0]?.detail}):null,0===j.length?(0,d.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,d.jsx)("div",{className:"space-y-2",children:j.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)(aj,{variant:a$(a.kind,a.isError),children:a.kind}),(0,d.jsx)("p",{className:"truncate text-[12px] text-white",children:a.title})]}),(0,d.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,x.fw)(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:a.detail,className:"text-[12.5px] leading-5 text-slate-100",url:a.url,filePath:a.filePath,displayPath:a.displayPath,basePath:b})})]},a.id))})]})}function aw({snapshot:a,task:b,taskDetail:c}){let e=c?.runs??a.runtimes.filter(a=>b.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),f=aZ(c?.createdFiles??e.flatMap(a=>aX(a))),g=c?.integrity??az(b),h=ax(a,b,e);return(0,d.jsxs)(aQ,{icon:K.A,title:"Files",value:String(f.length),children:[(0,d.jsxs)("p",{children:[e.length," run",1===e.length?"":"s"," contributed to this task."]}),g.outputDir||g.outputDirRelative?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:g.outputDirRelative||g.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:g.outputDir,displayPath:g.outputDirRelative||g.outputDir,basePath:h})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:g.outputDirExists?`${g.outputFileCount} file${1===g.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,d.jsx)(aS,{files:f,basePath:h,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function ax(a,b,c=[]){return ay(a,b,c)?.path??function(a,b,c=[]){for(let d of[b.primaryAgentId,...c.map(a=>a.agentId)].filter(a=>"string"==typeof a&&a.trim().length>0)){let b=a.agents.find(a=>a.id===d)?.workspacePath;if(b)return b}}(a,b,c)}function ay(a,b,c=[]){for(let d of[b.workspaceId,...c.map(a=>a.workspaceId),b.primaryAgentId?a.agents.find(a=>a.id===b.primaryAgentId)?.workspaceId:void 0,...c.map(b=>b.agentId?a.agents.find(a=>a.id===b.agentId)?.workspaceId:void 0)].filter(a=>"string"==typeof a&&a.trim().length>0)){let b=a.workspaces.find(a=>a.id===d);if(b)return b}return null}function az(a){var b,c;let d,e,f,g=!!a.metadata.optimistic&&!aI(a)&&"stalled"!==a.status,h=(d="string"==typeof(b=a).metadata.finalResponseText?b.metadata.finalResponseText.trim():"",e="string"==typeof b.metadata.resultPreview?b.metadata.resultPreview.trim():"",!!((f=d||e)&&!(aH(c=f)||/waiting for (the first )?(transcript|output)/i.test(c)||/working silently/i.test(c)))),i=aI(a)?[{id:"task-cancelled",severity:"warning",title:"Task was cancelled by the operator",detail:"The mission dispatch was stopped before completion, so the captured evidence is intentionally incomplete."}]:"stalled"===a.status?[{id:h?"partial-final-response":"stalled-dispatch",severity:"warning",title:h?"Final response came from an incomplete runtime":"Waiting for output evidence",detail:h?"The assistant produced output, but the runtime stalled before the task completed. Treat this as the last captured response, not a verified completion.":aH(a.subtitle)?"AgentOS is still waiting for the first transcript entry from this runtime.":a.subtitle}]:[];return{status:i.some(a=>"error"===a.severity)?"error":g||i.length>0?"warning":"verified",outputDir:"string"==typeof a.metadata.outputDir&&a.metadata.outputDir.trim().length>0?a.metadata.outputDir:null,outputDirRelative:"string"==typeof a.metadata.outputDirRelative&&a.metadata.outputDirRelative.trim().length>0?a.metadata.outputDirRelative:null,outputDirExists:!1,outputFileCount:0,transcriptTurnCount:0,matchingTranscriptTurnCount:0,finalResponseText:h?aC(a):null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:i}}function aA(a){return Array.isArray(a)?a.filter(aF):[]}function aB(a){return a.mission?.trim()||a.title.trim()||"Untitled task"}function aC(a){return("string"==typeof a.metadata.resultPreview?a.metadata.resultPreview.trim():"")||a.subtitle.trim()||""}function aD(a,b){return"number"==typeof a&&Number.isFinite(a)?a:b}function aE(a){return a.replace(/\s+/g," ").trim()}function aF(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function aG(a){return a.id.startsWith("runner-log:")}function aH(a){return"string"==typeof a&&(/No transcript file was found for this runtime session/i.test(a)||/No transcript entries were found for this runtime/i.test(a))}function aI(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}function aJ(a){if(aI(a))return!1;let b=a.status;return"running"===b||"queued"===b}function aK({snapshot:a,runtimeId:b,runtimeOutput:c,runtimeOutputLoading:e,runtimeOutputError:f}){let g=(0,x.hv)(a.generatedAt),h=a.runtimes.find(a=>a.id===b),i=aZ(c?.createdFiles??(h?aX(h):[])),j=c?.warnings??(h?aY(h):[]),k=c?.warningSummary??j[0]??null,l=h?a.workspaces.find(a=>a.id===h.workspaceId)?.path:void 0;return h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:I.A,title:"Runtime key",value:h.status,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:h.key}),(0,d.jsxs)("p",{children:["Session ",(0,x.m_)(h.sessionId,12)]}),h.taskId?(0,d.jsxs)("p",{children:["Task ",(0,x.m_)(h.taskId,12)]}):null,h.runId?(0,d.jsxs)("p",{children:["Run ",(0,x.m_)(h.runId,12)]}):null]}),(0,d.jsxs)(aQ,{icon:L.A,title:"Activity",value:(0,x.fw)(h.updatedAt,g),children:[(0,d.jsx)("p",{children:h.subtitle}),(0,d.jsxs)("p",{children:[(0,x._y)(h.tokenUsage?.total)," tokens"]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Latest output",value:c?.stopReason||(e?"loading":"no transcript"),children:[e?(0,d.jsx)("p",{children:"Loading transcript output…"}):null,f?(0,d.jsx)("p",{children:f}):null,e||f?null:(0,d.jsx)(Y,{text:c?.finalText||c?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100",basePath:l}),k?(0,d.jsxs)("p",{className:"mt-3 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:["Fallback used: ",k]}):null,c?.finalTimestamp?(0,d.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",(0,x.fw)(new Date(c.finalTimestamp).getTime())]}):null]}),(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(i.length),children:(0,d.jsx)(aS,{files:i,basePath:a.workspaces.find(a=>a.id===h.workspaceId)?.path,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function aL({runtime:a,runtimeOutput:b}){let c=aZ(b?.createdFiles??aX(a));return(0,d.jsxs)(aQ,{icon:K.A,title:"Files",value:String(c.length),children:[(0,d.jsx)("p",{children:a.title}),(0,d.jsx)(aS,{files:c,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function aM({runtime:a,basePath:b,runtimeOutput:c,runtimeOutputLoading:e,runtimeOutputError:f}){if(e)return(0,d.jsx)(aQ,{icon:I.A,title:"Runtime output",value:"loading",children:(0,d.jsxs)("p",{children:["Loading transcript output for ",a.title,"…"]})});if(f)return(0,d.jsx)(aQ,{icon:I.A,title:"Runtime output",value:"error",children:(0,d.jsx)("p",{children:f})});if(!c)return(0,d.jsx)(aQ,{icon:I.A,title:"Runtime output",value:"missing",children:(0,d.jsx)("p",{children:"No transcript data is available for this runtime."})});let g=aZ(c.createdFiles);return(0,d.jsxs)("div",{className:"space-y-3.5",children:[c.warningSummary?(0,d.jsx)(aQ,{icon:L.A,title:"Warnings",value:String(c.warnings.length),children:(0,d.jsx)("p",{children:c.warningSummary})}):null,(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(g.length),children:(0,d.jsx)(aS,{files:g,basePath:b,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,d.jsxs)(aQ,{icon:I.A,title:"Final response",value:"stalled"===a.status||"cancelled"===a.status?"stalled"===a.status?"stalled":a.status:c.stopReason||c.status,children:["stalled"===a.status||"cancelled"===a.status?(0,d.jsx)("p",{className:"mb-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:"stalled"===a.status?"This runtime is quiet or waiting for transcript output. AgentOS will keep watching for the first assistant update.":"This runtime was cancelled. The text below is the last captured assistant output, not a verified completion."}):null,c.errorMessage&&!aH(c.errorMessage)?(0,d.jsx)("p",{className:"mb-2 rounded-[12px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-[12px] leading-5 text-rose-100",children:c.errorMessage}):null,(0,d.jsx)(Y,{text:c.finalText||(c.errorMessage&&!aH(c.errorMessage)?c.errorMessage:"Waiting for the first assistant output from this runtime."),className:"text-[13px] leading-5 text-slate-100",basePath:b}),c.finalTimestamp?(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(c.finalTimestamp).toLocaleString()}):null]}),(0,d.jsxs)(aQ,{icon:L.A,title:"Transcript trail",value:String(c.items.length),children:[0===c.items.length?(0,d.jsx)("p",{children:"Waiting for the first transcript entry."}):null,(0,d.jsx)("div",{className:"space-y-2",children:c.items.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(aj,{variant:"assistant"===a.role?a.isError?"danger":"default":"toolResult"===a.role?"warning":"muted",children:a.role}),a.toolName?(0,d.jsx)(aj,{variant:"muted",children:a.toolName}):null]}),(0,d.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,x.fw)(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:a.text,className:"text-[12.5px] leading-5 text-slate-100",basePath:b})})]},a.id))})]})]})}function aN({snapshot:a,modelId:b}){let c=a.models.find(a=>a.id===b);return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:M.A,title:"Model routing",value:c.provider,children:[(0,d.jsx)("p",{children:c.name}),(0,d.jsx)("p",{children:c.local?"Local model":"Remote model"})]}),(0,d.jsxs)(aQ,{icon:L.A,title:"Capacity",value:`${(0,x.FO)(c.contextWindow)} ctx`,children:[(0,d.jsx)("p",{children:c.input}),(0,d.jsx)("p",{children:!1===c.available?"Unavailable":"Available"}),(0,d.jsxs)("p",{children:[c.usageCount," attached agents"]})]})]}):null}function aO({icon:a,label:b,active:c,surfaceTheme:e,panelCollapsed:f,tooltipSide:g,disabled:h=!1,onClick:i}){return(0,d.jsx)(_.A,{label:b,side:g,surfaceTheme:e,panelCollapsed:f,children:(0,d.jsx)("button",{type:"button","aria-label":b,"aria-disabled":h,tabIndex:h?-1:0,onClick:i,className:(0,y.cn)("inline-flex h-8 w-8 items-center justify-center rounded-[8px] border transition-all",h?"border-white/5 bg-white/[0.02] text-slate-600":c?"border-cyan-300/18 bg-cyan-400 text-slate-950 shadow-[0_10px_22px_rgba(96,165,250,0.28)]":"border-white/10 bg-white/[0.03] text-slate-400 hover:border-white/15 hover:bg-white/[0.08] hover:text-white"),children:(0,d.jsx)(a,{className:"h-3 w-3"})})})}function aP({label:a,active:b,onClick:c}){return(0,d.jsx)("button",{type:"button",onClick:c,className:(0,y.cn)("inline-flex items-center rounded-full border px-2.5 py-1.5 text-[10px] uppercase tracking-[0.14em] whitespace-nowrap transition-all",b?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_10px_24px_rgba(96,165,250,0.28)]":"border-white/[0.08] bg-white/[0.03] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:a})}function aQ({icon:a,title:b,value:c,actions:e,children:f,className:g}){return(0,d.jsxs)("section",{className:(0,y.cn)("rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(12,19,34,0.86),rgba(8,13,24,0.82))] p-3 transition-all",g),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:b}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("p",{className:"min-w-0 font-display text-[1rem] text-white",children:c}),e?(0,d.jsx)("div",{className:"shrink-0",children:e}):null]})]}),(0,d.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/5 p-2 text-slate-300",children:(0,d.jsx)(a,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("div",{className:"mt-3 space-y-1.5 text-[12.5px] leading-5 text-slate-300",children:f})]})}function aR({label:a,text:b,basePath:c,subtle:e=!1}){return(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:b,className:(0,y.cn)("text-[12.5px] leading-5",e?"text-slate-400":"text-slate-100"),basePath:c})})]})}function aS({files:a,basePath:b,emptyLabel:c}){let e=aZ(a??[]);return 0===e.length?(0,d.jsx)("p",{className:"text-[12px] text-slate-400",children:c}):(0,d.jsx)("div",{className:"space-y-2",children:e.map(a=>{var c;let e="string"==typeof(c=a.path)&&(c.startsWith("/")||/^[A-Za-z]:[\\/]/.test(c))||!!b;return(0,d.jsx)("button",{type:"button",disabled:!e,onClick:()=>void a_(a.path,b),className:(0,y.cn)("w-full rounded-[14px] border border-cyan-300/12 bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2 text-left transition-all",e?"hover:border-cyan-300/28 hover:bg-cyan-400/[0.08]":"cursor-not-allowed opacity-60"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-mono text-[12px] text-cyan-100",children:a.displayPath}),(0,d.jsx)("p",{className:"truncate text-[11px] text-slate-400",children:(0,x.$7)(a.path)})]}),(0,d.jsx)(aj,{variant:"muted",children:e?"reveal":"relative"})]})},a.path)})})}function aT({items:a}){return(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2",children:a.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.label}),(0,d.jsx)("p",{className:"mt-1 text-[13px] text-white",children:a.value})]},a.label))})}function aU({items:a,missingVariant:b="muted"}){return(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,d.jsx)(aj,{variant:a.present?"success":b,children:a.label},a.id))})}function aV({items:a,emptyLabel:b,itemVariant:c,emptyVariant:e}){return 0===a.length?(0,d.jsx)(aj,{variant:e,children:b}):(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,d.jsx)(aj,{variant:c,children:a},a))})}function aW({items:a,emptyLabel:b}){return 0===a.length?(0,d.jsx)("p",{className:"text-[12px] text-slate-400",children:b}):(0,d.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,d.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a})},a))})}function aX(a){let b=a.metadata.createdFiles;return Array.isArray(b)?b.flatMap(a=>{if(!a||"object"!=typeof a)return[];let b="path"in a&&"string"==typeof a.path?a.path:null,c="displayPath"in a&&"string"==typeof a.displayPath?a.displayPath:b;return b&&c?[{path:b,displayPath:c}]:[]}):[]}function aY(a){let b=a.metadata.warnings;return Array.isArray(b)?b.filter(a=>"string"==typeof a&&a.trim().length>0):[]}function aZ(a){let b=new Set,c=[];for(let d of Array.isArray(a)?a:[]){let a="string"==typeof d?.path?d.path.trim():"",e="string"==typeof d?.displayPath&&d.displayPath.trim().length>0?d.displayPath.trim():a;!a||b.has(a)||(b.add(a),c.push({path:a,displayPath:e}))}return c}function a$(a,b){if(b)return"danger";switch(a){case"assistant":return"default";case"tool":case"warning":return"warning";case"artifact":return"success";default:return"muted"}}async function a_(a,b){try{let c=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,basePath:b??null})}),d=await c.json();if(!c.ok)throw Error(d.error||"Unable to reveal file.");Q.oR.success("Revealed file.",{description:(0,x.$7)(a)})}catch(a){Q.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}var a0=c(33506),a1=c(67882),a2=c(37674),a3=c(23446),a4=c(58372);function a5({snapshot:a,surfaceTheme:b,isInspectorOpen:c,taskAbortRequest:e,taskAbortRunState:f,taskAbortMessage:h,onTaskAbortOpenChange:i,onTaskAbortConfirm:j,updateDialogOpen:l,updateRunState:m,updateStatusMessage:n,updateResultMessage:o,updateLog:p,updateManualCommand:q,activeRuntimeCount:r,updateInstallSummary:s,onUpdateDialogOpenChange:t,onRunOpenClawUpdate:v}){let w="running"===m,x="success"===m||"error"===m,z=(0,a3.Ku)(m),A=(0,a3.SG)(m),[B,C]=(0,g.useState)(!1),D=(0,a4.T)(q),E=async()=>{if(q)try{await navigator.clipboard.writeText(q),Q.oR.success("Command copied.",{description:"Open Terminal and paste it."})}catch(a){Q.oR.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},F=async()=>{if(q&&D){C(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:q})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");Q.oR.success("Terminal opened.",{description:"Confirm the update there, then return to AgentOS."})}catch(a){Q.oR.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{C(!1)}}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a2.lG,{open:null!==e,onOpenChange:a=>{"running"!==f&&i(a)},children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("max-w-[480px] gap-5 p-5 sm:p-6","light"===b?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,d.jsxs)(a2.c7,{children:[(0,d.jsx)(a2.L3,{className:"light"===b?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,d.jsx)(a2.rr,{className:"light"===b?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),e?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#4f3d31]":"border-rose-400/20 bg-rose-400/10 text-rose-50"),children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:"Selected task"}),(0,d.jsx)("p",{className:"mt-2 font-display text-[1.02rem] leading-6 text-inherit",children:e.title}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-sm leading-6","light"===b?"text-[#8b7262]":"text-rose-100/80"),children:e.subtitle}),h?(0,d.jsx)("p",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-sm text-rose-50",children:h}):null]}):null,(0,d.jsxs)(a2.Es,{children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",disabled:"running"===f,className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==f&&i(!1)},children:"Cancel"}),(0,d.jsx)(u.$,{type:"button",variant:"destructive",disabled:!e||"running"===f,onClick:()=>{j()},children:"running"===f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),c?null:(0,d.jsxs)("div",{className:(0,y.cn)("pointer-events-auto absolute bottom-3 right-[74px] z-30 text-[11px] tracking-[0.04em] lg:bottom-4","light"===b?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,d.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:(0,y.cn)("transition-colors","light"===b?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"OpenClaw"})," ","by"," ",(0,d.jsx)("a",{href:"https://sapienx.app/",target:"_blank",rel:"noreferrer",className:(0,y.cn)("transition-colors","light"===b?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,d.jsx)(a2.lG,{open:l,onOpenChange:a=>{w||t(a)},children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("max-h-[calc(100vh-48px)] max-w-[468px] gap-5 overflow-y-auto p-5 sm:p-6","light"===b?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,d.jsxs)(a2.c7,{children:[(0,d.jsx)(a2.L3,{className:"light"===b?"text-[#3f2f24]":"text-white",children:z}),(0,d.jsx)(a2.rr,{className:"light"===b?"text-[#7e6555]":"text-slate-400",children:A})]}),x?(0,d.jsxs)("div",{className:(0,y.cn)("space-y-4","light"===b?"text-[#4f3d31]":"text-slate-200"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[24px] border px-4 py-5",(0,a3.CP)(m,b)),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:(0,y.cn)("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(0,a3.to)(m,b)),children:"success"===m?(0,d.jsx)(a0.A,{className:"h-5 w-5"}):(0,d.jsx)(P.A,{className:"h-5 w-5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"font-display text-[1.05rem] leading-6",children:"success"===m?"OpenClaw is up to date":"Update needs attention"}),(0,d.jsx)("p",{className:"mt-1 text-sm leading-6",children:o||("success"===m?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Installed version"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",a.diagnostics.version||a.diagnostics.latestVersion||"unknown"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Latest reported"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",a.diagnostics.latestVersion||a.diagnostics.version||"unknown"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Detected install"}),(0,d.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:s.label}),(0,d.jsx)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:s.detail})]})]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center justify-between border-b px-4 py-3","light"===b?"border-[#eadccf]":"border-white/8"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,d.jsx)("span",{className:"light"===b?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===m?"Completed":"Failed"})]}),(0,d.jsx)("pre",{className:(0,y.cn)("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:p||"No command output was captured."})]}),q?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-3","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:D?"Terminal":"Manual"}),D?(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-sm leading-6","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to confirm the update."}):null,(0,d.jsx)("p",{className:(0,y.cn)("mt-2 break-all font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:q}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{E()},className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),D?(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{F()},disabled:B,className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:B?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]})]}):null]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:(0,y.cn)("grid gap-3 sm:grid-cols-2","light"===b?"text-[#4f3d31]":"text-slate-200"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Version target"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-[1.1rem] leading-6 text-inherit",children:["v",a.diagnostics.latestVersion||a.diagnostics.version||"unknown"]}),(0,d.jsxs)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",a.diagnostics.version||"unknown"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Detected install"}),(0,d.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:s.label}),(0,d.jsx)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:s.detail})]})]}),(0,d.jsx)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-3 text-sm",r>0?"light"===b?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:r>0?`${r} running or queued runtime${1===r?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),w?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center gap-3 border-b px-4 py-3","light"===b?"border-[#eadccf]":"border-white/8"),children:[(0,d.jsx)("div",{className:(0,y.cn)("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"light"===b?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,d.jsx)("p",{className:"light"===b?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:n||"Streaming OpenClaw output..."})]})]}),(0,d.jsx)("pre",{className:(0,y.cn)("max-h-[180px] min-h-[120px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:p||"Waiting for command output..."})]}):null]}),(0,d.jsxs)(a2.Es,{children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",onClick:()=>{t(!1)},className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:w?"Run in background":x?"Done":"Cancel"}),x?null:(0,d.jsx)(u.$,{type:"button",onClick:v,disabled:w,className:(0,y.cn)(a.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==b||a.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:w?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})}var a6=c(29075),a7=c(59418),a8=c(67897),a9=c(72349),ba=c(52188),bb=c(60557);function bc(a,b){return b?a:"system"}function bd(a,b,c,d,e,f,g,h){return"cli"===a?!h&&b.diagnostics.installed?`Installed${b.diagnostics.version?` \xb7 v${b.diagnostics.version}`:""}`:"installing-cli"===c?"Installing the CLI and local wrapper.":"detecting"===c||h||!b.diagnostics.installed?"Checking whether the CLI is already installed.":"Install the OpenClaw CLI.":"gateway"===a?!h&&b.diagnostics.loaded?"Gateway is already registered.":"installing-gateway"===c?"Registering the gateway service.":"starting-gateway"===c?"Starting the gateway service.":"detecting"===c&&d?"Checking gateway registration.":f||"verifying"===c?"Gateway is up and waiting on RPC.":!h&&b.diagnostics.rpcOk?"Gateway is running directly.":"Register the gateway service once.":g?"RPC, state, and session store are ready.":"verifying"===c?"Verifying RPC, state writes, and session store access.":"starting-gateway"===c?"Starting the gateway and waiting for RPC.":e?"Gateway is up; verify RPC and runtime state.":f?"RPC is online; final runtime checks continue.":"Start the gateway and verify RPC."}function be(a,b){if(!a.trim())return null;let c=b.find(b=>b.id===a);return c?.name||(0,x.JZ)(a)}function bf(a,b){return a?"complete":b?"current":"pending"}function bg(a){return"light"===a?"border-[#b89374] bg-[#ecd4c1] text-[#4a3426] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e4c6af] hover:text-[#38261b]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.1]"}function bh(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"ChatGPT":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":"xai"===b?"xAI":"google"===b||"gemini"===b?"Gemini":"deepseek"===b?"DeepSeek":"mistral"===b?"Mistral":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function bi(a){let b=a?.trim();if(!b)return null;let[c]=b.split("/",1);return c||null}function bj(a,b){let c=b?.trim()??"",d=bi(b);return d?"openai"===d&&bk(a,c)?"openai-codex":(0,bb.a3)(d)?d:null:null}function bk(a,b){if(!(0,ba.jw)(b))return!1;let c=a.diagnostics.modelReadiness.authProviders,d=c.find(a=>"openai-codex"===a.provider),e=c.find(a=>"openai"===a.provider);return!!d?.connected||"openai-codex"===a.diagnostics.modelReadiness.preferredLoginProvider||!!(d?.canLogin&&!e?.connected)}function bl(a,b){return"complete"===a?"light"===b?"border-emerald-200 bg-emerald-50/60":"border-emerald-400/20 bg-emerald-400/8":"current"===a?"light"===b?"border-[#d9c2b3] bg-white/70":"border-white/12 bg-white/[0.05]":"light"===b?"border-[#eadcd0] bg-[#fffaf6]/80":"border-white/6 bg-white/[0.02]"}function bm(a,b){return"complete"===a?"light"===b?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-white/12 bg-white/[0.06] text-white":"light"===b?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400"}function bn(a,b){return"complete"===a?"light"===b?"bg-emerald-100 text-emerald-700":"bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"bg-[#efe1d4] text-[#876c5a]":"bg-white/[0.06] text-slate-300":"light"===b?"bg-[#f6ece4] text-[#a08471]":"bg-white/[0.04] text-slate-500"}var bo=c(34474),bp=c(14847),bq=c(45100),br=c(49444),bs=c(89478),bt=c(68885);function bu({snapshot:a,selectedModelId:b,onSelectedModelIdChange:c,onOpenAddModels:e,onSnapshotChange:h,autoDiscover:i=!0}){let[j,l]=(0,g.useState)(()=>(function(a,b){let c=bj(a,b);if(c)return c;let d=a.diagnostics.modelReadiness.authProviders.find(a=>a.connected&&(0,bb.a3)(a.provider))?.provider;if(d)return d;let e=a.diagnostics.modelReadiness.preferredLoginProvider;if((0,bb.a3)(e))return e;let f=bi(a.diagnostics.modelReadiness.recommendedModelId);return(0,bb.a3)(f)?f:"openrouter"})(a,b)),[m,n]=(0,g.useState)({}),[o,p]=(0,g.useState)(!1),q=(0,g.useMemo)(()=>Object.values(m).flatMap(a=>a?.models??[]),[m]),r=(0,g.useMemo)(()=>(function(a,b,c=[]){let d=b?.trim();if(!d)return null;let e=c.find(a=>a.id===d&&(0,bb.a3)(a.provider))?.provider;if((0,bb.a3)(e))return e;let f=a.models.find(a=>a.id===d&&(0,bb.a3)(a.provider))?.provider;return(0,bb.a3)(f)?"openai"===f&&bk(a,d)?"openai-codex":f:bj(a,d)})(a,b,q),[q,b,a]),s=(0,bb.W2)(j),t=bw(m[j]),v=t.connection??bx(a,j),x=(0,g.useMemo)(()=>a.models.filter(a=>by(j,a.id,a.provider)&&!1!==a.available&&!a.missing).map(b=>({id:b.id,name:b.name,provider:b.provider,input:b.input,contextWindow:b.contextWindow,local:!!b.local,available:!1!==b.available,missing:b.missing,alreadyAdded:!0,recommended:b.id===a.diagnostics.modelReadiness.recommendedModelId||b.id===a.diagnostics.modelReadiness.resolvedDefaultModel||b.id===a.diagnostics.modelReadiness.defaultModel,supportsTools:b.tags.includes("tools"),isFree:b.tags.includes("free"),tags:b.tags})),[j,a.diagnostics.modelReadiness.defaultModel,a.diagnostics.modelReadiness.recommendedModelId,a.diagnostics.modelReadiness.resolvedDefaultModel,a.models]),z=t.models.length>0?t.models:x,A=(0,g.useMemo)(()=>{let a=t.search.trim().toLowerCase();return z.slice().sort((a,b)=>{let c=Number(b.recommended)+Number(b.isFree)+Number(b.supportsTools),d=Number(a.recommended)+Number(a.isFree)+Number(a.supportsTools);return c!==d?c-d:a.name.localeCompare(b.name)}).filter(b=>!a||`${b.name} ${b.id} ${b.tags.join(" ")}`.toLowerCase().includes(a))},[z,t.search]),B=a.models.find(a=>a.id===b)?.name||A.find(a=>a.id===b)?.name||b.trim()||null,C="connecting"===t.flowState||"discovering"===t.flowState||t.statusMessage?.startsWith("Checking ")===!0&&!v.connected,D="discovering"===t.flowState?`Discovering ${s.shortLabel} models...`:"connecting"===t.flowState?t.statusMessage||`Connecting ${s.shortLabel}...`:t.statusMessage||`Checking ${s.shortLabel}...`,E=A.length>6||!!s.searchPlaceholder,F=v.connected||A.length>0||!!t.emptyState;function G(a,b){n(c=>({...c,[a]:{...bw(c[a]),...b}}))}function H(a,b,c,d){G(a,{flowState:c,connection:b.connection,statusMessage:b.message,errorMessage:null,emptyState:b.emptyState??null,manualCommand:b.manualCommand??null,docsUrl:b.docsUrl??null,models:b.models,loaded:!0,...d})}async function J(a){let b=(0,bs.oZ)(a);G(a,{flowState:"idle",errorMessage:null,statusMessage:`Checking ${bh(a)}...`});try{let c=await b.getConnectionStatus(),d=c.connection.connected&&i&&!N(a);H(a,c,d?"discovering":"idle"),M(c),d&&await L(a,!0)}catch(b){G(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider status could not be loaded.",loaded:!0})}}async function K(a,b){let c=(0,bs.oZ)(a),d=bw(m[a]);G(a,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===a?b?.force?"Refreshing Codex app-server setup...":"Checking Codex app-server setup...":`Connecting ${(0,bb.W2)(a).shortLabel}...`});try{let e=await c.connect({apiKey:d.apiKey,force:b?.force}),f=e.connection.connected&&!e.manualCommand&&!N(a);H(a,e,f?"discovering":"idle",{apiKey:""}),M(e),f&&await L(a,!0)}catch(b){G(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider connection failed."})}}async function L(a,b=!1){let c=(0,bs.oZ)(a),d=bw(m[a]);if(b||"discovering"!==d.flowState){G(a,{flowState:"discovering",errorMessage:null,statusMessage:"ollama"===a?"Checking the local Ollama runtime...":`Discovering ${(0,bb.W2)(a).shortLabel} models...`});try{let b=await c.discoverModels();H(a,b,b.models.length>0?"ready":"idle",{search:d.search}),M(b)}catch(b){G(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider discovery failed."})}}}function M(a){a.snapshot&&h?.(a.snapshot)}function N(b){return a.models.some(a=>by(b,a.id,a.provider)&&!1!==a.available&&!a.missing)}async function O(a){try{await navigator.clipboard.writeText(a),w.o.success("Copied.",{description:"Command copied to your clipboard."})}catch(a){w.o.error("Copy failed.",{description:a instanceof Error?a.message:"Clipboard access is not available."})}}async function P(a){if(!(0,a4.T)(a))return void await O(a);p(!0);try{let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a})}),c=await b.json().catch(()=>null);if(!b.ok||c?.error)throw Error(c?.error||"Unable to open Terminal.");w.o.success("Terminal opened.",{description:"Finish auth there, then refresh this provider."})}catch(a){w.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{p(!1)}}return(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-3 py-3","border-white/8 bg-[rgba(255,255,255,0.03)]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("p",{className:"whitespace-nowrap text-[8px] font-medium text-slate-500",children:["Provider first : ",bb.y8.length," providers"]})}),(0,d.jsx)("div",{className:"flex shrink-0 flex-wrap gap-1.5",children:B?(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):null})]}),(0,d.jsx)("div",{className:"mt-3 flex snap-x snap-mandatory flex-nowrap gap-2 overflow-x-auto overflow-y-hidden pb-2 pr-1",children:bb.y8.map(b=>{let e=bw(m[b.id]).connection??bx(a,b.id);return(0,d.jsx)("div",{className:"w-[128px] shrink-0 snap-start sm:w-[136px]",children:(0,d.jsx)(bq.I,{descriptor:b,active:j===b.id,compact:!0,micro:!0,connected:e.connected,detail:e.detail,onClick:()=>{l(b.id),r&&r!==b.id&&c("")}})},b.id)})}),(0,d.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:s.label})}),(0,d.jsx)(ag.E,{variant:v.connected?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:v.connected?"Connected":"Not connected"})]}),t.statusMessage&&!C?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[11px] text-slate-200",children:t.statusMessage})}):null,t.errorMessage?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/[0.08] px-3 py-2 text-[11px] text-rose-100",children:t.errorMessage}):null,"apiKey"!==s.connectKind||v.connected||0!==A.length||C?null:(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap items-end gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("label",{className:"block text-[9px] uppercase tracking-[0.16em] text-slate-500",children:"API key"}),(0,d.jsx)(br.p,{type:"password",value:t.apiKey,onChange:a=>G(j,{apiKey:a.target.value}),placeholder:"openrouter"===j?"sk-or-v1-...":"Paste API key",className:"mt-1.5 h-8 text-[11px]"})]}),(0,d.jsx)(u.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===t.flowState||!t.apiKey.trim(),onClick:()=>{K(j)},children:"connecting"===t.flowState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]}):`Connect ${s.shortLabel}`})]}),"apiKey"===s.connectKind&&t.manualCommand&&!C?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,d.jsx)("p",{className:"mt-1 max-w-[460px] text-[10px] leading-[0.98rem] text-cyan-100/80",children:"Open Terminal, paste the provider API key there, then come back and refresh this provider."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:o,onClick:()=>{P(t.manualCommand||"")},children:o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{O(t.manualCommand||"")},children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{J(j)},children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:t.manualCommand})})]}):null,C?(0,d.jsxs)("div",{className:"relative mt-4 flex min-h-[280px] items-center justify-center overflow-hidden rounded-[28px] border border-cyan-300/20 bg-[radial-gradient(circle_at_top,rgba(34,211,238,0.16),rgba(8,15,28,0.98)_70%)] px-4 py-10 text-center shadow-[0_22px_52px_rgba(7,11,20,0.32)]",children:[(0,d.jsx)("div",{className:"absolute inset-x-8 top-8 h-px bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent blur-sm animate-pulse"}),(0,d.jsx)("div",{className:"absolute inset-x-8 bottom-8 h-px bg-gradient-to-r from-transparent via-cyan-200/30 to-transparent blur-sm animate-pulse [animation-delay:180ms]"}),(0,d.jsx)("div",{className:"absolute left-8 top-8 h-24 w-24 rounded-full border border-cyan-300/15 bg-cyan-300/[0.04] blur-[1px] animate-pulse"}),(0,d.jsx)("div",{className:"absolute right-10 top-14 h-16 w-16 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:120ms]"}),(0,d.jsx)("div",{className:"absolute bottom-10 left-1/2 h-20 w-20 -translate-x-1/2 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:240ms]"}),(0,d.jsxs)("div",{className:"relative flex max-w-[340px] flex-col items-center",children:[(0,d.jsx)("div",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-full border border-cyan-300/20 bg-cyan-300/[0.08] shadow-[0_0_0_8px_rgba(34,211,238,0.05)]",children:(0,d.jsx)(k.A,{className:"h-8 w-8 animate-spin text-cyan-200"})}),(0,d.jsx)("p",{className:"font-display text-[1.1rem] leading-[1.2rem] tracking-[0.01em] text-white",children:D}),(0,d.jsx)("p",{className:"mt-2 max-w-[280px] text-[11px] leading-[1rem] text-slate-400",children:"discovering"===t.flowState?"Pulling the provider catalog into AgentOS.":"connecting"===t.flowState?"Preparing the provider connection.":"Checking provider status before discovery."}),(0,d.jsxs)("div",{className:"mt-4 flex gap-1.5",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/90"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/60 [animation-delay:120ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/30 [animation-delay:240ms]"})]})]})]}):null,"oauth"!==s.connectKind||v.connected||0!==A.length||C?null:(0,d.jsxs)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Use Codex app-server"}),(0,d.jsxs)("p",{className:"mt-1 max-w-[500px] text-[10px] leading-[0.98rem] text-slate-400",children:["OpenClaw ",bt.L," uses the Codex app-server plugin for ChatGPT-backed models."]})]}),(0,d.jsx)(u.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===t.flowState&&!t.manualCommand,onClick:()=>{K(j)},children:"connecting"!==t.flowState||t.manualCommand?"Connect ChatGPT":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]})}),(0,d.jsx)(u.$,{type:"button",variant:"ghost",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===t.flowState&&!t.manualCommand,onClick:()=>{K(j,{force:!0})},children:"Refresh app-server"})]}),t.manualCommand?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,d.jsx)("p",{className:"mt-1 max-w-[460px] text-[10px] leading-[0.98rem] text-cyan-100/80",children:"Open Terminal, complete the Codex app-server setup, then come back and refresh this provider."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:o,onClick:()=>{P(t.manualCommand||"")},children:o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{O(t.manualCommand||"")},children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{J(j)},children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:t.manualCommand})})]}):null]}),F&&!C?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mt-4 flex flex-nowrap items-center justify-between gap-2 overflow-x-auto pb-1",children:[(0,d.jsx)("p",{className:"shrink-0 whitespace-nowrap text-[9px] uppercase tracking-[0.16em] text-slate-500",children:A.length>0?`Found ${A.length} model${1===A.length?"":"s"}`:"No models found"}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-nowrap gap-1.5",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{J(j)},className:"h-6 rounded-full px-2 text-[9px]",children:[(0,d.jsx)(f.A,{className:"mr-1 h-2.5 w-2.5"}),"Refresh"]}),(0,d.jsx)(u.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>e(j),className:"h-6 rounded-full px-2 text-[9px]",children:"Add Models"})]})]}),E?(0,d.jsxs)("div",{className:"relative mt-3",children:[(0,d.jsx)(bp.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(br.p,{value:t.search,onChange:a=>G(j,{search:a.target.value}),placeholder:s.searchPlaceholder??"Search models",className:"h-8 pl-8 text-[11px]"})]}):null,t.emptyState?(0,d.jsx)(bv,{emptyState:t.emptyState,onRefresh:()=>{J(j)}}):null,A.length>0?(0,d.jsx)("div",{className:"mt-3 max-h-[min(34vh,260px)] space-y-1 overflow-y-auto pr-1",children:A.map(a=>{let e=b===a.id;return(0,d.jsxs)("button",{type:"button",onClick:()=>{(0,bb.a3)(a.provider)&&l(a.provider),c(a.id)},className:(0,y.cn)("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",e?"border-cyan-300/35 bg-cyan-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:a.id}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:a.input}),a.contextWindow?(0,d.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null,a.isFree?(0,d.jsx)("span",{children:"free"}):null]})]}),(0,d.jsx)("div",{className:"shrink-0",children:e?(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):a.recommended?(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):a.local?(0,d.jsx)(ag.E,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,d.jsx)(ag.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},a.id)})}):(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-dashed border-white/10 bg-white/[0.02] px-3 py-4 text-[11px] text-slate-400",children:"No models are visible yet. Refresh this provider or open the full Add Models flow."})]}):null,B&&!C?(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 rounded-[16px] border border-emerald-300/15 bg-emerald-300/[0.06] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[8px] uppercase tracking-[0.16em] text-emerald-200/75",children:"Selected model"}),(0,d.jsx)("p",{className:"truncate text-[11px] text-emerald-50",children:B})]}),(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"})]}):null]})]})}function bv({emptyState:a,onRefresh:b}){return(0,d.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:a.title}),(0,d.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[0.98rem] text-slate-400",children:a.description}),(0,d.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:b,children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"Refresh provider"]})})]})}function bw(a){return a||{loaded:!1,connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],apiKey:"",search:"",flowState:"idle"}}function bx(a,b){let c=a.diagnostics.modelReadiness.authProviders.find(a=>a.provider===b),d=a.models.filter(a=>by(b,a.id,a.provider)).length;if("ollama"===b)return{connected:d>0,detail:d>0?`${d} model${1===d?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."};let e=!!c?.connected;return{connected:e,detail:e?c?.detail||(0,bb.W2)(b).helperText:d>0?`${d} model${1===d?"":"s"} are already saved in AgentOS. Connect ${bh(b)} to use them.`:(0,bb.W2)(b).helperText}}function by(a,b,c){return(0,ba.Pr)(a,b,c)}function bz({steps:a,surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,run:h,gatewayAuthNeedsSetup:i,onOpenGatewayAuthSettings:j}){let[l,m]=(0,g.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mt-3",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,d.jsx)("h2",{className:(0,y.cn)("mt-1 text-[13px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"System setup"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI, start the gateway, and verify RPC."})]}),(0,d.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.map((a,c)=>{let e="runtime"===a.id,f="current"===a.state&&"running"===h.runState,g="complete"===a.state?"Ready":"current"===a.state?f?"Checking":e?"Needs verification":"Pending":"Pending";return(0,d.jsxs)("div",{className:(0,y.cn)("relative flex items-center gap-1.5 overflow-hidden rounded-[12px] border px-2 py-1.5",f?"light"===b?"shadow-[inset_0_1px_0_rgba(255,255,255,0.55),0_0_0_1px_rgba(215,178,154,0.18)]":"shadow-[inset_0_1px_0_rgba(255,255,255,0.03),0_0_0_1px_rgba(103,232,249,0.08)]":"",bl(a.state,b)),children:[f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]","light"===b?"bg-gradient-to-r from-transparent via-[#d9b08d]/26 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/12 to-transparent"),animate:{x:["-30%",e?"250%":"230%"]},transition:{duration:e?1.45:2.05,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-x-2 bottom-0 h-px rounded-full","light"===b?"bg-gradient-to-r from-transparent via-[#c99672] to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent"),animate:{opacity:[.28,.92,.28],scaleX:[.86,1,.86]},transition:{duration:e?1.2:1.65,repeat:1/0,ease:"easeInOut"}})]}):null,(0,d.jsxs)("span",{className:(0,y.cn)("relative mt-0.5 inline-flex h-5 w-5 items-center justify-center overflow-hidden rounded-full border text-[9px] font-medium",bm(a.state,b)),children:[f?(0,d.jsx)(s.P.span,{"aria-hidden":"true",className:(0,y.cn)("absolute inset-0 rounded-full border","light"===b?"border-[#d9b59a]/35 bg-[#f7eee7]/80":"border-cyan-200/16 bg-cyan-300/[0.06]"),animate:{scale:[1,1.16,1],opacity:[.45,.95,.45]},transition:{duration:e?1.5:1.9,repeat:1/0,ease:"easeInOut"}}):null,(0,d.jsx)("span",{className:"relative z-[1]",children:"complete"===a.state?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):f?(0,d.jsx)(k.A,{className:"h-2.5 w-2.5 animate-spin"}):c+1})]}),(0,d.jsxs)("div",{className:"relative z-[1] min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",bn(a.state,b)),children:g})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.82rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]},a.id)})}),(0,d.jsx)(bI,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:l,onDetailsOpenChange:m,run:h}),i?(0,d.jsx)("div",{className:(0,y.cn)("mt-2.5 rounded-[14px] border px-2.5 py-2","light"===b?"border-amber-300 bg-amber-50 text-amber-950":"border-amber-300/22 bg-amber-300/10 text-amber-100"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(P.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium",children:"Native Gateway auth needs an env credential"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===b?"text-amber-900/78":"text-amber-100/78"),children:"OpenClaw reports the Gateway secret as redacted. Generate a local token in Settings so AgentOS can use native WS instead of CLI fallback."}),(0,d.jsx)(u.$,{type:"button",size:"sm",variant:"secondary",onClick:j,className:(0,y.cn)("mt-2",bg(b)),children:"Configure Gateway auth"})]})]})}):null]})}function bA({snapshot:a,surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,run:h,modelPhase:i,selectedModelId:j,modelSwitchFeedback:k,onSelectedModelIdChange:l,onClearModelSwitchFeedback:m,onOpenAddModels:n,onSnapshotChange:o}){let[p,q]=(0,g.useState)(!0),r=(0,g.useMemo)(()=>a.models.filter(a=>!1!==a.available&&!a.missing),[a.models]),s=(0,g.useMemo)(()=>be(j,r),[r,j]),t=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,u=(0,a9.X2)(a),v=bE(t,r),w=bE(j,r),x=!!(j.trim()&&j.trim()!==(t?.trim()??"")),z=(0,g.useMemo)(()=>(function({statusCopy:a,run:b,selectedModelLabel:c,phase:d}){var e;let f=`${a}
4
- ${b.log}`.toLowerCase(),g=!!b.manualCommand||/terminal|sign-in|login|oauth|api key|provider auth/.test(f),h="verifying"===d&&(/creating a demo workspace/.test(f)||/resolving workspace settings and reserving the target directory/.test(f)||/preparing workspace folder/.test(f)||/checking input and target path/.test(f)||/reserved target directory/.test(f)||/creating a fresh workspace folder/.test(f)||/fresh workspace folder created at/.test(f)||/preparing an empty workspace scaffold/.test(f)||/generating workspace docs/.test(f)||/scaffolding workspace files/.test(f)||/workspace files and starter docs are in place/.test(f)||/workspace bootstrap is wrapping up without a kickoff mission/.test(f)||/creating the first workspace agent/.test(f)||/provisioning the first workspace agent/.test(f)||/creating agent \d+ of \d+/.test(f)||/linked to the workspace/.test(f)||/finalizing workspace bootstrap/.test(f)||/workspace bootstrap finished/.test(f)||/demo workspace is ready/.test(f));if("running"!==b.runState||g||!h)return null;let i=(e=f,/resolving workspace settings/.test(e)||/checking input and target path/.test(e)||/reserved target directory/.test(e)||/creating a demo workspace/.test(e)?1:/preparing workspace folder/.test(e)||/creating a fresh workspace folder/.test(e)||/preparing an empty workspace scaffold/.test(e)||/scaffolding workspace files/.test(e)||/fresh workspace folder created at/.test(e)||/generating workspace docs/.test(e)||/workspace files and starter docs are in place/.test(e)?2:/creating the first workspace agent/.test(e)||/provisioning the first workspace agent/.test(e)||/creating agent \d+ of \d+/.test(e)||/linked to the workspace/.test(e)?3:/finalizing workspace bootstrap/.test(e)||/workspace bootstrap is wrapping up without a kickoff mission/.test(e)||/workspace bootstrap finished/.test(e)||/demo workspace is ready/.test(e)?4:1),j=[{id:"model",label:"Default model",detail:c?`${c} is now the route powering the workspace.`:"The selected route is being saved locally."},{id:"path",label:"Workspace shell",detail:"Validating the destination and preparing the workspace folder."},{id:"scaffold",label:"Workspace scaffold",detail:"Writing docs, memory, and the bootstrap metadata."},{id:"agent",label:"Starter agent",detail:"Provisioning the first agent and wiring it into the workspace."},{id:"handoff",label:"Canvas handoff",detail:"Refreshing the graph and selecting the new workspace."}].map((a,b)=>({...a,state:b<i?"done":b===i?"current":"pending"}));return{stepIndex:i,steps:j,logLines:b.log.split(/\r?\n/).map(a=>a.trim().replace(/^>\s*/,"")).filter(a=>!!a).slice(-4),headline:"Building your demo workspace",summary:"Workspace files, the first agent, and the initial canvas handoff are being assembled in real time.",selectedModelLabel:c}})({statusCopy:c,run:h,selectedModelLabel:s,phase:i}),[i,h,s,c]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)("p",{className:(0,y.cn)("text-[11px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"Step 2: Model setup"})}),z?(0,d.jsx)(bJ,{surfaceTheme:b,statusCopy:c,phaseLabel:f,buildScene:z}):"idle"!==k.phase?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bC,{surfaceTheme:b,feedback:k,defaultModelLabel:bE(k.previousModelId,r),nextModelLabel:bE(k.nextModelId,r),onChangeAgain:m}),(0,d.jsx)(bI,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:p,onDetailsOpenChange:q,run:h})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bB,{surfaceTheme:b,defaultModelLabel:v,switchTargetLabel:w,hasPendingModelSwitch:x}),(0,d.jsx)(bu,{snapshot:a,selectedModelId:j,onSelectedModelIdChange:l,onOpenAddModels:n,onSnapshotChange:o,autoDiscover:!u}),(0,d.jsx)(bI,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:p,onDetailsOpenChange:q,run:h})]})]})}function bB({surfaceTheme:a,defaultModelLabel:b,switchTargetLabel:c,hasPendingModelSwitch:e}){return(0,d.jsx)("div",{className:(0,y.cn)("mt-2 rounded-[14px] border px-2.5 py-2","light"===a?"border-[#e8d8ca] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7a65]":"text-slate-500"),children:"Detected default"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 truncate text-[10px]","light"===a?"text-[#3e2f24]":"text-white"),children:b??"Not set"})]}),e?(0,d.jsxs)("div",{className:"min-w-0 text-right",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7a65]":"text-slate-500"),children:"Switch to"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 truncate text-[10px]","light"===a?"text-[#7a4d2d]":"text-cyan-100"),children:c})]}):null]})})}function bC({surfaceTheme:a,feedback:b,defaultModelLabel:c,nextModelLabel:e,onChangeAgain:f}){var g;let h,i="light"===a,j="saving"===b.phase,l="success"===b.phase,m="error"===b.phase,n=b.message||(l?"AgentOS will use this route for new actions.":m?"Review the log below, then try again.":"Saving the route, refreshing OpenClaw config, and updating AgentOS."),o=(h=(g=b).message??"","saving"!==g.phase?0:/updating agentos snapshot|snapshot/i.test(h)?3:/verifying selected provider|provider/i.test(h)?2:+!!/refreshing openclaw config|config/i.test(h));return(0,d.jsx)("div",{className:(0,y.cn)("mt-3 overflow-hidden rounded-[22px] border",i?"border-[#e1d0c2] bg-[linear-gradient(180deg,rgba(255,250,246,0.98),rgba(248,240,232,0.98))]":"border-cyan-300/16 bg-[radial-gradient(circle_at_top,rgba(16,28,44,0.98),rgba(6,10,18,0.98)_72%)]"),children:(0,d.jsxs)("div",{className:"relative isolate min-h-[300px] overflow-hidden px-4 py-4 text-center",children:[(0,d.jsx)("div",{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-0",i?"bg-[radial-gradient(circle_at_50%_0%,rgba(232,186,151,0.22),transparent_34%),linear-gradient(135deg,rgba(255,255,255,0.4),transparent_48%)]":"bg-[radial-gradient(circle_at_50%_0%,rgba(34,211,238,0.18),transparent_34%),linear-gradient(135deg,rgba(255,255,255,0.04),transparent_48%)]")}),(0,d.jsxs)("div",{className:"relative z-[1] flex flex-col items-center",children:[(0,d.jsxs)("div",{className:"relative flex h-20 w-20 items-center justify-center",children:[j?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute h-20 w-20 rounded-full border",i?"border-[#d1a98b]":"border-cyan-200/24"),animate:{rotate:360},transition:{duration:8,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute h-14 w-14 rounded-full border border-dashed",i?"border-[#c8946f]":"border-cyan-200/40"),animate:{rotate:-360},transition:{duration:6,repeat:1/0,ease:"linear"}})]}):null,(0,d.jsx)("span",{className:(0,y.cn)("relative z-[1] inline-flex h-12 w-12 items-center justify-center rounded-full border",l?i?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":m?i?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":i?"border-[#d7b59a] bg-white text-[#9a6a48]":"border-cyan-300/20 bg-cyan-300/10 text-cyan-100"),children:l?(0,d.jsx)(a6.A,{className:"h-5 w-5"}):j?(0,d.jsx)(k.A,{className:"h-5 w-5 animate-spin"}):(0,d.jsx)(bo.A,{className:"h-5 w-5"})})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-3 text-[8px] uppercase tracking-[0.22em]",i?"text-[#94735e]":"text-cyan-200/70"),children:"Model route"}),(0,d.jsx)("h3",{className:(0,y.cn)("mt-1 text-[17px] font-medium tracking-[-0.03em]",i?"text-[#2d2118]":"text-white"),children:l?"Default model updated":m?"Default model could not be changed":"Switching default model"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 max-w-[320px] text-[10px] leading-[1rem]",i?"text-[#6d5647]":"text-slate-300"),children:n}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 grid w-full gap-2 rounded-[16px] border px-3 py-3 text-left",i?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,d.jsx)(bD,{label:"Previous",value:c??"Not set",surfaceTheme:a,muted:!0}),(0,d.jsx)(bD,{label:"New default",value:e??"Not selected",surfaceTheme:a})]}),j?(0,d.jsx)("div",{className:"mt-4 grid w-full gap-1.5 text-left",children:["Saving model route","Refreshing OpenClaw config","Verifying selected provider","Updating AgentOS snapshot"].map((a,b)=>(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center gap-2 rounded-[12px] border px-2.5 py-2",b===o?i?"border-[#c8946f] bg-[#fff5ed]":"border-cyan-300/24 bg-cyan-300/[0.07]":b<o?i?"border-emerald-200 bg-emerald-50/60":"border-emerald-300/16 bg-emerald-300/[0.05]":i?"border-[#ead8c8] bg-white/55":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("span",{className:(0,y.cn)("inline-flex h-4 w-4 items-center justify-center rounded-full border text-[8px]",b<o?i?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":b===o?i?"border-[#c8946f] bg-[#f8eadf] text-[#8c5d3d]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":i?"border-[#e0cec0] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-500"),children:b<o?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):b+1}),(0,d.jsx)("p",{className:(0,y.cn)("text-[10px]",i?"text-[#5f4b3e]":"text-slate-300"),children:a})]},a))}):null,j?null:(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:f,className:(0,y.cn)("mt-4 h-8 rounded-full px-3 text-[10px]",bg(a)),children:"Change again"})]})]})})}function bD({label:a,value:b,surfaceTheme:c,muted:e=!1}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("span",{className:(0,y.cn)("min-w-0 truncate text-right text-[10px]",e?"light"===c?"text-[#8a7261]":"text-slate-400":"light"===c?"text-[#3e2f24]":"text-white"),children:b})]})}function bE(a,b){return a?.trim()?be(a,b)??(0,x.JZ)(a):null}function bF({surfaceTheme:a,workspaceCount:b,agentCount:c,workspaceSetupReady:e,defaultModelLabel:f,createProgress:g,createRunState:h}){let i=b>0,j="running"===h&&!!g,k="error"===h&&!!g,l=!!g&&(j||k),m=i?e?`You already have ${b} workspace${1===b?"":"s"} online. Use AgentOS to inspect them or create another workspace for a new mission.`:"The workspace shell is visible. AgentOS is waiting for the starter agent before opening the canvas.":j?"AgentOS Workspace is being provisioned now. The scaffold and starter agent are being built in the background.":k?"The first workspace creation needs attention. Review the output, then try again.":"No workspace exists yet. Create one first so the live system has a place to keep context and deliverables.";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-3 py-3","light"===a?"border-emerald-200/80 bg-[linear-gradient(180deg,rgba(240,250,245,0.95),rgba(248,244,236,0.95))]":"border-emerald-300/15 bg-[linear-gradient(180deg,rgba(9,18,19,0.96),rgba(7,11,18,0.94))]"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border","light"===a?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:(0,d.jsx)(a6.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.18em]","light"===a?"text-emerald-700/75":"text-emerald-200/75"),children:"Launchpad"}),(0,d.jsx)("h2",{className:(0,y.cn)("mt-1 text-[13px] font-medium","light"===a?"text-[#2d2118]":"text-white"),children:"OpenClaw is ready."}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:m})]})]}),l?null:(0,d.jsxs)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:[(0,d.jsx)(bH,{surfaceTheme:a,label:"System",value:"Online",detail:"CLI, gateway, and runtime access verified"}),(0,d.jsx)(bH,{surfaceTheme:a,label:e?"Default model":"Detected default",value:f,detail:e?"Usable model route selected":"Detected on this machine, not yet confirmed by a workspace."}),(0,d.jsx)(bH,{surfaceTheme:a,label:"Runtime",value:"Smoke test passed",detail:"A live agent turn was verified"}),(0,d.jsx)(bH,{surfaceTheme:a,label:i?"Starter agent":"Workspaces",value:i?c>0?"Visible":"Pending":String(b),detail:i?"Required before canvas handoff":"Create one to begin"})]})]}),l?(0,d.jsx)(bG,{surfaceTheme:a,progress:g,runState:h}):(0,d.jsxs)("div",{className:(0,y.cn)("mt-2.5 rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Next step"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:i?"Open AgentOS to inspect the live graph, or create another workspace if you want a separate mission lane.":"Create the first workspace now. That is the shortest path from a ready system to a real mission."})]})]})}function bG({surfaceTheme:a,progress:b,runState:c}){let e="light"===a,f=b.steps.find(a=>"active"===a.status)??b.steps[0]??null,g="error"===c;return(0,d.jsxs)("div",{className:(0,y.cn)("relative mt-2.5 overflow-hidden rounded-[18px] border px-2.5 py-2.5",e?g?"border-rose-200 bg-[linear-gradient(180deg,rgba(255,248,247,0.98),rgba(252,242,242,0.96))]":"border-[#dcc7b8] bg-[linear-gradient(180deg,rgba(255,251,248,0.98),rgba(249,243,236,0.96))]":g?"border-rose-300/18 bg-[radial-gradient(circle_at_top,rgba(49,18,24,0.95),rgba(12,8,14,0.98)_72%)]":"border-cyan-300/16 bg-[radial-gradient(circle_at_top,rgba(11,21,34,0.98),rgba(5,10,18,0.98)_72%)]"),children:[(0,d.jsx)("div",{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-0",e?"bg-[radial-gradient(circle_at_20%_0%,rgba(255,255,255,0.95),transparent_28%),radial-gradient(circle_at_84%_18%,rgba(201,148,111,0.14),transparent_22%)]":g?"bg-[radial-gradient(circle_at_20%_0%,rgba(251,113,133,0.14),transparent_26%),radial-gradient(circle_at_84%_18%,rgba(248,113,113,0.08),transparent_22%)]":"bg-[radial-gradient(circle_at_20%_0%,rgba(34,211,238,0.12),transparent_26%),radial-gradient(circle_at_84%_18%,rgba(59,130,246,0.08),transparent_22%)]")}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute -left-8 top-5 h-24 w-24 rounded-full blur-3xl",e?"bg-[#efc6a8]/20":g?"bg-rose-300/10":"bg-cyan-300/10"),animate:{x:[0,10,0],y:[0,-6,0],opacity:[.45,.75,.45]},transition:{duration:7.5,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute -right-4 top-8 h-28 w-28 rounded-full blur-3xl",e?"bg-[#f6d9c2]/18":g?"bg-rose-300/8":"bg-sky-300/8"),animate:{x:[0,-12,0],y:[0,8,0],opacity:[.35,.7,.35]},transition:{duration:9.5,repeat:1/0,ease:"easeInOut"}}),(0,d.jsxs)("div",{className:"relative z-[1] flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)(s.P.div,{className:(0,y.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border",e?g?"border-rose-300 bg-white text-rose-700":"border-[#d9b59a] bg-white text-[#8b6d5a]":g?"border-rose-300/25 bg-rose-300/10 text-rose-100":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100"),animate:{scale:[1,1.06,1],opacity:[.82,1,.82]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"},children:g?(0,d.jsx)(P.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.18em]",e?g?"text-rose-600/75":"text-[#977b69]":g?"text-rose-200/75":"text-cyan-200/70"),children:g?"Needs attention":"Building"}),(0,d.jsx)("h3",{className:(0,y.cn)("mt-1 text-[13px] font-medium",e?g?"text-rose-950":"text-[#281d17]":g?"text-rose-50":"text-white"),children:g?"Workspace creation needs attention":b.title}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[10px] leading-[0.95rem]",e?g?"text-rose-700":"text-[#6f5a4c]":g?"text-rose-100/80":"text-slate-300"),children:g?"Review the captured output and retry when the workspace state is clean.":b.description})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]",e?g?"border-rose-200 bg-white text-rose-700":"border-[#dcc7b8] bg-white/75 text-[#8b6f5c]":g?"border-rose-300/20 bg-rose-300/8 text-rose-100":"border-cyan-300/16 bg-cyan-300/10 text-cyan-100"),children:g?"Error":`${b.percent}%`}),f?(0,d.jsx)("span",{className:(0,y.cn)("max-w-[140px] truncate rounded-full border px-2 py-0.5 text-[7px] uppercase tracking-[0.14em]",e?g?"border-rose-200 bg-white text-rose-700":"border-[#e9d7ca] bg-white text-[#8b6f5c]":g?"border-rose-300/18 bg-rose-300/8 text-rose-100":"border-white/10 bg-white/[0.04] text-slate-300"),children:f.label}):null]})]}),(0,d.jsx)("div",{className:"relative z-[1] mt-2.5 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)(s.P.div,{className:(0,y.cn)("h-full rounded-full transition-[width] duration-500 ease-out",e?g?"bg-rose-300/85":"bg-amber-300/85":g?"bg-rose-300/85":"bg-cyan-300/85"),style:{width:`${b.percent}%`}})}),(0,d.jsxs)("div",{className:(0,y.cn)("relative z-[1] mt-2.5 overflow-hidden rounded-[14px] border px-2.5 py-2",e?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,d.jsx)("div",{"aria-hidden":"true",className:(0,y.cn)("absolute inset-0 opacity-60",e?"bg-[linear-gradient(90deg,transparent,rgba(216,180,254,0.12),transparent)]":"bg-[linear-gradient(90deg,transparent,rgba(34,211,238,0.08),transparent)]")}),(0,d.jsx)("div",{className:"relative z-[1] flex items-center gap-2",children:["Workspace","Starter agent","Canvas"].map((a,c)=>{let f=0===c?b.percent>=28:1===c?b.percent>=62:b.percent>=88,h=!g&&!f&&(0===c||1===c&&b.percent>=28||2===c&&b.percent>=62);return(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,d.jsxs)("div",{className:(0,y.cn)("relative flex min-h-[52px] min-w-0 flex-1 flex-col justify-between rounded-[12px] border px-2 py-1.5",f?e?"border-emerald-200 bg-emerald-50/80":"border-emerald-300/20 bg-emerald-300/10":h?e?"border-[#d8b69b] bg-[#fff8f1]":"border-cyan-300/18 bg-cyan-300/[0.06]":e?"border-[#ead8c8] bg-white/65":"border-white/8 bg-white/[0.03]"),children:[h?(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute inset-y-0 left-0 w-1/2",e?"bg-gradient-to-r from-transparent via-[#d9b08d]/20 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/10 to-transparent"),animate:{x:["-50%","220%"]},transition:{duration:1.8,repeat:1/0,ease:"linear"}}):null,(0,d.jsx)("span",{className:(0,y.cn)("relative z-[1] inline-flex h-5 w-5 items-center justify-center rounded-full border text-[8px]",f?e?"border-emerald-300 bg-white text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":e?"border-[#dcc7b8] bg-white text-[#8b6f5c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:f?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):h?(0,d.jsx)(k.A,{className:"h-2.5 w-2.5 animate-spin"}):c+1}),(0,d.jsx)("span",{className:(0,y.cn)("relative z-[1] truncate text-[8px] leading-[0.9rem]",e?"text-[#5f4b3e]":"text-slate-300"),children:a})]}),c<2?(0,d.jsx)("span",{className:(0,y.cn)("hidden h-px w-4 shrink-0 sm:block",f?e?"bg-emerald-300/70":"bg-emerald-300/45":e?"bg-[#dfcabb]":"bg-white/12")}):null]},a)})})]}),(0,d.jsx)("div",{className:"relative z-[1] mt-2.5 space-y-1.5",children:b.steps.map((a,b)=>{let c="active"===a.status,f="done"===a.status?e?"border-emerald-200 bg-emerald-50/75":"border-emerald-400/20 bg-emerald-400/10":c?e?"border-[#d9bca5] bg-white":"border-cyan-300/18 bg-cyan-300/[0.05]":e?"border-[#eadccc] bg-white/70":"border-white/6 bg-white/[0.03]",h="done"===a.status?e?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":c?e?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100":e?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400";return(0,d.jsxs)("div",{className:(0,y.cn)("relative overflow-hidden rounded-[12px] border px-2.5 py-1.5",f),children:[c?(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]",e?"bg-gradient-to-r from-transparent via-[#d9b08d]/24 to-transparent":g?"bg-gradient-to-r from-transparent via-rose-300/10 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/12 to-transparent"),animate:{x:["-25%","230%"]},transition:{duration:1.7,repeat:1/0,ease:"linear"}}):null,(0,d.jsxs)("div",{className:"relative z-[1] flex items-start gap-1.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[9px] font-medium",h),children:"done"===a.status?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):c?(0,d.jsx)(k.A,{className:"h-2.5 w-2.5 animate-spin"}):b+1}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px]",e?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsxs)("span",{className:(0,y.cn)("text-[7px] tabular-nums",e?"text-[#8f7664]":"text-slate-400"),children:[a.percent,"%"]})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.82rem]",e?"text-[#8f7664]":"text-slate-500"),children:a.detail||a.description}),(0,d.jsx)("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)(s.P.div,{className:(0,y.cn)("h-full rounded-full transition-[width] duration-500 ease-out","done"===a.status?"bg-emerald-300/85":c?e?g?"bg-rose-300/85":"bg-amber-300/85":g?"bg-rose-300/85":"bg-cyan-300/85":"bg-transparent"),style:{width:`${Math.max(a.percent,10*!!c)}%`}})}),c&&a.activities.length>0?(0,d.jsx)("div",{className:"mt-1 space-y-0.5",children:a.activities.slice(-2).map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("flex items-start gap-1.5 text-[8px] leading-[0.9rem]",e?"text-[#705b4d]":"text-slate-300"),children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full","done"===a.status&&"bg-emerald-300","active"===a.status&&"bg-cyan-300","error"===a.status&&"bg-rose-300","pending"===a.status&&(e?"bg-[#c9b4a2]":"bg-slate-500"))}),(0,d.jsx)("span",{className:"min-w-0",children:a.message})]},a.id))}):null]})]})]},a.id)})})]})}function bH({surfaceTheme:a,label:b,value:c,detail:e}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e6d7cb] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:b}),(0,d.jsx)("p",{title:c,className:(0,y.cn)("mt-1 truncate text-[10px]","light"===a?"text-[#33251c]":"text-white"),children:c}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===a?"text-[#8f7664]":"text-slate-500"),children:e})]})}function bI({surfaceTheme:a,statusCopy:b,showDetails:c,phaseLabel:e,detailsOpen:f,onDetailsOpenChange:h,run:i}){let[j,l]=(0,g.useState)(!1),m=(0,a4.T)(i.manualCommand),n=async()=>{if(i.manualCommand)try{await navigator.clipboard.writeText(i.manualCommand),w.o.success("Command copied.",{description:"Open Terminal and paste it."})}catch(a){w.o.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},o=async()=>{if(i.manualCommand&&m){l(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:i.manualCommand})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");w.o.success("Terminal opened.",{description:"Finish auth there, then refresh."})}catch(a){w.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{l(!1)}}};return(0,d.jsxs)("div",{className:(0,y.cn)("mt-2.5 rounded-[12px] border","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,d.jsxs)("div",{className:"px-2.5 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Status"}),c?(0,d.jsx)("button",{type:"button",onClick:()=>h(!f),className:(0,y.cn)("text-[8px] uppercase tracking-[0.16em] transition-colors","light"===a?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:f?"Hide details":"Show details"}):null]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:b})]}),c&&f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center justify-between border-y px-2.5 py-1.5","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Log"}),(0,d.jsx)("span",{className:"light"===a?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:e})]}),(0,d.jsx)("pre",{className:(0,y.cn)("max-h-[120px] min-h-[68px] overflow-auto whitespace-pre-wrap break-words px-2.5 py-2 font-mono text-[8px] leading-[0.82rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:i.log||"No output yet.\n\nStart the step to stream logs."}),i.manualCommand?(0,d.jsxs)("div",{className:(0,y.cn)("border-t px-2.5 py-2","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:m?"Terminal":"Manual"}),m?(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===a?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command."}):null,(0,d.jsx)("p",{className:(0,y.cn)("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:i.manualCommand}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:n,className:bg(a),children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),m?(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:o,disabled:j,className:bg(a),children:j?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),i.docsUrl?(0,d.jsxs)("a",{href:i.docsUrl,target:"_blank",rel:"noreferrer",className:(0,y.cn)("mt-2 inline-flex items-center gap-1 text-[9px] underline underline-offset-4","light"===a?"text-[#7f6554]":"text-slate-300"),children:["Setup docs",(0,d.jsx)(a8.A,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function bJ({surfaceTheme:a,statusCopy:b,phaseLabel:c,buildScene:e}){let f="light"===a;return(0,d.jsx)("div",{className:(0,y.cn)("mt-3 overflow-hidden rounded-[24px] border",f?"border-[#e1d4c6] bg-[linear-gradient(180deg,rgba(255,251,247,0.96),rgba(248,241,233,0.98))]":"border-cyan-300/18 bg-[radial-gradient(circle_at_top,rgba(12,24,40,0.98),rgba(5,10,18,0.98)_72%)]"),children:(0,d.jsxs)("div",{className:"relative isolate min-h-[440px] overflow-hidden px-4 py-4 sm:px-5 sm:py-5",children:[(0,d.jsx)("div",{className:(0,y.cn)("pointer-events-none absolute inset-0",f?"bg-[radial-gradient(circle_at_20%_20%,rgba(255,255,255,0.96),transparent_30%),radial-gradient(circle_at_80%_10%,rgba(221,182,152,0.18),transparent_24%),linear-gradient(135deg,rgba(255,255,255,0.06),transparent_30%,rgba(218,193,176,0.12)_58%,transparent_72%)]":"bg-[radial-gradient(circle_at_20%_20%,rgba(34,211,238,0.16),transparent_24%),radial-gradient(circle_at_82%_12%,rgba(56,189,248,0.11),transparent_20%),linear-gradient(135deg,rgba(255,255,255,0.03),transparent_34%,rgba(34,211,238,0.05)_58%,transparent_74%)]")}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute -left-12 top-8 h-36 w-36 rounded-full blur-3xl",f?"bg-[#f1b27d]/25":"bg-cyan-300/12"),animate:{x:[0,16,0],y:[0,-10,0],opacity:[.55,.8,.55]},transition:{duration:8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute right-0 top-24 h-44 w-44 rounded-full blur-3xl",f?"bg-[#f9d8b6]/22":"bg-sky-300/10"),animate:{x:[0,-18,0],y:[0,8,0],opacity:[.35,.7,.35]},transition:{duration:10,repeat:1/0,ease:"easeInOut"}}),(0,d.jsxs)("div",{className:"relative z-[1] flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[9px] uppercase tracking-[0.24em]",f?"text-[#8f6f5d]":"text-cyan-200/70"),children:"Building"}),(0,d.jsx)("h3",{className:(0,y.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em] sm:text-[22px]",f?"text-[#231a15]":"text-white"),children:"Creating your demo workspace"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 max-w-[42rem] text-[11px] leading-[1rem] sm:text-[12px] sm:leading-[1.05rem]",f?"text-[#6f5a4c]":"text-slate-300"),children:b})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[8px] uppercase tracking-[0.16em]",f?"border-[#d9c3b1] bg-white/70 text-[#8b6f5c]":"border-cyan-300/18 bg-cyan-300/10 text-cyan-100"),children:c}),e.selectedModelLabel?(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex max-w-[220px] truncate rounded-full border px-2.5 py-1 text-[9px]",f?"border-[#ead8c8] bg-white text-[#5a4638]":"border-white/10 bg-white/[0.04] text-slate-200"),children:["Default model: ",e.selectedModelLabel]}):null]})]}),(0,d.jsxs)("div",{className:"relative z-[1] mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(280px,0.8fr)]",children:[(0,d.jsxs)("div",{className:(0,y.cn)("relative min-h-[290px] overflow-hidden rounded-[28px] border",f?"border-[#ead8c8] bg-[linear-gradient(180deg,rgba(255,255,255,0.92),rgba(252,246,239,0.98))] shadow-[0_18px_50px_rgba(165,126,98,0.08)]":"border-white/10 bg-[linear-gradient(180deg,rgba(9,16,28,0.98),rgba(5,10,18,0.98))] shadow-[0_18px_50px_rgba(0,0,0,0.3)]"),children:[(0,d.jsx)("div",{className:(0,y.cn)("absolute inset-0 opacity-80",f?"bg-[linear-gradient(rgba(116,85,65,0.05)_1px,transparent_1px),linear-gradient(90deg,rgba(116,85,65,0.05)_1px,transparent_1px)] bg-[size:28px_28px]":"bg-[linear-gradient(rgba(56,189,248,0.08)_1px,transparent_1px),linear-gradient(90deg,rgba(56,189,248,0.08)_1px,transparent_1px)] bg-[size:28px_28px]")}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute inset-x-0 top-0 h-px",f?"bg-gradient-to-r from-transparent via-[#caa789] to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent"),animate:{opacity:[.4,1,.4]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,d.jsxs)("div",{className:"relative flex flex-col items-center text-center",children:[(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute h-56 w-56 rounded-full border",f?"border-[#d8bda5]/45":"border-cyan-200/14"),animate:{rotate:360},transition:{duration:28,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute h-40 w-40 rounded-full border",f?"border-[#e2c4ad]/65":"border-cyan-200/16"),animate:{rotate:-360},transition:{duration:18,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute h-24 w-24 rounded-full border",f?"border-[#f0d8c8] bg-white/90":"border-cyan-300/18 bg-cyan-300/[0.08]"),animate:{scale:[1,1.04,1],opacity:[.75,1,.75]},transition:{duration:3.8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("div",{className:(0,y.cn)("relative flex h-24 w-24 items-center justify-center rounded-full border shadow-[0_0_0_14px_rgba(255,255,255,0.03)]",f?"border-[#d7b9a0] bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.98),rgba(246,232,219,0.98))] text-[#7c5b46]":"border-cyan-300/24 bg-[radial-gradient(circle_at_top,rgba(16,30,48,0.96),rgba(7,12,21,0.98))] text-cyan-100"),children:(0,d.jsx)(k.A,{className:"h-10 w-10 animate-spin"})}),(0,d.jsx)("p",{className:(0,y.cn)("mt-5 text-[9px] uppercase tracking-[0.22em]",f?"text-[#9a7d69]":"text-cyan-200/70"),children:"Workspace fabric"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em]",f?"text-[#281d17]":"text-white"),children:e.headline}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 max-w-[28rem] text-[11px] leading-[1rem]",f?"text-[#6a5547]":"text-slate-300"),children:e.summary}),(0,d.jsxs)("div",{className:"mt-5 flex flex-wrap items-center justify-center gap-2",children:[(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",f?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,d.jsx)("span",{className:(0,y.cn)("h-1.5 w-1.5 rounded-full",f?"bg-[#c98a5f]":"bg-cyan-300")}),"Building workspace"]}),(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",f?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,d.jsx)("span",{className:(0,y.cn)("h-1.5 w-1.5 rounded-full",f?"bg-emerald-500":"bg-emerald-300")}),"Default model locked"]})]})]})}),(0,d.jsx)("div",{className:"absolute inset-x-5 bottom-5",children:(0,d.jsx)("div",{className:(0,y.cn)("relative h-2 overflow-hidden rounded-full border",f?"border-[#dec8b8] bg-white/90":"border-white/10 bg-white/[0.04]"),children:(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute inset-y-0 left-0 w-1/3 rounded-full",f?"bg-gradient-to-r from-[#b97b4c] via-[#f1c59b] to-[#e39e69]":"bg-gradient-to-r from-cyan-400 via-sky-200 to-cyan-500"),animate:{x:["-15%","125%"]},transition:{duration:2.4,repeat:1/0,ease:"linear"}})})})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:[e.steps.map((a,b)=>(0,d.jsx)(s.P.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,delay:.05*b},className:(0,y.cn)("rounded-[18px] border px-3 py-2.5","current"===a.state?f?"border-[#d9b79f] bg-white shadow-[0_10px_28px_rgba(185,122,77,0.08)]":"border-cyan-300/24 bg-white/[0.05] shadow-[0_10px_28px_rgba(0,0,0,0.18)]":"done"===a.state?f?"border-[#e7d5c6] bg-[rgba(255,255,255,0.76)]":"border-white/10 bg-white/[0.03]":f?"border-[#eadccf] bg-[rgba(255,250,246,0.8)]":"border-white/8 bg-white/[0.02]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("div",{className:(0,y.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium","current"===a.state?f?"border-[#c78e61] bg-[#f7e6d7] text-[#6b4d39]":"border-cyan-300/28 bg-cyan-300/12 text-cyan-50":"done"===a.state?f?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/12 text-emerald-200":f?"border-[#e2d4c7] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"done"===a.state?(0,d.jsx)(a6.A,{className:"h-3.5 w-3.5"}):b+1}),(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px] font-medium",f?"text-[#2b1f18]":"text-white"),children:a.label}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[9px] leading-[0.95rem]",f?"text-[#7c6554]":"text-slate-400"),children:a.detail})]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full px-1.5 py-0.5 text-[7px] uppercase tracking-[0.14em]","current"===a.state?f?"bg-[#f1dfd0] text-[#835f48]":"bg-cyan-300/12 text-cyan-100":"done"===a.state?f?"bg-emerald-100 text-emerald-700":"bg-emerald-300/12 text-emerald-200":f?"bg-[#f6ece3] text-[#a0826e]":"bg-white/[0.04] text-slate-500"),children:"done"===a.state?"Ready":"current"===a.state?"Building":"Queued"})]})})]})},a.id)),(0,d.jsxs)("div",{className:(0,y.cn)("mt-auto rounded-[20px] border p-3",f?"border-[#ead8c8] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[8px] uppercase tracking-[0.18em]",f?"text-[#8f6f5d]":"text-cyan-200/60"),children:"Live build feed"}),(0,d.jsx)("span",{className:(0,y.cn)("text-[9px]",f?"text-[#8a6f5e]":"text-slate-400"),children:c})]}),(0,d.jsx)("div",{className:"mt-2 space-y-1.5",children:e.logLines.length>0?e.logLines.slice(-4).map((a,b)=>(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25,delay:.04*b},className:(0,y.cn)("flex items-start gap-2 rounded-[14px] border px-2.5 py-2 text-[10px] leading-[0.98rem]",b===e.logLines.length-1?f?"border-[#d8b79e] bg-[#fff7f0] text-[#5a4638]":"border-cyan-300/18 bg-cyan-300/[0.06] text-slate-100":f?"border-[#eee0d3] bg-[#fffdfb] text-[#735d4e]":"border-white/8 bg-white/[0.02] text-slate-300"),children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",b===e.logLines.length-1?f?"bg-[#c98758]":"bg-cyan-300":f?"bg-[#e3c8b2]":"bg-slate-500")}),(0,d.jsx)("span",{className:"min-w-0",children:a})]},`${a}-${b}`)):(0,d.jsx)("div",{className:(0,y.cn)("rounded-[14px] border border-dashed px-2.5 py-3 text-[10px]",f?"border-[#e8d7c8] text-[#7e6453]":"border-white/10 text-slate-400"),children:"Waiting for the first build signal..."})})]})]})]})]})})}function bK({snapshot:a,surfaceTheme:b,stage:c,systemReady:e,modelReady:f,systemSetupRequired:g,showReadyState:h,systemActionLabel:i,systemActionDescription:j,systemPhase:l,modelPhase:m,systemRun:n,modelRun:p,modelSwitchFeedback:q,selectedModelId:r,discoveredModels:t,onSelectedModelIdChange:v,onClearModelSwitchFeedback:w,onSnapshotChange:x,onRunSystemSetup:z,onRunModelSetDefault:A,onOpenAddModels:B,onOpenGatewayAuthSettings:C,onCreateWorkspace:D,onEnterAgentOS:E,onContinueToModels:F,onBackToSystem:G,onSelectStage:H,launchpadCreateProgress:I,launchpadCreateRunState:J}){var K,L;let M=e??("success"===n.runState||(0,a9.h6)(a)),N=(0,a3.Id)(a),O=f??("success"===q.phase||h||(0,a9.X2)(a)),P=O&&(h||!N||"running"===J||"success"===J||"error"===J),Q="running"===J,R=a.workspaces.length,S=a.agents.length,T=R>0,U=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Ready",V=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,W=[{id:"system",order:1,label:"System setup",description:"CLI, gateway, RPC",state:bf(M,"system"===c&&!M)},{id:"models",order:2,label:"Model setup",description:"Default model, auth",state:bf(O,"models"===c&&!O)}],X=function(a,b,c={}){let d=!0===c.forcePending,e=!d&&a.diagnostics.rpcOk&&!a.diagnostics.loaded,f=!d&&a.diagnostics.installed||"installing-gateway"===b||"starting-gateway"===b||"verifying"===b||"ready"===b,g=!d&&a.diagnostics.loaded||e||"starting-gateway"===b||"verifying"===b||"ready"===b,h=!d&&a.diagnostics.rpcOk||"ready"===b,i=!d&&a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable||"ready"===b,j=h&&i;return[{id:"cli",label:"OpenClaw CLI",description:bd("cli",a,b,f,g,h,j,d),state:bf(f,!f&&("detecting"===b||"installing-cli"===b))},{id:"gateway",label:"Gateway service",description:bd("gateway",a,b,f,g,h,j,d),state:bf(g,!g&&("installing-gateway"===b||f&&"detecting"===b))},{id:"runtime",label:"Runtime ready",description:bd("runtime",a,b,f,g,h,j,d),state:bf(j,!j&&("starting-gateway"===b||"verifying"===b||g&&"detecting"===b||g||h))}]}(a,M?"ready":l,{forcePending:g}),Y=be(r,a.models.filter(a=>!1!==a.available&&!a.missing)),Z="system"===c?n:p,$=Z.statusMessage||Z.resultMessage||("system"===c?j:Y?`Selected model: ${Y}.`:"Choose a provider, connect it, and then pick a model."),_="system"===c?M?"ready":g?"waiting":(0,a9.iN)(a)?"ready":a.diagnostics.rpcOk?"verifying access":a.diagnostics.loaded&&!a.diagnostics.rpcOk?"verifying"===l?"connecting":"starting gateway":l?l.replace("-"," "):"waiting":(0,a9.X2)(a)?"ready":a.diagnostics.modelReadiness.ready&&"passed"!==a.diagnostics.runtime.smokeTest.status?"smoke test":m?m.replace("-"," "):"waiting",aa="idle"!==Z.runState||!!Z.manualCommand||Z.log.trim().length>0||"models"===c&&t.length>0,ab=(K=Z.runState,"running"===K?"Running":O?"Ready":"success"===K?"models"===c?"Updated":"Step complete":"error"===K?"Needs attention":"system"===c?"Step 1":"Step 2"),ac=a.diagnostics.issues.some(a=>/gateway\..*auth|redacted secret|AGENTOS_OPENCLAW_GATEWAY_TOKEN|OPENCLAW_GATEWAY_TOKEN/i.test(a)),ad=function(a){if("system"===a.stage)return a.systemReady&&a.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:a.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:a.systemActionLabel};let b=a.selectedModelId.trim(),c=a.defaultModelId?.trim()??"";return b?b===c?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"set-default",label:"Set as default"}:a.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"select-model",label:"Select a model"}}({stage:c,systemReady:M,modelReady:O,systemActionLabel:i,selectedModelId:r,defaultModelId:V});return(0,d.jsx)(s.P.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:(0,y.cn)("openclaw-onboarding-backdrop absolute inset-0 z-[80] pointer-events-auto isolate flex items-center justify-center overflow-hidden px-3 py-4 sm:px-4 sm:py-6","light"===b?"openclaw-onboarding-backdrop--light bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.94),rgba(247,239,232,0.88)_46%,rgba(242,230,220,0.92))]":"openclaw-onboarding-backdrop--dark bg-[radial-gradient(circle_at_top,rgba(17,24,39,0.9),rgba(3,7,18,0.92)_48%,rgba(2,6,23,0.96))]"),children:(0,d.jsx)(s.P.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:(0,y.cn)("relative z-10 my-auto flex w-full min-h-0 max-h-[min(80vh,640px)] flex-col overflow-hidden rounded-[16px] border shadow-[0_18px_46px_rgba(0,0,0,0.18)] backdrop-blur-2xl",P&&(Q||"error"===J)?"max-w-[640px]":"max-w-[420px]","light"===b?"border-[#dccabd]/90 bg-[rgba(255,250,246,0.92)] text-[#47362b] shadow-[0_18px_50px_rgba(161,125,101,0.15)]":"border-white/10 bg-[rgba(6,10,18,0.84)] text-slate-100"),children:(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"px-2.5 py-2.5 sm:px-3 sm:py-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#d8c0b0] bg-[#f3e7dc] text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,d.jsx)(o.A,{className:"h-2 w-2"}),P?Q?"Opening":"error"===J?"Needs attention":"Launchpad":"Welcome"]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(L=Z.runState,"error"===L?"light"===b?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===L||O?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===L?"light"===b?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===b?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:ab})]}),(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)("p",{className:(0,y.cn)("whitespace-nowrap text-[9px] leading-[1rem] tracking-[0.08em]","light"===b?"text-[#33251c]":"text-slate-100"),children:P?Q?"AGENTOS : Opening your first workspace.":"error"===J?"AGENTOS : Workspace setup needs attention.":N?"AGENTOS : OpenClaw is ready. Choose your first action below.":T?"AGENTOS : Syncing the first workspace agent.":"AGENTOS : OpenClaw is ready. Create the first workspace below.":"AGENTOS : Bring your local OpenClaw online."})}),(0,d.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:W.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>H(a.id),className:(0,y.cn)("rounded-[14px] border px-2.5 py-2 text-left transition-colors hover:opacity-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","light"===b?"focus-visible:ring-[#c8946f] focus-visible:ring-offset-[#fff7f1]":"focus-visible:ring-white/70 focus-visible:ring-offset-[#060a12]",bl(a.state,b)),"aria-pressed":c===a.id,children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",bm(a.state,b)),children:"complete"===a.state?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):a.order}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",bn(a.state,b)),children:"complete"===a.state?"Ready":"current"===a.state?"Active":"Pending"})]})},a.id))})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-2.5 pb-2.5 sm:px-3 sm:pb-3",children:P?(0,d.jsx)(bF,{surfaceTheme:b,workspaceCount:R,agentCount:S,workspaceSetupReady:N,defaultModelLabel:U,createProgress:I,createRunState:J}):"system"===c?(0,d.jsx)(bz,{steps:X,surfaceTheme:b,statusCopy:$,showDetails:aa,phaseLabel:_,run:Z,gatewayAuthNeedsSetup:ac,onOpenGatewayAuthSettings:C}):(0,d.jsx)(bA,{snapshot:a,surfaceTheme:b,statusCopy:$,showDetails:aa,phaseLabel:_,run:Z,modelPhase:m,selectedModelId:r,modelSwitchFeedback:q,onSelectedModelIdChange:v,onClearModelSwitchFeedback:w,onOpenAddModels:B,onSnapshotChange:x})}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-auto flex flex-wrap items-center justify-between gap-1.5 border-t px-2.5 py-2 sm:px-3","light"===b?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:P?(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]","light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:T?N?"Setup complete":"error"===J?"Needs attention":"Syncing agent":"running"===J?"Building workspace":"error"===J?"Needs attention":"Ready"}):"models"===c?(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",onClick:G,disabled:"running"===Z.runState,className:"light"===b?"border border-[#d7bca7] bg-[#f8ede4] text-[#5a4131] hover:bg-[#eedbcc] hover:text-[#3f2d21]":"text-slate-500 hover:bg-white/[0.08] hover:text-slate-200",children:[(0,d.jsx)(a7.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null}),(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:P?(0,d.jsx)(d.Fragment,{children:N?(0,d.jsxs)(u.$,{type:"button",onClick:E,className:(0,y.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:["Enter AgentOS",(0,d.jsx)(a8.A,{className:"ml-1.5 h-3 w-3"})]}):Q?(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[9px] uppercase tracking-[0.16em]","light"===b?"border-[#d8c0b0] bg-white/85 text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,d.jsx)(k.A,{className:"h-3 w-3 animate-spin"}),"Building workspace"]}):(0,d.jsxs)(u.$,{type:"button",onClick:D,className:(0,y.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:["error"===J?"Retry setup":"Create Workspace",(0,d.jsx)(a8.A,{className:"ml-1.5 h-3 w-3"})]})}):(0,d.jsxs)(d.Fragment,{children:["models"!==c||O?null:(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>B(),className:bg(b),children:"Open full Add Models"}),(0,d.jsx)(u.$,{type:"button",onClick:()=>{"system"===c?"dismiss"===ad.kind?E():M?F():z():"dismiss"===ad.kind?E():"set-default"===ad.kind&&A(r||void 0)},disabled:"running"===Z.runState||"select-model"===ad.kind,className:(0,y.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:"running"===Z.runState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,d.jsxs)(d.Fragment,{children:[ad.label,(0,d.jsx)(a8.A,{className:"ml-1.5 h-3 w-3"})]})})]})})]})]})})})}var bL=c(51858),bM=c(17166),bN=c(36130),bO=c(34118);function bP({open:a,target:b,surfaceTheme:c,previewState:e,preview:f,previewError:g,runState:h,statusMessage:i,resultMessage:j,backgroundLogPath:l,log:m,confirmText:n,onConfirmTextChange:o,onRefreshPreview:p,onExecute:q,onBackToSetup:r,onOpenChange:s}){let t="full-uninstall"===b?"FULL UNINSTALL":"RESET MISSION CONTROL",v="running"===h,w="success"===h||"error"===h,x=null!==b&&"ready"===e&&!v&&!w&&n.trim()===t,z="full-uninstall"===b?"Full Uninstall":"Reset AgentOS",A="light"===c?"border-rose-400/80 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/35 bg-rose-500/90 text-white hover:bg-rose-500";return(0,d.jsx)(a2.lG,{open:a,onOpenChange:a=>{(a||!v)&&s(a)},children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("max-h-[88vh] w-[min(92vw,56rem)] max-w-[92vw] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl","light"===c?"border-[#dcc8bb] bg-[rgba(252,247,241,0.98)] text-[#402f24]":"border-white/12 bg-[rgba(7,12,22,0.96)] text-slate-100"),children:[(0,d.jsxs)(a2.c7,{children:[(0,d.jsxs)(a2.L3,{className:(0,y.cn)("flex items-center gap-2","light"===c?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===b?(0,d.jsx)(bL.A,{className:"h-4 w-4"}):(0,d.jsx)(bM.A,{className:"h-4 w-4"}),z]}),(0,d.jsx)(a2.rr,{className:"light"===c?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===b?"Remove AgentOS state, task history, OpenClaw service and local state, then attempt to remove detected OpenClaw and AgentOS CLI installs.":"Remove AgentOS-managed workspaces, attached agents, task history, planner state, and browser state."})]}),"loading"===e?(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center gap-2 rounded-[16px] border px-4 py-4 text-sm","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===e?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50 text-rose-900":"border-rose-400/25 bg-rose-500/10 text-rose-100"),children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"Preview could not be prepared."}),(0,d.jsx)("p",{className:"mt-1 text-sm",children:g||"Unknown reset preview error."})]}):null,f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,d.jsx)(bQ,{label:"Delete folders",value:String(f.summary.deleteFolderCount),surfaceTheme:c}),(0,d.jsx)(bQ,{label:"Keep folders",value:String(f.summary.metadataOnlyCount),surfaceTheme:c}),(0,d.jsx)(bQ,{label:"Agents",value:String(f.summary.agentCount),surfaceTheme:c}),(0,d.jsx)(bQ,{label:"Live agents",value:String(f.summary.liveAgentCount),surfaceTheme:c,danger:f.summary.liveAgentCount>0})]}),f.warnings.length>0?(0,d.jsx)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-amber-300/90 bg-amber-50 text-amber-950":"border-amber-300/25 bg-amber-300/10 text-amber-50"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(P.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,d.jsx)("div",{className:"space-y-1 text-sm",children:f.warnings.map(a=>(0,d.jsx)("p",{children:a},a))})]})}):null,(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-sm","light"===c?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and AgentOS integration from that location."})]}),(0,d.jsx)(u.$,{type:"button",size:"sm",variant:"secondary",onClick:p,className:"light"===c?"border-[#dcc6b6] bg-white text-[#5d4739] hover:bg-[#f7eee7] hover:text-[#5d4739]":void 0,children:"Refresh preview"})]}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:f.workspaces.map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.name}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-400"),children:a.path})]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]","delete-folder"===a.action?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:"delete-folder"===a.action?"Delete folder":"Keep folder"})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:[a.agentCount," agents, ",a.runtimeCount," tracked runs, ",a.liveAgentCount," live agents."]}),(0,d.jsx)("div",{className:"mt-2 space-y-1",children:a.reasons.map(a=>(0,d.jsx)("p",{className:(0,y.cn)("text-xs","light"===c?"text-[#7e6555]":"text-slate-500"),children:a},a))})]},a.workspaceId))})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,d.jsx)(bR,{title:"AgentOS state",items:f.missionControlPaths,surfaceTheme:c}),(0,d.jsx)(bR,{title:"Browser state",items:f.browserStorageKeys,surfaceTheme:c})]}),"full-uninstall"===b?(0,d.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,d.jsx)(bR,{title:"OpenClaw state",items:f.openClawPaths,surfaceTheme:c}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"CLI cleanup"}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:f.packageActions.map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("min-w-0 overflow-hidden rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("min-w-0 break-all text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.packageName}),(0,d.jsx)("span",{className:(0,y.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",a.detected?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a.detected?"Scheduled":"Manual"})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 break-words text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:a.reason||"No extra detail."}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-500"),children:a.command||"Automatic cleanup is not available."})]},a.packageName))})]})]}):null,(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50/70 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50"),children:[(0,d.jsxs)(bO.J,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",t," to continue"]}),(0,d.jsx)(br.p,{id:"reset-confirm",value:n,onChange:a=>o(a.target.value),placeholder:t,disabled:v,className:(0,y.cn)("mt-2 h-10","light"===c?"border-rose-200 bg-white text-rose-950 placeholder:text-rose-300":"border-rose-300/20 bg-slate-950/50 text-rose-50 placeholder:text-rose-200/35")})]})]}):null,"idle"!==h||j||m?(0,d.jsxs)("div",{className:(0,y.cn)("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===h?"light"===c?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===h?"light"===c?"border-emerald-200 bg-emerald-50 text-emerald-950":"border-emerald-400/25 bg-emerald-500/10 text-emerald-50":"light"===c?"border-[#e6d6ca] bg-white text-[#3f2f24]":"border-white/10 bg-white/[0.03] text-slate-100"),children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:i||j||"Reset status"}),j?(0,d.jsx)("p",{className:"mt-1 text-sm",children:j}):null,l?(0,d.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",l]}):null,(0,d.jsx)("pre",{className:(0,y.cn)("mt-3 max-h-56 w-full max-w-full overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-[14px] border px-3 py-3 text-[11px] leading-relaxed","light"===c?"border-[#e6d6ca] bg-[#fffaf6] text-[#5f4a3d]":"border-white/10 bg-slate-950/45 text-slate-300"),children:m||"Waiting for command output..."})]}):null,(0,d.jsxs)(a2.Es,{children:[(0,d.jsx)(u.$,{type:"button",variant:w?"default":"secondary",onClick:()=>{"full-uninstall"===b&&"success"===h?r():s(!1)},disabled:v,className:w&&"light"===c?"bg-[#5c4437] text-white hover:bg-[#4d382d]":w?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:"full-uninstall"===b&&"success"===h?"Back to setup":w?"Done":"Close"}),w?null:(0,d.jsx)(u.$,{type:"button",onClick:q,disabled:!x,className:A,children:v?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Running..."]}):(0,d.jsxs)(d.Fragment,{children:["full-uninstall"===b?(0,d.jsx)(bL.A,{className:"mr-1.5 h-3.5 w-3.5"}):(0,d.jsx)(bN.A,{className:"mr-1.5 h-3.5 w-3.5"}),z]})})]})]})})}function bQ({label:a,value:b,surfaceTheme:c,danger:e=!1}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-3",e?"light"===c?"border-rose-200 bg-rose-50":"border-rose-400/20 bg-rose-500/10":"light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 font-display text-lg","light"===c?"text-[#3f2f24]":"text-white"),children:b})]})}function bR({title:a,items:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:b.map(a=>(0,d.jsx)("p",{className:(0,y.cn)("break-all rounded-[12px] border px-3 py-2 font-mono text-[11px]","light"===c?"border-[#ece0d6] bg-[#fffaf6] text-[#6d5647]":"border-white/8 bg-white/[0.03] text-slate-400"),children:a},a))})]})}var bS=c(55421),bT=c.n(bS),bU=c(52426),bV=c(96615),bW=c(51118),bX=c(10903),bY=c(78282),bZ=c(11081),b$=c(23254),b_=c(15254),b0=c(90162),b1=c(49113);function b2(a,b,c){var d,e,f,g,h,i,j,k;let l,m,n=b3(a?.fallbackCounts),o=!function(a,b){if(0===a.length)return!1;if(!b)return!0;let c=Date.parse(b);return!Number.isFinite(c)||a.some(a=>{let b=Date.parse(a.at);return!Number.isFinite(b)||b>=c})}(a?.recentFallbackDiagnostics??[],a?.lastConnectedAt??null)?0:n,p=function(a){switch(a){case"cli-forced":return"CLI forced";case"connected":return"Connected";case"connecting":return"Connecting";case"idle":return"Idle";case"closed":return"Closed";case"error":return"Error";default:return"Unknown"}}(a?.connectionState),q=function(a){switch(a){case"live":return"Live";case"retrying":return"Retrying";default:return"Connecting"}}(b),r=(d=c,{label:function(a){switch(a){case"live":return"Gateway events: Live";case"reconnecting":return"Gateway events: Reconnecting";case"polling":return"Gateway events: Polling";default:return"Gateway events: Unknown"}}(l=d?.mode),lastEventLabel:b5(d?.lastEventAt),lastError:d?.lastError?.trim()||null,recovery:d?.recovery?.trim()||null,tone:"live"===(e=l)?"success":"reconnecting"===e||"polling"===e?"warning":"neutral"});return{modeLabel:"native-ws"===(f=a?.mode)?"Native WS":"cli"===f?"CLI forced":"Unknown",gatewayModeLabel:function(a){switch(a){case"native-ws":return"native-ws";case"cli-forced":return"cli-forced";case"fallback-active":return"fallback-active";case"degraded":return"degraded";case"unreachable":return"unreachable";default:return"unknown"}}(a?.gatewayMode),statusLabel:(g=a,g?.statusLabel?g.statusLabel:g?"cli"===g.mode||"cli-forced"===g.connectionState?"CLI fallback forced":b3(g.fallbackCounts)>0?"CLI fallback used":"connected"===g.connectionState?"Native Gateway: OK":"error"===g.connectionState?"Native Gateway: Unreachable":"Native Gateway: Degraded":"Native Gateway: Unknown"),connectionLabel:p,protocolLabel:"number"==typeof(h=a?.protocolVersion)&&Number.isFinite(h)?`v${h}`:"Unknown",protocolRangeLabel:(i=a?.protocolRange)&&"number"==typeof i.min&&"number"==typeof i.max?`v${i.min}-v${i.max} supported`:"Unknown",streamLabel:q,eventBridgeLabel:r.label,eventBridgeLastEventLabel:r.lastEventLabel,eventBridgeLastError:r.lastError,eventBridgeRecovery:r.recovery,eventBridgeTone:r.tone,fallbackTotal:n,fallbackOperationCount:b4(a?.fallbackCounts),fallbackSummaryLabel:(j=a?.fallbackTotal??n,m=b4(a?.fallbackCounts),j<=0||m<=0?"CLI fallback used: 0 operations":`CLI fallback used: ${j} ${1===j?"operation":"operations"} across ${m} ${1===m?"method":"methods"}`),lastConnectedLabel:b5(a?.lastConnectedAt),lastDisconnectedLabel:b5(a?.lastDisconnectedAt),lastNativeError:a?.lastNativeError?.trim()||null,recovery:a?.recovery?.trim()||null,recentFallbackDiagnostics:a?.recentFallbackDiagnostics??[],statusTone:"retrying"===(k={gatewayMode:a?.gatewayMode,connectionState:a?.connectionState,mode:a?.mode,streamState:b,fallbackTotal:o}).streamState||"error"===k.connectionState||"unreachable"===k.gatewayMode?"danger":"cli"===k.mode||"cli-forced"===k.connectionState||"closed"===k.connectionState||"connecting"===k.connectionState||"fallback-active"===k.gatewayMode||"degraded"===k.gatewayMode||k.fallbackTotal>0?"warning":"connected"===k.connectionState&&"live"===k.streamState?"success":"neutral"}}function b3(a){return Object.values(a??{}).reduce((a,b)=>Number.isFinite(b)&&b>0?a+b:a,0)}function b4(a){return Object.values(a??{}).filter(a=>Number.isFinite(a)&&a>0).length}function b5(a){if(!a)return"Not yet";let b=new Date(a);return Number.isNaN(b.getTime())?a:b.toLocaleString()}let b6=[{value:"auto",label:"Auto"},{value:"local-prefix",label:"Local prefix"},{value:"global-path",label:"Global PATH"},{value:"custom",label:"Custom"}],b7=[{id:"openclaw",label:"OpenClaw",icon:bU.A},{id:"gateway",label:"Gateway",icon:bV.A},{id:"models",label:"Models",icon:bW.A},{id:"workspace",label:"Workspace",icon:bX.A},{id:"agents",label:"Agents",icon:bY.A},{id:"diagnostics",label:"Diagnostics",icon:I.A},{id:"advanced",label:"Advanced",icon:bZ.A},{id:"danger-zone",label:"Danger Zone",icon:P.A,destructive:!0}];function b8(a){var b,c,e,h,i,j,l,m,n,o;let p,{snapshot:r,surfaceTheme:s,connectionState:t,gatewayDraft:v,workspaceRootDraft:w,openClawBinarySelection:x,isSavingGateway:z,isSavingWorkspaceRoot:A,isSavingOpenClawBinary:B,isCheckingForUpdates:C,updateRunState:D,selectedModelId:E,modelOnboardingRunState:F,gatewayControlAction:G,lastCheckedAt:H,onGatewayDraftChange:J,onWorkspaceRootDraftChange:K,onSelectedModelIdChange:L,onSaveGatewaySettings:M,onSaveWorkspaceRootSettings:N,onCheckForUpdates:O,onControlGateway:Q,onOpenSetupWizard:R,onRunModelRefresh:S,onRunModelSetDefault:T,onOpenAddModels:U,onOpenUpdateDialog:V,onOpenResetDialog:W,onOpenClawBinarySelectionModeChange:X,onOpenClawBinarySelectionPathChange:Y,onSaveOpenClawBinarySettings:Z,installSummary:$,sidebarOpen:_=!1}=a,[aa,ab]=(0,g.useState)(null),[ac,ad]=(0,g.useState)(null),[ae,af]=(0,g.useState)("token"),[ag,ah]=(0,g.useState)(""),[ai,aj]=(0,g.useState)(null),[ak,al]=(0,g.useState)(!1),[am,an]=(0,g.useState)(!1),[ao,ap]=(0,g.useState)(!1),[aq,ar]=(0,g.useState)(!1),[as,at]=(0,g.useState)(()=>r.diagnostics.compatibilitySmokeTest??null),[au,av]=(0,g.useState)(null),[aw,ax]=(0,g.useState)(!1),[ay,az]=(0,g.useState)(()=>r.diagnostics.configUpdatePacing),[aA,aB]=(0,g.useState)(()=>r.diagnostics.configUpdatePacing.settings.mode),[aC,aD]=(0,g.useState)(()=>String(Math.ceil((r.diagnostics.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3))),[aE,aF]=(0,g.useState)(null),[aG,aH]=(0,g.useState)(!1),[aI,aJ]=(0,g.useState)(0),[aK,aL]=(0,g.useState)(()=>cr()),[aM,aN]=(0,g.useState)(!1),aO=aM?aK:cr(),aP=!!(r.diagnostics.updateAvailable&&r.diagnostics.latestVersion),aQ=!!(r.diagnostics.version&&!r.diagnostics.latestVersion&&!r.diagnostics.updateError),aR=r.diagnostics.version||"unknown",aS=r.diagnostics.latestVersion||null,aT=r.diagnostics.updateInfo?.trim()||null,aU=r.diagnostics.updateError?.trim()||null,aV=r.diagnostics.modelReadiness.resolvedDefaultModel||r.diagnostics.modelReadiness.defaultModel||"",aW=E||aV||"",aX=r.models.find(a=>a.id===aW),aY=aX?.provider||r.diagnostics.modelReadiness.preferredLoginProvider||function(a){if(!a)return null;let[b]=a.split("/");return b||null}(aV)||"Not connected",aZ=(0,g.useMemo)(()=>r.diagnostics.commandHistory??[],[r.diagnostics.commandHistory]).slice(0,6),a$=(0,g.useMemo)(()=>({ok:aZ.filter(a=>"ok"===a.status).length,failed:aZ.filter(a=>"ok"!==a.status).length}),[aZ]),a_=(0,g.useMemo)(()=>b2(r.diagnostics.transport,t,r.diagnostics.eventBridge),[t,r.diagnostics.eventBridge,r.diagnostics.transport]),a0=r.diagnostics.capabilityMatrix,a2=r.diagnostics.compatibilityReport,a3=a0?.compatibility,a4=(r.diagnostics.gatewayFallbackDiagnostics?.length?r.diagnostics.gatewayFallbackDiagnostics:a0?.fallbackDiagnostics??[]).slice(0,4),a5=aa?aa.native.ok?"Authenticated":function(a){switch(a){case"auth":return"Needs credential";case"scope-limited":return"Needs scope repair";case"rate-limited":return"Rate limited";case"disabled":return"Disabled";case"unreachable":return"Unreachable";case"timeout":return"Timed out";case"malformed-response":return"Invalid response";default:return"Check failed"}}(aa.native.kind):"Unknown",a7=(0,g.useCallback)(async()=>{al(!0),ad(null);try{ab(await ci())}catch(a){ad(a instanceof Error?a.message:"Unable to check Gateway auth status.")}finally{al(!1)}},[]),a8=async()=>{let a=ag.trim();if(!a)return void ad("Gateway token/password is required.");an(!0),ad(null),aj(null);try{let b=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"saveCredential",kind:ae,value:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Gateway credential could not be saved.")}let c=await b.json();ab(c.authStatus),ah(""),aj("Saved to .env.local and applied to the current AgentOS server session.")}catch(a){ad(a instanceof Error?a.message:"Unable to save Gateway credential.")}finally{an(!1)}},a9=async()=>{ap(!0),ad(null),aj(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generateLocalToken"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway token could not be generated.")}let b=await a.json();ab(b.authStatus),aj("Generated a local Gateway token and applied it to AgentOS.")}catch(a){ad(a instanceof Error?a.message:"Unable to generate Gateway token.")}finally{ap(!1)}},ba=async()=>{ar(!0),ad(null),aj(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway device access could not be repaired.")}let b=await a.json();ab(b.authStatus),aj("Local Gateway device access repaired for AgentOS.")}catch(a){ad(a instanceof Error?a.message:"Unable to repair Gateway access.")}finally{ar(!1)}},bb=async()=>{ax(!0),av(null);try{let a=await fetch("/api/openclaw/compatibility-smoke",{method:"POST",cache:"no-store"});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw compatibility smoke test failed.")}let b=await a.json();at(b.report)}catch(a){av(a instanceof Error?a.message:"Unable to run OpenClaw compatibility smoke test.")}finally{ax(!1)}},bc=async()=>{aH(!0),aF(null);try{let a="custom"===aA?1e3*Math.max(1,Math.round(Number(aC)||10)):null,b=await fetch("/api/settings/config-pacing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:aA,minimumIntervalMs:a})}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to update config update pacing.");az(c.configUpdatePacing),aB(c.configUpdatePacing.settings.mode),aD(String(Math.ceil((c.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3)))}catch(a){aF(a instanceof Error?a.message:"Unable to update config update pacing.")}finally{aH(!1)}},bd=ay.cooldownUntil?Math.max(0,Date.parse(ay.cooldownUntil)-Date.now()+0*aI):null;return(0,d.jsx)("main",{className:(0,y.cn)("relative z-10 min-h-screen","light"===s?"text-[#2c211a]":"text-slate-100"),children:(0,d.jsx)("section",{className:(0,y.cn)("min-w-0 pb-8 pl-[72px] pr-3 pt-[86px] sm:pl-[84px] sm:pr-6 lg:mr-[84px] lg:px-7 xl:px-8",_?"lg:ml-[316px]":"lg:ml-[80px]"),children:(0,d.jsxs)("div",{className:"mx-auto max-w-[1160px] 2xl:max-w-[1240px]",children:[(0,d.jsx)("div",{className:"flex flex-col",children:(0,d.jsx)("nav",{"aria-label":"Settings sections",className:(0,y.cn)("flex flex-wrap gap-2 rounded-[22px] border p-2 shadow-[0_18px_44px_rgba(0,0,0,0.16)] backdrop-blur-xl","light"===s?"border-[#dfd0c2]/90 bg-[#fffaf3]/80":"border-white/[0.08] bg-[#0d1624]/88"),children:b7.map(a=>{let b=aO===a.id,c=a.icon;return(0,d.jsxs)(bT(),{href:`/settings#${a.id}`,scroll:!1,"aria-current":b?"page":void 0,onClick:()=>{aL(a.id)},className:(0,y.cn)("inline-flex h-10 items-center gap-2 rounded-[14px] border px-3 text-xs font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",b&&!a.destructive?"border-cyan-300/26 bg-cyan-300/[0.14] text-cyan-50 shadow-[0_10px_26px_rgba(34,211,238,0.12)]":b&&a.destructive?"border-rose-300/28 bg-rose-300/[0.14] text-rose-50 shadow-[0_10px_26px_rgba(244,63,94,0.12)]":"light"===s?"border-[#e2d1c4] bg-white/72 text-[#6b5546] hover:bg-[#fffdf9] hover:text-[#2f251f]":"border-white/[0.08] bg-white/[0.035] text-slate-300 hover:border-white/[0.14] hover:bg-white/[0.07] hover:text-white"),children:[(0,d.jsx)(c,{className:"h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("span",{children:a.label})]},a.id)})})}),(0,d.jsxs)("div",{className:"mt-5 flex flex-col gap-4",children:["openclaw"===aO?(0,d.jsx)("section",{id:"openclaw",className:"scroll-mt-24",children:(0,d.jsxs)("div",{className:(0,y.cn)("panel-surface panel-glow min-h-full overflow-hidden rounded-[22px] p-4","light"===s?"border-white/[0.08] bg-[linear-gradient(180deg,rgba(12,19,32,0.98),rgba(6,10,18,0.97))] text-white":"border-white/[0.08] bg-[linear-gradient(180deg,rgba(16,24,38,0.98),rgba(7,11,18,0.96))] text-slate-100"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:(0,y.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","light"===s?"border-white/10 bg-white/[0.04] text-emerald-200":"border-cyan-300/15 bg-cyan-300/10 text-cyan-200"),children:(0,d.jsx)(bU.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("h2",{className:"font-display text-lg",children:"OpenClaw"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-xs leading-5","light"===s?"text-white/54":"text-slate-400"),children:"Source of truth for runtime and control state."})]})]}),(0,d.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:[(0,d.jsx)(ca,{label:"Current version",value:`v${r.diagnostics.version||"unknown"}`,surfaceTheme:s,dark:!0}),(0,d.jsx)(ca,{label:"Latest available",value:r.diagnostics.latestVersion?`v${r.diagnostics.latestVersion}`:"Unknown",badge:aP?"Update":"Stable",surfaceTheme:s,dark:!0})]}),(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:V,disabled:!aP||"running"===D,className:"h-9 rounded-full bg-emerald-600 px-4 text-xs text-white hover:bg-emerald-500",children:["running"===D?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b$.A,{className:"h-3.5 w-3.5"}),"Update now"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void O(),disabled:C||"running"===D,className:cu(s,"px-4"),children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Check"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>R(),className:cu(s,"px-4"),children:[(0,d.jsx)(b_.A,{className:"h-3.5 w-3.5"}),"Open wizard"]})]}),(0,d.jsx)(ch,{surfaceTheme:s,isCheckingForUpdates:C,isUpdateRegistryLoading:aQ,hasUpdateAvailable:aP,currentVersion:aR,latestVersion:aS,updateInfo:aT,updateError:aU,lastCheckedAt:H,isUpdateRunning:"running"===D}),(0,d.jsxs)("div",{className:"mt-5 grid gap-3 border-t border-white/10 pt-4 sm:grid-cols-2",children:[(0,d.jsx)(ca,{label:"Detected install",value:$.label||"Unknown",surfaceTheme:s,dark:!0,compact:!0}),(0,d.jsx)(ca,{label:"Resolved path",value:co(x.resolvedPath||"openclaw",26),surfaceTheme:s,dark:!0,compact:!0})]}),(0,d.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-white/[0.035] p-3.5",children:[(0,d.jsx)(bO.J,{className:cs(s),children:"OpenClaw binary mode"}),(0,d.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:b6.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>X(a.value),className:(0,y.cn)("h-9 rounded-full border px-3 text-xs transition-colors",x.mode===a.value?"border-emerald-300 bg-emerald-300/14 text-emerald-100":"light"===s?"border-white/10 bg-white/[0.03] text-white/70 hover:bg-white/[0.08]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]"),children:a.label},a.value))}),"custom"===x.mode?(0,d.jsx)(br.p,{value:x.path??"",onChange:a=>Y(a.target.value),placeholder:"/path/to/openclaw",className:ct(s,"mt-3")}):null,(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void Z(x),disabled:B,className:cu(s,"mt-3 w-full"),children:[B?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save selection"]})]})]})}):null,"gateway"===aO?(0,d.jsx)("section",{id:"gateway",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Gateway",icon:bV.A,surfaceTheme:s,children:[(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Status",`${"remote"===(b=r).diagnostics.bindMode||b.diagnostics.configuredGatewayUrl?"Remote":"Local"} / ${r.diagnostics.loaded||r.diagnostics.rpcOk?"Online":"Offline"}`],["Native Gateway",a_.statusLabel],["Gateway mode",a_.gatewayModeLabel],["CLI fallback used",`${a_.fallbackTotal} operations`],["Endpoint",r.diagnostics.gatewayUrl||"Not configured"],["Auth status",a5],["Protocol",`${a_.protocolRangeLabel}, connected: ${a_.protocolLabel}`],["OpenClaw Compatibility",a2?ck(a2.status):"Unknown"],["Native Gateway coverage",a2?`${a2.summary.nativeGatewayCoveragePercent}% (${a2.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",a2?String(a2.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",a2?(p=[...(c=a2).summary.failedSurfaces,...c.summary.unsupportedSurfaces,...c.summary.degradedSurfaces]).length>0?cm(p,3):"None":"Unknown"],["Compatibility",function(a){switch(a?.protocol.status){case"compatible":return"Compatible";case"unsupported":return"Unsupported";default:return"Unknown"}}(a3)],["Contract audit",function(a){if(!a)return"Unknown";let b=function(a){switch(a){case"gateway-handshake":return"handshake";case"disabled":return"disabled";case"unavailable":return"unavailable";default:return a}}(a.source);switch(a.status){case"advertised":return`Advertised via ${b}`;case"verified":return`Verified via ${b}`;case"drift":return`Drift via ${b}`;default:return`Unknown via ${b}`}}(a3?.methodContract)],["Contract gaps",(e=a3?.methodContract,h=a0?.operations,e?"advertised"===e.status||"verified"===e.status?"None":"unknown"===e.status?e.reason:e.missingOperations.length>0?cn(e.missingOperations,h):`${e.missingMethodCount} methods`:"Unknown")],["Native ops",(i=a3)?`${i.nativeOperationCount} native / ${i.degradedOperationCount} limited`:"Unknown"],["Alias ops",(j=a3?.aliasOperations,l=a0?.operations,j?j.length>0?cn(j,l):"None":"Unknown")],["Limited ops",(m=a3?.degradedOperations,n=a0?.operations,m?m.length>0?cn(m,n):"None":"Unknown")],["Native chat",cj(a0?.nativeMissionDispatch)],["Config patch",cj(a0?.configPatch)],["Events",cj(a0?.eventBridge)]],successIndex:1}),(0,d.jsx)(cd,{compatibilityReport:a2,report:as,snapshot:r,capabilityMatrix:a0,transportSummary:a_,nativeAuthLabel:a5,error:au,isRunning:aw,onRun:()=>void bb(),surfaceTheme:s}),a_.recovery||a_.lastNativeError?(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] border p-3.5",cw(s)),children:[(0,d.jsx)("p",{className:cs(s),children:"Native Gateway diagnostic"}),a_.lastNativeError?(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-xs leading-5","light"===s?"text-[#6b5546]":"text-slate-300"),children:["Last native error: ",a_.lastNativeError]}):null,a_.recovery?(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===s?"text-[#52735e]":"text-slate-400"),children:["Recovery: ",a_.recovery]}):null]}):null,(0,d.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Gateway endpoint"}),(0,d.jsx)(br.p,{value:v,onChange:a=>J(a.target.value),placeholder:"ws://127.0.0.1:18789",className:ct(s,"mt-2")})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void M(v.trim()||null),disabled:z,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[z?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save endpoint"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void M(null),disabled:z,className:cu(s),children:[(0,d.jsx)(bM.A,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),(0,d.jsx)("div",{className:"mt-4 grid grid-cols-3 gap-2",children:["start","stop","restart"].map(a=>(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void Q(a),disabled:null!==G,className:(0,y.cn)(cu(s),"capitalize"),children:[G===a?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):null,a]},a))}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-emerald-200 bg-emerald-50/55":"border border-cyan-300/12 bg-cyan-300/[0.06]"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(b1.A,{className:(0,y.cn)("mt-0.5 h-4 w-4","light"===s?"text-emerald-700":"text-cyan-200")}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===s?"text-[#2f624b]":"text-slate-100"),children:"Native Gateway auth"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===s?"text-[#6f836f]":"text-slate-400"),children:"Use local repair when AgentOS reports missing operator scopes."})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void ba(),disabled:aq,className:cu(s,"px-3","gateway-contrast"),children:[aq?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b_.A,{className:"h-3.5 w-3.5"}),"Repair local access"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void a9(),disabled:ao,className:cu(s,"px-3","gateway-contrast"),children:[ao?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b1.A,{className:"h-3.5 w-3.5"}),"Generate token"]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-[112px_1fr]",children:[(0,d.jsxs)("select",{value:ae,onChange:a=>af(a.target.value),className:ct(s),children:[(0,d.jsx)("option",{value:"token",children:"Token"}),(0,d.jsx)("option",{value:"password",children:"Password"})]}),(0,d.jsx)(br.p,{type:"password",value:ag,onChange:a=>ah(a.target.value),placeholder:"Paste known credential",className:ct(s)})]}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void a8(),disabled:am,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[am?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save credential"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void a7(),disabled:ak,className:cu(s,void 0,"gateway-contrast"),children:[ak?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Test auth"]})]}),ac||ai||aa?.native.issue?(0,d.jsx)("p",{className:(0,y.cn)("mt-3 text-xs leading-5",ac?"light"===s?"text-red-700":"text-rose-300":"light"===s?"text-[#52735e]":"text-slate-400"),children:ac||ai||aa?.native.issue}):null]})]})}):null,"models"===aO?(0,d.jsx)("section",{id:"models",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Models",icon:bW.A,surfaceTheme:s,children:[(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Default model",aV||"Not selected"],["Provider",aY],["Available",`${r.diagnostics.modelReadiness.availableModelCount} of ${r.diagnostics.modelReadiness.totalModelCount}`]]}),(0,d.jsxs)("div",{className:"mt-4",children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Model"}),(0,d.jsxs)("select",{value:aW,onChange:a=>L(a.target.value),className:ct(s,"mt-2"),children:[(0,d.jsx)("option",{value:"",children:"Choose model"}),r.models.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name||a.id},a.id))]})]}),(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void T(aW),disabled:!aW||"running"===F,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:["running"===F?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(a6.A,{className:"h-3.5 w-3.5"}),"Use selected"]}),(0,d.jsx)(u.$,{type:"button",variant:"secondary",onClick:()=>U(null),className:cu(s),children:"Add models"})]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void S(),disabled:"running"===F,className:(0,y.cn)(cu(s),"mt-3 w-full"),children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Refresh models"]})]})}):null,"workspace"===aO?(0,d.jsx)("section",{id:"workspace",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Workspace",icon:bX.A,surfaceTheme:s,children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Workspace root"}),(0,d.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,d.jsx)(br.p,{value:w,onChange:a=>K(a.target.value),placeholder:"~/Documents/AgentOS",className:ct(s)}),(0,d.jsx)("button",{type:"button","aria-label":"Copy workspace root",onClick:()=>{var a;return a=w||r.diagnostics.workspaceRoot,void("u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(a))},className:(o=s,(0,y.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-[16px] border","light"===o?"border-[#e2d1c4] bg-white text-[#7b6353]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")),children:(0,d.jsx)(a1.A,{className:"h-3.5 w-3.5"})})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void N(w.trim()||null),disabled:A,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[A?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void N(null),disabled:A,className:cu(s),children:[(0,d.jsx)(bM.A,{className:"h-3.5 w-3.5"}),"Reset"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-[#eadbcf] bg-[#fbf4ec]/78":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsx)("p",{className:cs(s),children:"Current root"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 break-all text-sm","light"===s?"text-[#4f3e34]":"text-slate-200"),children:co(r.diagnostics.workspaceRoot,56)})]})]})}):null,"diagnostics"===aO?(0,d.jsx)("section",{id:"diagnostics",className:"scroll-mt-24",children:(0,d.jsx)(b9,{title:"Diagnostics",icon:I.A,surfaceTheme:s,action:(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs","light"===s?"border-[#e2d1c4] bg-white text-[#7b6353]":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300"),children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),a$.ok," OK",a$.failed?(0,d.jsxs)("span",{className:"text-red-600",children:[a$.failed," failed"]}):null]}),children:(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(ce,{summary:a_,surfaceTheme:s}),a4.length?(0,d.jsxs)("div",{className:(0,y.cn)("border-l-2 py-1 pl-3","light"===s?"border-amber-300":"border-amber-300/45"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:cs(s),children:"Gateway fallback diagnostics"}),(0,d.jsxs)("span",{className:(0,y.cn)("text-[11px]","light"===s?"text-[#8a7464]":"text-slate-400"),children:[a4.length," recent"]})]}),(0,d.jsx)("div",{className:"mt-2 space-y-2",children:a4.map(a=>(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:(0,y.cn)("text-sm font-medium","light"===s?"text-[#3b2d24]":"text-slate-100"),children:a.operationLabel}),(0,d.jsx)("code",{className:(0,y.cn)("rounded-full px-2 py-0.5 text-[10px]","light"===s?"bg-[#f3e5d8] text-[#7b6353]":"bg-white/[0.06] text-slate-300"),children:a.operation}),(0,d.jsx)("span",{className:(0,y.cn)("text-[11px]","light"===s?"text-amber-700":"text-amber-200"),children:function(a){switch(a){case"auth":return"Needs credential";case"scope-limited":return"Needs scope repair";case"protocol-mismatch":return"Protocol mismatch";case"rate-limited":return"Rate limited";case"unsupported":return"Unsupported method";case"disabled":return"Disabled";case"unreachable":return"Unreachable";case"timeout":return"Timed out";case"malformed-response":return"Invalid response";default:return"Gateway fallback"}}(a.kind)}),(0,d.jsx)("span",{className:(0,y.cn)("text-[11px]","light"===s?"text-[#8a7464]":"text-slate-500"),children:cp(a.at)})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs","light"===s?"text-[#7b6353]":"text-slate-400"),children:["Reason: ",a.issue]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-0.5 text-xs","light"===s?"text-[#8a7464]":"text-slate-500"),children:["Recovery: ",a.recovery||function(a){switch(a){case"auth":return"Check the Gateway token/password, then restart AgentOS.";case"scope-limited":return"Repair local device access so AgentOS has operator scopes.";case"protocol-mismatch":return"Update OpenClaw or AgentOS so the Gateway protocol versions overlap.";case"rate-limited":return"Wait for the Gateway cooldown to expire, then retry the config action.";case"unsupported":return"Update OpenClaw or check AgentOS/OpenClaw compatibility for this method.";case"timeout":return"Restart the Gateway and inspect OpenClaw diagnostics for slow handlers.";case"unreachable":return"Start or repair the OpenClaw Gateway.";case"malformed-response":return"Update OpenClaw or report the incompatible Gateway response.";default:return"Inspect diagnostics and retry after Gateway repair."}}(a.kind)]})]},`${a.at}-${a.operation}`))})]}):null,aZ.length?aZ.map(a=>(0,d.jsxs)("details",{className:(0,y.cn)("group rounded-[16px] border","light"===s?"border-[#e7d8ca] bg-[#fffdf9]":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,d.jsxs)("code",{className:(0,y.cn)("min-w-0 flex-1 truncate font-mono text-[11px]","light"===s?"text-[#3b2d24]":"text-slate-200"),children:[a.command," ",a.args.join(" ")]}),(0,d.jsx)("span",{className:(0,y.cn)("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]","ok"===a.status?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-red-200 bg-red-50 text-red-700"),children:a.status}),(0,d.jsxs)("span",{className:(0,y.cn)("hidden text-xs sm:inline","light"===s?"text-[#9a8271]":"text-slate-400"),children:[a.durationMs," ms"]}),(0,d.jsx)(q.A,{className:(0,y.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===s?"text-[#9a8271]":"text-slate-400")})]}),(0,d.jsxs)("div",{className:(0,y.cn)("border-t p-3.5","light"===s?"border-[#eadbcf]":"border-white/[0.08]"),children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(cc,{title:"stdout",value:a.stdoutPreview,surfaceTheme:s}),(0,d.jsx)(cc,{title:"stderr",value:a.stderrPreview,surfaceTheme:s})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-3 text-xs","light"===s?"text-[#8a7464]":"text-slate-400"),children:["Exit code: ",a.exitCode??"n/a"," | Started: ",cp(a.startedAt)]})]})]},a.id)):(0,d.jsx)(cg,{title:"No recent CLI calls",detail:"Diagnostics will appear after AgentOS uses fallback commands.",surfaceTheme:s})]})})}):null,"agents"===aO?(0,d.jsx)("section",{id:"agents",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Agents",icon:bY.A,surfaceTheme:s,children:[(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Agents",String(r.agents.length)],["Workspaces",String(r.workspaces.length)],["Active runtimes",String(r.runtimes.filter(a=>"running"===a.status).length)]]}),(0,d.jsx)(u.$,{asChild:!0,variant:"secondary",className:(0,y.cn)(cu(s),"mt-4 w-full"),children:(0,d.jsx)(bT(),{href:"/",children:"Open mission control"})})]})}):null,"advanced"===aO?(0,d.jsx)("section",{id:"advanced",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Advanced",icon:bZ.A,surfaceTheme:s,children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,d.jsx)(ca,{label:"Install method",value:r.diagnostics.updateInstallKind||$.label||"Unknown",surfaceTheme:s}),(0,d.jsx)(ca,{label:"Updater",value:r.diagnostics.updatePackageManager||"Unknown",surfaceTheme:s}),(0,d.jsx)(ca,{label:"Last checked",value:H?new Date(H).toLocaleTimeString():"Not checked",surfaceTheme:s})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-[#eadbcf] bg-[#fbf4ec]/78":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsx)("p",{className:cs(s),children:"Install root"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 break-all text-sm","light"===s?"text-[#4f3e34]":"text-slate-200"),children:co(r.diagnostics.updateRoot||$.root||"Not detected",80)})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-[#eadbcf] bg-[#fbf4ec]/78":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:cs(s),children:"Config update pacing"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===s?"text-[#7b6353]":"text-slate-400"),children:"Controls how often AgentOS attempts OpenClaw config updates. It does not change the OpenClaw Gateway rate limit."})]}),(0,d.jsx)("span",{className:(0,y.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.12em]",ay.pending?"light"===s?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/24 bg-amber-300/[0.08] text-amber-200":"light"===s?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/[0.08] text-emerald-200"),children:ay.pending?"Pending config update":"Idle"})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-3",children:[(0,d.jsx)("button",{type:"button",onClick:()=>aB("respect-gateway"),className:cv(s,"respect-gateway"===aA),children:"Respect Gateway"}),(0,d.jsx)("button",{type:"button",onClick:()=>aB("fast-local-testing"),className:cv(s,"fast-local-testing"===aA),children:"Fast testing"}),(0,d.jsx)("button",{type:"button",onClick:()=>aB("custom"),className:cv(s,"custom"===aA),children:"Custom"})]}),"custom"===aA?(0,d.jsxs)("div",{className:"mt-3",children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Minimum local interval, seconds"}),(0,d.jsx)(br.p,{type:"number",min:1,max:600,value:aC,onChange:a=>aD(a.target.value),className:ct(s,"mt-2")})]}):null,(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Current mode",function(a){switch(a){case"fast-local-testing":return"Fast local testing";case"custom":return"Custom";default:return"Respect Gateway cooldown"}}(ay.settings.mode)],["Minimum local interval",cq(ay.settings.minimumIntervalMs)],["Pending paths",ay.pendingPaths.length?ay.pendingPaths.join(", "):"None"],["Retry countdown",null!==bd?cq(bd):"None"],["CLI fallback","Disabled for Gateway config cooldown recovery"]]}),ay.lastIssue?(0,d.jsxs)("p",{className:(0,y.cn)("mt-3 text-xs leading-5","light"===s?"text-amber-700":"text-amber-200"),children:["Last Gateway issue: ",ay.lastIssue]}):null,aE?(0,d.jsx)("p",{className:(0,y.cn)("mt-3 text-xs leading-5","light"===s?"text-red-700":"text-rose-300"),children:aE}):null,(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void bc(),disabled:aG,className:(0,y.cn)(cu(s),"mt-3 w-full"),children:[aG?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save pacing"]})]})]})}):null,"danger-zone"===aO?(0,d.jsx)("section",{id:"danger-zone",className:"scroll-mt-24",children:(0,d.jsx)("div",{className:(0,y.cn)("rounded-[22px] p-4 shadow-[0_18px_44px_rgba(185,28,28,0.06)]","light"===s?"border border-red-200 bg-red-50/58":"border border-rose-400/20 bg-rose-500/[0.08]"),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:(0,y.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","light"===s?"border-red-200 bg-white text-red-600":"border-rose-300/20 bg-rose-400/10 text-rose-200"),children:(0,d.jsx)(P.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:(0,y.cn)("font-display text-lg","light"===s?"text-red-700":"text-rose-100"),children:"Danger Zone"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5 max-w-2xl text-sm leading-6","light"===s?"text-red-700/72":"text-rose-100/80"),children:"These actions are destructive and cannot be undone. Confirmation is required before anything runs."})]})]}),(0,d.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 md:min-w-[340px]",children:[(0,d.jsxs)(u.$,{type:"button",variant:"destructive",onClick:()=>W("mission-control"),className:"h-9 rounded-full bg-red-600 text-xs text-white hover:bg-red-500",children:[(0,d.jsx)(bN.A,{className:"h-3.5 w-3.5"}),"Reset AgentOS"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>W("full-uninstall"),className:(0,y.cn)("h-9 rounded-full text-xs","light"===s?"border-red-200 bg-white text-red-700 hover:bg-red-50":"border-rose-300/20 bg-[#121d2d] text-rose-100 hover:bg-[#182538]"),children:[(0,d.jsx)(bN.A,{className:"h-3.5 w-3.5"}),"Full uninstall"]})]})]})})}):null]})]})})})}function b9({title:a,icon:b,children:c,action:e,surfaceTheme:f}){return(0,d.jsxs)("div",{className:(0,y.cn)("min-h-full rounded-[22px] p-4 shadow-[0_20px_54px_rgba(101,74,54,0.07)] backdrop-blur-xl","light"===f?"border-[#dfd0c2]/90 bg-[#fffaf3]/80 text-[#2d211b]":"border-white/[0.08] bg-[#0d1624]/96 text-slate-100 shadow-[0_20px_54px_rgba(0,0,0,0.26)]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"light"===f?"flex h-10 w-10 items-center justify-center rounded-full border border-emerald-200 bg-emerald-50 text-emerald-700":"flex h-10 w-10 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-300/10 text-cyan-200",children:(0,d.jsx)(b,{className:"h-4 w-4"})}),(0,d.jsx)("h2",{className:(0,y.cn)("font-display text-lg","light"===f?"text-[#2d211b]":"text-slate-100"),children:a})]}),e]}),(0,d.jsx)("div",{className:"mt-4",children:c})]})}function ca({label:a,value:b,badge:c,surfaceTheme:e,dark:f=!1,compact:g=!1}){let h=f||"dark"===e;return(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px]",h?"text-white/54":"text-[#8a7464]"),children:a}),(0,d.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("min-w-0 truncate font-medium",g?"text-sm":"text-[1.05rem]",h?"text-white":"text-[#2f251f]"),title:b,children:b}),c?(0,d.jsx)("span",{className:(0,y.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",h?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"border-emerald-200 bg-emerald-50 text-emerald-700"),children:c}):null]})]})}function cb({rows:a,successIndex:b,surfaceTheme:c}){let e="dark"===c;return(0,d.jsx)("div",{className:(0,y.cn)("overflow-hidden rounded-[18px] border","light"===c?"border-[#eadbcf] bg-[#fffdf9]":"border-white/[0.08] bg-[#0f1826]"),children:a.map(([a,f],g)=>(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center justify-between gap-3 px-3.5 py-2.5 last:border-b-0","light"===c?"border-b border-[#eadbcf]":"border-b border-white/[0.08]"),children:[(0,d.jsx)("span",{className:(0,y.cn)("text-sm",e?"text-slate-400":"text-[#8a7464]"),children:a}),(0,d.jsx)("span",{className:(0,y.cn)("min-w-0 truncate text-right text-sm",e?"text-slate-100":"text-[#352820]",b===g?e?"rounded-full border border-emerald-300/20 bg-emerald-300/10 px-2 py-1 text-xs text-emerald-100":"rounded-full border border-emerald-200 bg-emerald-50 px-2 py-1 text-xs text-emerald-700":""),title:f,children:f})]},a))})}function cc({title:a,value:b,surfaceTheme:c}){let e="dark"===c;return(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:cs(c),children:a}),(0,d.jsx)("pre",{className:(0,y.cn)("mt-2 max-h-40 overflow-auto rounded-[14px] border p-3 text-xs",e?"border-white/[0.08] bg-[#0d1624]/92 text-slate-200":"border-[#eadbcf] bg-[#fbf4ec] text-[#4b3a30]"),children:b||"No output"})]})}function cd({compatibilityReport:a,report:b,snapshot:c,capabilityMatrix:e,transportSummary:f,nativeAuthLabel:g,error:h,isRunning:i,onRun:j,surfaceTheme:l}){var m;let n,o=b?.compatibility,p=a?.status,r=o?`v${o.agentOsSupportedProtocolRange.min}-v${o.agentOsSupportedProtocolRange.max}`:a?`v${a.gateway.protocolRange.min}-v${a.gateway.protocolRange.max}`:f.protocolRangeLabel,s=o?.lastFallbackReason||a?.fallback.diagnostics[0]?.issue||c.diagnostics.gatewayFallbackDiagnostics?.[0]?.issue||"None",t=o?.lastNativeError||f.lastNativeError||"None",v=a?.recovery||b?.recovery||f.recovery||c.diagnostics.issues[0]||"OpenClaw compatibility is not available yet.",w=p?ck(p):b?function(a){switch(a){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}(b.status):"Unknown",x=p?function(a){switch(a){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(p):b?function(a){switch(a){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(b.status):"neutral",z=b?b.safeToDispatchMissions?"Safe to dispatch":"Do not dispatch":a?"compatible"===a.status?"Compatible":"degraded"===a.status?"Degraded":"Incompatible":"Not tested",A=a?[...a.summary.failedSurfaces,...a.summary.unsupportedSurfaces,...a.summary.degradedSurfaces]:[],B=a?.contracts.filter(a=>"ok"!==a.status).slice(0,5)??[];return(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] border p-3.5",cw(l)),children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:cs(l),children:"Compatibility"}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("font-medium","light"===l?"text-[#2f251f]":"text-slate-100"),children:w}),(0,d.jsx)("span",{className:cf(x,l),children:z})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs","light"===l?"text-[#8a7464]":"text-slate-400"),children:["Report: ",a?cp(a.generatedAt):"Not available",b?` / Smoke: ${cp(b.checkedAt)}`:""]})]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:j,disabled:i,className:cu(l,"px-4"),children:[i?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(bU.A,{className:"h-3.5 w-3.5"}),i?"Running...":"Run OpenClaw Smoke Test"]})]}),(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(cb,{surfaceTheme:l,rows:[["Installed OpenClaw",cl(a?.openClaw.installedVersion??o?.installedVersion??c.diagnostics.version??null)],["Required OpenClaw",cl(o?.requiredOpenClawVersion??a?.openClaw.supportedBaselineVersion??null)],["Recommended OpenClaw",cl(a?.openClaw.recommendedVersion??o?.recommendedOpenClawVersion??c.diagnostics.latestVersion??null)],["Gateway protocol status",a?(n=(m=a).gateway.protocolVersion?`v${m.gateway.protocolVersion}`:"unknown",`${n} / ${m.gateway.protocolStatus}`):o?.gatewayProtocolVersion?`v${o.gatewayProtocolVersion}`:e?.gatewayProtocolVersion?`v${e.gatewayProtocolVersion}`:f.protocolLabel],["AgentOS protocol range",r],["Native Gateway coverage",a?`${a.summary.nativeGatewayCoveragePercent}% (${a.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",a?String(a.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",a?A.length>0?cm(A,3):"None":"Unknown"],["Node.js",o?.nodeVersion?`${o.nodeVersion} / ${function(a){switch(a){case"supported":return"Supported";case"unsupported":return"Unsupported";default:return"Unknown"}}(o.nodeStatus)}`:"Run smoke test"],["Gateway auth",o?.gatewayAuthStatus||g],["Native Gateway",a?`${a.gateway.health} / ${a.gateway.capabilitySource}`:o?.nativeGatewayStatus||f.statusLabel],["CLI fallback count",String(o?.cliFallbackUsageCount??f.fallbackTotal)],["Last native error",t],["Last fallback reason",s]]})}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border p-3 text-xs leading-5","light"===l?"border-[#eadbcf] bg-[#fffdf9] text-[#5a4638]":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,d.jsx)("p",{className:cs(l),children:"Recovery suggestion"}),(0,d.jsx)("p",{className:"mt-1.5",children:v}),h?(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5","light"===l?"text-rose-700":"text-rose-200"),children:h}):null]}),B.length>0?(0,d.jsx)("div",{className:"mt-3 space-y-2",children:B.map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border p-3","light"===l?"border-[#eadbcf] bg-[#fffdf9]":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:cf(function(a){switch(a){case"ok":return"success";case"degraded":return"warning";case"unsupported":case"failed":return"danger"}}(a.status),l),children:function(a){switch(a){case"ok":return"OK";case"degraded":return"Degraded";case"unsupported":return"Unsupported";case"failed":return"Failed"}}(a.status)}),(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===l?"text-[#3b2d24]":"text-slate-100"),children:a.label})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 text-xs leading-5","light"===l?"text-[#6b5546]":"text-slate-300"),children:a.reason}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===l?"text-[#52735e]":"text-slate-400"),children:["Recovery: ",a.suggestedRecovery]})]},a.operation))}):null,b?.checks.length?(0,d.jsx)("div",{className:"mt-3 space-y-2",children:b.checks.map(a=>(0,d.jsxs)("details",{className:(0,y.cn)("group rounded-[16px] border","light"===l?"border-[#e7d8ca] bg-[#fffdf9]":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,d.jsx)("span",{className:cf(function(a){switch(a){case"pass":return"success";case"warning":return"warning";case"fail":return"danger";default:return"neutral"}}(a.status),l),children:function(a){switch(a){case"pass":return"Pass";case"warning":return"Warning";case"fail":return"Fail";default:return"Unknown"}}(a.status)}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:(0,y.cn)("truncate text-sm font-medium","light"===l?"text-[#3b2d24]":"text-slate-100"),children:a.label}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 truncate text-xs","light"===l?"text-[#8a7464]":"text-slate-400"),children:a.summary})]}),(0,d.jsxs)("span",{className:(0,y.cn)("hidden text-xs sm:inline","light"===l?"text-[#9a8271]":"text-slate-400"),children:[a.durationMs," ms"]}),(0,d.jsx)(q.A,{className:(0,y.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===l?"text-[#9a8271]":"text-slate-400")})]}),(0,d.jsxs)("div",{className:(0,y.cn)("border-t p-3.5","light"===l?"border-[#eadbcf]":"border-white/[0.08]"),children:[a.recovery?(0,d.jsxs)("p",{className:(0,y.cn)("mb-3 text-xs leading-5","light"===l?"text-[#6b5546]":"text-slate-300"),children:["Recovery: ",a.recovery]}):null,(0,d.jsx)(cc,{title:"raw details",value:function(a){if(null==a)return"No raw details";if("string"==typeof a)return a;try{return JSON.stringify(a,null,2)}catch{return String(a)}}(a.rawDetails),surfaceTheme:l})]})]},a.id))}):(0,d.jsx)(cg,{title:"No compatibility smoke report",detail:"Run the smoke test to verify OpenClaw binary, Gateway, models, sessions, tasks, config, events, and fallback behavior.",surfaceTheme:l})]})}function ce({summary:a,surfaceTheme:b}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border p-3.5",cw(b)),children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:cs(b),children:"Gateway Transport"}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("font-medium","light"===b?"text-[#2f251f]":"text-slate-100"),children:a.statusLabel}),(0,d.jsx)("span",{className:cf(a.statusTone,b),children:a.gatewayModeLabel})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs","light"===b?"text-[#8a7464]":"text-slate-400"),children:[a.connectionLabel," / ",a.modeLabel]})]}),(0,d.jsxs)("div",{className:"text-left sm:text-right",children:[(0,d.jsx)("p",{className:cs(b),children:"Snapshot stream"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5 text-sm","light"===b?"text-[#4f3e34]":"text-slate-200"),children:a.streamLabel})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-4",children:[(0,d.jsx)(ca,{label:"Protocol support",value:a.protocolRangeLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Connected protocol",value:a.protocolLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"CLI fallback used",value:String(a.fallbackTotal),badge:a.fallbackTotal>0?"Used":"Clean",surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Last connected",value:a.lastConnectedLabel,surfaceTheme:b,dark:"dark"===b,compact:!0})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(ca,{label:"Last disconnected",value:a.lastDisconnectedLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Fallback summary",value:a.fallbackSummaryLabel,surfaceTheme:b,dark:"dark"===b,compact:!0})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(ca,{label:"Gateway event stream",value:a.eventBridgeLabel,badge:"success"===a.eventBridgeTone?"Live":"warning"===a.eventBridgeTone?"Degraded":"Unknown",surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Last Gateway event",value:a.eventBridgeLastEventLabel,surfaceTheme:b,dark:"dark"===b,compact:!0})]}),a.lastNativeError?(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(cc,{title:"Last native error",value:a.lastNativeError,surfaceTheme:b})}):null,a.eventBridgeLastError?(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(cc,{title:"Last event stream error",value:a.eventBridgeLastError,surfaceTheme:b})}):null,a.recovery?(0,d.jsxs)("p",{className:(0,y.cn)("mt-3 text-xs leading-5","light"===b?"text-[#52735e]":"text-slate-400"),children:["Recovery: ",a.recovery]}):null,a.eventBridgeRecovery?(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-xs leading-5","light"===b?"text-[#52735e]":"text-slate-400"),children:["Event stream recovery: ",a.eventBridgeRecovery]}):null]})}function cf(a,b){let c="inline-flex shrink-0 items-center rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]";return"success"===a?(0,y.cn)(c,"light"===b?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100"):"danger"===a?(0,y.cn)(c,"light"===b?"border-red-200 bg-red-50 text-red-700":"border-rose-300/20 bg-rose-300/10 text-rose-100"):"warning"===a?(0,y.cn)(c,"light"===b?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100"):(0,y.cn)(c,"light"===b?"border-[#e2d1c4] bg-white text-[#7b6353]":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300")}function cg({title:a,detail:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border border-dashed p-4 text-center","light"===c?"border-[#decfc2] bg-[#fbf4ec]/60":"border-white/[0.08] bg-[#0d1624]/60"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===c?"text-[#5f493b]":"text-slate-100"),children:a}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-xs","light"===c?"text-[#8a7464]":"text-slate-400"),children:b})]})}function ch({surfaceTheme:a,isCheckingForUpdates:b,isUpdateRegistryLoading:c,hasUpdateAvailable:e,currentVersion:f,latestVersion:g,updateInfo:h,updateError:i,lastCheckedAt:j,isUpdateRunning:l}){let m=b||l,n=b?"Checking registry":l?"Updating":e?"Update available":i?"Check failed":c?"Registry loading":"Up to date",o=e?"light"===a?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":i?"light"===a?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/20 bg-rose-300/10 text-rose-100":m||c?"light"===a?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100":"light"===a?"border-slate-300 bg-white text-slate-600":"border-white/10 bg-[#0f1826] text-slate-300",p=b?"Refreshing OpenClaw update registry...":l?"Installing the selected OpenClaw update.":e?"A newer release is available and ready to install.":i?"OpenClaw returned an error while checking updates.":c?"OpenClaw has not reported a latest release yet.":"No newer release is currently available.";return(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[20px] border p-3.5",cw(a)),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.18em]",cx(a)),children:"Update status"}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[m?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin text-emerald-400"}):null,(0,d.jsx)("p",{className:(0,y.cn)("font-medium","light"===a?"text-[#2f251f]":"text-slate-100"),children:n}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",o),children:e?"Ready":m?"Working":i?"Attention":"Stable"})]})]}),(0,d.jsxs)("div",{className:"text-right",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.18em]",cx(a)),children:"Last checked"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[11px]","light"===a?"text-[#6b5546]":"text-slate-300"),children:j?new Date(j).toLocaleTimeString():"Not yet"})]})]}),(0,d.jsx)("div",{className:"mt-3 h-2 overflow-hidden rounded-full bg-black/10 dark:bg-white/10",children:(0,d.jsx)("div",{className:(0,y.cn)("h-full rounded-full transition-all",m?"w-1/2 animate-pulse bg-emerald-400/80":e?"w-full bg-emerald-500":i?"w-2/3 bg-rose-400":"w-5/6 bg-slate-400/70")})}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,d.jsx)(ca,{label:"Current version",value:`v${f}`,surfaceTheme:a,dark:"dark"===a,compact:!0}),(0,d.jsx)(ca,{label:"Latest available",value:g?`v${g}`:"Unknown",badge:e?"Ready":i?"Error":m||c?"Loading":"Stable",surfaceTheme:a,dark:"dark"===a,compact:!0})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[18px] border p-3 text-[11px] leading-5","light"===a?"border-[#eadbcf] bg-[#fffdf9] text-[#5a4638]":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.18em]",cx(a)),children:"Details"}),(0,d.jsx)("p",{className:"mt-1.5",children:p}),h?(0,d.jsx)("p",{className:"mt-1.5 opacity-90",children:h}):null,i?(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5","light"===a?"text-rose-700":"text-rose-200"),children:i}):null,e?(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em]",children:[(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-1",o),children:"Update ready"}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-1",cx(a)),children:"Review before install"})]}):null]})]})}async function ci(){let a=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to check Gateway auth status.")}return(await a.json()).authStatus}function cj(a){return"supported"===a?"Supported":"unsupported"===a?"Fallback":"Unknown"}function ck(a){switch(a){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}function cl(a){return a?`v${a.replace(/^v/i,"")}`:"Unknown"}function cm(a,b){let c=Array.from(new Set(a)),d=c.slice(0,b),e=c.length>d.length?` +${c.length-d.length}`:"";return`${d.join(", ")}${e}`}function cn(a,b){let c=a.slice(0,3).map(a=>(function(a,b){let[c,d]=a.split(/:\s*/,2),e=b?.[c],f=e?.label??((c||a).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[._-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase())||"Gateway operation");return!d&&e?.recovery&&"gateway-native"!==e.mode?`${f}: ${e.recovery}`:d?`${f} via ${d}`:f})(a,b)),d=a.length>c.length?` +${a.length-c.length}`:"";return`${a.length}: ${c.join(", ")}${d}`}function co(a,b){let c=(0,x.$7)(a);return c.length<=b?c:`${c.slice(0,Math.max(0,b-3))}...`}function cp(a){let b=new Date(a);return Number.isNaN(b.getTime())?a:b.toLocaleString()}function cq(a){if(!a||a<=0)return"Gateway cooldown only";let b=Math.ceil(a/1e3);if(b<60)return`${b}s`;let c=Math.floor(b/60),d=b%60;return d?`${c}m ${d}s`:`${c}m`}function cr(){return"openclaw"}function cs(a){return(0,y.cn)("text-[10px] uppercase tracking-[0.18em]","light"===a?"text-[#9a8271]":"text-slate-400")}function ct(a,b){return(0,y.cn)("h-10 rounded-[16px] px-3 text-sm outline-none",b,"light"===a?"border-[#e2d1c4] bg-[#fffdf9] text-[#2d211b] placeholder:text-[#ad9889]":"border-white/10 bg-[#0f1826] text-slate-100 placeholder:text-slate-500")}function cu(a,b,c){return(0,y.cn)("h-9 rounded-full px-3 text-xs",b,"light"===a?"border-[#d7c4b6] bg-white text-[#6b5546] hover:bg-[#f4e9de]":"gateway-contrast"===c?"border-emerald-300/15 bg-[#0f1826] text-slate-100 hover:bg-[#182538]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function cv(a,b){return(0,y.cn)("h-9 rounded-full border px-3 text-xs transition-colors",b?"light"===a?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-cyan-300/24 bg-cyan-300/[0.12] text-cyan-100":"light"===a?"border-[#e2d1c4] bg-white text-[#6b5546] hover:bg-[#f4e9de]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function cw(a){return"light"===a?"border-[#eadbcf] bg-[#f9f1e8]/80":"border-white/[0.08] bg-[#101a2a]/92"}function cx(a){return"light"===a?"text-[#8c7564]":"text-slate-400"}var cy=c(607),cz=c(63685),cA=c(218),cB=c(47094),cC=c(3564),cD=c(61655);let cE=[];function cF({open:a,task:b,snapshot:c,surfaceTheme:e,onOpenChange:h,onAccept:i,onContinue:j,onRetry:l,onDismiss:m,onOpenEvidence:n}){var o,p,q;let r,s,t,v,[w,z]=(0,g.useState)(null),A=(0,g.useMemo)(()=>{var a;return Array.isArray(a=b?.metadata.optimisticEvents)?a.filter(cJ):[]},[b?.metadata.optimisticEvents]),{detail:B,loading:C,error:D}=function(a,b,c={}){let[d,e]=(0,g.useState)({taskId:null,feed:[],detail:null}),[f,h]=(0,g.useState)(null),[i,j]=(0,g.useState)({taskId:null,message:null}),[k,l]=(0,g.useState)({taskId:null,message:null}),m="string"==typeof c.dispatchId&&c.dispatchId.trim()?c.dispatchId.trim():null,n=a.startsWith("optimistic-task:"),o=b&&n&&!m?c.optimisticFeed??cE:null,p=o??(d.taskId===a?d.feed:[]),q=o?null:d.taskId===a?d.detail:null,r=o?null:i.taskId===a?i.message:null,s=o?null:k.taskId===a?k.message:null;return{feed:p,detail:q,loading:!o&&b&&f!==a&&null===r,error:r,streamNotice:s}}(b?.id??"task-review:none",a&&!!b,{dispatchId:b?.dispatchId,optimisticFeed:A}),E=function(a,b){if(!a||!b)return a??b;let c=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(a=>[a,b.metadata[a]]).filter(([,a])=>void 0!==a));return 0===Object.keys(c).length?a:{...a,metadata:{...a.metadata,...c}}}(B?.task,b),F=B?.integrity??null,H=E?c.workspaces.find(a=>a.id===E.workspaceId)??null:null,I=E?c.agents.find(a=>a.id===E.primaryAgentId)??null:null,J=[...B?.liveFeed??[]].reverse().find(a=>"assistant"===a.kind||"tool"===a.kind||"artifact"===a.kind)??null,K=E?ad(E,{hasLiveActivity:"running"===E.status||"queued"===E.status||E.liveRunCount>0,latestEvidenceAt:J?.timestamp??null}):null,L=E?ab(E):null,M=E?ac(E):null,N=E?(o=E,r="string"==typeof(p=F?.finalResponseText)?p.trim():"",s="string"==typeof o.metadata.finalResponseText?o.metadata.finalResponseText.trim():"",t="string"==typeof o.metadata.resultPreview?o.metadata.resultPreview.trim():"",v=o.subtitle.trim(),r||s||t||v):"",O=E?(q=E,q.mission?.trim()||q.title.trim()||"Untitled task"):"",Q=F?.issues.find(a=>"partial-final-response"===a.id)??F?.issues[0]??null,R=F?.status==="verified"&&!Q,S=K?ae(K):R?"verified":"needs review",T=K?af(K):Q?.detail||(R?"AgentOS recovered a matching completed response and no review issues remain.":"The captured task evidence needs an operator decision before AgentOS treats the result as handled."),U="light"===e,V=null!==w,W=async(a,b)=>{if(!w){z(a);try{await b()}finally{z(null)}}};return(0,d.jsx)(a2.lG,{open:a,onOpenChange:h,children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("flex h-[min(780px,calc(100dvh-32px))] w-[calc(100vw-24px)] max-w-[900px] flex-col gap-0 overflow-hidden rounded-[26px] border-white/10 p-0",U?"bg-white/95 text-slate-950 shadow-[0_24px_80px_rgba(15,23,42,0.22)]":"bg-[linear-gradient(180deg,rgba(8,13,24,0.98),rgba(4,7,14,0.98))] text-white"),closeClassName:U?"text-slate-500 hover:bg-slate-950/5 hover:text-slate-900":void 0,children:[(0,d.jsx)("div",{className:(0,y.cn)("border-b px-5 py-4",U?"border-slate-200/80 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-3 pr-9",children:[(0,d.jsx)("div",{className:(0,y.cn)("mt-0.5 flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border","accepted"===K||R?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"border-amber-300/30 bg-amber-400/12 text-amber-100"),children:"accepted"===K||R?(0,d.jsx)(a0.A,{className:"h-4 w-4"}):(0,d.jsx)(P.A,{className:"h-4 w-4"})}),(0,d.jsxs)(a2.c7,{className:"min-w-0 flex-1 space-y-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(ag.E,{variant:"accepted"===K||R?"success":K?"muted":"warning",children:S}),E?.dispatchId?(0,d.jsxs)(ag.E,{variant:"muted",children:["dispatch ",(0,x.m_)(E.dispatchId,8)]}):null]}),(0,d.jsx)(a2.L3,{className:(0,y.cn)("truncate text-lg",U&&"text-slate-950"),children:E?.title.trim()||"Task review"}),(0,d.jsxs)(a2.rr,{className:U?"text-slate-600":void 0,children:[H?.name||"Workspace",I?` \xb7 ${(0,x.CK)(I)}`:""]})]})]})}),(0,d.jsx)(cD.F,{className:"min-h-0 flex-1",children:(0,d.jsxs)("div",{className:"grid gap-4 p-5 lg:grid-cols-[minmax(0,1fr)_290px]",children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(cG,{icon:cz.A,title:"Captured output",tone:"accepted"===K||R?"success":"warning",isLight:U,children:N?(0,d.jsx)(Y,{text:N,className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-800":"text-slate-100")}):(0,d.jsx)("p",{className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-500":"text-slate-400"),children:"No captured assistant output is available yet."})}),(0,d.jsxs)(cG,{icon:P.A,title:"Review reason",tone:"warning",isLight:U,children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-700":"text-slate-200"),children:T}),M?(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-[11px]","text-slate-500"),children:["Last operator action: ",M]}):null]}),(0,d.jsx)(cG,{icon:cA.A,title:"Original prompt",isLight:U,children:(0,d.jsx)(Y,{text:O||"No original prompt was captured.",className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-700":"text-slate-200")})})]}),(0,d.jsxs)("aside",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border p-3",U?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Evidence"}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsx)(cH,{label:"Runs",value:String(E?.runtimeCount??0),isLight:U}),(0,d.jsx)(cH,{label:"Turns",value:String(function(a){if(!a)return 0;let b=a.metadata.turnCount;return"number"==typeof b&&Number.isFinite(b)?b:a.runtimeCount}(E)),isLight:U}),(0,d.jsx)(cH,{label:"Files",value:String(E?.artifactCount??0),isLight:U}),(0,d.jsx)(cH,{label:"Issues",value:String(F?.issues.length??E?.warningCount??0),isLight:U})]}),C?(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 flex items-center gap-2 text-[11px]",U?"text-slate-500":"text-slate-400"),children:[(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}),"Loading live evidence..."]}):null,D?(0,d.jsx)("p",{className:"mt-3 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[11px] leading-5 text-amber-100",children:D}):null]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border p-3",U?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Task state"}),(0,d.jsxs)("div",{className:"mt-3 space-y-2 text-[12px]",children:[(0,d.jsx)(cI,{label:"Status",value:E?.status??"unknown",isLight:U}),(0,d.jsx)(cI,{label:"Updated",value:E?.updatedAt?(0,x.fw)(E.updatedAt):"unknown",isLight:U}),(0,d.jsx)(cI,{label:"Reviewed",value:L?(0,x.fw)(Date.parse(L)):"not yet",isLight:U})]})]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",className:(0,y.cn)("w-full justify-start gap-2",U&&"border-slate-200 bg-slate-50 text-slate-800 hover:bg-slate-100"),disabled:!E||V,onClick:()=>{E&&n(E,"output")},children:[(0,d.jsx)(G.A,{className:"h-4 w-4"}),"Open evidence"]})]})]})}),(0,d.jsxs)("div",{className:(0,y.cn)("flex flex-col gap-2 border-t px-5 py-4 sm:flex-row sm:items-center sm:justify-end",U?"border-slate-200 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:[(0,d.jsxs)(u.$,{type:"button",variant:"ghost",className:(0,y.cn)("gap-2",U&&"text-slate-700 hover:bg-slate-950/5 hover:text-slate-950"),disabled:!E||V,onClick:()=>void W("dismiss",()=>{if(E)return m(E)}),children:["dismiss"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(cB.A,{className:"h-4 w-4"}),"dismiss"===w?"Dismissing...":"Dismiss"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",className:(0,y.cn)("gap-2",U&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!E||V,onClick:()=>void W("retry",()=>{if(E)return l(E)}),children:["retry"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(f.A,{className:"h-4 w-4"}),"retry"===w?"Preparing...":"Retry"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",className:(0,y.cn)("gap-2",U&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!E||V,onClick:()=>void W("continue",()=>{if(E)return j(E,N)}),children:["continue"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(cC.A,{className:"h-4 w-4"}),"continue"===w?"Continuing...":"Continue task"]}),(0,d.jsxs)(u.$,{type:"button",className:"gap-2 bg-emerald-400 text-slate-950 shadow-emerald-400/20 hover:bg-emerald-300",disabled:!E||V,onClick:()=>void W("accept",()=>{if(E)return i(E)}),children:["accept"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(a0.A,{className:"h-4 w-4"}),"accept"===w?"Accepting...":"Accept result"]})]})]})})}function cG({icon:a,title:b,tone:c="neutral",isLight:e,children:f}){return(0,d.jsxs)("section",{className:(0,y.cn)("rounded-[18px] border p-3.5",e?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,d.jsx)("div",{className:(0,y.cn)("flex h-7 w-7 items-center justify-center rounded-[10px] border","success"===c?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"warning"===c?"border-amber-300/30 bg-amber-400/12 text-amber-100":e?"border-slate-200 bg-slate-50 text-slate-600":"border-white/[0.08] bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(a,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:b})]}),f]})}function cH({label:a,value:b,isLight:c}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[12px] border px-3 py-2",c?"border-slate-200 bg-slate-50":"border-white/[0.08] bg-white/[0.04]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[9px] uppercase tracking-[0.16em]","text-slate-500"),children:a}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 font-mono text-[13px]",c?"text-slate-900":"text-white"),children:b})]})}function cI({label:a,value:b,isLight:c}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:"text-slate-500",children:a}),(0,d.jsx)("span",{className:(0,y.cn)("min-w-0 truncate text-right",c?"text-slate-900":"text-slate-100"),children:b})]})}function cJ(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}var cK=c(22591);function cL(a,b){let c=a.trim();return c.length<=b?c:`${c.slice(0,b).trimEnd()}
3
+ ${g}`:f:g)}),requestAnimationFrame(()=>{am.current?.focus();let a=am.current?.value??"";am.current?.setSelectionRange(a.length,a.length)})};return(0,d.jsx)("div",{className:(0,y.cn)("mx-auto w-full transition-[width,max-width] duration-300",aC&&"max-w-[360px]",aB&&"lg:w-[360px]"),onMouseEnter:()=>{ac&&!Y&&af(!0)},onMouseLeave:()=>{ac&&!Y&&af(!1)},children:(0,d.jsx)(r.N,{initial:!1,mode:"wait",children:aC?(0,d.jsx)(s.P.button,{type:"button",initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.98},disabled:Y,onFocus:()=>{Y||af(!0)},onClick:()=>{Y||(ah(!1),af(!0),requestAnimationFrame(()=>{am.current?.focus()}))},className:"w-full overflow-hidden rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2 text-left shadow-[0_24px_72px_rgba(0,0,0,0.22)] isolate",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.9),rgba(11,17,28,0.88))] px-3 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,d.jsx)("span",{className:"inline-flex h-7 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-2.5 text-[11px] text-slate-300",children:as||"No agent"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:Y?"Creating task...":ax}),(0,d.jsxs)("span",{className:"inline-flex h-8 items-center rounded-full bg-white px-3 text-[12px] font-medium text-slate-950",children:[Y?(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(l.A,{className:"mr-1.5 h-3.5 w-3.5"}),Y?"Creating":"Create task"]})]})},"collapsed"):(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.985},className:"overflow-hidden rounded-[26px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2.5 shadow-[0_24px_72px_rgba(0,0,0,0.26)] isolate",children:[(0,d.jsx)(r.N,{initial:!1,children:ak?(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-[12px] text-slate-400",children:[(0,d.jsxs)("span",{className:"truncate",children:["From ",ak.sourceLabel]}),(0,d.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>aE(ak.mission,{mode:"replace"}),children:"Replace"}),(0,d.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>aE(ak.mission),children:"Append"}),(0,d.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition-colors hover:bg-white/[0.06] hover:text-white",onClick:()=>al(null),"aria-label":"Dismiss runtime suggestion",children:(0,d.jsx)(m.A,{className:"h-3.5 w-3.5"})})]}):null}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[22px] border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.92),rgba(10,16,26,0.9))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] transition-all duration-200",h&&"border-white/[0.14] bg-[linear-gradient(180deg,rgba(24,34,50,0.94),rgba(12,18,30,0.92))] shadow-[inset_0_1px_0_rgba(255,255,255,0.06)]"),onFocusCapture:()=>{ah(!1),q?.(!0)},onBlurCapture:a=>{let b=a.relatedTarget;b instanceof Node&&a.currentTarget.contains(b)||(q?.(!1),ac||0!==S.trim().length||aa||null!==ak||af(!1))},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[ar?(0,d.jsx)(B,{value:U,options:au,onChange:a=>{ah(!1),V(a),j?.(a)}}):(0,d.jsx)(F,{children:"No agent"}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,d.jsx)(D,{label:"Refresh AgentOS",onClick:async()=>{_(!0),await G(),_(!1)},children:$?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(D,{label:"Create workspace",onClick:H,children:(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(D,{label:"Composer settings",onClick:()=>ab(a=>!a),active:aa||"medium"!==W,children:(0,d.jsxs)("span",{className:"relative inline-flex",children:[(0,d.jsx)(p.A,{className:"h-3.5 w-3.5"}),"medium"!==W?(0,d.jsx)("span",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-white/80"}):null]})})]})]}),(0,d.jsx)("div",{className:"px-2.5 pt-0.5",children:(0,d.jsx)(v.T,{ref:am,value:S,onChange:a=>{ah(!1),T(a.target.value)},onKeyDown:async a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aw&&at&&await aD({mission:S,agentId:at,workspaceId:c??void 0,thinking:W}))},placeholder:ax,className:"min-h-[50px] max-h-[150px] resize-none overflow-y-auto border-0 bg-transparent px-0 py-0.5 text-[15px] leading-[1.6] text-white placeholder:text-[#f6eee5]/60 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})}),(0,d.jsxs)("div",{className:"flex items-end justify-between gap-2.5 px-2.5 pb-2.5 pt-1.5",children:[(0,d.jsx)(r.N,{initial:!1,children:az?(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[ay.map(a=>(0,d.jsx)(E,{label:a.label,onClick:()=>{"open-workspace-create"===a.action?H():a.mission&&aE(a.mission,{thinking:a.thinking})}},a.id)),ap?(0,d.jsx)(t.O,{snapshot:a,defaultWorkspaceId:ap.id,onRefresh:G,onAgentCreationPending:M,onAgentCreated:a=>{an.current=a,V(a)},onAgentCreatedVisible:N,surfaceTheme:b,trigger:(0,d.jsx)("button",{type:"button",className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:"+ Create Agent"})}):null,ai&&ap?(0,d.jsx)("button",{type:"button",onClick:()=>I(),className:"inline-flex h-8 items-center rounded-full border border-cyan-300/18 bg-cyan-400/[0.1] px-3 text-[12px] text-cyan-50 transition-all hover:border-cyan-300/28 hover:bg-cyan-400/[0.14] hover:text-white",children:"Manage Surfaces"}):null]}):(0,d.jsx)("div",{})}),(0,d.jsxs)(u.$,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!aw,onClick:async()=>{at&&await aD({mission:S,agentId:at,workspaceId:c??void 0,thinking:W})},children:[Y?(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(l.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,d.jsx)(r.N,{initial:!1,children:aa?(0,d.jsx)(s.P.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},className:"mt-2 flex justify-end",children:(0,d.jsxs)("div",{className:"w-full max-w-[232px] rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(14,20,31,0.96),rgba(10,15,24,0.94))] p-3 shadow-[0_16px_32px_rgba(0,0,0,0.22)]",children:[(0,d.jsx)("p",{className:"text-[11px] text-slate-300",children:"Thinking"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(C,{ariaLabel:"Select thinking level",value:W,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:a=>X(a)})}),(0,d.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{ah(!1),T(""),X("medium"),al(null),ao.current=!0,av&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(av)},children:"Clear draft"})]})}):null})]},"expanded")})})}function B({value:a,options:b,onChange:c}){let e=b.find(b=>b.value===a)??b[0],f=b.length>1;return(0,d.jsxs)("div",{className:"relative inline-flex items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[f?(0,d.jsx)("select",{"aria-label":"Select mission agent",value:e?.value??"",onChange:a=>c(a.target.value),className:"h-8 appearance-none bg-transparent pl-3 pr-8 text-[12px] outline-none",children:b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}):(0,d.jsx)("span",{className:"px-3 text-[12px]",children:e?.label||"No agent"}),f?(0,d.jsx)(q.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function C({ariaLabel:a,value:b,options:c,onChange:e}){let f=c.find(a=>a.value===b)??c[0];return(0,d.jsxs)("div",{className:"relative inline-flex w-full items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[(0,d.jsx)("select",{"aria-label":a,value:f?.value??"",onChange:a=>e(a.target.value),className:"h-9 w-full appearance-none bg-transparent pl-3 pr-9 text-[12px] outline-none",children:c.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,d.jsx)(q.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function D({label:a,active:b=!1,onClick:c,children:e}){return(0,d.jsx)("button",{type:"button","aria-label":a,title:a,onClick:c,className:(0,y.cn)("inline-flex h-8 w-8 items-center justify-center rounded-full border border-transparent text-slate-400 transition-all hover:border-white/[0.08] hover:bg-white/[0.06] hover:text-white",b&&"border-white/[0.08] bg-white/[0.06] text-white"),children:e})}function E({label:a,onClick:b}){return(0,d.jsx)("button",{type:"button",onClick:b,className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:a})}function F({children:a}){return(0,d.jsx)("div",{className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300",children:a})}var G=c(91698),H=c(69484),I=c(25393),J=c(4645),K=c(68428),L=c(95127),M=c(96493),N=c(65474),O=c(32956),P=c(73596),Q=c(57825),R=c(29849),S=c(59777),T=c(31002);let U=/https?:\/\/[^\s<>"'`)\]]+/g,V=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,W=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,X=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function Y({text:a,className:b,url:c,filePath:e,displayPath:f,basePath:g,compact:h=!1}){let i=function(a,b){let c=new Set;for(let d of(b&&c.add(b),a.matchAll(U)))d[0]&&c.add(d[0]);return[...c]}(a,c),j=function(a){let b=new Set;for(let c of a.matchAll(V))c[0]&&b.add(c[0]);return[...b]}(a),k=function(a,b,c){var d,e;let f,g,h=[],i=(d=b,e=c,f=Z(d),g=Z(e),f&&g&&f.startsWith("/")?{path:f.replace(/\/+$/,""),label:g.replace(/\/+$/,"")}:null),j=(a,b)=>{let c=function(a,b){let c=Z(a);if(!c)return null;if(c.startsWith("/")||!b)return c;if(c===b.label)return b.path;let d=`${b.label}/`;if(!c.startsWith(d))return c;let e=c.slice(d.length).replace(/^\/+/,"");return e?`${b.path}/${e}`:b.path}(a,i),d=Z(b||a);c&&d&&(h.some(a=>Z(a.path)===c||Z(a.label)===d)||h.push({path:c,label:d}))};for(let d of(b&&j(b,c||b),a.matchAll(X))){let a=Z(d[1]);a&&j(a,a)}for(let b of a.matchAll(W)){let a=Z(b[1]);a&&j(a,a)}return h}(a,e,f);return(0,d.jsxs)("div",{className:(0,y.cn)("space-y-2",h&&"space-y-1.5"),children:[(0,d.jsx)("p",{className:(0,y.cn)("whitespace-pre-wrap break-words",b),children:function(a){let b=Array.from(a.matchAll(U));if(0===b.length)return a;let c=[],e=0;for(let[f]of b){let b=a.indexOf(f,e);b>e&&c.push(a.slice(e,b)),c.push((0,d.jsx)("a",{href:f,target:"_blank",rel:"noreferrer",className:"nodrag nopan text-cyan-100 underline decoration-cyan-200/45 underline-offset-2 transition-colors hover:text-cyan-50 hover:decoration-cyan-100",onClick:a=>a.stopPropagation(),children:f},`${f}:${b}`)),e=b+f.length}return e<a.length&&c.push(a.slice(e)),c}(a)}),i.length>0||j.length>0||k.length>0?(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[i.map(a=>(0,d.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:(0,y.cn)("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-cyan-300/16 bg-cyan-400/[0.08] px-2 py-1 text-[10px] text-cyan-100 transition-colors hover:border-cyan-200/30 hover:bg-cyan-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,d.jsx)(S.A,{className:(0,y.cn)("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:function(a){try{let b=new URL(a);return`${b.hostname}${"/"===b.pathname?"":b.pathname}`}catch{return a}}(a)})]},a)),j.map(a=>(0,d.jsxs)("a",{href:`mailto:${a}`,className:(0,y.cn)("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-sky-300/16 bg-sky-400/[0.08] px-2 py-1 text-[10px] text-sky-50 transition-colors hover:border-sky-200/30 hover:bg-sky-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,d.jsx)(S.A,{className:(0,y.cn)("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:a})]},a)),k.map(a=>(0,d.jsxs)("button",{type:"button",className:(0,y.cn)("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-emerald-300/16 bg-emerald-400/[0.08] px-2 py-1 text-[10px] text-emerald-50 transition-colors hover:border-emerald-200/30 hover:bg-emerald-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:b=>{b.stopPropagation(),$(a.path,g)},children:[(0,d.jsx)(T.A,{className:(0,y.cn)("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:(0,x.$7)(a.label)})]},`${a.path}:${a.label}`))]}):null]})}function Z(a){let b=a?.trim();return b?b.replace(/[.,:;]+$/g,""):null}async function $(a,b){try{let c=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,basePath:b??null})}),d=await c.json();if(!c.ok)throw Error(d.error||"Unable to reveal file.");Q.oR.success("Revealed file.",{description:(0,x.$7)(a)})}catch(a){Q.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}var _=c(63292);function aa(a){let b="string"==typeof a.key?a.key.trim():"",c="string"==typeof a.dispatchId?a.dispatchId.trim():"";return b||c||a.id}function ab(a){let b=a.metadata.reviewedAt;return"string"==typeof b&&b.trim().length>0?b:null}function ac(a){let b=a.metadata.reviewAction;return"string"==typeof b&&b.trim().length>0?b:null}function ad(a,b={}){var c;let d,e="accepted"===(c=d=a.metadata.reviewStatus)||"continued"===c||"retried"===c||"dismissed"===c?d:null;return"continued"!==e?e:!function(a,b={}){let c=ab(a),d=c?Date.parse(c):NaN;return!(!Number.isNaN(d)&&function(a,b){if(!a)return!1;let c=Date.parse(a);return!Number.isNaN(c)&&c>b}(b.latestEvidenceAt,d))&&(!!b.hasLiveActivity||!Number.isNaN(d)&&(b.nowMs??Date.now())-d<12e4)}(a,b)?null:e}function ae(a){switch(a){case"accepted":return"accepted";case"continued":return"continuing";case"retried":return"retry drafted";case"dismissed":return"dismissed"}}function af(a){switch(a){case"accepted":return"An operator accepted the captured result. The original warning remains available for audit.";case"continued":return"OpenClaw accepted a continuation in the existing task session.";case"retried":return"An operator drafted a retry from the original mission.";case"dismissed":return"An operator dismissed this review item without accepting the captured result."}}var ag=c(5813),ah=c(92078);let ai=["Focus on tests","Prioritize UI polish","Avoid changing public API","Continue from the latest failure"];function aj({className:a,...b}){return(0,d.jsx)(ag.E,{...b,className:(0,y.cn)("!h-4 !px-1.5 !py-0 !text-[8px] !leading-none !tracking-[0.1em] !whitespace-nowrap",a)})}function ak(a){return(0,d.jsx)(al,{...a},a.selectedNodeId??"overview")}function al({snapshot:a,surfaceTheme:b,selectedNodeId:c,activeTaskCard:e,agentDetailFocus:f,lastMission:h,onRefresh:i,onSnapshotChange:j,onConfigureAgentCapabilities:k,onConnectModelProvider:l,onAbortTask:m,collapsed:n,onToggleCollapsed:o,activeTab:p,onActiveTabChange:q}){let t=(0,x.hv)(a.generatedAt),u=a.workspaces.find(a=>a.id===c),v=a.agents.find(a=>a.id===c),w=a.tasks.find(a=>a.id===c),z=w&&e?.taskId===w.id?e:null,A=a.runtimes.find(a=>a.id===c),B=a.models.find(a=>a.id===c),C=!!w?.metadata.optimistic,D=u||v||w||A||B||null,E=A?.id??null,F=w?.id??null,M=w&&"string"==typeof w.dispatchId?w.dispatchId:null,{runtimeOutput:N,runtimeOutputError:O}=function(){let[a,b]=(0,g.useState)(null),[c,d]=(0,g.useState)(null);return{runtimeOutput:a,runtimeOutputError:c}}(),P=(0,g.useMemo)(()=>{var a;return C&&w?{task:a=w,runs:[],outputs:[],liveFeed:function(a){let b=new Map;for(let c of[...aA(a.metadata.optimisticEvents),...aA(a.metadata.reviewEvents)])b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))}(a),createdFiles:[],warnings:aI(a)||"stalled"===a.status&&!aH(a.subtitle)?[a.subtitle]:[],integrity:az(a)}:null},[C,w]),Q=!!F&&(!C||!!M),{taskDetail:S,taskDetailError:T,taskDetailNotice:U}=function({selectedTaskId:a,canStreamTaskDetail:b,selectedTaskDispatchId:c}){let[d,e]=(0,g.useState)(null),[f,h]=(0,g.useState)(null),[i,j]=(0,g.useState)(null);return{taskDetail:d,taskDetailError:f,taskDetailNotice:i}}({selectedTaskId:F,canStreamTaskDetail:Q,selectedTaskDispatchId:M}),V=N&&N.runtimeId===E?N:null,W=O?.runtimeId===E?O.message:null,X=S&&(S.task.id===F||M&&"string"==typeof S.task.dispatchId&&S.task.dispatchId===M)?S:null,Y=T?.taskId===F?T.message:null,Z=U?.taskId===F?U.message:null,$=function(a,b){var c,d,e;if(!a||!b||null===b.followUpIndex)return a;let f=function(a,b){let c=a.runId?.trim();if(c){let a=b.filter(a=>{let b;return a.runId===c||a.id===c||("string"==typeof(b=a.metadata.runId)&&b.trim().length>0?b.trim():null)===c});if(a.length>0)return a.sort((a,b)=>am(b.updatedAt)-am(a.updatedAt))}let d=a.createdAt?Date.parse(a.createdAt):NaN,e=a.sessionId?.trim();return b.filter(a=>{let b=am(a.updatedAt),c=Number.isNaN(d)||0===b||b>=d-5e3,f=!e||a.sessionId===e||a.key.includes(e);return c&&f}).sort((a,b)=>am(b.updatedAt)-am(a.updatedAt))}(b,a.runs),g=(c=f).find(a=>an(a))??c.find(a=>"completed"===a.status)??c[0]??null,h=a.outputs.filter(a=>f.some(b=>b.id===a.runtimeId)),i=(d=h).find(a=>a.finalText?.trim())??d.find(a=>a.errorMessage?.trim())??d[0]??null,j=function(a,b,c){if(b.length>0){let a=new Set(b.map(a=>a.id));return c.filter(b=>!!(b.runtimeId&&a.has(b.runtimeId)))}let d=a.createdAt?Date.parse(a.createdAt):NaN;return Number.isNaN(d)?[]:c.filter(a=>{let b=Date.parse(a.timestamp);return!Number.isNaN(b)&&b>=d-5e3})}(b,f,a.liveFeed),k=j.length>0?j:[(e=b,{id:`follow-up-${e.cardNumber}-accepted`,kind:"user",timestamp:e.createdAt??new Date().toISOString(),title:"Follow-up accepted",detail:e.message||"OpenClaw accepted the follow-up for the existing session.",runtimeId:e.runId??void 0})],l=h.length>0?aZ(h.flatMap(a=>a.createdFiles)):aZ(f.flatMap(a=>aX(a))),m=h.length>0?ao(h.flatMap(a=>a.warnings)):ao(f.flatMap(a=>aY(a))),n=function(a,b,c){switch(a){case"queued":case"running":case"idle":case"completed":case"stalled":case"cancelled":return a;default:return b?.finalText||c.summary?"completed":"running"}}(g?.status??b.status,i,b),o=i?.finalText?.trim()||b.summary?.trim()||null,p=ao([...f.flatMap(a=>a.toolNames??[]),...h.flatMap(a=>a.items.map(a=>a.toolName).filter(a=>!!a))]);return{...a,task:{...a.task,title:b.message||`Follow-up ${b.cardNumber-1}`,mission:b.message??a.task.mission,subtitle:o||(g&&an(g)?g.subtitle:null)||("running"===n||"queued"===n?"Follow-up is running in the existing OpenClaw session.":a.task.subtitle),status:n,updatedAt:g?.updatedAt??a.task.updatedAt,primaryRuntimeId:g?.id??a.task.primaryRuntimeId,runtimeIds:f.map(a=>a.id),sessionIds:ao([b.sessionId??"",...f.map(a=>a.sessionId??"")]),runIds:ao([b.runId??"",...f.map(a=>a.runId??"")]),runtimeCount:Math.max(f.length,+!!b.runId),updateCount:k.length,liveRunCount:+("running"===n||"queued"===n),artifactCount:l.length,warningCount:m.length,tokenUsage:function(a){let b=a.map(a=>a.tokenUsage).filter(a=>!!a);if(0!==b.length)return b.reduce((a,b)=>({input:a.input+(b?.input??0),output:a.output+(b?.output??0),total:a.total+(b?.total??0),cacheRead:(a.cacheRead??0)+(b?.cacheRead??0)}),{input:0,output:0,total:0,cacheRead:0})}(f),metadata:{...a.task.metadata,resultPreview:o??(g&&an(g)?g.subtitle:null)??"Waiting for follow-up output.",finalResponseText:o,finalResponseRuntimeId:g?.id??null,turnCount:Math.max(new Set(f.map(a=>a.runId??a.id)).size,+!!b.runId),sessionCount:ao([b.sessionId??"",...f.map(a=>a.sessionId??"")]).length,followUpCardNumber:b.cardNumber,followUpMessage:b.message??null}},runs:f,outputs:h,liveFeed:k,createdFiles:l,warnings:m,integrity:{...a.integrity,finalResponseText:o,finalResponseSource:o?"runtime":"none",outputFileCount:l.length,transcriptTurnCount:h.reduce((a,b)=>a+b.items.length,0)||f.length,matchingTranscriptTurnCount:h.reduce((a,b)=>a+b.items.length,0),toolNames:p,issues:o?[]:a.integrity.issues,status:o?"verified":a.integrity.status}}}(X??P,z),aa=Q&&!X&&!Y,ab=!!E&&!V&&!W,ac=!!v,ad=!!(A||w),ae=!!(A||w),af=("chat"!==p||ac)&&("output"!==p||ad)&&("files"!==p||ae)?p:"overview",ag="chat"===af&&!!v,ah=w?"Feed":"Output",ai=u?.name||(v?(0,x.CK)(v):null)||(z?(0,x.$m)(z.message||`Follow-up ${z.cardNumber-1}`,48)||"Follow-up":w?(0,x.$m)(w.title||w.mission||"Task",48)||"Task":null)||(A?(0,x.$m)(A.title||"Run",48)||"Run":null)||B?.name||"Gateway overview",ak=u?"workspace":v?"agent":w?z?`follow-up ${z.cardNumber}`:"task":A?"run":B?"model":"selection",at=(0,g.useMemo)(()=>[{id:"overview",label:"Overview",icon:G.A,enabled:!0},{id:"chat",label:"Chat",icon:H.A,enabled:ac},{id:"output",label:ah,icon:I.A,enabled:ad},{id:"files",label:"Files",icon:J.A,enabled:ae},{id:"raw",label:"Raw",icon:K.A,enabled:!0}],[ah,ac,ae,ad]);return(0,d.jsxs)("div",{className:"panel-surface panel-glow flex h-full flex-row-reverse overflow-hidden rounded-none border border-r-0 border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl",children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex h-full shrink-0 flex-col items-center bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(3,6,12,0.98))] px-1.5 py-2",n?"w-full":"w-[60px] border-l border-white/[0.08]"),children:[(0,d.jsx)(_.A,{label:"Inspector",side:"left",surfaceTheme:b,panelCollapsed:n,children:(0,d.jsx)("button",{type:"button","aria-label":n?"Expand inspector":"Collapse inspector",onClick:o,className:"flex h-9 w-9 items-center justify-center rounded-[8px] border border-cyan-300/18 bg-cyan-400/[0.1] shadow-[0_8px_18px_rgba(34,211,238,0.14)] transition-all hover:border-cyan-200/24 hover:bg-cyan-400/[0.14]",children:(0,d.jsx)(I.A,{className:"h-3.5 w-3.5 text-cyan-200"})})}),(0,d.jsx)("div",{className:"mt-3.5 flex flex-1 flex-col items-center gap-1",children:at.map(a=>(0,d.jsx)(aO,{icon:a.icon,label:a.label,active:af===a.id,surfaceTheme:b,panelCollapsed:n,tooltipSide:"left",disabled:!a.enabled,onClick:()=>{a.enabled&&(q(a.id),n&&o())}},a.id))}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-col items-center gap-0.5",children:[(0,d.jsx)(aj,{variant:"muted",className:"h-4 min-w-[28px] rounded-full px-1 py-0 text-[8px] leading-none tracking-[0.12em]",children:D?"live":"idle"}),n?(0,d.jsx)("p",{className:"max-w-[44px] truncate text-center text-[8px] uppercase tracking-[0.14em] text-slate-500",children:ak}):null]})]}),n?null:(0,d.jsx)("div",{className:"min-w-0 flex-1 bg-[linear-gradient(180deg,rgba(6,10,18,0.96),rgba(3,6,14,0.98))]",children:(0,d.jsxs)("div",{className:(0,y.cn)("mission-scroll flex h-full min-h-0 flex-col overscroll-contain",ag?"overflow-hidden":"overflow-y-auto"),children:[(0,d.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] px-3 pb-2 pt-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-[9px] font-medium uppercase tracking-[0.24em] text-slate-500",children:"Inspector"}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("h2",{className:"min-w-0 truncate font-display text-[1.02rem] leading-5 text-white",children:ai}),(0,d.jsx)(aj,{variant:"muted",className:"shrink-0 h-4 px-1.5 py-0 text-[8px] leading-none tracking-[0.1em]",children:ak})]}),(0,d.jsx)("p",{className:"mt-1 truncate text-[11px] leading-4 text-slate-400",children:w?`${w.runtimeCount} runs \xb7 ${w.liveRunCount} live \xb7 ${(0,x.fw)(w.updatedAt,t)}`:A?`Run ${(0,x.m_)(A.runId||A.id,10)} \xb7 ${A.status} \xb7 ${(0,x.fw)(A.updatedAt,t)}`:v?`${v.activeRuntimeIds.length} active runs`:u?`${u.agentIds.length} agents attached`:B?`${B.provider} model`:"Live gateway context"})]}),(0,d.jsx)("div",{className:"hidden h-8 w-8 shrink-0 items-center justify-center rounded-none border border-white/10 bg-white/[0.04] text-cyan-200 sm:flex",children:(0,d.jsx)(I.A,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("div",{className:"mt-2 flex flex-nowrap gap-1 overflow-x-auto pb-0.5",children:at.filter(a=>a.enabled).map(a=>(0,d.jsx)(aP,{label:a.label,active:af===a.id,onClick:()=>q(a.id)},a.id))})]}),(0,d.jsx)("div",{className:(0,y.cn)("flex-1 p-3",ag&&"min-h-0 overflow-hidden"),children:(0,d.jsx)(r.N,{mode:"wait",children:(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:(0,y.cn)("space-y-3.5",ag&&"flex h-full min-h-0 flex-col space-y-0"),children:["overview"===af?(0,d.jsxs)(d.Fragment,{children:[u?(0,d.jsx)(aq,{snapshot:a,workspaceId:u.id}):null,v?(0,d.jsx)(ar,{snapshot:a,agentId:v.id,focusSection:f,onConfigureAgentCapabilities:k}):null,w?(0,d.jsx)(as,{snapshot:a,task:w,taskId:w.id,taskDetail:$,taskDetailLoading:aa,taskDetailError:Y,taskDetailNotice:Z,onAbortTask:m,onControlComplete:i}):null,A?(0,d.jsx)(aK,{snapshot:a,runtimeId:A.id,runtimeOutput:V,runtimeOutputLoading:ab,runtimeOutputError:W}):null,B?(0,d.jsx)(aN,{snapshot:a,modelId:B.id}):null,D?null:(0,d.jsx)(ap,{snapshot:a,lastMission:h})]}):null,v?(0,d.jsx)("div",{className:(0,y.cn)("min-h-0 flex-1",ag?"block":"hidden"),"aria-hidden":!ag,children:(0,d.jsx)(R.d,{agent:v,snapshot:a,surfaceTheme:b,isVisible:ag,onRefresh:i,onSnapshotChange:j,onConnectModelProvider:l})}):null,"output"===af&&w?(0,d.jsx)(av,{task:w,basePath:ax(a,w,$?.runs),taskDetail:$,taskDetailLoading:aa,taskDetailError:Y,taskDetailNotice:Z,onAbortTask:m,onControlComplete:i}):null,"output"===af&&A?(0,d.jsx)(aM,{runtime:A,basePath:a.workspaces.find(a=>a.id===A.workspaceId)?.path,runtimeOutput:V,runtimeOutputLoading:ab,runtimeOutputError:W}):null,"files"===af&&w?(0,d.jsx)(aw,{snapshot:a,task:w,taskDetail:$}):null,"files"===af&&A?(0,d.jsx)(aL,{runtime:A,runtimeOutput:V}):null,"raw"===af?(0,d.jsx)("pre",{className:"overflow-x-auto rounded-[18px] border border-white/[0.08] bg-slate-950/[0.72] p-3 text-[11px] leading-5 text-slate-300",children:JSON.stringify(w&&$?$:A&&V?{runtime:A,output:V}:D||a,null,2)}):null]},c||"overview")})}),ag?null:(0,d.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-3",children:(0,d.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-3.5 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,d.jsx)(L.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:w?`${w.runtimeCount} runs`:A?`Run ${(0,x.m_)(A.runId||A.id,10)}`:v?`${v.activeRuntimeIds.length} active runs`:u?`${u.agentIds.length} agents`:B?B.provider:"Gateway overview"}),(0,d.jsxs)("p",{className:"mt-1 text-[12px] text-slate-400",children:[ak," \xb7"," ",w?`${$?.liveFeed.length??0} live feed events`:A?`${V?.items.length??0} transcript entries`:v?`${v.activeRuntimeIds.length} tracked runs`:u?`${u.agentIds.length} attached`:`${a.presence.length} live beacons`]})]})]})})})]})})]})}function am(a){return"number"!=typeof a||!Number.isFinite(a)||a<=0?0:a>1e12?a:1e3*a}function an(a){let b=a.subtitle.trim().toLowerCase();return!!(b&&!["chat","agent","sessions.changed","session.message","openclaw runtime event","gateway runtime event"].includes(b))}function ao(a){return Array.from(new Set(a.map(a=>a.trim()).filter(Boolean)))}function ap({snapshot:a,lastMission:b}){let c=(0,x.hv)(a.generatedAt),e=a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable?"passed"===a.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:L.A,title:"Gateway health",value:a.diagnostics.health,children:[(0,d.jsx)("p",{children:a.diagnostics.gatewayUrl}),(0,d.jsx)("p",{children:a.diagnostics.dashboardUrl})]}),(0,d.jsxs)(aQ,{icon:J.A,title:"Runtime preflight",value:e,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:a.diagnostics.runtime.stateRoot}),(0,d.jsx)("p",{children:a.diagnostics.runtime.sessionStores.length>0?`${a.diagnostics.runtime.sessionStores.filter(a=>a.writable).length}/${a.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),a.diagnostics.runtime.smokeTest.checkedAt?(0,d.jsxs)("p",{children:["Smoke test ",a.diagnostics.runtime.smokeTest.status," \xb7"," ",a.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",(0,x.fw)(Date.parse(a.diagnostics.runtime.smokeTest.checkedAt),c)]}):(0,d.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),a.diagnostics.runtime.issues[0]?(0,d.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:a.diagnostics.runtime.issues[0]}):null]}),(0,d.jsxs)(aQ,{icon:I.A,title:"Presence beacons",value:String(a.presence.length),children:[0===a.presence.length?(0,d.jsx)("p",{children:"No live presence payloads."}):null,a.presence.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsx)("div",{className:"text-[13px] text-white",children:a.host}),(0,d.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[a.ip," \xb7 ",a.platform," \xb7 ",a.version]})]},a.ts))]}),b?(0,d.jsxs)(aQ,{icon:M.A,title:"Last mission",value:b.status,children:[(0,d.jsx)("p",{className:"text-sm text-white",children:b.summary}),(0,d.jsx)("p",{className:"font-mono text-xs text-slate-500",children:b.runId?`Run ${b.runId}`:`Dispatch ${b.dispatchId??"pending"}`}),"string"==typeof b.meta?.outputDirRelative?(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:b.meta.outputDirRelative}):null,b.payloads[0]?.text?(0,d.jsx)("div",{className:"rounded-[14px] border border-cyan-400/15 bg-cyan-400/8 px-3 py-2 text-[13px] text-cyan-50",children:b.payloads[0].text}):null]}):null]})}function aq({snapshot:a,workspaceId:b}){let c=(0,x.hv)(a.generatedAt),e=a.workspaces.find(a=>a.id===b),f=a.agents.filter(a=>a.workspaceId===b),g=e?e.modelIds.map(b=>a.models.find(a=>a.id===b)?.name||b):[],h=a.runtimes.filter(a=>a.workspaceId===b||e?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0));if(!e)return null;let i=h.filter(a=>"running"===a.status||"queued"===a.status||"idle"===a.status),j=h[0]??null,k=aZ(h.flatMap(aX)).slice(0,8),l=e.bootstrap.coreFiles.every(a=>a.present)&&e.bootstrap.projectShell.every(a=>a.present)?"ready":e.bootstrap.coreFiles.some(a=>a.present)||e.bootstrap.projectShell.some(a=>a.present)?"partial":"thin",m=Array.from(new Set(f.flatMap(a=>a.observedTools??[]))),n=0===f.length?"no agents":e.capabilities.workspaceOnlyAgentCount===f.length?"workspace-only":0===e.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:J.A,title:"Overview",value:e.health,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,x.$7)(e.path)}),(0,d.jsx)(aT,{items:[{label:"Agents",value:String(f.length)},{label:"Models",value:String(e.modelIds.length)},{label:"Runs",value:String(h.length)},{label:"Sessions",value:String(e.totalSessions)}]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,d.jsx)(aV,{emptyLabel:"No models attached",items:g,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:f.map(a=>(0,d.jsx)(aj,{variant:a.isDefault?"default":"muted",children:(0,x.CK)(a)},a.id))})]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Bootstrap",value:l,children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(aj,{variant:e.bootstrap.template?"default":"muted",children:e.bootstrap.template||"template unknown"}),(0,d.jsx)(aj,{variant:e.bootstrap.sourceMode?"muted":"warning",children:e.bootstrap.sourceMode||"source unknown"}),e.bootstrap.agentTemplate?(0,d.jsx)(aj,{variant:"muted",children:e.bootstrap.agentTemplate}):null]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,d.jsx)(aU,{items:e.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,d.jsx)(aU,{items:[...e.bootstrap.optionalFiles,...e.bootstrap.folders]})]}),e.bootstrap.contextFiles?.length?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Context docs"}),(0,d.jsx)(aU,{items:e.bootstrap.contextFiles})]}):null,(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Project shell"}),(0,d.jsx)(aU,{items:e.bootstrap.projectShell})]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Capabilities",value:n,children:[(0,d.jsxs)("p",{children:[e.capabilities.workspaceOnlyAgentCount,"/",f.length," agents are configured with"," ",(0,d.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,d.jsx)(aV,{emptyLabel:"No explicit skills",items:e.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,d.jsx)(aV,{emptyLabel:"No local SKILL.md scaffolds",items:e.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,d.jsx)(aV,{emptyLabel:"No explicit tools configured",items:e.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,d.jsx)(aV,{emptyLabel:"No runtime tool calls recovered yet",items:m,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,d.jsxs)(aQ,{icon:I.A,title:"Activity",value:`${i.length} live`,children:[(0,d.jsxs)("p",{children:[h.length," tracked runs across ",e.totalSessions," recorded sessions."]}),(0,d.jsx)("p",{children:j?`Latest update ${(0,x.fw)(j.updatedAt,c)}`:"No runtime activity has been recorded yet."}),h.length>0?(0,d.jsx)("div",{className:"space-y-2 pt-1",children:h.slice(0,3).map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,d.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[a.subtitle," \xb7 ",(0,x.m_)(a.runId||a.id,10)]})]}),(0,d.jsx)(aj,{variant:(0,x.Uu)(a.status),children:a.status})]},a.id))}):null,(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,d.jsx)("div",{className:"space-y-2",children:f.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:(0,x.CK)(a)}),(0,d.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.currentAction})]}),(0,d.jsx)(aj,{variant:"engaged"===a.status?"default":"offline"===a.status?"danger":"muted",children:a.status})]},a.id))})]})]}),(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(k.length),children:(0,d.jsx)(aS,{files:k,basePath:e.path,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function ar({snapshot:a,agentId:b,focusSection:c,onConfigureAgentCapabilities:e}){let f=(0,x.hv)(a.generatedAt),h=a.agents.find(a=>a.id===b),i=a.workspaces.find(a=>a.id===h?.workspaceId),j=a.models.find(a=>a.id===h?.modelId),k=(0,g.useRef)(null),l=(0,g.useRef)(null),m=(0,g.useRef)(null),n=h?.observedTools??[],o=h?.skills??[],p=(h?.tools??[]).filter(a=>"fs.workspaceOnly"!==a),q=h?.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[],t=h?(0,ah.Cf)(h.policy.preset):null,v=o.length>0?o:t?.skillIds??[],w=p.length>0?p:t?.tools??[],z=h?[{label:"Preset",value:(0,ah._P)(h.policy.preset)},{label:"Missing tools",value:(0,ah.zR)(h.policy.missingToolBehavior)},{label:"Install scope",value:(0,ah.UJ)(h.policy.installScope)},{label:"File access",value:(0,ah.bQ)(h.policy.fileAccess)},{label:"Network",value:(0,ah.Bw)(h.policy.networkAccess)}]:[],A=a.runtimes.filter(a=>h?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),[B,C]=(0,g.useState)(null),D=aZ(A.flatMap(aX)).slice(0,8);return h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:M.A,title:"Agent identity",value:h.id,children:[(0,d.jsx)("p",{children:(0,x.CK)(h)}),(0,d.jsx)("p",{children:h.identity.emoji?`${h.identity.emoji} \xb7 ${h.identity.theme??"theme unset"}`:"No identity emoji"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[h.isDefault?(0,d.jsx)(aj,{variant:"default",children:"default agent"}):null,(0,d.jsx)(aj,{variant:(0,ah.Cf)(h.policy.preset).badgeVariant,children:(0,ah._P)(h.policy.preset)}),h.identity.source?(0,d.jsx)(aj,{variant:"muted",children:h.identity.source}):null]})]}),(0,d.jsxs)(aQ,{icon:J.A,title:"Workspace",value:i?.name||"n/a",children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,x.$7)(h.workspacePath)}),(0,d.jsxs)("p",{children:[h.sessionCount," recorded sessions"]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Model assignment",value:j?.name||h.modelId,children:[(0,d.jsx)("p",{children:j?`${j.provider} \xb7 ${(0,x.FO)(j.contextWindow)} ctx`:"Model metadata unavailable"}),(0,d.jsx)("p",{children:j?.available===!1?"Currently unavailable":j?.local?"Local model route":"Remote model route"})]}),(0,d.jsx)(aQ,{icon:M.A,title:"Agent summary",value:(0,ah._P)(h.policy.preset),actions:(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{e?.(h.id,"tools"===c?"tools":"skills")},className:"h-7 rounded-full px-2.5 text-[11px]",children:[(0,d.jsx)(N.A,{className:"mr-1 h-3 w-3"}),"Edit"]}),children:(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"w-full",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Purpose"}),(0,d.jsx)("div",{className:"w-full rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:(0,d.jsx)("p",{className:"text-[13px] leading-5 text-slate-200",children:h.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."})})]}),(0,d.jsxs)("div",{ref:k,className:(0,y.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","skills"===c&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,d.jsxs)(aj,{variant:"muted",children:[v.length," active"]})]}),(0,d.jsx)(aV,{emptyLabel:"No skills available",items:v,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{ref:l,className:(0,y.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","tools"===c&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[q.length>0?(0,d.jsxs)(aj,{variant:"success",children:[(0,d.jsx)(O.A,{className:"mr-1 h-3 w-3"}),"policy locked"]}):null,(0,d.jsxs)(aj,{variant:"muted",children:[w.length," active"]})]})]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(aV,{emptyLabel:"No tools available",items:w,emptyVariant:"muted",itemVariant:"warning"}),q.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Policy locked"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:q.map(a=>(0,d.jsxs)(aj,{variant:"success",children:[(0,d.jsx)(O.A,{className:"mr-1 h-3 w-3"}),a]},a))}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-slate-500",children:"This capability is derived from the agent policy and cannot be removed here."})]}):null,n.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed"}),(0,d.jsx)(aV,{emptyLabel:"No runtime tool calls recovered yet",items:n,emptyVariant:"muted",itemVariant:"default"})]}):null]})]}),(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-3",children:[(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:t?.description??"No policy description available."}),(0,d.jsxs)("div",{className:"mt-3 grid gap-1.5 text-[13px] text-slate-300",children:[z.map(a=>(0,d.jsxs)("p",{children:[a.label,": ",(0,d.jsx)("span",{className:"text-white",children:a.value})]},a.label)),h.profile.outputPreference?(0,d.jsxs)("p",{children:["Output preference: ",(0,d.jsx)("span",{className:"text-white",children:h.profile.outputPreference})]}):null]})]})]})}),(0,d.jsxs)(aQ,{icon:L.A,title:"Runtime posture",value:h.status,children:[(0,d.jsx)("p",{children:h.currentAction}),(0,d.jsxs)("p",{children:["Last active ",(0,x.fw)(h.lastActiveAt,f)]}),(0,d.jsx)("p",{children:h.heartbeat.enabled?`Heartbeat ${h.heartbeat.every}`:"Heartbeat disabled"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(aj,{variant:h.heartbeat.enabled?"success":"muted",children:h.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof h.heartbeat.everyMs?(0,d.jsxs)(aj,{variant:"muted",children:[Math.round(h.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,d.jsx)("div",{ref:m,className:"scroll-mt-4",children:(0,d.jsxs)(aQ,{icon:I.A,title:"Activity history",value:String(A.length),className:(0,y.cn)("sessions"===c&&"border-cyan-300/25 bg-[linear-gradient(180deg,rgba(12,25,37,0.92),rgba(8,13,24,0.88))] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("p",{children:[h.sessionCount," recorded sessions overall."]}),(0,d.jsx)("p",{children:A.length>0?`${A.length} history item${1===A.length?"":"s"} recovered from the latest agent activity.`:"No linked runtime records were recovered for this agent in the current snapshot."}),h.sessionCount>A.length?(0,d.jsxs)("p",{className:"text-[12px] text-slate-500",children:[h.sessionCount-A.length," session",h.sessionCount-A.length==1?"":"s"," do not have recovered runtime data yet."]}):null,A.length>0?(0,d.jsx)("div",{className:"space-y-2.5 pt-1",children:A.map(a=>{var b,c;let e=B===a.id,g=function(a){switch(a){case"session":return"Direct chat";case"turn":return"Conversation";case"cron":return"Scheduled";default:return"Unknown source"}}(a.source),h=function(a){if(a.taskId)return"Task";switch(a.source){case"session":return"Chat";case"turn":return"Run";case"cron":return"Scheduled";default:return"Activity"}}(a),i=a.sessionId?`session ${(0,x.m_)(a.sessionId,10)}`:a.runId?`run ${(0,x.m_)(a.runId,10)}`:"session n/a",j="number"!=typeof(b=a.tokenUsage?.total)||Number.isNaN(b)?"0 Tokens":b>=1e3?`${Math.round(b/1e3)}K Tokens`:`${b} Tokens`,k="number"!=typeof(c=a.updatedAt)||Number.isNaN(c)?"No time":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(c));return(0,d.jsxs)("div",{className:(0,y.cn)("overflow-hidden rounded-[14px] border bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] transition-all",e?"border-cyan-300/22 shadow-[0_0_0_1px_rgba(34,211,238,0.08)]":"border-white/[0.08]"),children:[(0,d.jsxs)("button",{type:"button","aria-expanded":e,className:"nodrag nopan flex w-full flex-col gap-2 px-3 py-2.5 text-left transition-colors hover:bg-white/[0.03]",onClick:()=>{C(b=>b===a.id?null:a.id)},onPointerDown:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)(aj,{variant:(0,x.Uu)(a.status),children:a.status}),(0,d.jsx)(aj,{variant:a.tokenUsage?.total?"default":"muted",children:j})]}),(0,d.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,d.jsx)("p",{className:"line-clamp-2 text-[13px] leading-5 text-white",children:a.title}),(0,d.jsx)("p",{className:"line-clamp-2 text-[12px] leading-5 text-slate-300",children:a.subtitle})]}),(0,d.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[(0,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("p",{className:"truncate text-[9px] uppercase tracking-[0.18em] text-slate-500",children:[h," \xb7 ",i]})}),(0,d.jsx)("p",{className:"shrink-0 text-right text-[9px] uppercase tracking-[0.18em] text-slate-500",children:k})]})]}),(0,d.jsx)(r.N,{initial:!1,children:e?(0,d.jsx)(s.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18},className:"overflow-hidden border-t border-white/[0.08]",children:(0,d.jsxs)("div",{className:"space-y-3 px-3 py-3",children:[(0,d.jsx)(aT,{items:[{label:"Source",value:g},{label:"Status",value:a.status},{label:"Updated",value:(0,x.fw)(a.updatedAt,f)},{label:"Key",value:(0,x.m_)(a.key,12)}]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[a.sessionId?(0,d.jsxs)(aj,{variant:"muted",children:["session ",(0,x.m_)(a.sessionId,12)]}):null,a.runId?(0,d.jsxs)(aj,{variant:"muted",children:["run ",(0,x.m_)(a.runId,12)]}):null,a.taskId?(0,d.jsxs)(aj,{variant:"muted",children:["task ",(0,x.m_)(a.taskId,12)]}):null,a.modelId?(0,d.jsxs)(aj,{variant:"muted",children:["model ",(0,x.m_)(a.modelId,12)]}):null]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Preview"}),(0,d.jsx)("div",{className:"rounded-[12px] border border-white/[0.08] bg-white/[0.03] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a.subtitle})})]}),a.toolNames?.length?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,d.jsx)(aV,{emptyLabel:"No tool names recorded",items:a.toolNames,emptyVariant:"muted",itemVariant:"warning"})]}):null]})}):null})]},a.id)})}):null]})}),(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(D.length),children:(0,d.jsx)(aS,{files:D,basePath:h.workspacePath,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,d.jsxs)(aQ,{icon:M.A,title:"Capabilities",value:`${h.skills.length} skills`,children:[(0,d.jsx)(aV,{emptyLabel:"No explicit skills",items:h.skills,emptyVariant:"muted",itemVariant:"muted"}),(0,d.jsxs)("div",{className:"pt-1",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,d.jsx)(aV,{emptyLabel:"No explicit tools configured",items:h.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,d.jsxs)("div",{className:"pt-1",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,d.jsx)(aV,{emptyLabel:"No runtime tool calls recovered yet",items:n,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function as({snapshot:a,task:b,taskId:c,taskDetail:e,taskDetailLoading:f,taskDetailError:g,taskDetailNotice:h,onAbortTask:i,onControlComplete:j}){var k,l,m,n,o;let p,q=a.tasks.find(a=>a.id===c)??b,r=e?.task?(k=e.task,l=q,0===Object.keys(p=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(a=>[a,l.metadata[a]]).filter(([,a])=>void 0!==a))).length?k:{...k,metadata:{...k.metadata,...p}}):q,s=aI(r),t=e?.runs??a.runtimes.filter(a=>b?.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),u=ax(a,r,t),v=ay(a,r,t),w=a.agents.find(a=>a.id===r?.primaryAgentId),y=aZ(e?.createdFiles??t.flatMap(a=>aX(a))),z=e?.warnings??[];if(!b)return null;let A=e?.integrity??az(b),B=aB(r),C=("string"==typeof(m=r).metadata.routedMission?m.metadata.routedMission.trim():"")||aB(m),D=(n=B,o=C,aE(n)!==aE(o)),E=aC(r),F=aD(r.metadata.sessionCount,r.sessionIds.length),G=aD(r.metadata.turnCount,t.length),H=(e?.liveFeed??[]).filter(a=>aG(a)).sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)),M=function(a){for(let b of a)if("string"==typeof b.filePath&&"string"==typeof b.displayPath)return{path:b.filePath,displayPath:b.displayPath};return null}(H);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:J.A,title:"Mission",value:s?"aborted":r.status,children:[(0,d.jsx)(aR,{label:"Original prompt",text:B,basePath:u}),(0,d.jsx)(aR,{label:"Sent to OpenClaw",text:D?C:"Same as original prompt.",basePath:u,subtle:!D}),(0,d.jsx)(aR,{label:"Latest task output",text:E||"Waiting for the first OpenClaw update.",basePath:u,subtle:!E}),(0,d.jsx)(aT,{items:[{label:"Sessions",value:String(F)},{label:"Turns",value:String(G)},{label:"Runs",value:String(r.runtimeCount)},{label:"Files",value:String(r.artifactCount)},{label:"Live",value:String(r.liveRunCount)},{label:"Tools",value:String(A.toolNames.length)}]}),(0,d.jsx)(au,{task:r,onAbortTask:i,onControlComplete:j}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[v?(0,d.jsx)(aj,{variant:"muted",children:v.name}):null,w?(0,d.jsx)(aj,{variant:"default",children:(0,x.CK)(w)}):null,r.dispatchId?(0,d.jsxs)(aj,{variant:"muted",children:["dispatch ",(0,x.m_)(r.dispatchId,8)]}):null,s?(0,d.jsx)(aj,{variant:"danger",children:"aborted"}):null]}),f&&!e?(0,d.jsx)("p",{children:"Connecting live task feed…"}):null,g?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:g}):null,h?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:h}):null]}),(0,d.jsx)(at,{task:r,integrity:A,basePath:u,latestEvidenceAt:([...e?.liveFeed??[]].reverse().find(a=>"assistant"===a.kind||"tool"===a.kind||"artifact"===a.kind)??null)?.timestamp??null}),(0,d.jsxs)(aQ,{icon:I.A,title:"Runner logs",value:String(H.length),children:[M?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Log file"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:M.displayPath,className:"text-[12.5px] leading-5 text-slate-100",filePath:M.path,displayPath:M.displayPath,basePath:u})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:"Only meaningful runner diagnostics are shown here. OpenClaw bootstrap debug noise is hidden."})]}):null,0===H.length?(0,d.jsx)("p",{children:"No meaningful dispatch runner diagnostics have been captured for this task yet."}):(0,d.jsx)("div",{className:"max-h-[300px] space-y-2 overflow-y-auto pr-1",children:H.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"flex min-w-0 items-center gap-2",children:(0,d.jsx)(aj,{variant:a$(a.kind,a.isError),children:a.title})}),(0,d.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,x.fw)(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("pre",{className:"mt-2 whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-slate-100",children:a.detail})]},a.id))})]}),(0,d.jsxs)(aQ,{icon:I.A,title:"Runs",value:String(t.length),children:[0===t.length?(0,d.jsx)("p",{children:"No OpenClaw runs have been grouped into this task yet."}):null,(0,d.jsx)("div",{className:"space-y-2",children:t.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,d.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.subtitle})]}),(0,d.jsx)(aj,{variant:(0,x.Uu)(a.status),children:a.status})]},a.id))})]}),(0,d.jsx)(aQ,{icon:K.A,title:"Artifacts",value:String(y.length),children:(0,d.jsx)(aS,{files:y,basePath:u,emptyLabel:"This task has not produced a detectable file artifact yet."})}),z.length>0?(0,d.jsx)(aQ,{icon:L.A,title:"Warnings",value:String(z.length),children:(0,d.jsx)(aW,{items:z,emptyLabel:"No warnings detected."})}):null]})}function at({task:a,integrity:b,basePath:c,latestEvidenceAt:e}){let f=aI(a),g=!!a.metadata.optimistic&&!f&&"stalled"!==a.status,h=b.issues.find(a=>"missing-final-response"===a.id),i=b.issues.find(a=>"partial-final-response"===a.id),j=!!(b.finalResponseText||b.outputFileCount>0||b.transcriptTurnCount>0||b.matchingTranscriptTurnCount>0||b.toolNames.length>0),k=ad(a,{hasLiveActivity:"running"===a.status||"queued"===a.status||a.liveRunCount>0,latestEvidenceAt:e}),l=ac(a),m=ab(a),n=k?af(k):f?"This task was aborted by an operator. Captured evidence may be incomplete.":g?"OpenClaw accepted this task. Session, tool, and file evidence will appear here as soon as the first runtime reports in.":h?h.detail:i?i.detail:"verified"===b.status?"AgentOS found a matching transcript and the captured result looks internally consistent.":b.sessionMismatch?"The linked transcript belongs to a different mission or stale session, so this completion cannot be trusted yet.":b.issues.some(a=>"empty-output-dir"===a.id)?"The task is marked completed, but the expected deliverables are missing from the output folder.":"error"===b.status?"The captured evidence does not line up with the requested mission.":"AgentOS recovered partial evidence, but this result still needs operator review.";return(0,d.jsxs)(aQ,{icon:L.A,title:"Result integrity",value:k?ae(k):f?"aborted":i?"needs review":"stalled"!==a.status||b.finalResponseText?g?"pending":b.status:j?"needs review":"waiting output",children:[(0,d.jsx)("p",{children:n}),k?(0,d.jsxs)("div",{className:"rounded-[14px] border border-emerald-400/16 bg-emerald-400/[0.06] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-emerald-100/80",children:"Operator review"}),(0,d.jsxs)("p",{className:"mt-2 text-[12px] leading-5 text-emerald-50",children:[l||ae(k),m?` \xb7 ${(0,x.fw)(Date.parse(m))}`:""]})]}):null,(0,d.jsx)(aT,{items:[{label:"Output files",value:String(b.outputFileCount)},{label:"Transcript turns",value:String(b.transcriptTurnCount)},{label:"Matched turns",value:String(b.matchingTranscriptTurnCount)},{label:"Tools",value:String(b.toolNames.length)},{label:"Emails",value:String(b.emails.length)}]}),b.outputDir||b.outputDirRelative?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:b.outputDirRelative||b.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:b.outputDir,displayPath:b.outputDirRelative||b.outputDir,basePath:c})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:b.outputDirExists?`${b.outputFileCount} file${1===b.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsxs)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:["Final response ","none"!==b.finalResponseSource?`(${b.finalResponseSource})`:""]}),i?(0,d.jsx)("p",{className:"mt-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:i.detail}):null,(0,d.jsx)("div",{className:"mt-2",children:b.finalResponseText?(0,d.jsx)(Y,{text:b.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100",basePath:c}):(0,d.jsx)("p",{className:"text-[12.5px] leading-5 text-slate-400",children:"No final response was captured."})})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Recovered tools"}),b.toolNames.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:b.toolNames.map(a=>(0,d.jsx)(aj,{variant:"muted",children:a},a))}):(0,d.jsx)("p",{children:"No tool calls were recovered from a matching transcript turn."})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Detected emails"}),b.emails.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:b.emails.map(a=>(0,d.jsx)(aj,{variant:"muted",children:a},a))}):(0,d.jsx)("p",{children:"No email addresses were detected in the captured result."})]}),b.dispatchSessionId?(0,d.jsxs)("p",{className:"font-mono text-xs text-slate-400",children:["session ",(0,x.m_)(b.dispatchSessionId,12),b.sessionMismatch?" \xb7 mismatch detected":""]}):null,b.issues.length>0?(0,d.jsxs)("div",{className:"rounded-[14px] border border-amber-400/16 bg-amber-400/[0.06] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-amber-100/80",children:"Review issues"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(aW,{items:b.issues.map(a=>`${a.title}: ${a.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function au({task:a,onAbortTask:b,onControlComplete:c}){var e;let[f,h]=(0,g.useState)(null),[i,j]=(0,g.useState)(""),[k,l]=(0,g.useState)(null),m=aJ(e=a)||e.liveRunCount>0,n=!!b&&aJ(a),o=i.trim();if(!m)return null;let p=a=>{h(b=>b===a?null:a),j("")},q=async()=>{if(f&&o&&!k){l(f);try{let d=await fetch(`/api/tasks/${encodeURIComponent(a.id)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:f,message:o,dispatchId:a.dispatchId??null})}),e=await d.json().catch(()=>null);if(!d.ok){var b;throw Error(((b=e)&&"object"==typeof b?"string"==typeof b.error?b.error:"string"==typeof b.message?b.message:null:null)||"Unable to update the running task.")}Q.oR.success("steer"===f?"Steer request sent.":"Context added to session."),h(null),j(""),c?.()}catch(a){Q.oR.error("steer"===f?"Steer request failed.":"Context injection failed.",{description:a instanceof Error?a.message:"Unknown control error."})}finally{l(null)}}};return(0,d.jsxs)("div",{className:"rounded-[14px] border border-cyan-300/12 bg-cyan-400/[0.05] p-2.5",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)(u.$,{type:"button",variant:"destructive",size:"sm",disabled:!n,className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>{n&&b?.(a)},children:[(0,d.jsx)(P.A,{className:"h-3.5 w-3.5"}),"Stop"]}),(0,d.jsxs)(u.$,{type:"button",variant:"steer"===f?"default":"secondary",size:"sm",className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>p("steer"),children:[(0,d.jsx)(N.A,{className:"h-3.5 w-3.5"}),"Steer"]}),(0,d.jsxs)(u.$,{type:"button",variant:"inject"===f?"default":"secondary",size:"sm",className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>p("inject"),children:[(0,d.jsx)(H.A,{className:"h-3.5 w-3.5"}),"Add context"]})]}),f?(0,d.jsxs)("div",{className:"mt-2.5 space-y-2",children:[(0,d.jsx)(v.T,{value:i,disabled:!!k,rows:3,maxLength:4e3,placeholder:"steer"===f?"Focus on tests":"Inject this note/reference into the running session",className:"min-h-[76px] rounded-[12px] px-3 py-2 text-[12px] leading-5",onChange:a=>j(a.target.value)}),"steer"===f?(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ai.map(a=>(0,d.jsx)("button",{type:"button",disabled:!!k,className:"rounded-full border border-white/[0.08] bg-white/[0.04] px-2 py-1 text-[10px] text-slate-300 transition-colors hover:border-cyan-300/25 hover:text-cyan-50 disabled:cursor-not-allowed disabled:opacity-60",onClick:()=>j(a),children:a},a))}):null,(0,d.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,d.jsx)(u.$,{type:"button",variant:"ghost",size:"sm",disabled:!!k,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>{h(null),j("")},children:"Cancel"}),(0,d.jsx)(u.$,{type:"button",variant:"default",size:"sm",disabled:!o||!!k,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>void q(),children:k?"Sending...":"steer"===f?"Send steer":"Add context"})]})]}):null]})}function av({task:a,basePath:b,taskDetail:c,taskDetailLoading:e,taskDetailError:f,taskDetailNotice:g,onAbortTask:h,onControlComplete:i}){if(e&&!c)return(0,d.jsxs)(aQ,{icon:I.A,title:"Live feed",value:"connecting",children:[(0,d.jsx)(au,{task:a,onAbortTask:h,onControlComplete:i}),(0,d.jsx)("p",{children:"Connecting to the task feed…"})]});if(f&&!c)return(0,d.jsxs)(aQ,{icon:I.A,title:"Live feed",value:"error",children:[(0,d.jsx)(au,{task:a,onAbortTask:h,onControlComplete:i}),(0,d.jsx)("p",{children:f})]});let j=(function(...a){let b=new Map;for(let c of a.flat())b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))})(c?.liveFeed??[],aA(a.metadata.reviewEvents)).filter(a=>!aG(a)),k=c?.integrity??az(a);return(0,d.jsxs)(aQ,{icon:I.A,title:"Live feed",value:String(j.length),children:[(0,d.jsx)(au,{task:c?.task??a,onAbortTask:h,onControlComplete:i}),f?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:f}):null,g?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:g}):null,k.issues.length>0?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:k.issues[0]?.detail}):null,0===j.length?(0,d.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,d.jsx)("div",{className:"space-y-2",children:j.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)(aj,{variant:a$(a.kind,a.isError),children:a.kind}),(0,d.jsx)("p",{className:"truncate text-[12px] text-white",children:a.title})]}),(0,d.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,x.fw)(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:a.detail,className:"text-[12.5px] leading-5 text-slate-100",url:a.url,filePath:a.filePath,displayPath:a.displayPath,basePath:b})})]},a.id))})]})}function aw({snapshot:a,task:b,taskDetail:c}){let e=c?.runs??a.runtimes.filter(a=>b.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),f=aZ(c?.createdFiles??e.flatMap(a=>aX(a))),g=c?.integrity??az(b),h=ax(a,b,e);return(0,d.jsxs)(aQ,{icon:K.A,title:"Files",value:String(f.length),children:[(0,d.jsxs)("p",{children:[e.length," run",1===e.length?"":"s"," contributed to this task."]}),g.outputDir||g.outputDirRelative?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:g.outputDirRelative||g.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:g.outputDir,displayPath:g.outputDirRelative||g.outputDir,basePath:h})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:g.outputDirExists?`${g.outputFileCount} file${1===g.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,d.jsx)(aS,{files:f,basePath:h,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function ax(a,b,c=[]){return ay(a,b,c)?.path??function(a,b,c=[]){for(let d of[b.primaryAgentId,...c.map(a=>a.agentId)].filter(a=>"string"==typeof a&&a.trim().length>0)){let b=a.agents.find(a=>a.id===d)?.workspacePath;if(b)return b}}(a,b,c)}function ay(a,b,c=[]){for(let d of[b.workspaceId,...c.map(a=>a.workspaceId),b.primaryAgentId?a.agents.find(a=>a.id===b.primaryAgentId)?.workspaceId:void 0,...c.map(b=>b.agentId?a.agents.find(a=>a.id===b.agentId)?.workspaceId:void 0)].filter(a=>"string"==typeof a&&a.trim().length>0)){let b=a.workspaces.find(a=>a.id===d);if(b)return b}return null}function az(a){var b,c;let d,e,f,g=!!a.metadata.optimistic&&!aI(a)&&"stalled"!==a.status,h=(d="string"==typeof(b=a).metadata.finalResponseText?b.metadata.finalResponseText.trim():"",e="string"==typeof b.metadata.resultPreview?b.metadata.resultPreview.trim():"",!!((f=d||e)&&!(aH(c=f)||/waiting for (the first )?(transcript|output)/i.test(c)||/working silently/i.test(c)))),i=aI(a)?[{id:"task-cancelled",severity:"warning",title:"Task was cancelled by the operator",detail:"The mission dispatch was stopped before completion, so the captured evidence is intentionally incomplete."}]:"stalled"===a.status?[{id:h?"partial-final-response":"stalled-dispatch",severity:"warning",title:h?"Final response came from an incomplete runtime":"Waiting for output evidence",detail:h?"The assistant produced output, but the runtime stalled before the task completed. Treat this as the last captured response, not a verified completion.":aH(a.subtitle)?"AgentOS is still waiting for the first transcript entry from this runtime.":a.subtitle}]:[];return{status:i.some(a=>"error"===a.severity)?"error":g||i.length>0?"warning":"verified",outputDir:"string"==typeof a.metadata.outputDir&&a.metadata.outputDir.trim().length>0?a.metadata.outputDir:null,outputDirRelative:"string"==typeof a.metadata.outputDirRelative&&a.metadata.outputDirRelative.trim().length>0?a.metadata.outputDirRelative:null,outputDirExists:!1,outputFileCount:0,transcriptTurnCount:0,matchingTranscriptTurnCount:0,finalResponseText:h?aC(a):null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:i}}function aA(a){return Array.isArray(a)?a.filter(aF):[]}function aB(a){return a.mission?.trim()||a.title.trim()||"Untitled task"}function aC(a){return("string"==typeof a.metadata.resultPreview?a.metadata.resultPreview.trim():"")||a.subtitle.trim()||""}function aD(a,b){return"number"==typeof a&&Number.isFinite(a)?a:b}function aE(a){return a.replace(/\s+/g," ").trim()}function aF(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function aG(a){return a.id.startsWith("runner-log:")}function aH(a){return"string"==typeof a&&(/No transcript file was found for this runtime session/i.test(a)||/No transcript entries were found for this runtime/i.test(a))}function aI(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}function aJ(a){if(aI(a))return!1;let b=a.status;return"running"===b||"queued"===b}function aK({snapshot:a,runtimeId:b,runtimeOutput:c,runtimeOutputLoading:e,runtimeOutputError:f}){let g=(0,x.hv)(a.generatedAt),h=a.runtimes.find(a=>a.id===b),i=aZ(c?.createdFiles??(h?aX(h):[])),j=c?.warnings??(h?aY(h):[]),k=c?.warningSummary??j[0]??null,l=h?a.workspaces.find(a=>a.id===h.workspaceId)?.path:void 0;return h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:I.A,title:"Runtime key",value:h.status,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:h.key}),(0,d.jsxs)("p",{children:["Session ",(0,x.m_)(h.sessionId,12)]}),h.taskId?(0,d.jsxs)("p",{children:["Task ",(0,x.m_)(h.taskId,12)]}):null,h.runId?(0,d.jsxs)("p",{children:["Run ",(0,x.m_)(h.runId,12)]}):null]}),(0,d.jsxs)(aQ,{icon:L.A,title:"Activity",value:(0,x.fw)(h.updatedAt,g),children:[(0,d.jsx)("p",{children:h.subtitle}),(0,d.jsxs)("p",{children:[(0,x._y)(h.tokenUsage?.total)," tokens"]})]}),(0,d.jsxs)(aQ,{icon:M.A,title:"Latest output",value:c?.stopReason||(e?"loading":"no transcript"),children:[e?(0,d.jsx)("p",{children:"Loading transcript output…"}):null,f?(0,d.jsx)("p",{children:f}):null,e||f?null:(0,d.jsx)(Y,{text:c?.finalText||c?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100",basePath:l}),k?(0,d.jsxs)("p",{className:"mt-3 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:["Fallback used: ",k]}):null,c?.finalTimestamp?(0,d.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",(0,x.fw)(new Date(c.finalTimestamp).getTime())]}):null]}),(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(i.length),children:(0,d.jsx)(aS,{files:i,basePath:a.workspaces.find(a=>a.id===h.workspaceId)?.path,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function aL({runtime:a,runtimeOutput:b}){let c=aZ(b?.createdFiles??aX(a));return(0,d.jsxs)(aQ,{icon:K.A,title:"Files",value:String(c.length),children:[(0,d.jsx)("p",{children:a.title}),(0,d.jsx)(aS,{files:c,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function aM({runtime:a,basePath:b,runtimeOutput:c,runtimeOutputLoading:e,runtimeOutputError:f}){if(e)return(0,d.jsx)(aQ,{icon:I.A,title:"Runtime output",value:"loading",children:(0,d.jsxs)("p",{children:["Loading transcript output for ",a.title,"…"]})});if(f)return(0,d.jsx)(aQ,{icon:I.A,title:"Runtime output",value:"error",children:(0,d.jsx)("p",{children:f})});if(!c)return(0,d.jsx)(aQ,{icon:I.A,title:"Runtime output",value:"missing",children:(0,d.jsx)("p",{children:"No transcript data is available for this runtime."})});let g=aZ(c.createdFiles);return(0,d.jsxs)("div",{className:"space-y-3.5",children:[c.warningSummary?(0,d.jsx)(aQ,{icon:L.A,title:"Warnings",value:String(c.warnings.length),children:(0,d.jsx)("p",{children:c.warningSummary})}):null,(0,d.jsx)(aQ,{icon:K.A,title:"Created files",value:String(g.length),children:(0,d.jsx)(aS,{files:g,basePath:b,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,d.jsxs)(aQ,{icon:I.A,title:"Final response",value:"stalled"===a.status||"cancelled"===a.status?"stalled"===a.status?"stalled":a.status:c.stopReason||c.status,children:["stalled"===a.status||"cancelled"===a.status?(0,d.jsx)("p",{className:"mb-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:"stalled"===a.status?"This runtime is quiet or waiting for transcript output. AgentOS will keep watching for the first assistant update.":"This runtime was cancelled. The text below is the last captured assistant output, not a verified completion."}):null,c.errorMessage&&!aH(c.errorMessage)?(0,d.jsx)("p",{className:"mb-2 rounded-[12px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-[12px] leading-5 text-rose-100",children:c.errorMessage}):null,(0,d.jsx)(Y,{text:c.finalText||(c.errorMessage&&!aH(c.errorMessage)?c.errorMessage:"Waiting for the first assistant output from this runtime."),className:"text-[13px] leading-5 text-slate-100",basePath:b}),c.finalTimestamp?(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(c.finalTimestamp).toLocaleString()}):null]}),(0,d.jsxs)(aQ,{icon:L.A,title:"Transcript trail",value:String(c.items.length),children:[0===c.items.length?(0,d.jsx)("p",{children:"Waiting for the first transcript entry."}):null,(0,d.jsx)("div",{className:"space-y-2",children:c.items.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(aj,{variant:"assistant"===a.role?a.isError?"danger":"default":"toolResult"===a.role?"warning":"muted",children:a.role}),a.toolName?(0,d.jsx)(aj,{variant:"muted",children:a.toolName}):null]}),(0,d.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,x.fw)(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:a.text,className:"text-[12.5px] leading-5 text-slate-100",basePath:b})})]},a.id))})]})]})}function aN({snapshot:a,modelId:b}){let c=a.models.find(a=>a.id===b);return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aQ,{icon:M.A,title:"Model routing",value:c.provider,children:[(0,d.jsx)("p",{children:c.name}),(0,d.jsx)("p",{children:c.local?"Local model":"Remote model"})]}),(0,d.jsxs)(aQ,{icon:L.A,title:"Capacity",value:`${(0,x.FO)(c.contextWindow)} ctx`,children:[(0,d.jsx)("p",{children:c.input}),(0,d.jsx)("p",{children:!1===c.available?"Unavailable":"Available"}),(0,d.jsxs)("p",{children:[c.usageCount," attached agents"]})]})]}):null}function aO({icon:a,label:b,active:c,surfaceTheme:e,panelCollapsed:f,tooltipSide:g,disabled:h=!1,onClick:i}){return(0,d.jsx)(_.A,{label:b,side:g,surfaceTheme:e,panelCollapsed:f,children:(0,d.jsx)("button",{type:"button","aria-label":b,"aria-disabled":h,tabIndex:h?-1:0,onClick:i,className:(0,y.cn)("inline-flex h-8 w-8 items-center justify-center rounded-[8px] border transition-all",h?"border-white/5 bg-white/[0.02] text-slate-600":c?"border-cyan-300/18 bg-cyan-400 text-slate-950 shadow-[0_10px_22px_rgba(96,165,250,0.28)]":"border-white/10 bg-white/[0.03] text-slate-400 hover:border-white/15 hover:bg-white/[0.08] hover:text-white"),children:(0,d.jsx)(a,{className:"h-3 w-3"})})})}function aP({label:a,active:b,onClick:c}){return(0,d.jsx)("button",{type:"button",onClick:c,className:(0,y.cn)("inline-flex items-center rounded-full border px-2.5 py-1.5 text-[10px] uppercase tracking-[0.14em] whitespace-nowrap transition-all",b?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_10px_24px_rgba(96,165,250,0.28)]":"border-white/[0.08] bg-white/[0.03] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:a})}function aQ({icon:a,title:b,value:c,actions:e,children:f,className:g}){return(0,d.jsxs)("section",{className:(0,y.cn)("rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(12,19,34,0.86),rgba(8,13,24,0.82))] p-3 transition-all",g),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:b}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("p",{className:"min-w-0 font-display text-[1rem] text-white",children:c}),e?(0,d.jsx)("div",{className:"shrink-0",children:e}):null]})]}),(0,d.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/5 p-2 text-slate-300",children:(0,d.jsx)(a,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("div",{className:"mt-3 space-y-1.5 text-[12.5px] leading-5 text-slate-300",children:f})]})}function aR({label:a,text:b,basePath:c,subtle:e=!1}){return(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(Y,{text:b,className:(0,y.cn)("text-[12.5px] leading-5",e?"text-slate-400":"text-slate-100"),basePath:c})})]})}function aS({files:a,basePath:b,emptyLabel:c}){let e=aZ(a??[]);return 0===e.length?(0,d.jsx)("p",{className:"text-[12px] text-slate-400",children:c}):(0,d.jsx)("div",{className:"space-y-2",children:e.map(a=>{var c;let e="string"==typeof(c=a.path)&&(c.startsWith("/")||/^[A-Za-z]:[\\/]/.test(c))||!!b;return(0,d.jsx)("button",{type:"button",disabled:!e,onClick:()=>void a_(a.path,b),className:(0,y.cn)("w-full rounded-[14px] border border-cyan-300/12 bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2 text-left transition-all",e?"hover:border-cyan-300/28 hover:bg-cyan-400/[0.08]":"cursor-not-allowed opacity-60"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-mono text-[12px] text-cyan-100",children:a.displayPath}),(0,d.jsx)("p",{className:"truncate text-[11px] text-slate-400",children:(0,x.$7)(a.path)})]}),(0,d.jsx)(aj,{variant:"muted",children:e?"reveal":"relative"})]})},a.path)})})}function aT({items:a}){return(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2",children:a.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.label}),(0,d.jsx)("p",{className:"mt-1 text-[13px] text-white",children:a.value})]},a.label))})}function aU({items:a,missingVariant:b="muted"}){return(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,d.jsx)(aj,{variant:a.present?"success":b,children:a.label},a.id))})}function aV({items:a,emptyLabel:b,itemVariant:c,emptyVariant:e}){return 0===a.length?(0,d.jsx)(aj,{variant:e,children:b}):(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,d.jsx)(aj,{variant:c,children:a},a))})}function aW({items:a,emptyLabel:b}){return 0===a.length?(0,d.jsx)("p",{className:"text-[12px] text-slate-400",children:b}):(0,d.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,d.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a})},a))})}function aX(a){let b=a.metadata.createdFiles;return Array.isArray(b)?b.flatMap(a=>{if(!a||"object"!=typeof a)return[];let b="path"in a&&"string"==typeof a.path?a.path:null,c="displayPath"in a&&"string"==typeof a.displayPath?a.displayPath:b;return b&&c?[{path:b,displayPath:c}]:[]}):[]}function aY(a){let b=a.metadata.warnings;return Array.isArray(b)?b.filter(a=>"string"==typeof a&&a.trim().length>0):[]}function aZ(a){let b=new Set,c=[];for(let d of Array.isArray(a)?a:[]){let a="string"==typeof d?.path?d.path.trim():"",e="string"==typeof d?.displayPath&&d.displayPath.trim().length>0?d.displayPath.trim():a;!a||b.has(a)||(b.add(a),c.push({path:a,displayPath:e}))}return c}function a$(a,b){if(b)return"danger";switch(a){case"assistant":return"default";case"tool":case"warning":return"warning";case"artifact":return"success";default:return"muted"}}async function a_(a,b){try{let c=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,basePath:b??null})}),d=await c.json();if(!c.ok)throw Error(d.error||"Unable to reveal file.");Q.oR.success("Revealed file.",{description:(0,x.$7)(a)})}catch(a){Q.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}var a0=c(33506),a1=c(67882),a2=c(37674),a3=c(23446),a4=c(58372);function a5({snapshot:a,surfaceTheme:b,isInspectorOpen:c,taskAbortRequest:e,taskAbortRunState:f,taskAbortMessage:h,onTaskAbortOpenChange:i,onTaskAbortConfirm:j,updateDialogOpen:l,updateRunState:m,updateStatusMessage:n,updateResultMessage:o,updateLog:p,updateManualCommand:q,activeRuntimeCount:r,updateInstallSummary:s,onUpdateDialogOpenChange:t,onRunOpenClawUpdate:v}){let w="running"===m,x="success"===m||"error"===m,z=(0,a3.Ku)(m),A=(0,a3.SG)(m),[B,C]=(0,g.useState)(!1),D=(0,a4.T)(q),E=async()=>{if(q)try{await navigator.clipboard.writeText(q),Q.oR.success("Command copied.",{description:"Open Terminal and paste it."})}catch(a){Q.oR.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},F=async()=>{if(q&&D){C(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:q})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");Q.oR.success("Terminal opened.",{description:"Confirm the update there, then return to AgentOS."})}catch(a){Q.oR.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{C(!1)}}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a2.lG,{open:null!==e,onOpenChange:a=>{"running"!==f&&i(a)},children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("max-w-[480px] gap-5 p-5 sm:p-6","light"===b?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,d.jsxs)(a2.c7,{children:[(0,d.jsx)(a2.L3,{className:"light"===b?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,d.jsx)(a2.rr,{className:"light"===b?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),e?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#4f3d31]":"border-rose-400/20 bg-rose-400/10 text-rose-50"),children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:"Selected task"}),(0,d.jsx)("p",{className:"mt-2 font-display text-[1.02rem] leading-6 text-inherit",children:e.title}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-sm leading-6","light"===b?"text-[#8b7262]":"text-rose-100/80"),children:e.subtitle}),h?(0,d.jsx)("p",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-sm text-rose-50",children:h}):null]}):null,(0,d.jsxs)(a2.Es,{children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",disabled:"running"===f,className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==f&&i(!1)},children:"Cancel"}),(0,d.jsx)(u.$,{type:"button",variant:"destructive",disabled:!e||"running"===f,onClick:()=>{j()},children:"running"===f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),c?null:(0,d.jsxs)("div",{className:(0,y.cn)("pointer-events-auto absolute bottom-3 right-[74px] z-30 text-[11px] tracking-[0.04em] lg:bottom-4","light"===b?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,d.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:(0,y.cn)("transition-colors","light"===b?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"OpenClaw"})," ","by"," ",(0,d.jsx)("a",{href:"https://sapienx.app/",target:"_blank",rel:"noreferrer",className:(0,y.cn)("transition-colors","light"===b?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,d.jsx)(a2.lG,{open:l,onOpenChange:a=>{w||t(a)},children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("max-h-[calc(100vh-48px)] max-w-[468px] gap-5 overflow-y-auto p-5 sm:p-6","light"===b?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,d.jsxs)(a2.c7,{children:[(0,d.jsx)(a2.L3,{className:"light"===b?"text-[#3f2f24]":"text-white",children:z}),(0,d.jsx)(a2.rr,{className:"light"===b?"text-[#7e6555]":"text-slate-400",children:A})]}),x?(0,d.jsxs)("div",{className:(0,y.cn)("space-y-4","light"===b?"text-[#4f3d31]":"text-slate-200"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[24px] border px-4 py-5",(0,a3.CP)(m,b)),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:(0,y.cn)("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(0,a3.to)(m,b)),children:"success"===m?(0,d.jsx)(a0.A,{className:"h-5 w-5"}):(0,d.jsx)(P.A,{className:"h-5 w-5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"font-display text-[1.05rem] leading-6",children:"success"===m?"OpenClaw is up to date":"Update needs attention"}),(0,d.jsx)("p",{className:"mt-1 text-sm leading-6",children:o||("success"===m?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Installed version"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",a.diagnostics.version||a.diagnostics.latestVersion||"unknown"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Latest reported"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",a.diagnostics.latestVersion||a.diagnostics.version||"unknown"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Detected install"}),(0,d.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:s.label}),(0,d.jsx)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:s.detail})]})]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center justify-between border-b px-4 py-3","light"===b?"border-[#eadccf]":"border-white/8"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,d.jsx)("span",{className:"light"===b?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===m?"Completed":"Failed"})]}),(0,d.jsx)("pre",{className:(0,y.cn)("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:p||"No command output was captured."})]}),q?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-3","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:D?"Terminal":"Manual"}),D?(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-sm leading-6","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to confirm the update."}):null,(0,d.jsx)("p",{className:(0,y.cn)("mt-2 break-all font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:q}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{E()},className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),D?(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{F()},disabled:B,className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:B?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]})]}):null]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:(0,y.cn)("grid gap-3 sm:grid-cols-2","light"===b?"text-[#4f3d31]":"text-slate-200"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Version target"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-[1.1rem] leading-6 text-inherit",children:["v",a.diagnostics.latestVersion||a.diagnostics.version||"unknown"]}),(0,d.jsxs)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",a.diagnostics.version||"unknown"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Detected install"}),(0,d.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:s.label}),(0,d.jsx)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:s.detail})]})]}),(0,d.jsx)("div",{className:(0,y.cn)("rounded-[20px] border px-4 py-3 text-sm",r>0?"light"===b?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:r>0?`${r} running or queued runtime${1===r?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),w?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center gap-3 border-b px-4 py-3","light"===b?"border-[#eadccf]":"border-white/8"),children:[(0,d.jsx)("div",{className:(0,y.cn)("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"light"===b?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,d.jsx)("p",{className:"light"===b?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:n||"Streaming OpenClaw output..."})]})]}),(0,d.jsx)("pre",{className:(0,y.cn)("max-h-[180px] min-h-[120px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:p||"Waiting for command output..."})]}):null]}),(0,d.jsxs)(a2.Es,{children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",onClick:()=>{t(!1)},className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:w?"Run in background":x?"Done":"Cancel"}),x?null:(0,d.jsx)(u.$,{type:"button",onClick:v,disabled:w,className:(0,y.cn)(a.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==b||a.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:w?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})}var a6=c(29075),a7=c(59418),a8=c(67897),a9=c(72349),ba=c(52188),bb=c(60557);function bc(a,b){return b?a:"system"}function bd(a,b,c,d,e,f,g,h){return"cli"===a?!h&&b.diagnostics.installed?`Installed${b.diagnostics.version?` \xb7 v${b.diagnostics.version}`:""}`:"installing-cli"===c?"Installing the CLI and local wrapper.":"detecting"===c||h||!b.diagnostics.installed?"Checking whether the CLI is already installed.":"Install the OpenClaw CLI.":"gateway"===a?!h&&b.diagnostics.loaded?"Gateway is already registered.":"installing-gateway"===c?"Registering the gateway service.":"starting-gateway"===c?"Starting the gateway service.":"detecting"===c&&d?"Checking gateway registration.":f||"verifying"===c?"Gateway is up and waiting on RPC.":!h&&b.diagnostics.rpcOk?"Gateway is running directly.":"Register the gateway service once.":g?"RPC, state, and session store are ready.":"verifying"===c?"Verifying RPC, state writes, and session store access.":"starting-gateway"===c?"Starting the gateway and waiting for RPC.":e?"Gateway is up; verify RPC and runtime state.":f?"RPC is online; final runtime checks continue.":"Start the gateway and verify RPC."}function be(a,b){if(!a.trim())return null;let c=b.find(b=>b.id===a);return c?.name||(0,x.JZ)(a)}function bf(a,b){return a?"complete":b?"current":"pending"}function bg(a){return"light"===a?"border-[#b89374] bg-[#ecd4c1] text-[#4a3426] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e4c6af] hover:text-[#38261b]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.1]"}function bh(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"ChatGPT":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":"xai"===b?"xAI":"google"===b||"gemini"===b?"Gemini":"deepseek"===b?"DeepSeek":"mistral"===b?"Mistral":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function bi(a){let b=a?.trim();if(!b)return null;let[c]=b.split("/",1);return c||null}function bj(a,b){let c=b?.trim()??"",d=bi(b);return d?"openai"===d&&bk(a,c)?"openai-codex":(0,bb.a3)(d)?d:null:null}function bk(a,b){if(!(0,ba.jw)(b))return!1;let c=a.diagnostics.modelReadiness.authProviders,d=c.find(a=>"openai-codex"===a.provider),e=c.find(a=>"openai"===a.provider);return!!d?.connected||"openai-codex"===a.diagnostics.modelReadiness.preferredLoginProvider||!!(d?.canLogin&&!e?.connected)}function bl(a,b){return"complete"===a?"light"===b?"border-emerald-200 bg-emerald-50/60":"border-emerald-400/20 bg-emerald-400/8":"current"===a?"light"===b?"border-[#d9c2b3] bg-white/70":"border-white/12 bg-white/[0.05]":"light"===b?"border-[#eadcd0] bg-[#fffaf6]/80":"border-white/6 bg-white/[0.02]"}function bm(a,b){return"complete"===a?"light"===b?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-white/12 bg-white/[0.06] text-white":"light"===b?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400"}function bn(a,b){return"complete"===a?"light"===b?"bg-emerald-100 text-emerald-700":"bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"bg-[#efe1d4] text-[#876c5a]":"bg-white/[0.06] text-slate-300":"light"===b?"bg-[#f6ece4] text-[#a08471]":"bg-white/[0.04] text-slate-500"}var bo=c(34474),bp=c(14847),bq=c(45100),br=c(49444),bs=c(89478),bt=c(68885);function bu({snapshot:a,selectedModelId:b,onSelectedModelIdChange:c,onOpenAddModels:e,onSnapshotChange:h,autoDiscover:i=!0}){let[j,l]=(0,g.useState)(()=>(function(a,b){let c=bj(a,b);if(c)return c;let d=a.diagnostics.modelReadiness.authProviders.find(a=>a.connected&&(0,bb.a3)(a.provider))?.provider;if(d)return d;let e=a.diagnostics.modelReadiness.preferredLoginProvider;if((0,bb.a3)(e))return e;let f=bi(a.diagnostics.modelReadiness.recommendedModelId);return(0,bb.a3)(f)?f:"openrouter"})(a,b)),[m,n]=(0,g.useState)({}),[o,p]=(0,g.useState)(!1),q=(0,g.useMemo)(()=>Object.values(m).flatMap(a=>a?.models??[]),[m]),r=(0,g.useMemo)(()=>(function(a,b,c=[]){let d=b?.trim();if(!d)return null;let e=c.find(a=>a.id===d&&(0,bb.a3)(a.provider))?.provider;if((0,bb.a3)(e))return e;let f=a.models.find(a=>a.id===d&&(0,bb.a3)(a.provider))?.provider;return(0,bb.a3)(f)?"openai"===f&&bk(a,d)?"openai-codex":f:bj(a,d)})(a,b,q),[q,b,a]),s=(0,bb.W2)(j),t=bw(m[j]),v=t.connection??bx(a,j),x=(0,g.useMemo)(()=>a.models.filter(a=>by(j,a.id,a.provider)&&!1!==a.available&&!a.missing).map(b=>({id:b.id,name:b.name,provider:b.provider,input:b.input,contextWindow:b.contextWindow,local:!!b.local,available:!1!==b.available,missing:b.missing,alreadyAdded:!0,recommended:b.id===a.diagnostics.modelReadiness.recommendedModelId||b.id===a.diagnostics.modelReadiness.resolvedDefaultModel||b.id===a.diagnostics.modelReadiness.defaultModel,supportsTools:b.tags.includes("tools"),isFree:b.tags.includes("free"),tags:b.tags})),[j,a.diagnostics.modelReadiness.defaultModel,a.diagnostics.modelReadiness.recommendedModelId,a.diagnostics.modelReadiness.resolvedDefaultModel,a.models]),z=t.models.length>0?t.models:x,A=(0,g.useMemo)(()=>{let a=t.search.trim().toLowerCase();return z.slice().sort((a,b)=>{let c=Number(b.recommended)+Number(b.isFree)+Number(b.supportsTools),d=Number(a.recommended)+Number(a.isFree)+Number(a.supportsTools);return c!==d?c-d:a.name.localeCompare(b.name)}).filter(b=>!a||`${b.name} ${b.id} ${b.tags.join(" ")}`.toLowerCase().includes(a))},[z,t.search]),B=a.models.find(a=>a.id===b)?.name||A.find(a=>a.id===b)?.name||b.trim()||null,C="connecting"===t.flowState||"discovering"===t.flowState||t.statusMessage?.startsWith("Checking ")===!0&&!v.connected,D="discovering"===t.flowState?`Discovering ${s.shortLabel} models...`:"connecting"===t.flowState?t.statusMessage||`Connecting ${s.shortLabel}...`:t.statusMessage||`Checking ${s.shortLabel}...`,E=A.length>6||!!s.searchPlaceholder,F=v.connected||A.length>0||!!t.emptyState;function G(a,b){n(c=>({...c,[a]:{...bw(c[a]),...b}}))}function H(a,b,c,d){G(a,{flowState:c,connection:b.connection,statusMessage:b.message,errorMessage:null,emptyState:b.emptyState??null,manualCommand:b.manualCommand??null,docsUrl:b.docsUrl??null,models:b.models,loaded:!0,...d})}async function J(a){let b=(0,bs.oZ)(a);G(a,{flowState:"idle",errorMessage:null,statusMessage:`Checking ${bh(a)}...`});try{let c=await b.getConnectionStatus(),d=c.connection.connected&&i&&!N(a);H(a,c,d?"discovering":"idle"),M(c),d&&await L(a,!0)}catch(b){G(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider status could not be loaded.",loaded:!0})}}async function K(a,b){let c=(0,bs.oZ)(a),d=bw(m[a]);G(a,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===a?b?.force?"Refreshing Codex app-server setup...":"Checking Codex app-server setup...":`Connecting ${(0,bb.W2)(a).shortLabel}...`});try{let e=await c.connect({apiKey:d.apiKey,force:b?.force}),f=e.connection.connected&&!e.manualCommand&&!N(a);H(a,e,f?"discovering":"idle",{apiKey:""}),M(e),f&&await L(a,!0)}catch(b){G(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider connection failed."})}}async function L(a,b=!1){let c=(0,bs.oZ)(a),d=bw(m[a]);if(b||"discovering"!==d.flowState){G(a,{flowState:"discovering",errorMessage:null,statusMessage:"ollama"===a?"Checking the local Ollama runtime...":`Discovering ${(0,bb.W2)(a).shortLabel} models...`});try{let b=await c.discoverModels();H(a,b,b.models.length>0?"ready":"idle",{search:d.search}),M(b)}catch(b){G(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider discovery failed."})}}}function M(a){a.snapshot&&h?.(a.snapshot)}function N(b){return a.models.some(a=>by(b,a.id,a.provider)&&!1!==a.available&&!a.missing)}async function O(a){try{await navigator.clipboard.writeText(a),w.o.success("Copied.",{description:"Command copied to your clipboard."})}catch(a){w.o.error("Copy failed.",{description:a instanceof Error?a.message:"Clipboard access is not available."})}}async function P(a){if(!(0,a4.T)(a))return void await O(a);p(!0);try{let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a})}),c=await b.json().catch(()=>null);if(!b.ok||c?.error)throw Error(c?.error||"Unable to open Terminal.");w.o.success("Terminal opened.",{description:"Finish auth there, then refresh this provider."})}catch(a){w.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{p(!1)}}return(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-3 py-3","border-white/8 bg-[rgba(255,255,255,0.03)]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("p",{className:"whitespace-nowrap text-[8px] font-medium text-slate-500",children:["Provider first : ",bb.y8.length," providers"]})}),(0,d.jsx)("div",{className:"flex shrink-0 flex-wrap gap-1.5",children:B?(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):null})]}),(0,d.jsx)("div",{className:"mt-3 flex snap-x snap-mandatory flex-nowrap gap-2 overflow-x-auto overflow-y-hidden pb-2 pr-1",children:bb.y8.map(b=>{let e=bw(m[b.id]).connection??bx(a,b.id);return(0,d.jsx)("div",{className:"w-[128px] shrink-0 snap-start sm:w-[136px]",children:(0,d.jsx)(bq.I,{descriptor:b,active:j===b.id,compact:!0,micro:!0,connected:e.connected,detail:e.detail,onClick:()=>{l(b.id),r&&r!==b.id&&c("")}})},b.id)})}),(0,d.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:s.label})}),(0,d.jsx)(ag.E,{variant:v.connected?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:v.connected?"Connected":"Not connected"})]}),t.statusMessage&&!C?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[11px] text-slate-200",children:t.statusMessage})}):null,t.errorMessage?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/[0.08] px-3 py-2 text-[11px] text-rose-100",children:t.errorMessage}):null,"apiKey"!==s.connectKind||v.connected||0!==A.length||C?null:(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap items-end gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("label",{className:"block text-[9px] uppercase tracking-[0.16em] text-slate-500",children:"API key"}),(0,d.jsx)(br.p,{type:"password",value:t.apiKey,onChange:a=>G(j,{apiKey:a.target.value}),placeholder:"openrouter"===j?"sk-or-v1-...":"Paste API key",className:"mt-1.5 h-8 text-[11px]"})]}),(0,d.jsx)(u.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===t.flowState||!t.apiKey.trim(),onClick:()=>{K(j)},children:"connecting"===t.flowState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]}):`Connect ${s.shortLabel}`})]}),"apiKey"===s.connectKind&&t.manualCommand&&!C?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,d.jsx)("p",{className:"mt-1 max-w-[460px] text-[10px] leading-[0.98rem] text-cyan-100/80",children:"Open Terminal, paste the provider API key there, then come back and refresh this provider."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:o,onClick:()=>{P(t.manualCommand||"")},children:o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{O(t.manualCommand||"")},children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{J(j)},children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:t.manualCommand})})]}):null,C?(0,d.jsxs)("div",{className:"relative mt-4 flex min-h-[280px] items-center justify-center overflow-hidden rounded-[28px] border border-cyan-300/20 bg-[radial-gradient(circle_at_top,rgba(34,211,238,0.16),rgba(8,15,28,0.98)_70%)] px-4 py-10 text-center shadow-[0_22px_52px_rgba(7,11,20,0.32)]",children:[(0,d.jsx)("div",{className:"absolute inset-x-8 top-8 h-px bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent blur-sm animate-pulse"}),(0,d.jsx)("div",{className:"absolute inset-x-8 bottom-8 h-px bg-gradient-to-r from-transparent via-cyan-200/30 to-transparent blur-sm animate-pulse [animation-delay:180ms]"}),(0,d.jsx)("div",{className:"absolute left-8 top-8 h-24 w-24 rounded-full border border-cyan-300/15 bg-cyan-300/[0.04] blur-[1px] animate-pulse"}),(0,d.jsx)("div",{className:"absolute right-10 top-14 h-16 w-16 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:120ms]"}),(0,d.jsx)("div",{className:"absolute bottom-10 left-1/2 h-20 w-20 -translate-x-1/2 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:240ms]"}),(0,d.jsxs)("div",{className:"relative flex max-w-[340px] flex-col items-center",children:[(0,d.jsx)("div",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-full border border-cyan-300/20 bg-cyan-300/[0.08] shadow-[0_0_0_8px_rgba(34,211,238,0.05)]",children:(0,d.jsx)(k.A,{className:"h-8 w-8 animate-spin text-cyan-200"})}),(0,d.jsx)("p",{className:"font-display text-[1.1rem] leading-[1.2rem] tracking-[0.01em] text-white",children:D}),(0,d.jsx)("p",{className:"mt-2 max-w-[280px] text-[11px] leading-[1rem] text-slate-400",children:"discovering"===t.flowState?"Pulling the provider catalog into AgentOS.":"connecting"===t.flowState?"Preparing the provider connection.":"Checking provider status before discovery."}),(0,d.jsxs)("div",{className:"mt-4 flex gap-1.5",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/90"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/60 [animation-delay:120ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/30 [animation-delay:240ms]"})]})]})]}):null,"oauth"!==s.connectKind||v.connected||0!==A.length||C?null:(0,d.jsxs)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Use Codex app-server"}),(0,d.jsxs)("p",{className:"mt-1 max-w-[500px] text-[10px] leading-[0.98rem] text-slate-400",children:["OpenClaw ",bt.L," uses the Codex app-server plugin for ChatGPT-backed models."]})]}),(0,d.jsx)(u.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===t.flowState&&!t.manualCommand,onClick:()=>{K(j)},children:"connecting"!==t.flowState||t.manualCommand?"Connect ChatGPT":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]})}),(0,d.jsx)(u.$,{type:"button",variant:"ghost",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===t.flowState&&!t.manualCommand,onClick:()=>{K(j,{force:!0})},children:"Refresh app-server"})]}),t.manualCommand?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,d.jsx)("p",{className:"mt-1 max-w-[460px] text-[10px] leading-[0.98rem] text-cyan-100/80",children:"Open Terminal, complete the Codex app-server setup, then come back and refresh this provider."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:o,onClick:()=>{P(t.manualCommand||"")},children:o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{O(t.manualCommand||"")},children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{J(j)},children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:t.manualCommand})})]}):null]}),F&&!C?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mt-4 flex flex-nowrap items-center justify-between gap-2 overflow-x-auto pb-1",children:[(0,d.jsx)("p",{className:"shrink-0 whitespace-nowrap text-[9px] uppercase tracking-[0.16em] text-slate-500",children:A.length>0?`Found ${A.length} model${1===A.length?"":"s"}`:"No models found"}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-nowrap gap-1.5",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{J(j)},className:"h-6 rounded-full px-2 text-[9px]",children:[(0,d.jsx)(f.A,{className:"mr-1 h-2.5 w-2.5"}),"Refresh"]}),(0,d.jsx)(u.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>e(j),className:"h-6 rounded-full px-2 text-[9px]",children:"Add Models"})]})]}),E?(0,d.jsxs)("div",{className:"relative mt-3",children:[(0,d.jsx)(bp.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(br.p,{value:t.search,onChange:a=>G(j,{search:a.target.value}),placeholder:s.searchPlaceholder??"Search models",className:"h-8 pl-8 text-[11px]"})]}):null,t.emptyState?(0,d.jsx)(bv,{emptyState:t.emptyState,onRefresh:()=>{J(j)}}):null,A.length>0?(0,d.jsx)("div",{className:"mt-3 max-h-[min(34vh,260px)] space-y-1 overflow-y-auto pr-1",children:A.map(a=>{let e=b===a.id;return(0,d.jsxs)("button",{type:"button",onClick:()=>{(0,bb.a3)(a.provider)&&l(a.provider),c(a.id)},className:(0,y.cn)("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",e?"border-cyan-300/35 bg-cyan-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:a.id}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:a.input}),a.contextWindow?(0,d.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null,a.isFree?(0,d.jsx)("span",{children:"free"}):null]})]}),(0,d.jsx)("div",{className:"shrink-0",children:e?(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):a.recommended?(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):a.local?(0,d.jsx)(ag.E,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,d.jsx)(ag.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},a.id)})}):(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-dashed border-white/10 bg-white/[0.02] px-3 py-4 text-[11px] text-slate-400",children:"No models are visible yet. Refresh this provider or open the full Add Models flow."})]}):null,B&&!C?(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 rounded-[16px] border border-emerald-300/15 bg-emerald-300/[0.06] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[8px] uppercase tracking-[0.16em] text-emerald-200/75",children:"Selected model"}),(0,d.jsx)("p",{className:"truncate text-[11px] text-emerald-50",children:B})]}),(0,d.jsx)(ag.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"})]}):null]})]})}function bv({emptyState:a,onRefresh:b}){return(0,d.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:a.title}),(0,d.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[0.98rem] text-slate-400",children:a.description}),(0,d.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:b,children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"Refresh provider"]})})]})}function bw(a){return a||{loaded:!1,connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],apiKey:"",search:"",flowState:"idle"}}function bx(a,b){let c=a.diagnostics.modelReadiness.authProviders.find(a=>a.provider===b),d=a.models.filter(a=>by(b,a.id,a.provider)).length;if("ollama"===b)return{connected:d>0,detail:d>0?`${d} model${1===d?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."};let e=!!c?.connected;return{connected:e,detail:e?c?.detail||(0,bb.W2)(b).helperText:d>0?`${d} model${1===d?"":"s"} are already saved in AgentOS. Connect ${bh(b)} to use them.`:(0,bb.W2)(b).helperText}}function by(a,b,c){return(0,ba.Pr)(a,b,c)}function bz({steps:a,surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,run:h,gatewayAuthNeedsSetup:i,onOpenGatewayAuthSettings:j}){let[l,m]=(0,g.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mt-3",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,d.jsx)("h2",{className:(0,y.cn)("mt-1 text-[13px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"System setup"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI, start the gateway, and verify RPC."})]}),(0,d.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.map((a,c)=>{let e="runtime"===a.id,f="current"===a.state&&"running"===h.runState,g="complete"===a.state?"Ready":"current"===a.state?f?"Checking":e?"Needs verification":"Pending":"Pending";return(0,d.jsxs)("div",{className:(0,y.cn)("relative flex items-center gap-1.5 overflow-hidden rounded-[12px] border px-2 py-1.5",f?"light"===b?"shadow-[inset_0_1px_0_rgba(255,255,255,0.55),0_0_0_1px_rgba(215,178,154,0.18)]":"shadow-[inset_0_1px_0_rgba(255,255,255,0.03),0_0_0_1px_rgba(103,232,249,0.08)]":"",bl(a.state,b)),children:[f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]","light"===b?"bg-gradient-to-r from-transparent via-[#d9b08d]/26 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/12 to-transparent"),animate:{x:["-30%",e?"250%":"230%"]},transition:{duration:e?1.45:2.05,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-x-2 bottom-0 h-px rounded-full","light"===b?"bg-gradient-to-r from-transparent via-[#c99672] to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent"),animate:{opacity:[.28,.92,.28],scaleX:[.86,1,.86]},transition:{duration:e?1.2:1.65,repeat:1/0,ease:"easeInOut"}})]}):null,(0,d.jsxs)("span",{className:(0,y.cn)("relative mt-0.5 inline-flex h-5 w-5 items-center justify-center overflow-hidden rounded-full border text-[9px] font-medium",bm(a.state,b)),children:[f?(0,d.jsx)(s.P.span,{"aria-hidden":"true",className:(0,y.cn)("absolute inset-0 rounded-full border","light"===b?"border-[#d9b59a]/35 bg-[#f7eee7]/80":"border-cyan-200/16 bg-cyan-300/[0.06]"),animate:{scale:[1,1.16,1],opacity:[.45,.95,.45]},transition:{duration:e?1.5:1.9,repeat:1/0,ease:"easeInOut"}}):null,(0,d.jsx)("span",{className:"relative z-[1]",children:"complete"===a.state?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):f?(0,d.jsx)(k.A,{className:"h-2.5 w-2.5 animate-spin"}):c+1})]}),(0,d.jsxs)("div",{className:"relative z-[1] min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",bn(a.state,b)),children:g})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.82rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]},a.id)})}),(0,d.jsx)(bI,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:l,onDetailsOpenChange:m,run:h}),i?(0,d.jsx)("div",{className:(0,y.cn)("mt-2.5 rounded-[14px] border px-2.5 py-2","light"===b?"border-amber-300 bg-amber-50 text-amber-950":"border-amber-300/22 bg-amber-300/10 text-amber-100"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(P.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium",children:"Native Gateway auth needs an env credential"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===b?"text-amber-900/78":"text-amber-100/78"),children:"OpenClaw reports the Gateway secret as redacted. Generate a local token in Settings so AgentOS can use native WS instead of CLI fallback."}),(0,d.jsx)(u.$,{type:"button",size:"sm",variant:"secondary",onClick:j,className:(0,y.cn)("mt-2",bg(b)),children:"Configure Gateway auth"})]})]})}):null]})}function bA({snapshot:a,surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,run:h,modelPhase:i,selectedModelId:j,modelSwitchFeedback:k,onSelectedModelIdChange:l,onClearModelSwitchFeedback:m,onOpenAddModels:n,onSnapshotChange:o}){let[p,q]=(0,g.useState)(!0),r=(0,g.useMemo)(()=>a.models.filter(a=>!1!==a.available&&!a.missing),[a.models]),s=(0,g.useMemo)(()=>be(j,r),[r,j]),t=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,u=(0,a9.X2)(a),v=bE(t,r),w=bE(j,r),x=!!(j.trim()&&j.trim()!==(t?.trim()??"")),z=(0,g.useMemo)(()=>(function({statusCopy:a,run:b,selectedModelLabel:c,phase:d}){var e;let f=`${a}
4
+ ${b.log}`.toLowerCase(),g=!!b.manualCommand||/terminal|sign-in|login|oauth|api key|provider auth/.test(f),h="verifying"===d&&(/creating a demo workspace/.test(f)||/resolving workspace settings and reserving the target directory/.test(f)||/preparing workspace folder/.test(f)||/checking input and target path/.test(f)||/reserved target directory/.test(f)||/creating a fresh workspace folder/.test(f)||/fresh workspace folder created at/.test(f)||/preparing an empty workspace scaffold/.test(f)||/generating workspace docs/.test(f)||/scaffolding workspace files/.test(f)||/workspace files and starter docs are in place/.test(f)||/workspace bootstrap is wrapping up without a kickoff mission/.test(f)||/creating the first workspace agent/.test(f)||/provisioning the first workspace agent/.test(f)||/creating agent \d+ of \d+/.test(f)||/linked to the workspace/.test(f)||/finalizing workspace bootstrap/.test(f)||/workspace bootstrap finished/.test(f)||/demo workspace is ready/.test(f));if("running"!==b.runState||g||!h)return null;let i=(e=f,/resolving workspace settings/.test(e)||/checking input and target path/.test(e)||/reserved target directory/.test(e)||/creating a demo workspace/.test(e)?1:/preparing workspace folder/.test(e)||/creating a fresh workspace folder/.test(e)||/preparing an empty workspace scaffold/.test(e)||/scaffolding workspace files/.test(e)||/fresh workspace folder created at/.test(e)||/generating workspace docs/.test(e)||/workspace files and starter docs are in place/.test(e)?2:/creating the first workspace agent/.test(e)||/provisioning the first workspace agent/.test(e)||/creating agent \d+ of \d+/.test(e)||/linked to the workspace/.test(e)?3:/finalizing workspace bootstrap/.test(e)||/workspace bootstrap is wrapping up without a kickoff mission/.test(e)||/workspace bootstrap finished/.test(e)||/demo workspace is ready/.test(e)?4:1),j=[{id:"model",label:"Default model",detail:c?`${c} is now the route powering the workspace.`:"The selected route is being saved locally."},{id:"path",label:"Workspace shell",detail:"Validating the destination and preparing the workspace folder."},{id:"scaffold",label:"Workspace scaffold",detail:"Writing docs, memory, and the bootstrap metadata."},{id:"agent",label:"Starter agent",detail:"Provisioning the first agent and wiring it into the workspace."},{id:"handoff",label:"Canvas handoff",detail:"Refreshing the graph and selecting the new workspace."}].map((a,b)=>({...a,state:b<i?"done":b===i?"current":"pending"}));return{stepIndex:i,steps:j,logLines:b.log.split(/\r?\n/).map(a=>a.trim().replace(/^>\s*/,"")).filter(a=>!!a).slice(-4),headline:"Building your demo workspace",summary:"Workspace files, the first agent, and the initial canvas handoff are being assembled in real time.",selectedModelLabel:c}})({statusCopy:c,run:h,selectedModelLabel:s,phase:i}),[i,h,s,c]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)("p",{className:(0,y.cn)("text-[11px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"Step 2: Model setup"})}),z?(0,d.jsx)(bJ,{surfaceTheme:b,statusCopy:c,phaseLabel:f,buildScene:z}):"idle"!==k.phase?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bC,{surfaceTheme:b,feedback:k,defaultModelLabel:bE(k.previousModelId,r),nextModelLabel:bE(k.nextModelId,r),onChangeAgain:m}),(0,d.jsx)(bI,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:p,onDetailsOpenChange:q,run:h})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bB,{surfaceTheme:b,defaultModelLabel:v,switchTargetLabel:w,hasPendingModelSwitch:x}),(0,d.jsx)(bu,{snapshot:a,selectedModelId:j,onSelectedModelIdChange:l,onOpenAddModels:n,onSnapshotChange:o,autoDiscover:!u}),(0,d.jsx)(bI,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:p,onDetailsOpenChange:q,run:h})]})]})}function bB({surfaceTheme:a,defaultModelLabel:b,switchTargetLabel:c,hasPendingModelSwitch:e}){return(0,d.jsx)("div",{className:(0,y.cn)("mt-2 rounded-[14px] border px-2.5 py-2","light"===a?"border-[#e8d8ca] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7a65]":"text-slate-500"),children:"Detected default"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 truncate text-[10px]","light"===a?"text-[#3e2f24]":"text-white"),children:b??"Not set"})]}),e?(0,d.jsxs)("div",{className:"min-w-0 text-right",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7a65]":"text-slate-500"),children:"Switch to"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 truncate text-[10px]","light"===a?"text-[#7a4d2d]":"text-cyan-100"),children:c})]}):null]})})}function bC({surfaceTheme:a,feedback:b,defaultModelLabel:c,nextModelLabel:e,onChangeAgain:f}){var g;let h,i="light"===a,j="saving"===b.phase,l="success"===b.phase,m="error"===b.phase,n=b.message||(l?"AgentOS will use this route for new actions.":m?"Review the log below, then try again.":"Saving the route, refreshing OpenClaw config, and updating AgentOS."),o=(h=(g=b).message??"","saving"!==g.phase?0:/updating agentos snapshot|snapshot/i.test(h)?3:/verifying selected provider|provider/i.test(h)?2:+!!/refreshing openclaw config|config/i.test(h));return(0,d.jsx)("div",{className:(0,y.cn)("mt-3 overflow-hidden rounded-[22px] border",i?"border-[#e1d0c2] bg-[linear-gradient(180deg,rgba(255,250,246,0.98),rgba(248,240,232,0.98))]":"border-cyan-300/16 bg-[radial-gradient(circle_at_top,rgba(16,28,44,0.98),rgba(6,10,18,0.98)_72%)]"),children:(0,d.jsxs)("div",{className:"relative isolate min-h-[300px] overflow-hidden px-4 py-4 text-center",children:[(0,d.jsx)("div",{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-0",i?"bg-[radial-gradient(circle_at_50%_0%,rgba(232,186,151,0.22),transparent_34%),linear-gradient(135deg,rgba(255,255,255,0.4),transparent_48%)]":"bg-[radial-gradient(circle_at_50%_0%,rgba(34,211,238,0.18),transparent_34%),linear-gradient(135deg,rgba(255,255,255,0.04),transparent_48%)]")}),(0,d.jsxs)("div",{className:"relative z-[1] flex flex-col items-center",children:[(0,d.jsxs)("div",{className:"relative flex h-20 w-20 items-center justify-center",children:[j?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute h-20 w-20 rounded-full border",i?"border-[#d1a98b]":"border-cyan-200/24"),animate:{rotate:360},transition:{duration:8,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute h-14 w-14 rounded-full border border-dashed",i?"border-[#c8946f]":"border-cyan-200/40"),animate:{rotate:-360},transition:{duration:6,repeat:1/0,ease:"linear"}})]}):null,(0,d.jsx)("span",{className:(0,y.cn)("relative z-[1] inline-flex h-12 w-12 items-center justify-center rounded-full border",l?i?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":m?i?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":i?"border-[#d7b59a] bg-white text-[#9a6a48]":"border-cyan-300/20 bg-cyan-300/10 text-cyan-100"),children:l?(0,d.jsx)(a6.A,{className:"h-5 w-5"}):j?(0,d.jsx)(k.A,{className:"h-5 w-5 animate-spin"}):(0,d.jsx)(bo.A,{className:"h-5 w-5"})})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-3 text-[8px] uppercase tracking-[0.22em]",i?"text-[#94735e]":"text-cyan-200/70"),children:"Model route"}),(0,d.jsx)("h3",{className:(0,y.cn)("mt-1 text-[17px] font-medium tracking-[-0.03em]",i?"text-[#2d2118]":"text-white"),children:l?"Default model updated":m?"Default model could not be changed":"Switching default model"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 max-w-[320px] text-[10px] leading-[1rem]",i?"text-[#6d5647]":"text-slate-300"),children:n}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 grid w-full gap-2 rounded-[16px] border px-3 py-3 text-left",i?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,d.jsx)(bD,{label:"Previous",value:c??"Not set",surfaceTheme:a,muted:!0}),(0,d.jsx)(bD,{label:"New default",value:e??"Not selected",surfaceTheme:a})]}),j?(0,d.jsx)("div",{className:"mt-4 grid w-full gap-1.5 text-left",children:["Saving model route","Refreshing OpenClaw config","Verifying selected provider","Updating AgentOS snapshot"].map((a,b)=>(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center gap-2 rounded-[12px] border px-2.5 py-2",b===o?i?"border-[#c8946f] bg-[#fff5ed]":"border-cyan-300/24 bg-cyan-300/[0.07]":b<o?i?"border-emerald-200 bg-emerald-50/60":"border-emerald-300/16 bg-emerald-300/[0.05]":i?"border-[#ead8c8] bg-white/55":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("span",{className:(0,y.cn)("inline-flex h-4 w-4 items-center justify-center rounded-full border text-[8px]",b<o?i?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":b===o?i?"border-[#c8946f] bg-[#f8eadf] text-[#8c5d3d]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":i?"border-[#e0cec0] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-500"),children:b<o?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):b+1}),(0,d.jsx)("p",{className:(0,y.cn)("text-[10px]",i?"text-[#5f4b3e]":"text-slate-300"),children:a})]},a))}):null,j?null:(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:f,className:(0,y.cn)("mt-4 h-8 rounded-full px-3 text-[10px]",bg(a)),children:"Change again"})]})]})})}function bD({label:a,value:b,surfaceTheme:c,muted:e=!1}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("span",{className:(0,y.cn)("min-w-0 truncate text-right text-[10px]",e?"light"===c?"text-[#8a7261]":"text-slate-400":"light"===c?"text-[#3e2f24]":"text-white"),children:b})]})}function bE(a,b){return a?.trim()?be(a,b)??(0,x.JZ)(a):null}function bF({surfaceTheme:a,workspaceCount:b,agentCount:c,workspaceSetupReady:e,defaultModelLabel:f,createProgress:g,createRunState:h}){let i=b>0,j="running"===h&&!!g,k="error"===h&&!!g,l=!!g&&(j||k),m=i?e?`You already have ${b} workspace${1===b?"":"s"} online. Use AgentOS to inspect them or create another workspace for a new mission.`:"The workspace shell is visible. AgentOS is waiting for the starter agent before opening the canvas.":j?"AgentOS Workspace is being provisioned now. The scaffold and starter agent are being built in the background.":k?"The first workspace creation needs attention. Review the output, then try again.":"No workspace exists yet. Create one first so the live system has a place to keep context and deliverables.";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-3 py-3","light"===a?"border-emerald-200/80 bg-[linear-gradient(180deg,rgba(240,250,245,0.95),rgba(248,244,236,0.95))]":"border-emerald-300/15 bg-[linear-gradient(180deg,rgba(9,18,19,0.96),rgba(7,11,18,0.94))]"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border","light"===a?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:(0,d.jsx)(a6.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.18em]","light"===a?"text-emerald-700/75":"text-emerald-200/75"),children:"Launchpad"}),(0,d.jsx)("h2",{className:(0,y.cn)("mt-1 text-[13px] font-medium","light"===a?"text-[#2d2118]":"text-white"),children:"OpenClaw is ready."}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:m})]})]}),l?null:(0,d.jsxs)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:[(0,d.jsx)(bH,{surfaceTheme:a,label:"System",value:"Online",detail:"CLI, gateway, and runtime access verified"}),(0,d.jsx)(bH,{surfaceTheme:a,label:e?"Default model":"Detected default",value:f,detail:e?"Usable model route selected":"Detected on this machine, not yet confirmed by a workspace."}),(0,d.jsx)(bH,{surfaceTheme:a,label:"Runtime",value:"Smoke test passed",detail:"A live agent turn was verified"}),(0,d.jsx)(bH,{surfaceTheme:a,label:i?"Starter agent":"Workspaces",value:i?c>0?"Visible":"Pending":String(b),detail:i?"Required before canvas handoff":"Create one to begin"})]})]}),l?(0,d.jsx)(bG,{surfaceTheme:a,progress:g,runState:h}):(0,d.jsxs)("div",{className:(0,y.cn)("mt-2.5 rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Next step"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:i?"Open AgentOS to inspect the live graph, or create another workspace if you want a separate mission lane.":"Create the first workspace now. That is the shortest path from a ready system to a real mission."})]})]})}function bG({surfaceTheme:a,progress:b,runState:c}){let e="light"===a,f=b.steps.find(a=>"active"===a.status)??b.steps[0]??null,g="error"===c;return(0,d.jsxs)("div",{className:(0,y.cn)("relative mt-2.5 overflow-hidden rounded-[18px] border px-2.5 py-2.5",e?g?"border-rose-200 bg-[linear-gradient(180deg,rgba(255,248,247,0.98),rgba(252,242,242,0.96))]":"border-[#dcc7b8] bg-[linear-gradient(180deg,rgba(255,251,248,0.98),rgba(249,243,236,0.96))]":g?"border-rose-300/18 bg-[radial-gradient(circle_at_top,rgba(49,18,24,0.95),rgba(12,8,14,0.98)_72%)]":"border-cyan-300/16 bg-[radial-gradient(circle_at_top,rgba(11,21,34,0.98),rgba(5,10,18,0.98)_72%)]"),children:[(0,d.jsx)("div",{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-0",e?"bg-[radial-gradient(circle_at_20%_0%,rgba(255,255,255,0.95),transparent_28%),radial-gradient(circle_at_84%_18%,rgba(201,148,111,0.14),transparent_22%)]":g?"bg-[radial-gradient(circle_at_20%_0%,rgba(251,113,133,0.14),transparent_26%),radial-gradient(circle_at_84%_18%,rgba(248,113,113,0.08),transparent_22%)]":"bg-[radial-gradient(circle_at_20%_0%,rgba(34,211,238,0.12),transparent_26%),radial-gradient(circle_at_84%_18%,rgba(59,130,246,0.08),transparent_22%)]")}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute -left-8 top-5 h-24 w-24 rounded-full blur-3xl",e?"bg-[#efc6a8]/20":g?"bg-rose-300/10":"bg-cyan-300/10"),animate:{x:[0,10,0],y:[0,-6,0],opacity:[.45,.75,.45]},transition:{duration:7.5,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute -right-4 top-8 h-28 w-28 rounded-full blur-3xl",e?"bg-[#f6d9c2]/18":g?"bg-rose-300/8":"bg-sky-300/8"),animate:{x:[0,-12,0],y:[0,8,0],opacity:[.35,.7,.35]},transition:{duration:9.5,repeat:1/0,ease:"easeInOut"}}),(0,d.jsxs)("div",{className:"relative z-[1] flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)(s.P.div,{className:(0,y.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border",e?g?"border-rose-300 bg-white text-rose-700":"border-[#d9b59a] bg-white text-[#8b6d5a]":g?"border-rose-300/25 bg-rose-300/10 text-rose-100":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100"),animate:{scale:[1,1.06,1],opacity:[.82,1,.82]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"},children:g?(0,d.jsx)(P.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.18em]",e?g?"text-rose-600/75":"text-[#977b69]":g?"text-rose-200/75":"text-cyan-200/70"),children:g?"Needs attention":"Building"}),(0,d.jsx)("h3",{className:(0,y.cn)("mt-1 text-[13px] font-medium",e?g?"text-rose-950":"text-[#281d17]":g?"text-rose-50":"text-white"),children:g?"Workspace creation needs attention":b.title}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[10px] leading-[0.95rem]",e?g?"text-rose-700":"text-[#6f5a4c]":g?"text-rose-100/80":"text-slate-300"),children:g?"Review the captured output and retry when the workspace state is clean.":b.description})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]",e?g?"border-rose-200 bg-white text-rose-700":"border-[#dcc7b8] bg-white/75 text-[#8b6f5c]":g?"border-rose-300/20 bg-rose-300/8 text-rose-100":"border-cyan-300/16 bg-cyan-300/10 text-cyan-100"),children:g?"Error":`${b.percent}%`}),f?(0,d.jsx)("span",{className:(0,y.cn)("max-w-[140px] truncate rounded-full border px-2 py-0.5 text-[7px] uppercase tracking-[0.14em]",e?g?"border-rose-200 bg-white text-rose-700":"border-[#e9d7ca] bg-white text-[#8b6f5c]":g?"border-rose-300/18 bg-rose-300/8 text-rose-100":"border-white/10 bg-white/[0.04] text-slate-300"),children:f.label}):null]})]}),(0,d.jsx)("div",{className:"relative z-[1] mt-2.5 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)(s.P.div,{className:(0,y.cn)("h-full rounded-full transition-[width] duration-500 ease-out",e?g?"bg-rose-300/85":"bg-amber-300/85":g?"bg-rose-300/85":"bg-cyan-300/85"),style:{width:`${b.percent}%`}})}),(0,d.jsxs)("div",{className:(0,y.cn)("relative z-[1] mt-2.5 overflow-hidden rounded-[14px] border px-2.5 py-2",e?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,d.jsx)("div",{"aria-hidden":"true",className:(0,y.cn)("absolute inset-0 opacity-60",e?"bg-[linear-gradient(90deg,transparent,rgba(216,180,254,0.12),transparent)]":"bg-[linear-gradient(90deg,transparent,rgba(34,211,238,0.08),transparent)]")}),(0,d.jsx)("div",{className:"relative z-[1] flex items-center gap-2",children:["Workspace","Starter agent","Canvas"].map((a,c)=>{let f=0===c?b.percent>=28:1===c?b.percent>=62:b.percent>=88,h=!g&&!f&&(0===c||1===c&&b.percent>=28||2===c&&b.percent>=62);return(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,d.jsxs)("div",{className:(0,y.cn)("relative flex min-h-[52px] min-w-0 flex-1 flex-col justify-between rounded-[12px] border px-2 py-1.5",f?e?"border-emerald-200 bg-emerald-50/80":"border-emerald-300/20 bg-emerald-300/10":h?e?"border-[#d8b69b] bg-[#fff8f1]":"border-cyan-300/18 bg-cyan-300/[0.06]":e?"border-[#ead8c8] bg-white/65":"border-white/8 bg-white/[0.03]"),children:[h?(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute inset-y-0 left-0 w-1/2",e?"bg-gradient-to-r from-transparent via-[#d9b08d]/20 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/10 to-transparent"),animate:{x:["-50%","220%"]},transition:{duration:1.8,repeat:1/0,ease:"linear"}}):null,(0,d.jsx)("span",{className:(0,y.cn)("relative z-[1] inline-flex h-5 w-5 items-center justify-center rounded-full border text-[8px]",f?e?"border-emerald-300 bg-white text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":e?"border-[#dcc7b8] bg-white text-[#8b6f5c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:f?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):h?(0,d.jsx)(k.A,{className:"h-2.5 w-2.5 animate-spin"}):c+1}),(0,d.jsx)("span",{className:(0,y.cn)("relative z-[1] truncate text-[8px] leading-[0.9rem]",e?"text-[#5f4b3e]":"text-slate-300"),children:a})]}),c<2?(0,d.jsx)("span",{className:(0,y.cn)("hidden h-px w-4 shrink-0 sm:block",f?e?"bg-emerald-300/70":"bg-emerald-300/45":e?"bg-[#dfcabb]":"bg-white/12")}):null]},a)})})]}),(0,d.jsx)("div",{className:"relative z-[1] mt-2.5 space-y-1.5",children:b.steps.map((a,b)=>{let c="active"===a.status,f="done"===a.status?e?"border-emerald-200 bg-emerald-50/75":"border-emerald-400/20 bg-emerald-400/10":c?e?"border-[#d9bca5] bg-white":"border-cyan-300/18 bg-cyan-300/[0.05]":e?"border-[#eadccc] bg-white/70":"border-white/6 bg-white/[0.03]",h="done"===a.status?e?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":c?e?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100":e?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400";return(0,d.jsxs)("div",{className:(0,y.cn)("relative overflow-hidden rounded-[12px] border px-2.5 py-1.5",f),children:[c?(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]",e?"bg-gradient-to-r from-transparent via-[#d9b08d]/24 to-transparent":g?"bg-gradient-to-r from-transparent via-rose-300/10 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/12 to-transparent"),animate:{x:["-25%","230%"]},transition:{duration:1.7,repeat:1/0,ease:"linear"}}):null,(0,d.jsxs)("div",{className:"relative z-[1] flex items-start gap-1.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[9px] font-medium",h),children:"done"===a.status?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):c?(0,d.jsx)(k.A,{className:"h-2.5 w-2.5 animate-spin"}):b+1}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px]",e?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsxs)("span",{className:(0,y.cn)("text-[7px] tabular-nums",e?"text-[#8f7664]":"text-slate-400"),children:[a.percent,"%"]})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.82rem]",e?"text-[#8f7664]":"text-slate-500"),children:a.detail||a.description}),(0,d.jsx)("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)(s.P.div,{className:(0,y.cn)("h-full rounded-full transition-[width] duration-500 ease-out","done"===a.status?"bg-emerald-300/85":c?e?g?"bg-rose-300/85":"bg-amber-300/85":g?"bg-rose-300/85":"bg-cyan-300/85":"bg-transparent"),style:{width:`${Math.max(a.percent,10*!!c)}%`}})}),c&&a.activities.length>0?(0,d.jsx)("div",{className:"mt-1 space-y-0.5",children:a.activities.slice(-2).map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("flex items-start gap-1.5 text-[8px] leading-[0.9rem]",e?"text-[#705b4d]":"text-slate-300"),children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full","done"===a.status&&"bg-emerald-300","active"===a.status&&"bg-cyan-300","error"===a.status&&"bg-rose-300","pending"===a.status&&(e?"bg-[#c9b4a2]":"bg-slate-500"))}),(0,d.jsx)("span",{className:"min-w-0",children:a.message})]},a.id))}):null]})]})]},a.id)})})]})}function bH({surfaceTheme:a,label:b,value:c,detail:e}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e6d7cb] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:b}),(0,d.jsx)("p",{title:c,className:(0,y.cn)("mt-1 truncate text-[10px]","light"===a?"text-[#33251c]":"text-white"),children:c}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===a?"text-[#8f7664]":"text-slate-500"),children:e})]})}function bI({surfaceTheme:a,statusCopy:b,showDetails:c,phaseLabel:e,detailsOpen:f,onDetailsOpenChange:h,run:i}){let[j,l]=(0,g.useState)(!1),m=(0,a4.T)(i.manualCommand),n=async()=>{if(i.manualCommand)try{await navigator.clipboard.writeText(i.manualCommand),w.o.success("Command copied.",{description:"Open Terminal and paste it."})}catch(a){w.o.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},o=async()=>{if(i.manualCommand&&m){l(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:i.manualCommand})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");w.o.success("Terminal opened.",{description:"Finish auth there, then refresh."})}catch(a){w.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{l(!1)}}};return(0,d.jsxs)("div",{className:(0,y.cn)("mt-2.5 rounded-[12px] border","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,d.jsxs)("div",{className:"px-2.5 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Status"}),c?(0,d.jsx)("button",{type:"button",onClick:()=>h(!f),className:(0,y.cn)("text-[8px] uppercase tracking-[0.16em] transition-colors","light"===a?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:f?"Hide details":"Show details"}):null]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:b})]}),c&&f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center justify-between border-y px-2.5 py-1.5","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Log"}),(0,d.jsx)("span",{className:"light"===a?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:e})]}),(0,d.jsx)("pre",{className:(0,y.cn)("max-h-[120px] min-h-[68px] overflow-auto whitespace-pre-wrap break-words px-2.5 py-2 font-mono text-[8px] leading-[0.82rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:i.log||"No output yet.\n\nStart the step to stream logs."}),i.manualCommand?(0,d.jsxs)("div",{className:(0,y.cn)("border-t px-2.5 py-2","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:m?"Terminal":"Manual"}),m?(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===a?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command."}):null,(0,d.jsx)("p",{className:(0,y.cn)("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:i.manualCommand}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:n,className:bg(a),children:[(0,d.jsx)(a1.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),m?(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:o,disabled:j,className:bg(a),children:j?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(I.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),i.docsUrl?(0,d.jsxs)("a",{href:i.docsUrl,target:"_blank",rel:"noreferrer",className:(0,y.cn)("mt-2 inline-flex items-center gap-1 text-[9px] underline underline-offset-4","light"===a?"text-[#7f6554]":"text-slate-300"),children:["Setup docs",(0,d.jsx)(a8.A,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function bJ({surfaceTheme:a,statusCopy:b,phaseLabel:c,buildScene:e}){let f="light"===a;return(0,d.jsx)("div",{className:(0,y.cn)("mt-3 overflow-hidden rounded-[24px] border",f?"border-[#e1d4c6] bg-[linear-gradient(180deg,rgba(255,251,247,0.96),rgba(248,241,233,0.98))]":"border-cyan-300/18 bg-[radial-gradient(circle_at_top,rgba(12,24,40,0.98),rgba(5,10,18,0.98)_72%)]"),children:(0,d.jsxs)("div",{className:"relative isolate min-h-[440px] overflow-hidden px-4 py-4 sm:px-5 sm:py-5",children:[(0,d.jsx)("div",{className:(0,y.cn)("pointer-events-none absolute inset-0",f?"bg-[radial-gradient(circle_at_20%_20%,rgba(255,255,255,0.96),transparent_30%),radial-gradient(circle_at_80%_10%,rgba(221,182,152,0.18),transparent_24%),linear-gradient(135deg,rgba(255,255,255,0.06),transparent_30%,rgba(218,193,176,0.12)_58%,transparent_72%)]":"bg-[radial-gradient(circle_at_20%_20%,rgba(34,211,238,0.16),transparent_24%),radial-gradient(circle_at_82%_12%,rgba(56,189,248,0.11),transparent_20%),linear-gradient(135deg,rgba(255,255,255,0.03),transparent_34%,rgba(34,211,238,0.05)_58%,transparent_74%)]")}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute -left-12 top-8 h-36 w-36 rounded-full blur-3xl",f?"bg-[#f1b27d]/25":"bg-cyan-300/12"),animate:{x:[0,16,0],y:[0,-10,0],opacity:[.55,.8,.55]},transition:{duration:8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute right-0 top-24 h-44 w-44 rounded-full blur-3xl",f?"bg-[#f9d8b6]/22":"bg-sky-300/10"),animate:{x:[0,-18,0],y:[0,8,0],opacity:[.35,.7,.35]},transition:{duration:10,repeat:1/0,ease:"easeInOut"}}),(0,d.jsxs)("div",{className:"relative z-[1] flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[9px] uppercase tracking-[0.24em]",f?"text-[#8f6f5d]":"text-cyan-200/70"),children:"Building"}),(0,d.jsx)("h3",{className:(0,y.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em] sm:text-[22px]",f?"text-[#231a15]":"text-white"),children:"Creating your demo workspace"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 max-w-[42rem] text-[11px] leading-[1rem] sm:text-[12px] sm:leading-[1.05rem]",f?"text-[#6f5a4c]":"text-slate-300"),children:b})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[8px] uppercase tracking-[0.16em]",f?"border-[#d9c3b1] bg-white/70 text-[#8b6f5c]":"border-cyan-300/18 bg-cyan-300/10 text-cyan-100"),children:c}),e.selectedModelLabel?(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex max-w-[220px] truncate rounded-full border px-2.5 py-1 text-[9px]",f?"border-[#ead8c8] bg-white text-[#5a4638]":"border-white/10 bg-white/[0.04] text-slate-200"),children:["Default model: ",e.selectedModelLabel]}):null]})]}),(0,d.jsxs)("div",{className:"relative z-[1] mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(280px,0.8fr)]",children:[(0,d.jsxs)("div",{className:(0,y.cn)("relative min-h-[290px] overflow-hidden rounded-[28px] border",f?"border-[#ead8c8] bg-[linear-gradient(180deg,rgba(255,255,255,0.92),rgba(252,246,239,0.98))] shadow-[0_18px_50px_rgba(165,126,98,0.08)]":"border-white/10 bg-[linear-gradient(180deg,rgba(9,16,28,0.98),rgba(5,10,18,0.98))] shadow-[0_18px_50px_rgba(0,0,0,0.3)]"),children:[(0,d.jsx)("div",{className:(0,y.cn)("absolute inset-0 opacity-80",f?"bg-[linear-gradient(rgba(116,85,65,0.05)_1px,transparent_1px),linear-gradient(90deg,rgba(116,85,65,0.05)_1px,transparent_1px)] bg-[size:28px_28px]":"bg-[linear-gradient(rgba(56,189,248,0.08)_1px,transparent_1px),linear-gradient(90deg,rgba(56,189,248,0.08)_1px,transparent_1px)] bg-[size:28px_28px]")}),(0,d.jsx)(s.P.div,{"aria-hidden":"true",className:(0,y.cn)("absolute inset-x-0 top-0 h-px",f?"bg-gradient-to-r from-transparent via-[#caa789] to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent"),animate:{opacity:[.4,1,.4]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,d.jsxs)("div",{className:"relative flex flex-col items-center text-center",children:[(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute h-56 w-56 rounded-full border",f?"border-[#d8bda5]/45":"border-cyan-200/14"),animate:{rotate:360},transition:{duration:28,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute h-40 w-40 rounded-full border",f?"border-[#e2c4ad]/65":"border-cyan-200/16"),animate:{rotate:-360},transition:{duration:18,repeat:1/0,ease:"linear"}}),(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute h-24 w-24 rounded-full border",f?"border-[#f0d8c8] bg-white/90":"border-cyan-300/18 bg-cyan-300/[0.08]"),animate:{scale:[1,1.04,1],opacity:[.75,1,.75]},transition:{duration:3.8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("div",{className:(0,y.cn)("relative flex h-24 w-24 items-center justify-center rounded-full border shadow-[0_0_0_14px_rgba(255,255,255,0.03)]",f?"border-[#d7b9a0] bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.98),rgba(246,232,219,0.98))] text-[#7c5b46]":"border-cyan-300/24 bg-[radial-gradient(circle_at_top,rgba(16,30,48,0.96),rgba(7,12,21,0.98))] text-cyan-100"),children:(0,d.jsx)(k.A,{className:"h-10 w-10 animate-spin"})}),(0,d.jsx)("p",{className:(0,y.cn)("mt-5 text-[9px] uppercase tracking-[0.22em]",f?"text-[#9a7d69]":"text-cyan-200/70"),children:"Workspace fabric"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em]",f?"text-[#281d17]":"text-white"),children:e.headline}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 max-w-[28rem] text-[11px] leading-[1rem]",f?"text-[#6a5547]":"text-slate-300"),children:e.summary}),(0,d.jsxs)("div",{className:"mt-5 flex flex-wrap items-center justify-center gap-2",children:[(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",f?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,d.jsx)("span",{className:(0,y.cn)("h-1.5 w-1.5 rounded-full",f?"bg-[#c98a5f]":"bg-cyan-300")}),"Building workspace"]}),(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",f?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,d.jsx)("span",{className:(0,y.cn)("h-1.5 w-1.5 rounded-full",f?"bg-emerald-500":"bg-emerald-300")}),"Default model locked"]})]})]})}),(0,d.jsx)("div",{className:"absolute inset-x-5 bottom-5",children:(0,d.jsx)("div",{className:(0,y.cn)("relative h-2 overflow-hidden rounded-full border",f?"border-[#dec8b8] bg-white/90":"border-white/10 bg-white/[0.04]"),children:(0,d.jsx)(s.P.div,{className:(0,y.cn)("absolute inset-y-0 left-0 w-1/3 rounded-full",f?"bg-gradient-to-r from-[#b97b4c] via-[#f1c59b] to-[#e39e69]":"bg-gradient-to-r from-cyan-400 via-sky-200 to-cyan-500"),animate:{x:["-15%","125%"]},transition:{duration:2.4,repeat:1/0,ease:"linear"}})})})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:[e.steps.map((a,b)=>(0,d.jsx)(s.P.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,delay:.05*b},className:(0,y.cn)("rounded-[18px] border px-3 py-2.5","current"===a.state?f?"border-[#d9b79f] bg-white shadow-[0_10px_28px_rgba(185,122,77,0.08)]":"border-cyan-300/24 bg-white/[0.05] shadow-[0_10px_28px_rgba(0,0,0,0.18)]":"done"===a.state?f?"border-[#e7d5c6] bg-[rgba(255,255,255,0.76)]":"border-white/10 bg-white/[0.03]":f?"border-[#eadccf] bg-[rgba(255,250,246,0.8)]":"border-white/8 bg-white/[0.02]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("div",{className:(0,y.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium","current"===a.state?f?"border-[#c78e61] bg-[#f7e6d7] text-[#6b4d39]":"border-cyan-300/28 bg-cyan-300/12 text-cyan-50":"done"===a.state?f?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/12 text-emerald-200":f?"border-[#e2d4c7] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"done"===a.state?(0,d.jsx)(a6.A,{className:"h-3.5 w-3.5"}):b+1}),(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px] font-medium",f?"text-[#2b1f18]":"text-white"),children:a.label}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[9px] leading-[0.95rem]",f?"text-[#7c6554]":"text-slate-400"),children:a.detail})]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full px-1.5 py-0.5 text-[7px] uppercase tracking-[0.14em]","current"===a.state?f?"bg-[#f1dfd0] text-[#835f48]":"bg-cyan-300/12 text-cyan-100":"done"===a.state?f?"bg-emerald-100 text-emerald-700":"bg-emerald-300/12 text-emerald-200":f?"bg-[#f6ece3] text-[#a0826e]":"bg-white/[0.04] text-slate-500"),children:"done"===a.state?"Ready":"current"===a.state?"Building":"Queued"})]})})]})},a.id)),(0,d.jsxs)("div",{className:(0,y.cn)("mt-auto rounded-[20px] border p-3",f?"border-[#ead8c8] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[8px] uppercase tracking-[0.18em]",f?"text-[#8f6f5d]":"text-cyan-200/60"),children:"Live build feed"}),(0,d.jsx)("span",{className:(0,y.cn)("text-[9px]",f?"text-[#8a6f5e]":"text-slate-400"),children:c})]}),(0,d.jsx)("div",{className:"mt-2 space-y-1.5",children:e.logLines.length>0?e.logLines.slice(-4).map((a,b)=>(0,d.jsxs)(s.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25,delay:.04*b},className:(0,y.cn)("flex items-start gap-2 rounded-[14px] border px-2.5 py-2 text-[10px] leading-[0.98rem]",b===e.logLines.length-1?f?"border-[#d8b79e] bg-[#fff7f0] text-[#5a4638]":"border-cyan-300/18 bg-cyan-300/[0.06] text-slate-100":f?"border-[#eee0d3] bg-[#fffdfb] text-[#735d4e]":"border-white/8 bg-white/[0.02] text-slate-300"),children:[(0,d.jsx)("span",{className:(0,y.cn)("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",b===e.logLines.length-1?f?"bg-[#c98758]":"bg-cyan-300":f?"bg-[#e3c8b2]":"bg-slate-500")}),(0,d.jsx)("span",{className:"min-w-0",children:a})]},`${a}-${b}`)):(0,d.jsx)("div",{className:(0,y.cn)("rounded-[14px] border border-dashed px-2.5 py-3 text-[10px]",f?"border-[#e8d7c8] text-[#7e6453]":"border-white/10 text-slate-400"),children:"Waiting for the first build signal..."})})]})]})]})]})})}function bK({snapshot:a,surfaceTheme:b,stage:c,systemReady:e,modelReady:f,systemSetupRequired:g,showReadyState:h,systemActionLabel:i,systemActionDescription:j,systemPhase:l,modelPhase:m,systemRun:n,modelRun:p,modelSwitchFeedback:q,selectedModelId:r,discoveredModels:t,onSelectedModelIdChange:v,onClearModelSwitchFeedback:w,onSnapshotChange:x,onRunSystemSetup:z,onRunModelSetDefault:A,onOpenAddModels:B,onOpenGatewayAuthSettings:C,onCreateWorkspace:D,onEnterAgentOS:E,onContinueToModels:F,onBackToSystem:G,onSelectStage:H,launchpadCreateProgress:I,launchpadCreateRunState:J}){var K,L;let M=e??("success"===n.runState||(0,a9.h6)(a)),N=(0,a3.Id)(a),O=f??("success"===q.phase||h||(0,a9.X2)(a)),P=O&&(h||!N||"running"===J||"success"===J||"error"===J),Q="running"===J,R=a.workspaces.length,S=a.agents.length,T=R>0,U=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Ready",V=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,W=[{id:"system",order:1,label:"System setup",description:"CLI, gateway, RPC",state:bf(M,"system"===c&&!M)},{id:"models",order:2,label:"Model setup",description:"Default model, auth",state:bf(O,"models"===c&&!O)}],X=function(a,b,c={}){let d=!0===c.forcePending,e=!d&&a.diagnostics.rpcOk&&!a.diagnostics.loaded,f=!d&&a.diagnostics.installed||"installing-gateway"===b||"starting-gateway"===b||"verifying"===b||"ready"===b,g=!d&&a.diagnostics.loaded||e||"starting-gateway"===b||"verifying"===b||"ready"===b,h=!d&&a.diagnostics.rpcOk||"ready"===b,i=!d&&a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable||"ready"===b,j=h&&i;return[{id:"cli",label:"OpenClaw CLI",description:bd("cli",a,b,f,g,h,j,d),state:bf(f,!f&&("detecting"===b||"installing-cli"===b))},{id:"gateway",label:"Gateway service",description:bd("gateway",a,b,f,g,h,j,d),state:bf(g,!g&&("installing-gateway"===b||f&&"detecting"===b))},{id:"runtime",label:"Runtime ready",description:bd("runtime",a,b,f,g,h,j,d),state:bf(j,!j&&("starting-gateway"===b||"verifying"===b||g&&"detecting"===b||g||h))}]}(a,M?"ready":l,{forcePending:g}),Y=be(r,a.models.filter(a=>!1!==a.available&&!a.missing)),Z="system"===c?n:p,$=Z.statusMessage||Z.resultMessage||("system"===c?j:Y?`Selected model: ${Y}.`:"Choose a provider, connect it, and then pick a model."),_="system"===c?M?"ready":g?"waiting":(0,a9.iN)(a)?"ready":a.diagnostics.rpcOk?"verifying access":a.diagnostics.loaded&&!a.diagnostics.rpcOk?"verifying"===l?"connecting":"starting gateway":l?l.replace("-"," "):"waiting":(0,a9.X2)(a)?"ready":a.diagnostics.modelReadiness.ready&&"passed"!==a.diagnostics.runtime.smokeTest.status?"smoke test":m?m.replace("-"," "):"waiting",aa="idle"!==Z.runState||!!Z.manualCommand||Z.log.trim().length>0||"models"===c&&t.length>0,ab=(K=Z.runState,"running"===K?"Running":O?"Ready":"success"===K?"models"===c?"Updated":"Step complete":"error"===K?"Needs attention":"system"===c?"Step 1":"Step 2"),ac=a.diagnostics.issues.some(a=>/gateway\..*auth|redacted secret|AGENTOS_OPENCLAW_GATEWAY_TOKEN|OPENCLAW_GATEWAY_TOKEN/i.test(a)),ad=function(a){if("system"===a.stage)return a.systemReady&&a.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:a.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:a.systemActionLabel};let b=a.selectedModelId.trim(),c=a.defaultModelId?.trim()??"";return b?b===c?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"set-default",label:"Set as default"}:a.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"select-model",label:"Select a model"}}({stage:c,systemReady:M,modelReady:O,systemActionLabel:i,selectedModelId:r,defaultModelId:V});return(0,d.jsx)(s.P.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:(0,y.cn)("openclaw-onboarding-backdrop absolute inset-0 z-[80] pointer-events-auto isolate flex items-center justify-center overflow-hidden px-3 py-4 sm:px-4 sm:py-6","light"===b?"openclaw-onboarding-backdrop--light bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.94),rgba(247,239,232,0.88)_46%,rgba(242,230,220,0.92))]":"openclaw-onboarding-backdrop--dark bg-[radial-gradient(circle_at_top,rgba(17,24,39,0.9),rgba(3,7,18,0.92)_48%,rgba(2,6,23,0.96))]"),children:(0,d.jsx)(s.P.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:(0,y.cn)("relative z-10 my-auto flex w-full min-h-0 max-h-[min(80vh,640px)] flex-col overflow-hidden rounded-[16px] border shadow-[0_18px_46px_rgba(0,0,0,0.18)] backdrop-blur-2xl",P&&(Q||"error"===J)?"max-w-[640px]":"max-w-[420px]","light"===b?"border-[#dccabd]/90 bg-[rgba(255,250,246,0.92)] text-[#47362b] shadow-[0_18px_50px_rgba(161,125,101,0.15)]":"border-white/10 bg-[rgba(6,10,18,0.84)] text-slate-100"),children:(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"px-2.5 py-2.5 sm:px-3 sm:py-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#d8c0b0] bg-[#f3e7dc] text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,d.jsx)(o.A,{className:"h-2 w-2"}),P?Q?"Opening":"error"===J?"Needs attention":"Launchpad":"Welcome"]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(L=Z.runState,"error"===L?"light"===b?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===L||O?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===L?"light"===b?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===b?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:ab})]}),(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)("p",{className:(0,y.cn)("whitespace-nowrap text-[9px] leading-[1rem] tracking-[0.08em]","light"===b?"text-[#33251c]":"text-slate-100"),children:P?Q?"AGENTOS : Opening your first workspace.":"error"===J?"AGENTOS : Workspace setup needs attention.":N?"AGENTOS : OpenClaw is ready. Choose your first action below.":T?"AGENTOS : Syncing the first workspace agent.":"AGENTOS : OpenClaw is ready. Create the first workspace below.":"AGENTOS : Bring your local OpenClaw online."})}),(0,d.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:W.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>H(a.id),className:(0,y.cn)("rounded-[14px] border px-2.5 py-2 text-left transition-colors hover:opacity-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","light"===b?"focus-visible:ring-[#c8946f] focus-visible:ring-offset-[#fff7f1]":"focus-visible:ring-white/70 focus-visible:ring-offset-[#060a12]",bl(a.state,b)),"aria-pressed":c===a.id,children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:(0,y.cn)("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",bm(a.state,b)),children:"complete"===a.state?(0,d.jsx)(a6.A,{className:"h-2.5 w-2.5"}):a.order}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",bn(a.state,b)),children:"complete"===a.state?"Ready":"current"===a.state?"Active":"Pending"})]})},a.id))})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-2.5 pb-2.5 sm:px-3 sm:pb-3",children:P?(0,d.jsx)(bF,{surfaceTheme:b,workspaceCount:R,agentCount:S,workspaceSetupReady:N,defaultModelLabel:U,createProgress:I,createRunState:J}):"system"===c?(0,d.jsx)(bz,{steps:X,surfaceTheme:b,statusCopy:$,showDetails:aa,phaseLabel:_,run:Z,gatewayAuthNeedsSetup:ac,onOpenGatewayAuthSettings:C}):(0,d.jsx)(bA,{snapshot:a,surfaceTheme:b,statusCopy:$,showDetails:aa,phaseLabel:_,run:Z,modelPhase:m,selectedModelId:r,modelSwitchFeedback:q,onSelectedModelIdChange:v,onClearModelSwitchFeedback:w,onOpenAddModels:B,onSnapshotChange:x})}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-auto flex flex-wrap items-center justify-between gap-1.5 border-t px-2.5 py-2 sm:px-3","light"===b?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:P?(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]","light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:T?N?"Setup complete":"error"===J?"Needs attention":"Syncing agent":"running"===J?"Building workspace":"error"===J?"Needs attention":"Ready"}):"models"===c?(0,d.jsxs)(u.$,{type:"button",variant:"ghost",size:"sm",onClick:G,disabled:"running"===Z.runState,className:"light"===b?"border border-[#d7bca7] bg-[#f8ede4] text-[#5a4131] hover:bg-[#eedbcc] hover:text-[#3f2d21]":"text-slate-500 hover:bg-white/[0.08] hover:text-slate-200",children:[(0,d.jsx)(a7.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null}),(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:P?(0,d.jsx)(d.Fragment,{children:N?(0,d.jsxs)(u.$,{type:"button",onClick:E,className:(0,y.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:["Enter AgentOS",(0,d.jsx)(a8.A,{className:"ml-1.5 h-3 w-3"})]}):Q?(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[9px] uppercase tracking-[0.16em]","light"===b?"border-[#d8c0b0] bg-white/85 text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,d.jsx)(k.A,{className:"h-3 w-3 animate-spin"}),"Building workspace"]}):(0,d.jsxs)(u.$,{type:"button",onClick:D,className:(0,y.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:["error"===J?"Retry setup":"Create Workspace",(0,d.jsx)(a8.A,{className:"ml-1.5 h-3 w-3"})]})}):(0,d.jsxs)(d.Fragment,{children:["models"!==c||O?null:(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>B(),className:bg(b),children:"Open full Add Models"}),(0,d.jsx)(u.$,{type:"button",onClick:()=>{"system"===c?"dismiss"===ad.kind?E():M?F():z():"dismiss"===ad.kind?E():"set-default"===ad.kind&&A(r||void 0)},disabled:"running"===Z.runState||"select-model"===ad.kind,className:(0,y.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:"running"===Z.runState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,d.jsxs)(d.Fragment,{children:[ad.label,(0,d.jsx)(a8.A,{className:"ml-1.5 h-3 w-3"})]})})]})})]})]})})})}var bL=c(51858),bM=c(17166),bN=c(36130),bO=c(34118);function bP({open:a,target:b,surfaceTheme:c,previewState:e,preview:f,previewError:g,runState:h,statusMessage:i,resultMessage:j,backgroundLogPath:l,log:m,confirmText:n,onConfirmTextChange:o,onRefreshPreview:p,onExecute:q,onBackToSetup:r,onOpenChange:s}){let t="full-uninstall"===b?"FULL UNINSTALL":"RESET MISSION CONTROL",v="running"===h,w="success"===h||"error"===h,x=null!==b&&"ready"===e&&!v&&!w&&n.trim()===t,z="full-uninstall"===b?"Full Uninstall":"Reset AgentOS",A="light"===c?"border-rose-400/80 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/35 bg-rose-500/90 text-white hover:bg-rose-500";return(0,d.jsx)(a2.lG,{open:a,onOpenChange:a=>{(a||!v)&&s(a)},children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("max-h-[88vh] w-[min(92vw,56rem)] max-w-[92vw] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl","light"===c?"border-[#dcc8bb] bg-[rgba(252,247,241,0.98)] text-[#402f24]":"border-white/12 bg-[rgba(7,12,22,0.96)] text-slate-100"),children:[(0,d.jsxs)(a2.c7,{children:[(0,d.jsxs)(a2.L3,{className:(0,y.cn)("flex items-center gap-2","light"===c?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===b?(0,d.jsx)(bL.A,{className:"h-4 w-4"}):(0,d.jsx)(bM.A,{className:"h-4 w-4"}),z]}),(0,d.jsx)(a2.rr,{className:"light"===c?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===b?"Remove AgentOS state, task history, OpenClaw service and local state, then attempt to remove detected OpenClaw and AgentOS CLI installs.":"Remove AgentOS-managed workspaces, attached agents, task history, planner state, and browser state."})]}),"loading"===e?(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center gap-2 rounded-[16px] border px-4 py-4 text-sm","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===e?(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50 text-rose-900":"border-rose-400/25 bg-rose-500/10 text-rose-100"),children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"Preview could not be prepared."}),(0,d.jsx)("p",{className:"mt-1 text-sm",children:g||"Unknown reset preview error."})]}):null,f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,d.jsx)(bQ,{label:"Delete folders",value:String(f.summary.deleteFolderCount),surfaceTheme:c}),(0,d.jsx)(bQ,{label:"Keep folders",value:String(f.summary.metadataOnlyCount),surfaceTheme:c}),(0,d.jsx)(bQ,{label:"Agents",value:String(f.summary.agentCount),surfaceTheme:c}),(0,d.jsx)(bQ,{label:"Live agents",value:String(f.summary.liveAgentCount),surfaceTheme:c,danger:f.summary.liveAgentCount>0})]}),f.warnings.length>0?(0,d.jsx)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-amber-300/90 bg-amber-50 text-amber-950":"border-amber-300/25 bg-amber-300/10 text-amber-50"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(P.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,d.jsx)("div",{className:"space-y-1 text-sm",children:f.warnings.map(a=>(0,d.jsx)("p",{children:a},a))})]})}):null,(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-sm","light"===c?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and AgentOS integration from that location."})]}),(0,d.jsx)(u.$,{type:"button",size:"sm",variant:"secondary",onClick:p,className:"light"===c?"border-[#dcc6b6] bg-white text-[#5d4739] hover:bg-[#f7eee7] hover:text-[#5d4739]":void 0,children:"Refresh preview"})]}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:f.workspaces.map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.name}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-400"),children:a.path})]}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]","delete-folder"===a.action?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:"delete-folder"===a.action?"Delete folder":"Keep folder"})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:[a.agentCount," agents, ",a.runtimeCount," tracked runs, ",a.liveAgentCount," live agents."]}),(0,d.jsx)("div",{className:"mt-2 space-y-1",children:a.reasons.map(a=>(0,d.jsx)("p",{className:(0,y.cn)("text-xs","light"===c?"text-[#7e6555]":"text-slate-500"),children:a},a))})]},a.workspaceId))})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,d.jsx)(bR,{title:"AgentOS state",items:f.missionControlPaths,surfaceTheme:c}),(0,d.jsx)(bR,{title:"Browser state",items:f.browserStorageKeys,surfaceTheme:c})]}),"full-uninstall"===b?(0,d.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,d.jsx)(bR,{title:"OpenClaw state",items:f.openClawPaths,surfaceTheme:c}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"CLI cleanup"}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:f.packageActions.map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("min-w-0 overflow-hidden rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("min-w-0 break-all text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.packageName}),(0,d.jsx)("span",{className:(0,y.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",a.detected?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a.detected?"Scheduled":"Manual"})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 break-words text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:a.reason||"No extra detail."}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-500"),children:a.command||"Automatic cleanup is not available."})]},a.packageName))})]})]}):null,(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50/70 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50"),children:[(0,d.jsxs)(bO.J,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",t," to continue"]}),(0,d.jsx)(br.p,{id:"reset-confirm",value:n,onChange:a=>o(a.target.value),placeholder:t,disabled:v,className:(0,y.cn)("mt-2 h-10","light"===c?"border-rose-200 bg-white text-rose-950 placeholder:text-rose-300":"border-rose-300/20 bg-slate-950/50 text-rose-50 placeholder:text-rose-200/35")})]})]}):null,"idle"!==h||j||m?(0,d.jsxs)("div",{className:(0,y.cn)("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===h?"light"===c?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===h?"light"===c?"border-emerald-200 bg-emerald-50 text-emerald-950":"border-emerald-400/25 bg-emerald-500/10 text-emerald-50":"light"===c?"border-[#e6d6ca] bg-white text-[#3f2f24]":"border-white/10 bg-white/[0.03] text-slate-100"),children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:i||j||"Reset status"}),j?(0,d.jsx)("p",{className:"mt-1 text-sm",children:j}):null,l?(0,d.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",l]}):null,(0,d.jsx)("pre",{className:(0,y.cn)("mt-3 max-h-56 w-full max-w-full overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-[14px] border px-3 py-3 text-[11px] leading-relaxed","light"===c?"border-[#e6d6ca] bg-[#fffaf6] text-[#5f4a3d]":"border-white/10 bg-slate-950/45 text-slate-300"),children:m||"Waiting for command output..."})]}):null,(0,d.jsxs)(a2.Es,{children:[(0,d.jsx)(u.$,{type:"button",variant:w?"default":"secondary",onClick:()=>{"full-uninstall"===b&&"success"===h?r():s(!1)},disabled:v,className:w&&"light"===c?"bg-[#5c4437] text-white hover:bg-[#4d382d]":w?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:"full-uninstall"===b&&"success"===h?"Back to setup":w?"Done":"Close"}),w?null:(0,d.jsx)(u.$,{type:"button",onClick:q,disabled:!x,className:A,children:v?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Running..."]}):(0,d.jsxs)(d.Fragment,{children:["full-uninstall"===b?(0,d.jsx)(bL.A,{className:"mr-1.5 h-3.5 w-3.5"}):(0,d.jsx)(bN.A,{className:"mr-1.5 h-3.5 w-3.5"}),z]})})]})]})})}function bQ({label:a,value:b,surfaceTheme:c,danger:e=!1}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-3",e?"light"===c?"border-rose-200 bg-rose-50":"border-rose-400/20 bg-rose-500/10":"light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 font-display text-lg","light"===c?"text-[#3f2f24]":"text-white"),children:b})]})}function bR({title:a,items:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:b.map(a=>(0,d.jsx)("p",{className:(0,y.cn)("break-all rounded-[12px] border px-3 py-2 font-mono text-[11px]","light"===c?"border-[#ece0d6] bg-[#fffaf6] text-[#6d5647]":"border-white/8 bg-white/[0.03] text-slate-400"),children:a},a))})]})}var bS=c(55421),bT=c.n(bS),bU=c(52426),bV=c(96615),bW=c(51118),bX=c(10903),bY=c(78282),bZ=c(11081),b$=c(23254),b_=c(15254),b0=c(90162),b1=c(49113);function b2(a,b,c){var d,e,f,g,h,i,j,k;let l,m,n=b3(a?.fallbackCounts),o=!function(a,b){if(0===a.length)return!1;if(!b)return!0;let c=Date.parse(b);return!Number.isFinite(c)||a.some(a=>{let b=Date.parse(a.at);return!Number.isFinite(b)||b>=c})}(a?.recentFallbackDiagnostics??[],a?.lastConnectedAt??null)?0:n,p=function(a){switch(a){case"cli-forced":return"CLI forced";case"connected":return"Connected";case"connecting":return"Connecting";case"idle":return"Idle";case"closed":return"Closed";case"error":return"Error";default:return"Unknown"}}(a?.connectionState),q=function(a){switch(a){case"live":return"Live";case"retrying":return"Retrying";default:return"Connecting"}}(b),r=(d=c,{label:function(a){switch(a){case"live":return"Gateway events: Live";case"reconnecting":return"Gateway events: Reconnecting";case"polling":return"Gateway events: Polling";default:return"Gateway events: Unknown"}}(l=d?.mode),lastEventLabel:b5(d?.lastEventAt),lastError:d?.lastError?.trim()||null,recovery:d?.recovery?.trim()||null,tone:"live"===(e=l)?"success":"reconnecting"===e||"polling"===e?"warning":"neutral"});return{modeLabel:"native-ws"===(f=a?.mode)?"Native WS":"cli"===f?"CLI forced":"Unknown",gatewayModeLabel:function(a){switch(a){case"native-ws":return"native-ws";case"cli-forced":return"cli-forced";case"fallback-active":return"fallback-active";case"degraded":return"degraded";case"unreachable":return"unreachable";default:return"unknown"}}(a?.gatewayMode),statusLabel:(g=a,g?.statusLabel?g.statusLabel:g?"cli"===g.mode||"cli-forced"===g.connectionState?"CLI fallback forced":b3(g.fallbackCounts)>0?"CLI fallback used":"connected"===g.connectionState?"Native Gateway: OK":"error"===g.connectionState?"Native Gateway: Unreachable":"Native Gateway: Degraded":"Native Gateway: Unknown"),connectionLabel:p,protocolLabel:"number"==typeof(h=a?.protocolVersion)&&Number.isFinite(h)?`v${h}`:"Unknown",protocolRangeLabel:(i=a?.protocolRange)&&"number"==typeof i.min&&"number"==typeof i.max?`v${i.min}-v${i.max} supported`:"Unknown",streamLabel:q,eventBridgeLabel:r.label,eventBridgeLastEventLabel:r.lastEventLabel,eventBridgeLastError:r.lastError,eventBridgeRecovery:r.recovery,eventBridgeTone:r.tone,fallbackTotal:n,fallbackOperationCount:b4(a?.fallbackCounts),fallbackSummaryLabel:(j=a?.fallbackTotal??n,m=b4(a?.fallbackCounts),j<=0||m<=0?"CLI fallback used: 0 operations":`CLI fallback used: ${j} ${1===j?"operation":"operations"} across ${m} ${1===m?"method":"methods"}`),lastConnectedLabel:b5(a?.lastConnectedAt),lastDisconnectedLabel:b5(a?.lastDisconnectedAt),lastNativeError:a?.lastNativeError?.trim()||null,recovery:a?.recovery?.trim()||null,recentFallbackDiagnostics:a?.recentFallbackDiagnostics??[],statusTone:"retrying"===(k={gatewayMode:a?.gatewayMode,connectionState:a?.connectionState,mode:a?.mode,streamState:b,fallbackTotal:o}).streamState||"error"===k.connectionState||"unreachable"===k.gatewayMode?"danger":"cli"===k.mode||"cli-forced"===k.connectionState||"closed"===k.connectionState||"connecting"===k.connectionState||"fallback-active"===k.gatewayMode||"degraded"===k.gatewayMode||k.fallbackTotal>0?"warning":"connected"===k.connectionState&&"live"===k.streamState?"success":"neutral"}}function b3(a){return Object.values(a??{}).reduce((a,b)=>Number.isFinite(b)&&b>0?a+b:a,0)}function b4(a){return Object.values(a??{}).filter(a=>Number.isFinite(a)&&a>0).length}function b5(a){if(!a)return"Not yet";let b=new Date(a);return Number.isNaN(b.getTime())?a:b.toLocaleString()}let b6=[{value:"auto",label:"Auto"},{value:"local-prefix",label:"Local prefix"},{value:"global-path",label:"Global PATH"},{value:"custom",label:"Custom"}],b7=[{id:"openclaw",label:"OpenClaw",icon:bU.A},{id:"gateway",label:"Gateway",icon:bV.A},{id:"models",label:"Models",icon:bW.A},{id:"workspace",label:"Workspace",icon:bX.A},{id:"agents",label:"Agents",icon:bY.A},{id:"diagnostics",label:"Diagnostics",icon:I.A},{id:"advanced",label:"Advanced",icon:bZ.A},{id:"danger-zone",label:"Danger Zone",icon:P.A,destructive:!0}];function b8(a){var b,c,e,h,i,j,l,m,n,o;let p,{snapshot:r,surfaceTheme:s,connectionState:t,gatewayDraft:v,workspaceRootDraft:w,openClawBinarySelection:x,isSavingGateway:z,isSavingWorkspaceRoot:A,isSavingOpenClawBinary:B,isCheckingForUpdates:C,updateRunState:D,selectedModelId:E,modelOnboardingRunState:F,gatewayControlAction:G,lastCheckedAt:H,onGatewayDraftChange:J,onWorkspaceRootDraftChange:K,onSelectedModelIdChange:L,onSaveGatewaySettings:M,onSaveWorkspaceRootSettings:N,onCheckForUpdates:O,onControlGateway:Q,onOpenSetupWizard:R,onRunModelRefresh:S,onRunModelSetDefault:T,onOpenAddModels:U,onOpenUpdateDialog:V,onOpenResetDialog:W,onOpenClawBinarySelectionModeChange:X,onOpenClawBinarySelectionPathChange:Y,onSaveOpenClawBinarySettings:Z,installSummary:$,sidebarOpen:_=!1}=a,[aa,ab]=(0,g.useState)(null),[ac,ad]=(0,g.useState)(null),[ae,af]=(0,g.useState)("token"),[ag,ah]=(0,g.useState)(""),[ai,aj]=(0,g.useState)(null),[ak,al]=(0,g.useState)(!1),[am,an]=(0,g.useState)(!1),[ao,ap]=(0,g.useState)(!1),[aq,ar]=(0,g.useState)(!1),[as,at]=(0,g.useState)(()=>r.diagnostics.compatibilitySmokeTest??null),[au,av]=(0,g.useState)(null),[aw,ax]=(0,g.useState)(!1),[ay,az]=(0,g.useState)(()=>r.diagnostics.configUpdatePacing),[aA,aB]=(0,g.useState)(()=>r.diagnostics.configUpdatePacing.settings.mode),[aC,aD]=(0,g.useState)(()=>String(Math.ceil((r.diagnostics.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3))),[aE,aF]=(0,g.useState)(null),[aG,aH]=(0,g.useState)(!1),[aI,aJ]=(0,g.useState)(0),[aK,aL]=(0,g.useState)(()=>cr()),[aM,aN]=(0,g.useState)(!1),aO=aM?aK:cr(),aP=!!(r.diagnostics.updateAvailable&&r.diagnostics.latestVersion),aQ=!!(r.diagnostics.version&&!r.diagnostics.latestVersion&&!r.diagnostics.updateError),aR=r.diagnostics.version||"unknown",aS=r.diagnostics.latestVersion||null,aT=r.diagnostics.updateInfo?.trim()||null,aU=r.diagnostics.updateError?.trim()||null,aV=r.diagnostics.modelReadiness.resolvedDefaultModel||r.diagnostics.modelReadiness.defaultModel||"",aW=E||aV||"",aX=r.models.find(a=>a.id===aW),aY=aX?.provider||r.diagnostics.modelReadiness.preferredLoginProvider||function(a){if(!a)return null;let[b]=a.split("/");return b||null}(aV)||"Not connected",aZ=(0,g.useMemo)(()=>r.diagnostics.commandHistory??[],[r.diagnostics.commandHistory]).slice(0,6),a$=(0,g.useMemo)(()=>({ok:aZ.filter(a=>"ok"===a.status).length,failed:aZ.filter(a=>"ok"!==a.status).length}),[aZ]),a_=(0,g.useMemo)(()=>b2(r.diagnostics.transport,t,r.diagnostics.eventBridge),[t,r.diagnostics.eventBridge,r.diagnostics.transport]),a0=r.diagnostics.capabilityMatrix,a2=r.diagnostics.compatibilityReport,a3=a0?.compatibility,a4=(r.diagnostics.gatewayFallbackDiagnostics?.length?r.diagnostics.gatewayFallbackDiagnostics:a0?.fallbackDiagnostics??[]).slice(0,4),a5=aa?aa.native.ok?"Authenticated":function(a){switch(a){case"auth":return"Needs credential";case"scope-limited":return"Needs scope repair";case"rate-limited":return"Rate limited";case"disabled":return"Disabled";case"unreachable":return"Unreachable";case"timeout":return"Timed out";case"malformed-response":return"Invalid response";default:return"Check failed"}}(aa.native.kind):"Unknown",a7=(0,g.useCallback)(async()=>{al(!0),ad(null);try{ab(await ci())}catch(a){ad(a instanceof Error?a.message:"Unable to check Gateway auth status.")}finally{al(!1)}},[]),a8=async()=>{let a=ag.trim();if(!a)return void ad("Gateway token/password is required.");an(!0),ad(null),aj(null);try{let b=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"saveCredential",kind:ae,value:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Gateway credential could not be saved.")}let c=await b.json();ab(c.authStatus),ah(""),aj("Saved to .env.local and applied to the current AgentOS server session.")}catch(a){ad(a instanceof Error?a.message:"Unable to save Gateway credential.")}finally{an(!1)}},a9=async()=>{ap(!0),ad(null),aj(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generateLocalToken"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway token could not be generated.")}let b=await a.json();ab(b.authStatus),aj("Generated a local Gateway token and applied it to AgentOS.")}catch(a){ad(a instanceof Error?a.message:"Unable to generate Gateway token.")}finally{ap(!1)}},ba=async()=>{ar(!0),ad(null),aj(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway device access could not be repaired.")}let b=await a.json();ab(b.authStatus),aj("Local Gateway device access repaired for AgentOS.")}catch(a){ad(a instanceof Error?a.message:"Unable to repair Gateway access.")}finally{ar(!1)}},bb=async()=>{ax(!0),av(null);try{let a=await fetch("/api/openclaw/compatibility-smoke",{method:"POST",cache:"no-store"});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw compatibility smoke test failed.")}let b=await a.json();at(b.report)}catch(a){av(a instanceof Error?a.message:"Unable to run OpenClaw compatibility smoke test.")}finally{ax(!1)}},bc=async()=>{aH(!0),aF(null);try{let a="custom"===aA?1e3*Math.max(1,Math.round(Number(aC)||10)):null,b=await fetch("/api/settings/config-pacing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:aA,minimumIntervalMs:a})}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to update config update pacing.");az(c.configUpdatePacing),aB(c.configUpdatePacing.settings.mode),aD(String(Math.ceil((c.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3)))}catch(a){aF(a instanceof Error?a.message:"Unable to update config update pacing.")}finally{aH(!1)}},bd=ay.cooldownUntil?Math.max(0,Date.parse(ay.cooldownUntil)-Date.now()+0*aI):null;return(0,d.jsx)("main",{className:(0,y.cn)("relative z-10 min-h-screen","light"===s?"text-foreground":"text-slate-100"),children:(0,d.jsx)("section",{className:(0,y.cn)("min-w-0 pb-8 pl-[72px] pr-3 pt-[86px] sm:pl-[84px] sm:pr-6 lg:mr-[84px] lg:px-7 xl:px-8",_?"lg:ml-[316px]":"lg:ml-[80px]"),children:(0,d.jsxs)("div",{className:"mx-auto max-w-[1160px] 2xl:max-w-[1240px]",children:[(0,d.jsx)("div",{className:"flex flex-col",children:(0,d.jsx)("nav",{"aria-label":"Settings sections",className:(0,y.cn)("flex flex-wrap gap-2 rounded-[22px] border p-2 backdrop-blur-xl","light"===s?"border-border bg-card/88 shadow-card":"border-border bg-card/88 shadow-[0_18px_44px_rgba(0,0,0,0.16)]"),children:b7.map(a=>{let b=aO===a.id,c=a.icon;return(0,d.jsxs)(bT(),{href:`/settings#${a.id}`,scroll:!1,"aria-current":b?"page":void 0,onClick:()=>{aL(a.id)},className:(0,y.cn)("inline-flex h-10 items-center gap-2 rounded-[14px] border px-3 text-xs font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35",b&&!a.destructive?"light"===s?"border-primary/35 bg-primary/10 text-primary shadow-[0_10px_26px_hsl(var(--primary)/0.10)]":"border-primary/35 bg-primary/12 text-primary shadow-[0_10px_26px_hsl(var(--primary)/0.14)]":b&&a.destructive?"light"===s?"border-destructive/35 bg-destructive/10 text-destructive shadow-[0_10px_26px_hsl(var(--destructive)/0.10)]":"border-destructive/35 bg-destructive/12 text-destructive shadow-[0_10px_26px_hsl(var(--destructive)/0.14)]":"light"===s?"border-border bg-card/75 text-muted-foreground hover:bg-muted/70 hover:text-foreground":"border-border bg-white/[0.035] text-muted-foreground hover:border-primary/20 hover:bg-white/[0.07] hover:text-foreground"),children:[(0,d.jsx)(c,{className:"h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("span",{children:a.label})]},a.id)})})}),(0,d.jsxs)("div",{className:"mt-5 flex flex-col gap-4",children:["openclaw"===aO?(0,d.jsx)("section",{id:"openclaw",className:"scroll-mt-24",children:(0,d.jsxs)("div",{className:(0,y.cn)("panel-surface panel-glow min-h-full overflow-hidden rounded-[22px] p-4","light"===s?"border-border bg-card/95 text-foreground shadow-card":"border-white/[0.08] bg-[linear-gradient(180deg,rgba(16,24,38,0.98),rgba(7,11,18,0.96))] text-slate-100"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:(0,y.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","border-primary/15 bg-primary/10 text-primary"),children:(0,d.jsx)(bU.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("h2",{className:"font-display text-lg",children:"OpenClaw"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 text-xs leading-5","light"===s?"text-muted-foreground":"text-slate-400"),children:"Source of truth for runtime and control state."})]})]}),(0,d.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:[(0,d.jsx)(ca,{label:"Current version",value:`v${r.diagnostics.version||"unknown"}`,surfaceTheme:s,dark:"dark"===s}),(0,d.jsx)(ca,{label:"Latest available",value:r.diagnostics.latestVersion?`v${r.diagnostics.latestVersion}`:"Unknown",badge:aP?"Update":"Stable",surfaceTheme:s,dark:"dark"===s})]}),(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:V,disabled:!aP||"running"===D,className:"h-9 rounded-full bg-emerald-600 px-4 text-xs text-white hover:bg-emerald-500",children:["running"===D?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b$.A,{className:"h-3.5 w-3.5"}),"Update now"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void O(),disabled:C||"running"===D,className:cu(s,"px-4"),children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Check"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>R(),className:cu(s,"px-4"),children:[(0,d.jsx)(b_.A,{className:"h-3.5 w-3.5"}),"Open wizard"]})]}),(0,d.jsx)(ch,{surfaceTheme:s,isCheckingForUpdates:C,isUpdateRegistryLoading:aQ,hasUpdateAvailable:aP,currentVersion:aR,latestVersion:aS,updateInfo:aT,updateError:aU,lastCheckedAt:H,isUpdateRunning:"running"===D}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-5 grid gap-3 border-t pt-4 sm:grid-cols-2","light"===s?"border-border":"border-white/10"),children:[(0,d.jsx)(ca,{label:"Detected install",value:$.label||"Unknown",surfaceTheme:s,dark:"dark"===s,compact:!0}),(0,d.jsx)(ca,{label:"Resolved path",value:co(x.resolvedPath||"openclaw",26),surfaceTheme:s,dark:"dark"===s,compact:!0})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] border p-3.5","light"===s?"border-border bg-muted/45":"border-white/10 bg-white/[0.035]"),children:[(0,d.jsx)(bO.J,{className:cs(s),children:"OpenClaw binary mode"}),(0,d.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:b6.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>X(a.value),className:(0,y.cn)("h-9 rounded-full border px-3 text-xs transition-colors",x.mode===a.value?"light"===s?"border-primary/35 bg-primary/10 text-primary":"border-primary/30 bg-primary/12 text-primary":"light"===s?"border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]"),children:a.label},a.value))}),"custom"===x.mode?(0,d.jsx)(br.p,{value:x.path??"",onChange:a=>Y(a.target.value),placeholder:"/path/to/openclaw",className:ct(s,"mt-3")}):null,(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void Z(x),disabled:B,className:cu(s,"mt-3 w-full"),children:[B?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save selection"]})]})]})}):null,"gateway"===aO?(0,d.jsx)("section",{id:"gateway",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Gateway",icon:bV.A,surfaceTheme:s,children:[(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Status",`${"remote"===(b=r).diagnostics.bindMode||b.diagnostics.configuredGatewayUrl?"Remote":"Local"} / ${r.diagnostics.loaded||r.diagnostics.rpcOk?"Online":"Offline"}`],["Native Gateway",a_.statusLabel],["Gateway mode",a_.gatewayModeLabel],["CLI fallback used",`${a_.fallbackTotal} operations`],["Endpoint",r.diagnostics.gatewayUrl||"Not configured"],["Auth status",a5],["Protocol",`${a_.protocolRangeLabel}, connected: ${a_.protocolLabel}`],["OpenClaw Compatibility",a2?ck(a2.status):"Unknown"],["Native Gateway coverage",a2?`${a2.summary.nativeGatewayCoveragePercent}% (${a2.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",a2?String(a2.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",a2?(p=[...(c=a2).summary.failedSurfaces,...c.summary.unsupportedSurfaces,...c.summary.degradedSurfaces]).length>0?cm(p,3):"None":"Unknown"],["Compatibility",function(a){switch(a?.protocol.status){case"compatible":return"Compatible";case"unsupported":return"Unsupported";default:return"Unknown"}}(a3)],["Contract audit",function(a){if(!a)return"Unknown";let b=function(a){switch(a){case"gateway-handshake":return"handshake";case"disabled":return"disabled";case"unavailable":return"unavailable";default:return a}}(a.source);switch(a.status){case"advertised":return`Advertised via ${b}`;case"verified":return`Verified via ${b}`;case"drift":return`Drift via ${b}`;default:return`Unknown via ${b}`}}(a3?.methodContract)],["Contract gaps",(e=a3?.methodContract,h=a0?.operations,e?"advertised"===e.status||"verified"===e.status?"None":"unknown"===e.status?e.reason:e.missingOperations.length>0?cn(e.missingOperations,h):`${e.missingMethodCount} methods`:"Unknown")],["Native ops",(i=a3)?`${i.nativeOperationCount} native / ${i.degradedOperationCount} limited`:"Unknown"],["Alias ops",(j=a3?.aliasOperations,l=a0?.operations,j?j.length>0?cn(j,l):"None":"Unknown")],["Limited ops",(m=a3?.degradedOperations,n=a0?.operations,m?m.length>0?cn(m,n):"None":"Unknown")],["Native chat",cj(a0?.nativeMissionDispatch)],["Config patch",cj(a0?.configPatch)],["Events",cj(a0?.eventBridge)]],successIndex:1}),(0,d.jsx)(cd,{compatibilityReport:a2,report:as,snapshot:r,capabilityMatrix:a0,transportSummary:a_,nativeAuthLabel:a5,error:au,isRunning:aw,onRun:()=>void bb(),surfaceTheme:s}),a_.recovery||a_.lastNativeError?(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] border p-3.5",cw(s)),children:[(0,d.jsx)("p",{className:cs(s),children:"Native Gateway diagnostic"}),a_.lastNativeError?(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-xs leading-5","light"===s?"text-muted-foreground":"text-slate-300"),children:["Last native error: ",a_.lastNativeError]}):null,a_.recovery?(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===s?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",a_.recovery]}):null]}):null,(0,d.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Gateway endpoint"}),(0,d.jsx)(br.p,{value:v,onChange:a=>J(a.target.value),placeholder:"ws://127.0.0.1:18789",className:ct(s,"mt-2")})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void M(v.trim()||null),disabled:z,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[z?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save endpoint"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void M(null),disabled:z,className:cu(s),children:[(0,d.jsx)(bM.A,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),(0,d.jsx)("div",{className:"mt-4 grid grid-cols-3 gap-2",children:["start","stop","restart"].map(a=>(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void Q(a),disabled:null!==G,className:(0,y.cn)(cu(s),"capitalize"),children:[G===a?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):null,a]},a))}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-emerald-200 bg-emerald-50/55":"border border-cyan-300/12 bg-cyan-300/[0.06]"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(b1.A,{className:(0,y.cn)("mt-0.5 h-4 w-4","light"===s?"text-emerald-700":"text-cyan-200")}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===s?"text-[#2f624b]":"text-slate-100"),children:"Native Gateway auth"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===s?"text-[#6f836f]":"text-slate-400"),children:"Use local repair when AgentOS reports missing operator scopes."})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void ba(),disabled:aq,className:cu(s,"px-3","gateway-contrast"),children:[aq?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b_.A,{className:"h-3.5 w-3.5"}),"Repair local access"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void a9(),disabled:ao,className:cu(s,"px-3","gateway-contrast"),children:[ao?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b1.A,{className:"h-3.5 w-3.5"}),"Generate token"]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-[112px_1fr]",children:[(0,d.jsxs)("select",{value:ae,onChange:a=>af(a.target.value),className:ct(s),children:[(0,d.jsx)("option",{value:"token",children:"Token"}),(0,d.jsx)("option",{value:"password",children:"Password"})]}),(0,d.jsx)(br.p,{type:"password",value:ag,onChange:a=>ah(a.target.value),placeholder:"Paste known credential",className:ct(s)})]}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void a8(),disabled:am,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[am?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save credential"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void a7(),disabled:ak,className:cu(s,void 0,"gateway-contrast"),children:[ak?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Test auth"]})]}),ac||ai||aa?.native.issue?(0,d.jsx)("p",{className:(0,y.cn)("mt-3 text-xs leading-5",ac?"light"===s?"text-red-700":"text-rose-300":"light"===s?"text-muted-foreground":"text-slate-400"),children:ac||ai||aa?.native.issue}):null]})]})}):null,"models"===aO?(0,d.jsx)("section",{id:"models",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Models",icon:bW.A,surfaceTheme:s,children:[(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Default model",aV||"Not selected"],["Provider",aY],["Available",`${r.diagnostics.modelReadiness.availableModelCount} of ${r.diagnostics.modelReadiness.totalModelCount}`]]}),(0,d.jsxs)("div",{className:"mt-4",children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Model"}),(0,d.jsxs)("select",{value:aW,onChange:a=>L(a.target.value),className:ct(s,"mt-2"),children:[(0,d.jsx)("option",{value:"",children:"Choose model"}),r.models.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name||a.id},a.id))]})]}),(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void T(aW),disabled:!aW||"running"===F,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:["running"===F?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(a6.A,{className:"h-3.5 w-3.5"}),"Use selected"]}),(0,d.jsx)(u.$,{type:"button",variant:"secondary",onClick:()=>U(null),className:cu(s),children:"Add models"})]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void S(),disabled:"running"===F,className:(0,y.cn)(cu(s),"mt-3 w-full"),children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Refresh models"]})]})}):null,"workspace"===aO?(0,d.jsx)("section",{id:"workspace",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Workspace",icon:bX.A,surfaceTheme:s,children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Workspace root"}),(0,d.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,d.jsx)(br.p,{value:w,onChange:a=>K(a.target.value),placeholder:"~/Documents/AgentOS",className:ct(s)}),(0,d.jsx)("button",{type:"button","aria-label":"Copy workspace root",onClick:()=>{var a;return a=w||r.diagnostics.workspaceRoot,void("u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(a))},className:(o=s,(0,y.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-[16px] border","light"===o?"border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground":"border-border bg-[#121d2d] text-slate-200 hover:bg-[#182538]")),children:(0,d.jsx)(a1.A,{className:"h-3.5 w-3.5"})})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(u.$,{type:"button",onClick:()=>void N(w.trim()||null),disabled:A,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[A?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void N(null),disabled:A,className:cu(s),children:[(0,d.jsx)(bM.A,{className:"h-3.5 w-3.5"}),"Reset"]})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsx)("p",{className:cs(s),children:"Current root"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 break-all text-sm","light"===s?"text-foreground":"text-slate-200"),children:co(r.diagnostics.workspaceRoot,56)})]})]})}):null,"diagnostics"===aO?(0,d.jsx)("section",{id:"diagnostics",className:"scroll-mt-24",children:(0,d.jsx)(b9,{title:"Diagnostics",icon:I.A,surfaceTheme:s,action:(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs","light"===s?"border-border bg-card text-muted-foreground":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300"),children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),a$.ok," OK",a$.failed?(0,d.jsxs)("span",{className:"text-red-600",children:[a$.failed," failed"]}):null]}),children:(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(ce,{summary:a_,surfaceTheme:s}),a4.length?(0,d.jsxs)("div",{className:(0,y.cn)("border-l-2 py-1 pl-3","light"===s?"border-amber-300":"border-amber-300/45"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:cs(s),children:"Gateway fallback diagnostics"}),(0,d.jsxs)("span",{className:(0,y.cn)("text-[11px]","light"===s?"text-muted-foreground":"text-slate-400"),children:[a4.length," recent"]})]}),(0,d.jsx)("div",{className:"mt-2 space-y-2",children:a4.map(a=>(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:(0,y.cn)("text-sm font-medium","light"===s?"text-foreground":"text-slate-100"),children:a.operationLabel}),(0,d.jsx)("code",{className:(0,y.cn)("rounded-full px-2 py-0.5 text-[10px]","light"===s?"bg-muted text-muted-foreground":"bg-white/[0.06] text-slate-300"),children:a.operation}),(0,d.jsx)("span",{className:(0,y.cn)("text-[11px]","light"===s?"text-amber-700":"text-amber-200"),children:function(a){switch(a){case"auth":return"Needs credential";case"scope-limited":return"Needs scope repair";case"protocol-mismatch":return"Protocol mismatch";case"rate-limited":return"Rate limited";case"unsupported":return"Unsupported method";case"disabled":return"Disabled";case"unreachable":return"Unreachable";case"timeout":return"Timed out";case"malformed-response":return"Invalid response";default:return"Gateway fallback"}}(a.kind)}),(0,d.jsx)("span",{className:(0,y.cn)("text-[11px]","light"===s?"text-muted-foreground":"text-slate-500"),children:cp(a.at)})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs","light"===s?"text-muted-foreground":"text-slate-400"),children:["Reason: ",a.issue]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-0.5 text-xs","light"===s?"text-muted-foreground":"text-slate-500"),children:["Recovery: ",a.recovery||function(a){switch(a){case"auth":return"Check the Gateway token/password, then restart AgentOS.";case"scope-limited":return"Repair local device access so AgentOS has operator scopes.";case"protocol-mismatch":return"Update OpenClaw or AgentOS so the Gateway protocol versions overlap.";case"rate-limited":return"Wait for the Gateway cooldown to expire, then retry the config action.";case"unsupported":return"Update OpenClaw or check AgentOS/OpenClaw compatibility for this method.";case"timeout":return"Restart the Gateway and inspect OpenClaw diagnostics for slow handlers.";case"unreachable":return"Start or repair the OpenClaw Gateway.";case"malformed-response":return"Update OpenClaw or report the incompatible Gateway response.";default:return"Inspect diagnostics and retry after Gateway repair."}}(a.kind)]})]},`${a.at}-${a.operation}`))})]}):null,aZ.length?aZ.map(a=>(0,d.jsxs)("details",{className:(0,y.cn)("group rounded-[16px] border","light"===s?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,d.jsxs)("code",{className:(0,y.cn)("min-w-0 flex-1 truncate font-mono text-[11px]","light"===s?"text-foreground":"text-slate-200"),children:[a.command," ",a.args.join(" ")]}),(0,d.jsx)("span",{className:(0,y.cn)("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]","ok"===a.status?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-red-200 bg-red-50 text-red-700"),children:a.status}),(0,d.jsxs)("span",{className:(0,y.cn)("hidden text-xs sm:inline","light"===s?"text-muted-foreground":"text-slate-400"),children:[a.durationMs," ms"]}),(0,d.jsx)(q.A,{className:(0,y.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===s?"text-muted-foreground":"text-slate-400")})]}),(0,d.jsxs)("div",{className:(0,y.cn)("border-t p-3.5","light"===s?"border-border":"border-white/[0.08]"),children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(cc,{title:"stdout",value:a.stdoutPreview,surfaceTheme:s}),(0,d.jsx)(cc,{title:"stderr",value:a.stderrPreview,surfaceTheme:s})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-3 text-xs","light"===s?"text-muted-foreground":"text-slate-400"),children:["Exit code: ",a.exitCode??"n/a"," | Started: ",cp(a.startedAt)]})]})]},a.id)):(0,d.jsx)(cg,{title:"No recent CLI calls",detail:"Diagnostics will appear after AgentOS uses fallback commands.",surfaceTheme:s})]})})}):null,"agents"===aO?(0,d.jsx)("section",{id:"agents",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Agents",icon:bY.A,surfaceTheme:s,children:[(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Agents",String(r.agents.length)],["Workspaces",String(r.workspaces.length)],["Active runtimes",String(r.runtimes.filter(a=>"running"===a.status).length)]]}),(0,d.jsx)(u.$,{asChild:!0,variant:"secondary",className:(0,y.cn)(cu(s),"mt-4 w-full"),children:(0,d.jsx)(bT(),{href:"/",children:"Open mission control"})})]})}):null,"advanced"===aO?(0,d.jsx)("section",{id:"advanced",className:"scroll-mt-24",children:(0,d.jsxs)(b9,{title:"Advanced",icon:bZ.A,surfaceTheme:s,children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,d.jsx)(ca,{label:"Install method",value:r.diagnostics.updateInstallKind||$.label||"Unknown",surfaceTheme:s}),(0,d.jsx)(ca,{label:"Updater",value:r.diagnostics.updatePackageManager||"Unknown",surfaceTheme:s}),(0,d.jsx)(ca,{label:"Last checked",value:H?new Date(H).toLocaleTimeString():"Not checked",surfaceTheme:s})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsx)("p",{className:cs(s),children:"Install root"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 break-all text-sm","light"===s?"text-foreground":"text-slate-200"),children:co(r.diagnostics.updateRoot||$.root||"Not detected",80)})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] p-3.5","light"===s?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:cs(s),children:"Config update pacing"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===s?"text-muted-foreground":"text-slate-400"),children:"Controls how often AgentOS attempts OpenClaw config updates. It does not change the OpenClaw Gateway rate limit."})]}),(0,d.jsx)("span",{className:(0,y.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.12em]",ay.pending?"light"===s?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/24 bg-amber-300/[0.08] text-amber-200":"light"===s?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/[0.08] text-emerald-200"),children:ay.pending?"Pending config update":"Idle"})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-3",children:[(0,d.jsx)("button",{type:"button",onClick:()=>aB("respect-gateway"),className:cv(s,"respect-gateway"===aA),children:"Respect Gateway"}),(0,d.jsx)("button",{type:"button",onClick:()=>aB("fast-local-testing"),className:cv(s,"fast-local-testing"===aA),children:"Fast testing"}),(0,d.jsx)("button",{type:"button",onClick:()=>aB("custom"),className:cv(s,"custom"===aA),children:"Custom"})]}),"custom"===aA?(0,d.jsxs)("div",{className:"mt-3",children:[(0,d.jsx)(bO.J,{className:cs(s),children:"Minimum local interval, seconds"}),(0,d.jsx)(br.p,{type:"number",min:1,max:600,value:aC,onChange:a=>aD(a.target.value),className:ct(s,"mt-2")})]}):null,(0,d.jsx)(cb,{surfaceTheme:s,rows:[["Current mode",function(a){switch(a){case"fast-local-testing":return"Fast local testing";case"custom":return"Custom";default:return"Respect Gateway cooldown"}}(ay.settings.mode)],["Minimum local interval",cq(ay.settings.minimumIntervalMs)],["Pending paths",ay.pendingPaths.length?ay.pendingPaths.join(", "):"None"],["Retry countdown",null!==bd?cq(bd):"None"],["CLI fallback","Disabled for Gateway config cooldown recovery"]]}),ay.lastIssue?(0,d.jsxs)("p",{className:(0,y.cn)("mt-3 text-xs leading-5","light"===s?"text-amber-700":"text-amber-200"),children:["Last Gateway issue: ",ay.lastIssue]}):null,aE?(0,d.jsx)("p",{className:(0,y.cn)("mt-3 text-xs leading-5","light"===s?"text-red-700":"text-rose-300"),children:aE}):null,(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>void bc(),disabled:aG,className:(0,y.cn)(cu(s),"mt-3 w-full"),children:[aG?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(b0.A,{className:"h-3.5 w-3.5"}),"Save pacing"]})]})]})}):null,"danger-zone"===aO?(0,d.jsx)("section",{id:"danger-zone",className:"scroll-mt-24",children:(0,d.jsx)("div",{className:(0,y.cn)("rounded-[22px] p-4 shadow-[0_18px_44px_rgba(185,28,28,0.06)]","light"===s?"border border-red-200 bg-red-50/58":"border border-rose-400/20 bg-rose-500/[0.08]"),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:(0,y.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","light"===s?"border-red-200 bg-white text-red-600":"border-rose-300/20 bg-rose-400/10 text-rose-200"),children:(0,d.jsx)(P.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:(0,y.cn)("font-display text-lg","light"===s?"text-red-700":"text-rose-100"),children:"Danger Zone"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5 max-w-2xl text-sm leading-6","light"===s?"text-red-700/72":"text-rose-100/80"),children:"These actions are destructive and cannot be undone. Confirmation is required before anything runs."})]})]}),(0,d.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 md:min-w-[340px]",children:[(0,d.jsxs)(u.$,{type:"button",variant:"destructive",onClick:()=>W("mission-control"),className:"h-9 rounded-full bg-red-600 text-xs text-white hover:bg-red-500",children:[(0,d.jsx)(bN.A,{className:"h-3.5 w-3.5"}),"Reset AgentOS"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:()=>W("full-uninstall"),className:(0,y.cn)("h-9 rounded-full text-xs","light"===s?"border-red-200 bg-white text-red-700 hover:bg-red-50":"border-rose-300/20 bg-[#121d2d] text-rose-100 hover:bg-[#182538]"),children:[(0,d.jsx)(bN.A,{className:"h-3.5 w-3.5"}),"Full uninstall"]})]})]})})}):null]})]})})})}function b9({title:a,icon:b,children:c,action:e,surfaceTheme:f}){return(0,d.jsxs)("div",{className:(0,y.cn)("min-h-full rounded-[22px] p-4 shadow-[0_20px_54px_rgba(101,74,54,0.07)] backdrop-blur-xl","light"===f?"border-border bg-card/92 text-card-foreground shadow-card":"border-border bg-card/96 text-card-foreground shadow-[0_20px_54px_rgba(0,0,0,0.26)]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"flex h-10 w-10 items-center justify-center rounded-full border border-primary/15 bg-primary/10 text-primary",children:(0,d.jsx)(b,{className:"h-4 w-4"})}),(0,d.jsx)("h2",{className:(0,y.cn)("font-display text-lg","light"===f?"text-[#2d211b]":"text-slate-100"),children:a})]}),e]}),(0,d.jsx)("div",{className:"mt-4",children:c})]})}function ca({label:a,value:b,badge:c,surfaceTheme:e,dark:f=!1,compact:g=!1}){let h=f||"dark"===e;return(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[11px]",h?"text-slate-400":"text-muted-foreground"),children:a}),(0,d.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("min-w-0 truncate font-medium",g?"text-sm":"text-[1.05rem]",h?"text-white":"text-foreground"),title:b,children:b}),c?(0,d.jsx)("span",{className:(0,y.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",h?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"border-emerald-200 bg-emerald-50 text-emerald-700"),children:c}):null]})]})}function cb({rows:a,successIndex:b,surfaceTheme:c}){let e="dark"===c;return(0,d.jsx)("div",{className:(0,y.cn)("overflow-hidden rounded-[18px] border","light"===c?"border-border bg-card":"border-border bg-[#0f1826]"),children:a.map(([a,c],f)=>(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center justify-between gap-3 px-3.5 py-2.5 last:border-b-0","border-b border-border"),children:[(0,d.jsx)("span",{className:(0,y.cn)("text-sm",e?"text-slate-400":"text-muted-foreground"),children:a}),(0,d.jsx)("span",{className:(0,y.cn)("min-w-0 truncate text-right text-sm",e?"text-slate-100":"text-foreground",b===f?e?"rounded-full border border-emerald-300/20 bg-emerald-300/10 px-2 py-1 text-xs text-emerald-100":"rounded-full border border-emerald-200 bg-emerald-50 px-2 py-1 text-xs text-emerald-700":""),title:c,children:c})]},a))})}function cc({title:a,value:b,surfaceTheme:c}){let e="dark"===c;return(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:cs(c),children:a}),(0,d.jsx)("pre",{className:(0,y.cn)("mt-2 max-h-40 overflow-auto rounded-[14px] border p-3 text-xs",e?"border-white/[0.08] bg-[#0d1624]/92 text-slate-200":"border-border bg-muted/55 text-foreground"),children:b||"No output"})]})}function cd({compatibilityReport:a,report:b,snapshot:c,capabilityMatrix:e,transportSummary:f,nativeAuthLabel:g,error:h,isRunning:i,onRun:j,surfaceTheme:l}){var m;let n,o=b?.compatibility,p=a?.status,r=o?`v${o.agentOsSupportedProtocolRange.min}-v${o.agentOsSupportedProtocolRange.max}`:a?`v${a.gateway.protocolRange.min}-v${a.gateway.protocolRange.max}`:f.protocolRangeLabel,s=o?.lastFallbackReason||a?.fallback.diagnostics[0]?.issue||c.diagnostics.gatewayFallbackDiagnostics?.[0]?.issue||"None",t=o?.lastNativeError||f.lastNativeError||"None",v=a?.recovery||b?.recovery||f.recovery||c.diagnostics.issues[0]||"OpenClaw compatibility is not available yet.",w=p?ck(p):b?function(a){switch(a){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}(b.status):"Unknown",x=p?function(a){switch(a){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(p):b?function(a){switch(a){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(b.status):"neutral",z=b?b.safeToDispatchMissions?"Safe to dispatch":"Do not dispatch":a?"compatible"===a.status?"Compatible":"degraded"===a.status?"Degraded":"Incompatible":"Not tested",A=a?[...a.summary.failedSurfaces,...a.summary.unsupportedSurfaces,...a.summary.degradedSurfaces]:[],B=a?.contracts.filter(a=>"ok"!==a.status).slice(0,5)??[];return(0,d.jsxs)("div",{className:(0,y.cn)("mt-4 rounded-[18px] border p-3.5",cw(l)),children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:cs(l),children:"Compatibility"}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("font-medium","light"===l?"text-foreground":"text-slate-100"),children:w}),(0,d.jsx)("span",{className:cf(x,l),children:z})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs","light"===l?"text-muted-foreground":"text-slate-400"),children:["Report: ",a?cp(a.generatedAt):"Not available",b?` / Smoke: ${cp(b.checkedAt)}`:""]})]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",onClick:j,disabled:i,className:cu(l,"px-4"),children:[i?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(bU.A,{className:"h-3.5 w-3.5"}),i?"Running...":"Run OpenClaw Smoke Test"]})]}),(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(cb,{surfaceTheme:l,rows:[["Installed OpenClaw",cl(a?.openClaw.installedVersion??o?.installedVersion??c.diagnostics.version??null)],["Required OpenClaw",cl(o?.requiredOpenClawVersion??a?.openClaw.supportedBaselineVersion??null)],["Recommended OpenClaw",cl(a?.openClaw.recommendedVersion??o?.recommendedOpenClawVersion??c.diagnostics.latestVersion??null)],["Gateway protocol status",a?(n=(m=a).gateway.protocolVersion?`v${m.gateway.protocolVersion}`:"unknown",`${n} / ${m.gateway.protocolStatus}`):o?.gatewayProtocolVersion?`v${o.gatewayProtocolVersion}`:e?.gatewayProtocolVersion?`v${e.gatewayProtocolVersion}`:f.protocolLabel],["AgentOS protocol range",r],["Native Gateway coverage",a?`${a.summary.nativeGatewayCoveragePercent}% (${a.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",a?String(a.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",a?A.length>0?cm(A,3):"None":"Unknown"],["Node.js",o?.nodeVersion?`${o.nodeVersion} / ${function(a){switch(a){case"supported":return"Supported";case"unsupported":return"Unsupported";default:return"Unknown"}}(o.nodeStatus)}`:"Run smoke test"],["Gateway auth",o?.gatewayAuthStatus||g],["Native Gateway",a?`${a.gateway.health} / ${a.gateway.capabilitySource}`:o?.nativeGatewayStatus||f.statusLabel],["CLI fallback count",String(o?.cliFallbackUsageCount??f.fallbackTotal)],["Last native error",t],["Last fallback reason",s]]})}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[16px] border p-3 text-xs leading-5","light"===l?"border-border bg-muted/45 text-foreground":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,d.jsx)("p",{className:cs(l),children:"Recovery suggestion"}),(0,d.jsx)("p",{className:"mt-1.5",children:v}),h?(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5","light"===l?"text-rose-700":"text-rose-200"),children:h}):null]}),B.length>0?(0,d.jsx)("div",{className:"mt-3 space-y-2",children:B.map(a=>(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[16px] border p-3","light"===l?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:cf(function(a){switch(a){case"ok":return"success";case"degraded":return"warning";case"unsupported":case"failed":return"danger"}}(a.status),l),children:function(a){switch(a){case"ok":return"OK";case"degraded":return"Degraded";case"unsupported":return"Unsupported";case"failed":return"Failed"}}(a.status)}),(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===l?"text-foreground":"text-slate-100"),children:a.label})]}),(0,d.jsx)("p",{className:(0,y.cn)("mt-2 text-xs leading-5","light"===l?"text-muted-foreground":"text-slate-300"),children:a.reason}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs leading-5","light"===l?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",a.suggestedRecovery]})]},a.operation))}):null,b?.checks.length?(0,d.jsx)("div",{className:"mt-3 space-y-2",children:b.checks.map(a=>(0,d.jsxs)("details",{className:(0,y.cn)("group rounded-[16px] border","light"===l?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,d.jsx)("span",{className:cf(function(a){switch(a){case"pass":return"success";case"warning":return"warning";case"fail":return"danger";default:return"neutral"}}(a.status),l),children:function(a){switch(a){case"pass":return"Pass";case"warning":return"Warning";case"fail":return"Fail";default:return"Unknown"}}(a.status)}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:(0,y.cn)("truncate text-sm font-medium","light"===l?"text-foreground":"text-slate-100"),children:a.label}),(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5 truncate text-xs","light"===l?"text-muted-foreground":"text-slate-400"),children:a.summary})]}),(0,d.jsxs)("span",{className:(0,y.cn)("hidden text-xs sm:inline","light"===l?"text-muted-foreground":"text-slate-400"),children:[a.durationMs," ms"]}),(0,d.jsx)(q.A,{className:(0,y.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===l?"text-muted-foreground":"text-slate-400")})]}),(0,d.jsxs)("div",{className:(0,y.cn)("border-t p-3.5","light"===l?"border-border":"border-white/[0.08]"),children:[a.recovery?(0,d.jsxs)("p",{className:(0,y.cn)("mb-3 text-xs leading-5","light"===l?"text-muted-foreground":"text-slate-300"),children:["Recovery: ",a.recovery]}):null,(0,d.jsx)(cc,{title:"raw details",value:function(a){if(null==a)return"No raw details";if("string"==typeof a)return a;try{return JSON.stringify(a,null,2)}catch{return String(a)}}(a.rawDetails),surfaceTheme:l})]})]},a.id))}):(0,d.jsx)(cg,{title:"No compatibility smoke report",detail:"Run the smoke test to verify OpenClaw binary, Gateway, models, sessions, tasks, config, events, and fallback behavior.",surfaceTheme:l})]})}function ce({summary:a,surfaceTheme:b}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border p-3.5",cw(b)),children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:cs(b),children:"Gateway Transport"}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:(0,y.cn)("font-medium","light"===b?"text-foreground":"text-slate-100"),children:a.statusLabel}),(0,d.jsx)("span",{className:cf(a.statusTone,b),children:a.gatewayModeLabel})]}),(0,d.jsxs)("p",{className:(0,y.cn)("mt-1 text-xs","light"===b?"text-muted-foreground":"text-slate-400"),children:[a.connectionLabel," / ",a.modeLabel]})]}),(0,d.jsxs)("div",{className:"text-left sm:text-right",children:[(0,d.jsx)("p",{className:cs(b),children:"Snapshot stream"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5 text-sm","light"===b?"text-foreground":"text-slate-200"),children:a.streamLabel})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-4",children:[(0,d.jsx)(ca,{label:"Protocol support",value:a.protocolRangeLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Connected protocol",value:a.protocolLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"CLI fallback used",value:String(a.fallbackTotal),badge:a.fallbackTotal>0?"Used":"Clean",surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Last connected",value:a.lastConnectedLabel,surfaceTheme:b,dark:"dark"===b,compact:!0})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(ca,{label:"Last disconnected",value:a.lastDisconnectedLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Fallback summary",value:a.fallbackSummaryLabel,surfaceTheme:b,dark:"dark"===b,compact:!0})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(ca,{label:"Gateway event stream",value:a.eventBridgeLabel,badge:"success"===a.eventBridgeTone?"Live":"warning"===a.eventBridgeTone?"Degraded":"Unknown",surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(ca,{label:"Last Gateway event",value:a.eventBridgeLastEventLabel,surfaceTheme:b,dark:"dark"===b,compact:!0})]}),a.lastNativeError?(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(cc,{title:"Last native error",value:a.lastNativeError,surfaceTheme:b})}):null,a.eventBridgeLastError?(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(cc,{title:"Last event stream error",value:a.eventBridgeLastError,surfaceTheme:b})}):null,a.recovery?(0,d.jsxs)("p",{className:(0,y.cn)("mt-3 text-xs leading-5","light"===b?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",a.recovery]}):null,a.eventBridgeRecovery?(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-xs leading-5","light"===b?"text-muted-foreground":"text-slate-400"),children:["Event stream recovery: ",a.eventBridgeRecovery]}):null]})}function cf(a,b){let c="inline-flex shrink-0 items-center rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]";return"success"===a?(0,y.cn)(c,"light"===b?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100"):"danger"===a?(0,y.cn)(c,"light"===b?"border-red-200 bg-red-50 text-red-700":"border-rose-300/20 bg-rose-300/10 text-rose-100"):"warning"===a?(0,y.cn)(c,"light"===b?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100"):(0,y.cn)(c,"light"===b?"border-border bg-card text-muted-foreground":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300")}function cg({title:a,detail:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border border-dashed p-4 text-center","light"===c?"border-border bg-muted/45":"border-white/[0.08] bg-[#0d1624]/60"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-sm font-medium","light"===c?"text-foreground":"text-slate-100"),children:a}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-xs","light"===c?"text-muted-foreground":"text-slate-400"),children:b})]})}function ch({surfaceTheme:a,isCheckingForUpdates:b,isUpdateRegistryLoading:c,hasUpdateAvailable:e,currentVersion:f,latestVersion:g,updateInfo:h,updateError:i,lastCheckedAt:j,isUpdateRunning:l}){let m=b||l,n=b?"Checking registry":l?"Updating":e?"Update available":i?"Check failed":c?"Registry loading":"Up to date",o=e?"light"===a?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":i?"light"===a?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/20 bg-rose-300/10 text-rose-100":m||c?"light"===a?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100":"light"===a?"border-slate-300 bg-white text-slate-600":"border-white/10 bg-[#0f1826] text-slate-300",p=b?"Refreshing OpenClaw update registry...":l?"Installing the selected OpenClaw update.":e?"A newer release is available and ready to install.":i?"OpenClaw returned an error while checking updates.":c?"OpenClaw has not reported a latest release yet.":"No newer release is currently available.";return(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[20px] border p-3.5",cw(a)),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.18em]",cx(a)),children:"Update status"}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[m?(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin text-emerald-400"}):null,(0,d.jsx)("p",{className:(0,y.cn)("font-medium","light"===a?"text-foreground":"text-slate-100"),children:n}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",o),children:e?"Ready":m?"Working":i?"Attention":"Stable"})]})]}),(0,d.jsxs)("div",{className:"text-right",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.18em]",cx(a)),children:"Last checked"}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-[11px]","light"===a?"text-muted-foreground":"text-slate-300"),children:j?new Date(j).toLocaleTimeString():"Not yet"})]})]}),(0,d.jsx)("div",{className:"mt-3 h-2 overflow-hidden rounded-full bg-black/10 dark:bg-white/10",children:(0,d.jsx)("div",{className:(0,y.cn)("h-full rounded-full transition-all",m?"w-1/2 animate-pulse bg-emerald-400/80":e?"w-full bg-emerald-500":i?"w-2/3 bg-rose-400":"w-5/6 bg-slate-400/70")})}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,d.jsx)(ca,{label:"Current version",value:`v${f}`,surfaceTheme:a,dark:"dark"===a,compact:!0}),(0,d.jsx)(ca,{label:"Latest available",value:g?`v${g}`:"Unknown",badge:e?"Ready":i?"Error":m||c?"Loading":"Stable",surfaceTheme:a,dark:"dark"===a,compact:!0})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 rounded-[18px] border p-3 text-[11px] leading-5","light"===a?"border-border bg-card text-foreground":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.18em]",cx(a)),children:"Details"}),(0,d.jsx)("p",{className:"mt-1.5",children:p}),h?(0,d.jsx)("p",{className:"mt-1.5 opacity-90",children:h}):null,i?(0,d.jsx)("p",{className:(0,y.cn)("mt-1.5","light"===a?"text-rose-700":"text-rose-200"),children:i}):null,e?(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em]",children:[(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-1",o),children:"Update ready"}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-2 py-1",cx(a)),children:"Review before install"})]}):null]})]})}async function ci(){let a=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to check Gateway auth status.")}return(await a.json()).authStatus}function cj(a){return"supported"===a?"Supported":"unsupported"===a?"Fallback":"Unknown"}function ck(a){switch(a){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}function cl(a){return a?`v${a.replace(/^v/i,"")}`:"Unknown"}function cm(a,b){let c=Array.from(new Set(a)),d=c.slice(0,b),e=c.length>d.length?` +${c.length-d.length}`:"";return`${d.join(", ")}${e}`}function cn(a,b){let c=a.slice(0,3).map(a=>(function(a,b){let[c,d]=a.split(/:\s*/,2),e=b?.[c],f=e?.label??((c||a).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[._-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase())||"Gateway operation");return!d&&e?.recovery&&"gateway-native"!==e.mode?`${f}: ${e.recovery}`:d?`${f} via ${d}`:f})(a,b)),d=a.length>c.length?` +${a.length-c.length}`:"";return`${a.length}: ${c.join(", ")}${d}`}function co(a,b){let c=(0,x.$7)(a);return c.length<=b?c:`${c.slice(0,Math.max(0,b-3))}...`}function cp(a){let b=new Date(a);return Number.isNaN(b.getTime())?a:b.toLocaleString()}function cq(a){if(!a||a<=0)return"Gateway cooldown only";let b=Math.ceil(a/1e3);if(b<60)return`${b}s`;let c=Math.floor(b/60),d=b%60;return d?`${c}m ${d}s`:`${c}m`}function cr(){return"openclaw"}function cs(a){return(0,y.cn)("text-[10px] uppercase tracking-[0.18em]","light"===a?"text-muted-foreground":"text-slate-400")}function ct(a,b){return(0,y.cn)("h-10 rounded-[16px] px-3 text-sm outline-none",b,"light"===a?"border-input bg-card text-foreground placeholder:text-muted-foreground/70 focus-visible:ring-2 focus-visible:ring-ring/25":"border-input bg-[#0f1826] text-foreground placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring/30")}function cu(a,b,c){return(0,y.cn)("h-9 rounded-full px-3 text-xs",b,"light"===a?"border-border bg-card text-secondary-foreground hover:bg-muted hover:text-foreground":"gateway-contrast"===c?"border-primary/15 bg-[#0f1826] text-foreground hover:bg-[#182538]":"border-border bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function cv(a,b){return(0,y.cn)("h-9 rounded-full border px-3 text-xs transition-colors",b?"light"===a?"border-primary/35 bg-primary/10 text-primary":"border-primary/30 bg-primary/12 text-primary":"light"===a?"border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground":"border-border bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function cw(a){return"light"===a?"border-border bg-muted/45":"border-border bg-[#101a2a]/92"}function cx(a){return"light"===a?"text-muted-foreground":"text-slate-400"}var cy=c(607),cz=c(63685),cA=c(218),cB=c(47094),cC=c(3564),cD=c(61655);let cE=[];function cF({open:a,task:b,snapshot:c,surfaceTheme:e,onOpenChange:h,onAccept:i,onContinue:j,onRetry:l,onDismiss:m,onOpenEvidence:n}){var o,p,q;let r,s,t,v,[w,z]=(0,g.useState)(null),A=(0,g.useMemo)(()=>{var a;return Array.isArray(a=b?.metadata.optimisticEvents)?a.filter(cJ):[]},[b?.metadata.optimisticEvents]),{detail:B,loading:C,error:D}=function(a,b,c={}){let[d,e]=(0,g.useState)({taskId:null,feed:[],detail:null}),[f,h]=(0,g.useState)(null),[i,j]=(0,g.useState)({taskId:null,message:null}),[k,l]=(0,g.useState)({taskId:null,message:null}),m="string"==typeof c.dispatchId&&c.dispatchId.trim()?c.dispatchId.trim():null,n=a.startsWith("optimistic-task:"),o=b&&n&&!m?c.optimisticFeed??cE:null,p=o??(d.taskId===a?d.feed:[]),q=o?null:d.taskId===a?d.detail:null,r=o?null:i.taskId===a?i.message:null,s=o?null:k.taskId===a?k.message:null;return{feed:p,detail:q,loading:!o&&b&&f!==a&&null===r,error:r,streamNotice:s}}(b?.id??"task-review:none",a&&!!b,{dispatchId:b?.dispatchId,optimisticFeed:A}),E=function(a,b){if(!a||!b)return a??b;let c=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(a=>[a,b.metadata[a]]).filter(([,a])=>void 0!==a));return 0===Object.keys(c).length?a:{...a,metadata:{...a.metadata,...c}}}(B?.task,b),F=B?.integrity??null,H=E?c.workspaces.find(a=>a.id===E.workspaceId)??null:null,I=E?c.agents.find(a=>a.id===E.primaryAgentId)??null:null,J=[...B?.liveFeed??[]].reverse().find(a=>"assistant"===a.kind||"tool"===a.kind||"artifact"===a.kind)??null,K=E?ad(E,{hasLiveActivity:"running"===E.status||"queued"===E.status||E.liveRunCount>0,latestEvidenceAt:J?.timestamp??null}):null,L=E?ab(E):null,M=E?ac(E):null,N=E?(o=E,r="string"==typeof(p=F?.finalResponseText)?p.trim():"",s="string"==typeof o.metadata.finalResponseText?o.metadata.finalResponseText.trim():"",t="string"==typeof o.metadata.resultPreview?o.metadata.resultPreview.trim():"",v=o.subtitle.trim(),r||s||t||v):"",O=E?(q=E,q.mission?.trim()||q.title.trim()||"Untitled task"):"",Q=F?.issues.find(a=>"partial-final-response"===a.id)??F?.issues[0]??null,R=F?.status==="verified"&&!Q,S=K?ae(K):R?"verified":"needs review",T=K?af(K):Q?.detail||(R?"AgentOS recovered a matching completed response and no review issues remain.":"The captured task evidence needs an operator decision before AgentOS treats the result as handled."),U="light"===e,V=null!==w,W=async(a,b)=>{if(!w){z(a);try{await b()}finally{z(null)}}};return(0,d.jsx)(a2.lG,{open:a,onOpenChange:h,children:(0,d.jsxs)(a2.Cf,{className:(0,y.cn)("flex h-[min(780px,calc(100dvh-32px))] w-[calc(100vw-24px)] max-w-[900px] flex-col gap-0 overflow-hidden rounded-[26px] border-white/10 p-0",U?"bg-white/95 text-slate-950 shadow-[0_24px_80px_rgba(15,23,42,0.22)]":"bg-[linear-gradient(180deg,rgba(8,13,24,0.98),rgba(4,7,14,0.98))] text-white"),closeClassName:U?"text-slate-500 hover:bg-slate-950/5 hover:text-slate-900":void 0,children:[(0,d.jsx)("div",{className:(0,y.cn)("border-b px-5 py-4",U?"border-slate-200/80 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-3 pr-9",children:[(0,d.jsx)("div",{className:(0,y.cn)("mt-0.5 flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border","accepted"===K||R?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"border-amber-300/30 bg-amber-400/12 text-amber-100"),children:"accepted"===K||R?(0,d.jsx)(a0.A,{className:"h-4 w-4"}):(0,d.jsx)(P.A,{className:"h-4 w-4"})}),(0,d.jsxs)(a2.c7,{className:"min-w-0 flex-1 space-y-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(ag.E,{variant:"accepted"===K||R?"success":K?"muted":"warning",children:S}),E?.dispatchId?(0,d.jsxs)(ag.E,{variant:"muted",children:["dispatch ",(0,x.m_)(E.dispatchId,8)]}):null]}),(0,d.jsx)(a2.L3,{className:(0,y.cn)("truncate text-lg",U&&"text-slate-950"),children:E?.title.trim()||"Task review"}),(0,d.jsxs)(a2.rr,{className:U?"text-slate-600":void 0,children:[H?.name||"Workspace",I?` \xb7 ${(0,x.CK)(I)}`:""]})]})]})}),(0,d.jsx)(cD.F,{className:"min-h-0 flex-1",children:(0,d.jsxs)("div",{className:"grid gap-4 p-5 lg:grid-cols-[minmax(0,1fr)_290px]",children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(cG,{icon:cz.A,title:"Captured output",tone:"accepted"===K||R?"success":"warning",isLight:U,children:N?(0,d.jsx)(Y,{text:N,className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-800":"text-slate-100")}):(0,d.jsx)("p",{className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-500":"text-slate-400"),children:"No captured assistant output is available yet."})}),(0,d.jsxs)(cG,{icon:P.A,title:"Review reason",tone:"warning",isLight:U,children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-700":"text-slate-200"),children:T}),M?(0,d.jsxs)("p",{className:(0,y.cn)("mt-2 text-[11px]","text-slate-500"),children:["Last operator action: ",M]}):null]}),(0,d.jsx)(cG,{icon:cA.A,title:"Original prompt",isLight:U,children:(0,d.jsx)(Y,{text:O||"No original prompt was captured.",className:(0,y.cn)("text-[12.5px] leading-6",U?"text-slate-700":"text-slate-200")})})]}),(0,d.jsxs)("aside",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border p-3",U?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Evidence"}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsx)(cH,{label:"Runs",value:String(E?.runtimeCount??0),isLight:U}),(0,d.jsx)(cH,{label:"Turns",value:String(function(a){if(!a)return 0;let b=a.metadata.turnCount;return"number"==typeof b&&Number.isFinite(b)?b:a.runtimeCount}(E)),isLight:U}),(0,d.jsx)(cH,{label:"Files",value:String(E?.artifactCount??0),isLight:U}),(0,d.jsx)(cH,{label:"Issues",value:String(F?.issues.length??E?.warningCount??0),isLight:U})]}),C?(0,d.jsxs)("div",{className:(0,y.cn)("mt-3 flex items-center gap-2 text-[11px]",U?"text-slate-500":"text-slate-400"),children:[(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 animate-spin"}),"Loading live evidence..."]}):null,D?(0,d.jsx)("p",{className:"mt-3 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[11px] leading-5 text-amber-100",children:D}):null]}),(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[18px] border p-3",U?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Task state"}),(0,d.jsxs)("div",{className:"mt-3 space-y-2 text-[12px]",children:[(0,d.jsx)(cI,{label:"Status",value:E?.status??"unknown",isLight:U}),(0,d.jsx)(cI,{label:"Updated",value:E?.updatedAt?(0,x.fw)(E.updatedAt):"unknown",isLight:U}),(0,d.jsx)(cI,{label:"Reviewed",value:L?(0,x.fw)(Date.parse(L)):"not yet",isLight:U})]})]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",className:(0,y.cn)("w-full justify-start gap-2",U&&"border-slate-200 bg-slate-50 text-slate-800 hover:bg-slate-100"),disabled:!E||V,onClick:()=>{E&&n(E,"output")},children:[(0,d.jsx)(G.A,{className:"h-4 w-4"}),"Open evidence"]})]})]})}),(0,d.jsxs)("div",{className:(0,y.cn)("flex flex-col gap-2 border-t px-5 py-4 sm:flex-row sm:items-center sm:justify-end",U?"border-slate-200 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:[(0,d.jsxs)(u.$,{type:"button",variant:"ghost",className:(0,y.cn)("gap-2",U&&"text-slate-700 hover:bg-slate-950/5 hover:text-slate-950"),disabled:!E||V,onClick:()=>void W("dismiss",()=>{if(E)return m(E)}),children:["dismiss"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(cB.A,{className:"h-4 w-4"}),"dismiss"===w?"Dismissing...":"Dismiss"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",className:(0,y.cn)("gap-2",U&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!E||V,onClick:()=>void W("retry",()=>{if(E)return l(E)}),children:["retry"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(f.A,{className:"h-4 w-4"}),"retry"===w?"Preparing...":"Retry"]}),(0,d.jsxs)(u.$,{type:"button",variant:"secondary",className:(0,y.cn)("gap-2",U&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!E||V,onClick:()=>void W("continue",()=>{if(E)return j(E,N)}),children:["continue"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(cC.A,{className:"h-4 w-4"}),"continue"===w?"Continuing...":"Continue task"]}),(0,d.jsxs)(u.$,{type:"button",className:"gap-2 bg-emerald-400 text-slate-950 shadow-emerald-400/20 hover:bg-emerald-300",disabled:!E||V,onClick:()=>void W("accept",()=>{if(E)return i(E)}),children:["accept"===w?(0,d.jsx)(k.A,{className:"h-4 w-4 animate-spin"}):(0,d.jsx)(a0.A,{className:"h-4 w-4"}),"accept"===w?"Accepting...":"Accept result"]})]})]})})}function cG({icon:a,title:b,tone:c="neutral",isLight:e,children:f}){return(0,d.jsxs)("section",{className:(0,y.cn)("rounded-[18px] border p-3.5",e?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,d.jsx)("div",{className:(0,y.cn)("flex h-7 w-7 items-center justify-center rounded-[10px] border","success"===c?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"warning"===c?"border-amber-300/30 bg-amber-400/12 text-amber-100":e?"border-slate-200 bg-slate-50 text-slate-600":"border-white/[0.08] bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(a,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:b})]}),f]})}function cH({label:a,value:b,isLight:c}){return(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[12px] border px-3 py-2",c?"border-slate-200 bg-slate-50":"border-white/[0.08] bg-white/[0.04]"),children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[9px] uppercase tracking-[0.16em]","text-slate-500"),children:a}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 font-mono text-[13px]",c?"text-slate-900":"text-white"),children:b})]})}function cI({label:a,value:b,isLight:c}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:"text-slate-500",children:a}),(0,d.jsx)("span",{className:(0,y.cn)("min-w-0 truncate text-right",c?"text-slate-900":"text-slate-100"),children:b})]})}function cJ(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}var cK=c(22591);function cL(a,b){let c=a.trim();return c.length<=b?c:`${c.slice(0,b).trimEnd()}
5
5
 
6
6
  [truncated for task continuation]`}var cM=c(42601),cN=c(1994),cO=c(24203),cP=c(69903),cQ=c(36611),cR=c(59056);function cS(a,b){if(a.workspaceId?.trim())return a.workspaceId;for(let c of[a.primaryAgentId,...a.agentIds].filter(a=>"string"==typeof a&&a.trim().length>0)){let a=b.find(a=>a.id===c)?.workspaceId;if(a)return a}return null}c(40299);var cT=c(19653),cU=c(53925),cV=c(75455),cW=c(19481),cX=c(68123);function cY({snapshot:a,surfaceTheme:b,connectionState:c,isCheckingForUpdates:e,updateRunState:h,lastCheckedAt:i,onCheckForUpdates:j,onOpenSetupWizard:l,onOpenUpdateDialog:m}){let[n,o]=(0,g.useState)(null),[q,r]=(0,g.useState)(null),[s,t]=(0,g.useState)(!1),[v,w]=(0,g.useState)(!1),x="running"===h,z=(0,a9.X2)(a),A=!!(a.diagnostics.updateAvailable&&a.diagnostics.latestVersion),B=!!(a.diagnostics.version&&!a.diagnostics.latestVersion&&!a.diagnostics.updateError),C=e?"Checking update registry...":A?`Latest v${a.diagnostics.latestVersion}`:a.diagnostics.updateError?"Check failed":B?a.diagnostics.updateInfo?.trim()||"Registry status is still loading.":"Up to date",D=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Not selected",E=function(a){let{diagnostics:b}=a,c="remote"===b.bindMode||b.configuredGatewayUrl?"Remote":"Local",d=b.rpcOk||b.loaded?"Online":"Offline";return`${c} / ${d}`}(a),F=b2(a.diagnostics.transport,c),G=!!(n&&!n.native.ok&&("auth"===n.native.kind||"scope-limited"===n.native.kind)),H=(0,g.useCallback)(async()=>{t(!0),r(null);try{o(await c_())}catch(a){r(a instanceof Error?a.message:"Unable to check Gateway auth status.")}finally{t(!1)}},[]),I=async()=>{w(!0),r(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway access could not be repaired.")}let b=await a.json();o(b.authStatus)}catch(a){r(a instanceof Error?a.message:"Unable to repair Gateway access.")}finally{w(!1)}};return(0,d.jsxs)("div",{role:"menu","aria-label":"System menu",className:(0,y.cn)("absolute right-0 top-14 z-50 w-[336px] overflow-hidden rounded-[24px] border p-3 shadow-[0_24px_68px_rgba(40,28,20,0.22)] backdrop-blur-2xl","light"===b?"border-[#dfcfc2] bg-[#fffaf3]/96 text-[#2b211c]":"border-white/[0.10] bg-[#08101c]/98 text-slate-100 shadow-[0_28px_80px_rgba(0,0,0,0.48)]"),children:[(0,d.jsxs)("div",{className:(0,y.cn)("rounded-[20px] border p-3.5",c1(b)),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[9px] uppercase tracking-[0.22em]",c2(b)),children:"OpenClaw"}),(0,d.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"font-display text-[1rem]",children:c0(a.diagnostics.health)}),(0,d.jsx)(cZ,{health:a.diagnostics.health,surfaceTheme:b})]})]}),(0,d.jsxs)("div",{className:"text-right",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[9px] uppercase tracking-[0.2em]",c2(b)),children:"Version"}),(0,d.jsxs)("p",{className:"mt-0.5 font-mono text-[11px]",children:["v",a.diagnostics.version||"unknown"]})]})]}),(0,d.jsx)("div",{className:(0,y.cn)("mt-3 rounded-[18px] border p-3","light"===b?"border-[#eadbcf] bg-[#f9f1e8]/80":"border-white/[0.08] bg-[#101a2a]/92"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[9px] uppercase tracking-[0.18em]",c2(b)),children:"Updates"}),(0,d.jsx)("p",{className:"mt-0.5 text-[13px]",children:C})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(u.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>void j(),disabled:e||x,className:c3(b),children:[e?(0,d.jsx)(k.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(f.A,{className:"h-3 w-3"}),e?"Checking...":"Check"]}),A?(0,d.jsxs)(u.$,{type:"button",size:"sm",onClick:m,disabled:x,className:"rounded-full bg-emerald-600 px-2.5 text-[11px] text-white shadow-[0_12px_24px_rgba(16,185,129,0.24)] hover:bg-emerald-500",children:[(0,d.jsx)(cW.A,{className:"h-3 w-3"}),"Update"]}):null]})]})})]}),(0,d.jsxs)("div",{className:(0,y.cn)("mt-2 rounded-[16px] border px-3 py-2","light"===b?"border-[#e6d7c9] bg-white text-[#6b5546]":"border-white/[0.08] bg-[#0f1826] text-slate-300"),children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em]",children:e?"Checking":"Registry"}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-4",children:e?"Refreshing OpenClaw update registry...":a.diagnostics.updateInfo?.trim()||(i?`Last checked ${new Date(i).toLocaleTimeString()}.`:"No registry check run yet.")})]}),(0,d.jsxs)("div",{className:"mt-2.5 grid gap-1.5",children:[(0,d.jsx)(c$,{surfaceTheme:b,icon:(0,d.jsx)(b_.A,{className:"h-3.5 w-3.5"}),label:"Gateway",value:F.statusLabel,detail:`${E} / ${F.gatewayModeLabel}`}),(0,d.jsx)(c$,{surfaceTheme:b,icon:(0,d.jsx)(p.A,{className:"h-3.5 w-3.5"}),label:"Default model",value:D,wrapValue:!0,action:(0,d.jsx)(u.$,{asChild:!0,size:"sm",variant:"secondary",className:c3(b),children:(0,d.jsxs)(bT(),{href:"/settings#models",children:[(0,d.jsx)(cX.A,{className:"h-3 w-3"}),"Models"]})})}),(0,d.jsx)(c$,{surfaceTheme:b,icon:z?(0,d.jsx)(a0.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(P.A,{className:"h-3.5 w-3.5"}),label:"Setup",value:z?"Ready":"Needs setup",action:(0,d.jsx)(u.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>l(z?"system":void 0),className:c3(b),children:"Open"})})]}),G||q?(0,d.jsxs)("div",{className:(0,y.cn)("mt-2.5 rounded-[18px] border p-2.5","light"===b?"border-amber-300/70 bg-amber-50/80 text-amber-950":"border-amber-300/20 bg-amber-300/10 text-amber-100"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)(b1.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-[13px] font-medium",children:"Gateway auth needs attention"}),(0,d.jsx)("p",{className:"mt-0.5 line-clamp-2 text-[11px] leading-4 opacity-80",children:q||n?.native.issue||"Native Gateway auth is not ready. Open Settings to repair access."})]})]}),(0,d.jsxs)("div",{className:"mt-2.5 flex items-center gap-1.5",children:[(0,d.jsxs)(u.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>void H(),disabled:s||v,className:c3(b),children:[s?(0,d.jsx)(k.A,{className:"h-3 w-3 animate-spin"}):null,"Test"]}),n?.native.kind==="scope-limited"?(0,d.jsxs)(u.$,{type:"button",size:"sm",onClick:()=>void I(),disabled:s||v,className:"rounded-full bg-emerald-600 px-2.5 text-[11px] text-white hover:bg-emerald-500",children:[v?(0,d.jsx)(k.A,{className:"h-3 w-3 animate-spin"}):null,"Repair"]}):null,(0,d.jsx)(u.$,{asChild:!0,size:"sm",variant:"secondary",className:c3(b),children:(0,d.jsx)(bT(),{href:"/settings#gateway",children:"Open settings"})})]})]}):null,(0,d.jsxs)("div",{className:(0,y.cn)("mt-2.5 grid grid-cols-2 gap-1.5 border-t pt-2.5","light"===b?"border-[#e6d7c9]":"border-white/[0.08]"),children:[(0,d.jsx)(u.$,{asChild:!0,variant:"secondary",className:c4(b),children:(0,d.jsxs)(bT(),{href:"/settings",children:[(0,d.jsx)(bZ.A,{className:"h-3.5 w-3.5"}),"Control Center"]})}),(0,d.jsx)(u.$,{asChild:!0,variant:"secondary",className:c4(b),children:(0,d.jsxs)(bT(),{href:"/settings#diagnostics",children:[(0,d.jsx)(P.A,{className:"h-3.5 w-3.5"}),"Diagnostics"]})})]})]})}function cZ({health:a,surfaceTheme:b}){return(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-[10px] uppercase tracking-[0.18em]","healthy"===a?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-400/30 bg-emerald-400/10 text-emerald-200":"degraded"===a?"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-100":"light"===b?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-100"),children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),c0(a)]})}function c$({surfaceTheme:a,icon:b,label:c,value:e,detail:f,action:g,wrapValue:h=!1}){return(0,d.jsxs)("div",{className:(0,y.cn)("flex items-center gap-3 rounded-[20px] border p-3",c1(a)),children:[(0,d.jsx)("span",{className:(0,y.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-full border","light"===a?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-cyan-300/15 bg-cyan-300/10 text-cyan-200"),children:b}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.18em]",c2(a)),children:c}),(0,d.jsx)("p",{className:(0,y.cn)("mt-1 text-sm font-medium",h?"break-words leading-4":"truncate"),title:e,children:e}),f?(0,d.jsx)("p",{className:(0,y.cn)("mt-0.5",h?"break-words text-[11px] leading-4":"truncate text-xs",c2(a)),children:f}):null]}),g?(0,d.jsx)("div",{className:"shrink-0",children:g}):null]})}async function c_(){let a=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to check Gateway auth status.")}return(await a.json()).authStatus}function c0(a){switch(a){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}function c1(a){return"light"===a?"border-[#e5d7c9] bg-[#fffaf4]/86 shadow-[0_18px_48px_rgba(119,91,70,0.08)]":"border-white/[0.08] bg-[#0d1624]/96"}function c2(a){return"light"===a?"text-[#8c7564]":"text-slate-400"}function c3(a){return(0,y.cn)("h-8 rounded-full px-3 text-xs","light"===a?"border-[#dcc9bb] bg-[#fffaf3] text-[#5d493b] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function c4(a){return(0,y.cn)("h-10 rounded-full text-xs","light"===a?"border-[#dcc9bb] bg-[#fffaf3] text-[#4d3c32] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function c5(a,b){switch(a){case"healthy":return"light"===b?"border-emerald-300/80 bg-emerald-50 text-emerald-700":"border-emerald-400/25 bg-emerald-400/10 text-emerald-200";case"degraded":return"light"===b?"border-amber-300/90 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200";default:return"light"===b?"border-rose-300/80 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"}}function c6(a){switch(a){case"healthy":return"bg-emerald-400";case"degraded":return"bg-amber-300";default:return"bg-rose-300"}}function c7({surfaceTheme:a}){return(0,d.jsxs)("div",{className:(0,y.cn)("flex h-11 items-center gap-3 rounded-full border px-4 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl","light"===a?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:(0,y.cn)("inline-flex h-7 w-7 items-center justify-center overflow-hidden rounded-[8px] border","light"===a?"border-[#d1bcad] bg-[#f5ece4]":"border-white/[0.08] bg-white/[0.03]"),children:(0,d.jsx)("video",{"aria-hidden":"true",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"auto",className:"h-full w-full scale-[1.15] object-cover",children:(0,d.jsx)("source",{src:"/assets/logo.webm",type:"video/webm"})})}),(0,d.jsx)("p",{className:(0,y.cn)("text-[10px] tracking-[0.18em]","light"===a?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,d.jsx)("span",{"aria-hidden":"true",className:(0,y.cn)("h-4 w-px","light"===a?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,d.jsx)("h2",{className:(0,y.cn)("font-display text-[0.88rem]","light"===a?"text-[#816958]/80":"text-slate-400/75"),children:"Control Plane"})]})}function c8({settingsRef:a,isSettingsOpen:b,onToggleTheme:c,onToggleSettings:e,...f}){var g,h,i;let{snapshot:j,surfaceTheme:k}=f,{onOpenSetupWizard:l}=f,m=j.diagnostics.health,n="offline"===m,o=function(a){switch(a){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}(m),p=(g=k,(0,y.cn)("inline-flex h-8 w-8 items-center justify-center rounded-full border transition-[background-color,border-color,color,transform] duration-150 active:scale-[0.96]","light"===g?"border-[#d0bcae] bg-[#efe5dc] text-[#7f6554] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e7d9ce] hover:border-[#c8b09f] hover:text-[#5f4a3d] active:bg-[#ddcdbf]":"border-white/12 bg-white/[0.08] text-slate-200 hover:bg-white/[0.12] hover:border-white/16 hover:text-slate-100 active:bg-white/[0.16]")),q=(h=k,(0,y.cn)("relative inline-flex h-7 w-14 items-center rounded-full border transition-[background-color,border-color,transform] duration-150 active:scale-[0.98]","light"===h?"border-[#d0bcae] bg-[#eaded3] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e3d5c8] hover:border-[#c8b09f] active:bg-[#d9c8ba]":"border-white/12 bg-white/[0.08] hover:bg-white/[0.12] hover:border-white/16 active:bg-white/[0.16]")),r=(i=k,(0,y.cn)("absolute left-1 inline-flex h-5 w-5 items-center justify-center rounded-full shadow-[0_4px_12px_rgba(0,0,0,0.18)] transition-[transform,background-color,color] duration-150","light"===i?"translate-x-7 bg-[#c8946f] text-white":"translate-x-0 bg-cyan-300 text-slate-950"));return(0,d.jsx)("div",{className:"flex w-full items-center px-0 pt-6",children:(0,d.jsxs)("div",{ref:a,className:"pointer-events-auto relative ml-auto",children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex h-11 items-center gap-3 rounded-full border px-4 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl","light"===k?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-[3px]",children:[(0,d.jsx)("span",{className:(0,y.cn)("text-[10px] uppercase tracking-[0.3em]","light"===k?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,d.jsxs)("span",{className:(0,y.cn)("font-mono text-[8px] tracking-[0.04em]","light"===k?"text-[#6f5a4b]/85":"text-slate-300/80"),children:["v",j.diagnostics.version||"unknown"]})]}),n?(0,d.jsxs)(s.P.button,{type:"button",onClick:()=>l(),title:"System is offline. Open the setup wizard.","aria-label":"System is offline. Open the setup wizard.",whileHover:{scale:1.03,y:-1},whileTap:{scale:.98},transition:{type:"spring",stiffness:420,damping:28},className:(0,y.cn)("group relative inline-flex cursor-pointer select-none items-center gap-2 overflow-hidden rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em] transition-[background-color,border-color,color,box-shadow,transform] duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent",c5(m,k),"light"===k?"shadow-[0_10px_24px_rgba(244,63,94,0.12)] hover:border-rose-300 hover:bg-rose-100 hover:text-rose-800":"shadow-[0_10px_24px_rgba(244,63,94,0.18)] hover:border-rose-300/40 hover:bg-rose-300/15 hover:text-rose-100"),children:[(0,d.jsx)(s.P.span,{"aria-hidden":"true",className:(0,y.cn)("pointer-events-none absolute inset-0 rounded-full","light"===k?"bg-[radial-gradient(circle_at_top,rgba(244,63,94,0.18),rgba(244,63,94,0))]":"bg-[radial-gradient(circle_at_top,rgba(251,113,133,0.18),rgba(251,113,133,0))]"),animate:{opacity:[.35,.65,.35],scale:[.98,1.02,.98]},transition:{duration:2.8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("span",{"aria-hidden":"true",className:(0,y.cn)("relative z-10 h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",c6(m))}),(0,d.jsxs)("span",{className:"relative z-10 inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{children:o}),(0,d.jsx)("span",{className:(0,y.cn)("rounded-full border px-1.5 py-0.5 text-[7px] uppercase tracking-[0.18em]","light"===k?"border-rose-300/40 bg-rose-100/70 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100/90"),children:"Setup"}),(0,d.jsx)(cT.A,{className:"h-3 w-3 opacity-80 transition-transform duration-200 group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]})]}):(0,d.jsxs)("span",{className:(0,y.cn)("inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em]",c5(m,k)),children:[(0,d.jsx)("span",{"aria-hidden":"true",className:(0,y.cn)("h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",c6(m))}),o]}),(0,d.jsx)("button",{type:"button",role:"switch","aria-label":"light"===k?"Switch to dark theme":"Switch to light theme","aria-checked":"light"===k,onClick:c,className:q,children:(0,d.jsx)("span",{className:r,children:"light"===k?(0,d.jsx)(cU.A,{className:"h-3 w-3"}):(0,d.jsx)(cV.A,{className:"h-3 w-3"})})}),(0,d.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":b,"aria-haspopup":"menu",onClick:e,className:p,children:(0,d.jsx)(bZ.A,{className:"h-3.5 w-3.5"})})]}),b?(0,d.jsx)(cY,{...f}):null]})})}var c9=c(30094),da=c(98895);let db=(0,cQ.default)(async()=>{},{loadableGenerated:{modules:["components/mission-control/mission-control-shell.tsx -> @/components/mission-control/canvas"]},ssr:!1,loading:()=>(0,d.jsx)("div",{className:"h-full w-full"})}),dc=[4e3,8e3,15e3,3e4,45e3,6e4],dd=[0,800,1200,1800,2600,3600,5e3,6500],de=void 0===globalThis.window?g.useEffect:g.useLayoutEffect,df={phase:"idle",previousModelId:null,nextModelId:null,message:null};function dg(a){return new Promise(b=>{setTimeout(b,a)})}function dh({initialSnapshot:a,mode:b="mission"}){let{snapshot:c,connectionState:k,refresh:l,refreshSnapshot:m,setSnapshot:n}=(0,cR.v)(a),[o,p]=(0,g.useState)(a.workspaces[0]?.id??null),[q,r]=(0,g.useState)(a.workspaces[0]?.id??null),[s,t]=(0,g.useState)(null),[u,v]=(0,g.useState)(null),[z,B]=(0,g.useState)(null),[C,D]=(0,g.useState)(!1),[E,F]=(0,g.useState)(!1),[G,H]=(0,g.useState)(0),[I,J]=(0,g.useState)("overview"),[K,L]=(0,g.useState)(null),[M,N]=(0,g.useState)(null),[O,P]=(0,g.useState)(null),[Q,R]=(0,g.useState)([]),[S,T]=(0,g.useState)(null),{surfaceTheme:U,setSurfaceTheme:V,hiddenRuntimeIds:W,setHiddenRuntimeIds:X,hiddenTaskKeys:Y,setHiddenTaskKeys:Z,lockedTaskKeys:$,setLockedTaskKeys:_,safeHiddenRuntimeIds:ab,safeHiddenTaskKeys:ac,safeLockedTaskKeys:ad,clearPreferenceState:ae}=(0,cK.$)(),[ag,ah]=(0,g.useState)(null),[ai,aj]=(0,g.useState)(null),[al,am]=(0,g.useState)(null),[an,ao]=(0,g.useState)("idle"),[ap,aq]=(0,g.useState)(null),ar=(0,g.useRef)(new Map),[as,at]=(0,g.useState)(null),[au,av]=(0,g.useState)([]),[aw,ax]=(0,g.useState)({}),[ay,az]=(0,g.useState)(!1),[aA,aB]=(0,g.useState)(!1),[aC,aD]=(0,g.useState)(!1),[aE,aF]=(0,g.useState)(!1),[aG,aH]=(0,g.useState)(null),[aI,aJ]=(0,g.useState)("idle"),[aK,aL]=(0,g.useState)(null),[aM,aN]=(0,g.useState)(null),[aO,aP]=(0,g.useState)("idle"),[aQ,aR]=(0,g.useState)(null),[aS,aT]=(0,g.useState)(null),[aU,aV]=(0,g.useState)(null),[aW,aX]=(0,g.useState)(""),[aY,aZ]=(0,g.useState)(""),[a$,a_]=(0,g.useState)("idle"),[a0,a1]=(0,g.useState)(null),[a2,a4]=(0,g.useState)(null),a6=(0,g.useRef)(null),a7=(0,g.useRef)(new Map),[a8,ba]=(0,g.useState)(()=>(0,a3.QO)(a)),[bd,be]=(0,g.useState)(()=>(0,a3.hZ)(a)),[bf,bg]=(0,g.useState)(()=>a.diagnostics.openClawBinarySelection),[bh,bi]=(0,g.useState)(!1),[bj,bk]=(0,g.useState)(!1),[bl,bm]=(0,g.useState)(!1),[bn,bo]=(0,g.useState)(!1),[bp,bq]=(0,g.useState)("idle"),[br,bs]=(0,g.useState)(null),[bt,bu]=(0,g.useState)(null),[bv,bw]=(0,g.useState)(""),[bx,by]=(0,g.useState)(null),[bz,bA]=(0,g.useState)("idle"),[bB,bC]=(0,g.useState)(null),[bD,bE]=(0,g.useState)(null),[bF,bG]=(0,g.useState)(null),[bH,bI]=(0,g.useState)(""),[bJ,bL]=(0,g.useState)(null),[bM,bN]=(0,g.useState)(null),[bO,bQ]=(0,g.useState)("system"),[bR,bS]=(0,g.useState)(""),[bT,bU]=(0,g.useState)([]),[bV,bW]=(0,g.useState)("idle"),[bX,bY]=(0,g.useState)(null),[bZ,b$]=(0,g.useState)(null),[b_,b0]=(0,g.useState)(null),[b1,b2]=(0,g.useState)(""),[b3,b4]=(0,g.useState)(null),[b5,b6]=(0,g.useState)(null),[b7,b9]=(0,g.useState)(df),[ca,cb]=(0,g.useState)(!1),[cc,cd]=(0,g.useState)(!1),[ce,cf]=(0,g.useState)(!1),[cg,ch]=(0,g.useState)(!1),[ci,cj]=(0,g.useState)(!1),[ck,cl]=(0,g.useState)(null),[cm,cn]=(0,g.useState)(null),[co,cp]=(0,g.useState)(!1),[cq,cr]=(0,g.useState)("basic"),[cs,ct]=(0,g.useState)(null),[cu,cv]=(0,g.useState)(!1),[cw,cx]=(0,g.useState)(null),[cz,cA]=(0,g.useState)([]),[cB,cC]=(0,g.useState)([]),[cD,cE]=(0,g.useState)(null),[cG,cH]=(0,g.useState)(!1),[cI,cJ]=(0,g.useState)(null),[cQ,cT]=(0,g.useState)(null),[cU,cV]=(0,g.useState)(null),[cW,cX]=(0,g.useState)(null);(0,g.useRef)(null);let cY=(0,g.useRef)(null),cZ=(0,g.useRef)(null),c$=(0,g.useRef)(null),c_=(0,g.useRef)(0),c0=(0,g.useRef)(null),c1=(0,g.useCallback)((a,b="overview",c=null)=>{r(a),J(b),t(c),L(b=>b?.taskId===a?b:null)},[]),{taskReviewRequest:c2,taskReviewState:c3,clearTaskReviewState:c4,openTaskReview:c5,closeTaskReview:c6,acceptTaskReview:di,dismissTaskReview:dj,continueTaskReview:dk,retryTaskReview:dl,openTaskReviewEvidence:dm}=function({selectNode:a,setIsInspectorOpen:b,setComposeIntent:c,setComposerTargetAgentId:d,setIsComposerActive:e,refreshSnapshot:f}){let[h,i]=(0,g.useState)(null),[j,k]=(0,g.useState)({}),[l,m]=(0,g.useState)(!1),n=(0,g.useCallback)(b=>{a(b.id,"output"),i({requestId:`task-review:${b.id}:${Date.now()}`,taskId:b.id,taskKey:aa(b),fallbackTask:b})},[a]),o=(0,g.useCallback)((a,b,c)=>{let d=function(a,b,c,d=new Date().toISOString()){return{taskId:a.id,taskKey:aa(a),status:b,action:c,reviewedAt:d}}(a,b,c);return k(a=>({...a,[d.taskKey]:d})),d},[]),p=(0,g.useCallback)(()=>{i(null)},[]),q=(0,g.useCallback)(a=>{o(a,"accepted","Accepted result"),p(),w.o.success("Task result accepted.",{description:"The review warning is marked as handled for this workspace."})},[p,o]),r=(0,g.useCallback)(a=>{o(a,"dismissed","Dismissed review"),p(),w.o.message("Task review dismissed.",{description:"The warning remains available in the task evidence."})},[p,o]),s=(0,g.useCallback)(async(c,d)=>{let e,g,h=(e=cL((0,a3.sL)(c),3200),["Continue this task from the last captured output. Finish the remaining work and verify the result.","","Original mission:",e,(g=cL(d,7600))?"":null,g?"Last captured output:":null,g||null].filter(a=>"string"==typeof a).join("\n"));try{let d=await fetch(`/api/tasks/${encodeURIComponent(c.id)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"continue",message:h,dispatchId:c.dispatchId??null})}),e=await d.json().catch(()=>null);if(!d.ok)throw Error(e?.error||"Unable to continue this task.");o(c,"continued","Accepted continuation"),a(c.id,"output"),b(!0),p(),f({force:!0}),w.o.success("Task continuation accepted.",{description:"OpenClaw accepted the continuation. AgentOS will track the follow-up until live output arrives."})}catch(a){w.o.error("Task continuation failed.",{description:a instanceof Error?a.message:"Unable to continue this task."})}},[p,o,f,a,b]),t=(0,g.useCallback)(a=>{o(a,"retried","Drafted retry"),c({id:`review-retry:${a.id}:${Date.now()}`,mission:["Retry this task from the original mission. Do not assume the previous stalled runtime completed.\n\nOriginal mission:",(0,a3.sL)(a)].join("\n"),agentId:a.primaryAgentId,sourceKind:"reply",sourceLabel:a.title.trim()||"Task review"}),d(a.primaryAgentId??null),e(!0),p(),w.o.success("Retry draft prepared.",{description:"Review the mission input, then send it when ready."})},[p,o,c,d,e]),u=(0,g.useCallback)((c,d)=>{a(c.id,d),b(!0),p()},[p,a,b]);return{taskReviewRequest:h,taskReviewState:j,clearTaskReviewState:()=>{k({})},openTaskReview:n,closeTaskReview:p,acceptTaskReview:q,dismissTaskReview:r,continueTaskReview:s,retryTaskReview:t,openTaskReviewEvidence:u}}({selectNode:c1,setIsInspectorOpen:aB,setComposeIntent:a=>{F(!0),T(a)},setComposerTargetAgentId:B,setIsComposerActive:D,refreshSnapshot:m}),dn=aA&&"chat"===I?q:null,dp=(0,g.useMemo)(()=>{var a=(0,a3.Uh)(c,Q);if(0===Object.keys(c3).length)return a;let b=!1,d=a.tasks.map(a=>{var c,d,e,f;let g=c3[aa(a)];return g?(b=!0,c=a,d=g,{...c,metadata:{...c.metadata,reviewStatus:d.status,reviewAction:d.action,reviewedAt:d.reviewedAt,reviewEvents:[(e=c,f=d,{id:`task-review:${f.taskKey}:${f.status}`,kind:"accepted"===f.status||"continued"===f.status?"status":"warning",timestamp:f.reviewedAt,title:function(a){switch(a){case"accepted":return"Review accepted";case"continued":return"Continuation accepted";case"retried":return"Retry drafted";case"dismissed":return"Review dismissed"}}(f.status),detail:`${af(f.status)} Task: ${e.title.trim()||e.id}.`})]}}):a});return b?{...a,tasks:d}:a},[c,Q,c3]),dq=(0,g.useMemo)(()=>c2?dp.tasks.find(a=>a.id===c2.taskId||aa(a)===c2.taskKey)??c2.fallbackTask:null,[c2,dp.tasks]),dr=(0,g.useCallback)((a,b={})=>{b.markPending&&a&&cV(a),v(null),B(null),p(a),c1(a)},[c1]),ds=(0,g.useRef)(null),dt=(0,g.useRef)(!1),du=(0,g.useRef)(!1),dv=c.runtimes.filter(a=>("running"===a.status||"queued"===a.status)&&!(0,a3.MG)(a)).length,dw=!cg&&(0,a9.h6)(c),dx=!cg&&(0,a9.X2)(c),dy=bc(bO,dw||"success"===bz),dz=(0,a3.Id)(c),dA=(0,a3.R)(c),dB=(0,a3.iy)(c),dC=dv>0||Q.length>0,dD=(0,a3.EE)(c,{hasSeenMissionReady:ci,modelSwitchSucceeded:"success"===b7.phase}),dE=dw&&dx&&!dz,dF=!dC&&(!ca||dE)&&(!dx||dE)&&!dD||ce||cc,dG=dp.tasks.filter(a=>!o||cS(a,dp.agents)===o).filter(a=>(0,a3.Zc)(a,ab,ac,ad)).length,dH=(0,g.useCallback)(a=>{let b=dp.tasks.filter(b=>cS(b,dp.agents)===a).filter(a=>!ad.includes(a.key));if(0===b.length)return;let c=b.every(a=>(0,a3.Zc)(a,ab,ac,ad)),d=new Set(b.map(a=>a.key)),e=new Set(b.flatMap(a=>a.runtimeIds));if(c){Z(a=>a.filter(a=>!d.has(a))),X(a=>a.filter(a=>!e.has(a)));return}Z(a=>Array.from(new Set([...a,...d]))),X(a=>Array.from(new Set([...a,...e])))},[dp.agents,dp.tasks,ab,ac,ad,X,Z]),dI=(0,g.useCallback)(a=>{let b=dp.agents.find(b=>b.id===a);b&&(v(b=>b===a?null:a),p(b.workspaceId),c1(a))},[c1,dp.agents]),dJ=(0,g.useCallback)((a,b)=>{let c=dp.agents.find(b=>b.id===a);c&&(p(c.workspaceId),aB(!0),c1(c.id,"overview",b))},[c1,dp.agents]),dK=(0,g.useCallback)((a,b)=>{let c=dp.agents.find(b=>b.id===a);c&&(p(c.workspaceId),c1(c.id),aj({requestId:`capabilities:${a}:${b}:${Date.now()}`,agentId:a,focus:b}))},[c1,dp.agents]),dL=(0,g.useCallback)(a=>{let b=dp.agents.find(b=>b.id===a);b&&(p(b.workspaceId),c1(b.id),cT({requestId:`model:${a}:${Date.now()}`,agentId:a}))},[c1,dp.agents]),dM=(0,g.useCallback)(a=>{av(b=>b.filter(b=>b.id!==a)),at(a),a6.current&&clearTimeout(a6.current),a6.current=setTimeout(()=>{a6.current=null,at(null)},2400)},[]),dN=(0,g.useCallback)(a=>{if(p(a.workspaceId),c1(a.id),av(b=>[...b.filter(b=>b.id!==a.id),a]),a.warning){ax(b=>({...b,[a.id]:a.warning??""}));let b=a7.current.get(a.id);b&&clearTimeout(b);let c=setTimeout(()=>{a7.current.delete(a.id),ax(b=>{let c={...b};return delete c[a.id],c})},12e3);a7.current.set(a.id,c)}},[c1]),dO=(0,g.useCallback)(a=>{a||cT(null)},[]),dP=(0,g.useCallback)(a=>{a||aj(null)},[]),dQ=(0,g.useCallback)(a=>{if(!u)return;let b=dp.agents.find(b=>b.id===a);b&&(u!==a||o!==b.workspaceId||q!==a)&&(v(a),p(b.workspaceId),c1(a))},[o,u,c1,q,dp.agents]),dR=(0,g.useCallback)(a=>{let b=dp.agents.find(b=>b.id===a);b&&(p(b.workspaceId),B(b.id),F(!0),D(!0),c1(b.id))},[c1,dp.agents]),dS=(0,g.useCallback)(()=>{dt.current=!0},[]),dT=(0,g.useCallback)(a=>{if(a){du.current=!1,F(!0),D(!0);return}if(dt.current){du.current=!0;return}du.current=!1,F(!1),D(!1)},[]),dU=(0,g.useCallback)(()=>{v(null),c1(o??dp.workspaces[0]?.id??null)},[o,c1,dp.workspaces]),dV=(0,g.useCallback)((a="basic")=>{ct(null),cr(a),cp(!0)},[]),dW=(0,g.useCallback)(a=>{ct(a),cr("advanced"),cp(!0)},[]),dX=(0,g.useCallback)(a=>{cp(a),a||(ct(null),cr("basic"))},[]),dY=(0,g.useCallback)(async()=>{try{let[a,b]=await Promise.all([fetch("/api/accounts/login-targets",{cache:"no-store"}),fetch("/api/accounts/access-rules",{cache:"no-store"})]),c=await a.json().catch(()=>null),d=await b.json().catch(()=>null);a.ok&&c?.ok&&cA(c.targets),b.ok&&d?.ok&&cC(d.rules)}catch{cA([]),cC([])}},[]),dZ=(0,g.useCallback)((a,b)=>{a&&dr(a),cx(b??null),cv(!0),dY()},[dY,dr]),d$=(0,g.useCallback)(a=>{dr(a),cE(a)},[dr]),d_=(0,g.useCallback)(a=>{a||cE(null)},[]);de(()=>{let a=c.diagnostics.workspaceRoot;if(cW===a||(0,a3.DK)(c))return;let b=(0,a3.cY)(a),d=globalThis.localStorage?.getItem(b)??null,e=(0,a3.mr)(c.workspaces.map(a=>a.id),d,o);e!==o&&(p(e),r(e??null)),cX(a)},[o,cW,c.diagnostics.loaded,c.diagnostics.rpcOk,c.diagnostics.workspaceRoot,c.mode,c.workspaces]);let d0=()=>{"running"!==bp&&(bq("idle"),bs(null),bu(null),bw(""),by(null))},d1=()=>{bA("idle"),bC(null),bE(null),bG(null),bI(""),bL(null),bN(null),bW("idle"),bY(null),b$(null),b0(null),b4(null),b6(null),b2(""),bU([]),bS(""),b9(df),cf(!1),cj(!1),a_("idle"),a1(null),cY.current=null},d2=()=>{d1(),ch(!0),bQ("system"),cb(!1),cd(!0)},d3=a=>{bw(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},d4=a=>{bI(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},d5=a=>{b2(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},d6=a=>{aX(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},d7=(0,g.useCallback)((a,b={})=>{let c=function(a){let b=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null;if(b&&a.diagnostics.modelReadiness.defaultModelReady)return b;let c=a.diagnostics.modelReadiness.recommendedModelId||null;return c&&a.workspaces.length>0?c:null}(a);if(!c)return;let d=cY.current;cY.current=c,bS(a=>{let e=a.trim();return b.force||!e||e===d?c:a})},[]),d8=(0,g.useCallback)(async a=>{let b=a??null;try{b=await m({force:!0})}catch{}return b&&(n(b),d7(b)),b},[d7,m,n]),d9=(0,g.useCallback)(async()=>{if(!al||"running"===an)return;let a="string"==typeof al.metadata.optimisticRequestId?al.metadata.optimisticRequestId:null,b=a?Q.find(b=>b.requestId===a):Q.find(a=>a.task.id===al.id),c="string"==typeof al.dispatchId?al.dispatchId:b?.dispatchId??null;if(a&&!c){ar.current.get(a)?.abort(),ar.current.delete(a),R(b=>b.map(b=>b.requestId===a?{...b,task:(0,a3.GU)(b.task,{status:"cancelled",subtitle:"Mission submission cancelled before dispatch.",bootstrapStage:"cancelled",feedEvent:{id:`${b.task.id}:cancelled:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch cancelled",detail:"Mission submission cancelled before dispatch.",isError:!1}})}:b)),w.o.success("Mission submission cancelled.",{description:al.title}),am(null),ao("idle"),aq(null);return}ao("running"),aq(null);try{let a=await fetch(`/api/tasks/${encodeURIComponent(al.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Aborted from AgentOS.",dispatchId:c})}),b=await a.json().catch(()=>null);if(!a.ok)throw Error(b?.error||b?.message||b?.summary||"Unable to abort task.");w.o.success("Task abort requested.",{description:al.title}),am(null),ao("idle"),await l()}catch(b){let a=b instanceof Error?b.message:"Unknown abort error.";ao("error"),aq(a),w.o.error("Task abort failed.",{description:a})}},[Q,l,al,an]),ea=a=>{a&&bU(a)},eb=async()=>{if("running"===bp)return void bo(!0);let a=a=>{c0.current=w.o.loading("Updating OpenClaw...",{id:c0.current??void 0,description:a,duration:1/0,action:{label:"View",onClick:()=>bo(!0)}})},b=(a,b)=>{let c={id:c0.current??void 0,description:b,duration:a?6e3:1e4,action:{label:"View details",onClick:()=>bo(!0)}};a?w.o.success("OpenClaw updated.",c):w.o.error("OpenClaw update failed.",c),c0.current=null},c=!1,d=a=>{if(d3(`
7
7
  > ${a.message}